[Libreoffice-commits] .: Branch 'feature/calc-multiline-input' - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon May 23 12:33:33 PDT 2011


 sc/source/ui/app/inputwin.cxx |   49 +++++++++++++++++++++++++++++++-----------
 1 file changed, 37 insertions(+), 12 deletions(-)

New commits:
commit e0142fade08df22537cd9b03a279ca8f64d401a5
Author: Anurag Jain <anuragjainfzd at gmail.com>
Date:   Mon May 23 15:30:26 2011 -0400

    Implementing height offset in paint method of ScTextWnd.

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8019fee..4f9abfa 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -78,7 +78,7 @@
 #include "AccessibleEditObject.hxx"
 #include "AccessibleText.hxx"
 
-#define TEXT_STARTPOS		3
+#define TEXT_STARTPOS		5
 #define THESIZE				1000000	//!!! langt... :-)
 #define TBX_WINDOW_HEIGHT 	22 // in Pixeln - fuer alle Systeme gleich?
 
@@ -504,8 +504,8 @@ void ScInputWindow::Resize()
 
     aSize.Width() = Max( ((long)(nWidth - nLeft - 40)), (long)0 );
 
-    printf("Inside ScInputWindow:Resize()\n");
-    printf("nWidth %ld nLeft %ld aSize.Width%ld \n",nWidth, nLeft, aSize.Width());
+//    printf("Inside ScInputWindow:Resize()\n");
+//    printf("nWidth %ld nLeft %ld aSize.Width%ld \n",nWidth, nLeft, aSize.Width());
 
     aTextWindow.SetSizePixel( aSize );
     aTextWindow.Invalidate();
@@ -555,11 +555,11 @@ void ScInputWindow::SetTextString( const String& rString )
     if (rString.Len() <= 32767)
     {
         aTextWindow.SetTextString(rString);
-        printf("%d ScInputWnd:SetTextString(),  if \n",i);
+//        printf("%d ScInputWnd:SetTextString(),  if \n",i);
     }
     else
     {
-        printf("%d ScInputWnd:SetTextString(),  else \n",i);
+//        printf("%d ScInputWnd:SetTextString(),  else \n",i);
         String aNew = rString;
         aNew.Erase(32767);
         aTextWindow.SetTextString(aNew);
@@ -761,13 +761,16 @@ ScTextWnd::ScTextWnd( Window* pParent )
 
     Size aSize(1,TBX_WINDOW_HEIGHT);
     Size aMinEditSize( Edit::GetMinimumEditSize() );
+    printf("construstor of ScTextWnd edit height %ld edit width%ld\n",aMinEditSize.Height() , aMinEditSize.Width() );
     if( aMinEditSize.Height() > aSize.Height() )
         aSize.Height() = aMinEditSize.Height();
+    printf("So aSize is %ld %ld \n",aSize.Width(), aSize.Height());
     SetSizePixel		( aSize );
     SetBackground		( aBgColor );
     SetLineColor		( COL_BLACK );
     SetMapMode		    ( MAP_TWIP );
     SetPointer		    ( POINTER_TEXT );
+//    StartEditEngine();
 }
 
 ScTextWnd::~ScTextWnd()
