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

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Aug 15 12:19:12 PDT 2011


 sc/source/ui/app/inputwin.cxx |   62 +++++++++++++++++++++++-------------------
 1 file changed, 35 insertions(+), 27 deletions(-)

New commits:
commit 4f78e3ddd5554514df2c6c26c6152dfdbcff8a14
Author: Anurag Jain <anuragjainfzd at gmail.com>
Date:   Mon Aug 15 19:14:14 2011 +0530

    Implemented new resize logic for textbox. Looks more clean.

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index f1c2598..418d7d8 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -814,9 +814,9 @@ void ScInputBarGroup::Resize()
     }
 
     long nWidth = pParent->GetSizePixel().Width();
-    long nLeft  = GetPosPixel().X();
+    Point aPos  = GetPosPixel();
     Size aSize  = GetSizePixel();
-    aSize.Width() = Max( ((long)(nWidth - nLeft - LEFT_OFFSET)), (long)0 );
+    aSize.Width() = Max( ((long)(nWidth - aPos.X() - LEFT_OFFSET)), (long)0 );
 
     if(pParent->GetMultiLineStatus())
     {
@@ -826,7 +826,7 @@ void ScInputBarGroup::Resize()
     {
         aSize.Height()=TBX_WINDOW_HEIGHT;
     }
-    SetSizePixel(aSize);
+    SetPosSizePixel(aPos,aSize);
     Invalidate();
 
     aButton.SetPosSizePixel(Point(aSize.Width()-3*LEFT_OFFSET,0),Size(0.5*TBX_WINDOW_HEIGHT,TBX_WINDOW_HEIGHT));
@@ -940,45 +940,53 @@ void ScMultiTextWnd::Resize()
         return;
     }
 
+
     long nWidth = GetParent()->GetSizePixel().Width();
-    long nLeft  = GetPosPixel().X();
-    Size cSize  = GetSizePixel();
-    cSize.Width() = Max( ((long)(nWidth - nLeft - 3*LEFT_OFFSET)), (long)0 );
+    Point aPos=GetPosPixel();
+    Size aTextBoxSize  = GetSizePixel();
+    aTextBoxSize.Width() = Max( ((long)(nWidth - aPos.X() - 3*LEFT_OFFSET)), (long)0 );
 
     if(pParent->GetMultiLineStatus())
     {
-        cSize.Height()=3*TBX_WINDOW_HEIGHT;
+        aTextBoxSize.Height()=3*LogicToPixel(Size(0,GetTextHeight())).Height()+8;
         
-        if (pEditView)
+        if(pEditView)
         {
-        
-        Size aSize = GetOutputSizePixel();
-        Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
-        int nDiff=(aSize.Height()-bSize.Height())/2;
-        Point aPos(TEXT_STARTPOS,4);
-        Point aPos2(aSize.Width()-5,50);
-        pEditView->SetOutputArea(
-                PixelToLogic(Rectangle(aPos, aPos2)));
+            Size aOutputSize=GetOutputSizePixel();
+            Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+            int nDiff = (aOutputSize.Height() - 3*aLineSize.Height())/2;
+
+            Point aPos1(TEXT_STARTPOS,nDiff);
+            Point aPos2(aOutputSize.Width()-5,aOutputSize.Height()-2);
+
+            pEditView->SetOutputArea(
+                PixelToLogic(Rectangle(aPos1, aPos2)));
+
         }
+
     }
+
     else
     {
-        cSize.Height()=TBX_WINDOW_HEIGHT;
         
-        if (pEditView)
+        aTextBoxSize.Height()=TBX_WINDOW_HEIGHT;
+        if(pEditView)
         {
-            Size aSize = GetOutputSizePixel();
-            Size bSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
-            int nDiff=(aSize.Height()-bSize.Height())/2;
-            Point aPos(TEXT_STARTPOS,nDiff*aSize.Height()/aSize.Height());
-            Point aPos2(aSize.Width()-5,(aSize.Height()-nDiff)*aSize.Height()/aSize.Height());
+            Size aOutputSize=GetOutputSizePixel();
+            Size aLineSize = LogicToPixel(Size(0,pEditEngine->GetLineHeight(0,0)));
+
+            int nDiff = (aOutputSize.Height() - aLineSize.Height())/2;
+
+            Point aPos1(TEXT_STARTPOS,nDiff);
+            Point aPos2(aOutputSize.Width()-5,(aOutputSize.Height() - nDiff));
             pEditView->SetOutputArea(
-                PixelToLogic(Rectangle(aPos, aPos2)));
-        } 
+                PixelToLogic(Rectangle(aPos1, aPos2)));
+        }
+
     }
-    SetSizePixel(cSize);
 
-    
+    SetPosSizePixel(aPos,aTextBoxSize);
 }
 
 


More information about the Libreoffice-commits mailing list