Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hello Kohei,

I've implemented new logic for the resize of the textbox.

Thanks and regards

-- 
Anurag Jain
Final yr B.Tech CSE
SASTRA University
Thanjavur(T.N.)-613402
From 45fcb8cde31971cfba4354be5e98553930054c60 Mon Sep 17 00:00:00 2001
From: Anurag Jain <anuragjainfzd@gmail.com>
Date: Mon, 15 Aug 2011 19:14:14 +0530
Subject: [PATCH] Implemented new resize logic for textbox. Looks more clean.

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

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);
 }
 
 
-- 
1.7.0.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.