@@ -781,17 +784,30 @@ ScTextWnd::~ScTextWnd()
 
 void ScTextWnd::Paint( const Rectangle& rRec )
 {
-    if (pEditView)
-        pEditView->Paint( rRec );
+   if (pEditView)
+        {
+          long x =    GetOutputSizePixel().Width();
+          long hHeight=LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0))).Height();
+          long lCount=pEditEngine->GetLineCount(0);
+
+          pEditEngine->Draw(this, rRec,  Point(TEXT_STARTPOS, (lCount-1)*hHeight), true);
+//        pEditView->Paint(rRec);
+          printf("rectangle drawn height %ld count %ld\n",hHeight,lCount);
+//        pEditEngine->SetPaperSize(PixelToLogic(Size(x,lCount>1?(lCount)*hHeight:hHeight)));
+        }
     else
     {
         SetFont( aTextFont );
-
+        long a =    GetOutputSizePixel().Height();
+        long b =    GetOutputSizePixel().Width();
+        long c =    LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
+        long d =    LogicToPixel( Size( 0, GetTextHeight() ) ).Width();
         long nDiff =  GetOutputSizePixel().Height()
                     - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
 //		if (nDiff<2) nDiff=2;		// mind. 1 Pixel
 
         long nStartPos = TEXT_STARTPOS;
+        printf("ScTextWnd::Paint() nDiff: %ld GOSPH %ld GOSPW %ld\n",nDiff,a,b);
         if ( bIsRTL )
         {
             //	right-align
@@ -801,9 +817,10 @@ void ScTextWnd::Paint( const Rectangle& rRec )
             //	LayoutMode isn't changed as long as ModifyRTLDefaults doesn't include SvxFrameDirectionItem
         }
 
-        printf("ScTextWnd::Paint() nDiff: %ld GOSP height %ld text height \n",nDiff, GetOutputSizePixel().Height(), LogicToPixel( Size( 0, GetTextHeight() ) ).Height());
+        printf("ScTextWnd::Paint() text Height  %ld text width %ld \n",c,d);
 
         DrawText( PixelToLogic( Point( nStartPos, nDiff/2 ) ), aString );
+//        pEditEngine->Draw(this, rRec, Point( nStartPos, nDiff/2 ) ,false);
     }
 }
 
@@ -812,12 +829,17 @@ void ScTextWnd::Resize()
     if (pEditView)
     {
         Size aSize = GetOutputSizePixel();
+        long a =    aSize.Height();
+        long b =    aSize.Width();
+        long c =    LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
+        long d =    LogicToPixel( Size( 0, GetTextHeight() ) ).Width();
+
         long nDiff =  aSize.Height()
                     - LogicToPixel( Size( 0, GetTextHeight() ) ).Height();
 
         aSize.Width() -= 2 * TEXT_STARTPOS - 1;
 
-        printf("ScTextWnd:Resize() width %ld \n",aSize.Width());
+        printf("ScTextWnd:Resize() nDiff %ld gosph %ld gospw %ld text h %ld text w %ld \n",nDiff,a,b,c,d);
 
         pEditView->SetOutputArea(
             PixelToLogic( Rectangle( Point( TEXT_STARTPOS, (nDiff > 0) ? nDiff/2 : 1 ),
@@ -966,7 +988,7 @@ void ScTextWnd::LoseFocus()
 String ScTextWnd::GetText() const
 {
     //	ueberladen, um per Testtool an den Text heranzukommen
-
+printf("ScTextWnd::GetText()\n");
     if ( pEditEngine )
         return pEditEngine->GetText();
     else
@@ -1044,12 +1066,14 @@ void lcl_ModifyRTLVisArea( EditView* pEditView )
 void ScTextWnd::StartEditEngine()
 {
     //	Bei "eigener Modalitaet" (Doc-modale Dialoge) nicht aktivieren
+
     SfxObjectShell* pObjSh = SfxObjectShell::Current();
     if ( pObjSh && pObjSh->IsInModalMode() )
         return;
 
     if ( !pEditView || !pEditEngine )
     {
+        printf("Starting EditEngine\n");
         ScFieldEditEngine* pNew;
         ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell();
         if ( pViewSh )
@@ -1071,7 +1095,7 @@ void ScTextWnd::StartEditEngine()
         barSize.Height()=nDiff+barHeight;
         barSize.Width() -= 2*TEXT_STARTPOS-4;
         pEditEngine->SetUpdateMode( false );
-        pEditEngine->SetPaperSize( PixelToLogic(barSize) );
+        pEditEngine->SetPaperSize( PixelToLogic(Size(barSize.Width(),10000)) );
         pEditEngine->SetWordDelimiters(
                         ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
 
@@ -1160,6 +1184,7 @@ IMPL_LINK(ScTextWnd, NotifyHdl, EENotify*, EMPTYARG)
 
 void ScTextWnd::StopEditEngine( sal_Bool bAll )
 {
+    printf("stopping editEngine\n");
     if (pEditView)
     {
         if (!maAccTextDatas.empty())


More information about the Libreoffice-commits mailing list