[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - sc/source

Noel Power noelp at kemper.freedesktop.org
Wed Dec 7 08:39:42 PST 2011


 sc/source/ui/app/inputwin.cxx |   24 ++++++++++--------------
 sc/source/ui/inc/inputwin.hxx |    2 +-
 2 files changed, 11 insertions(+), 15 deletions(-)

New commits:
commit 2e580e9b1b0d095cda7991614f58681c75336a83
Author: Noel Power <noel.power at novell.com>
Date:   Wed Dec 7 15:53:20 2011 +0000

    remove unused variable

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a04451f..a271487 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1157,7 +1157,6 @@ void ScMultiTextWnd::Resize()
     if(pEditView)
     {
         Size aOutputSize = GetOutputSizePixel();
-        Size aLineSize = Size(0,aTextBoxSize.Height());
         Point aPos1(TEXT_STARTPOS,0);
         Point aPos2(aOutputSize.Width(),aOutputSize.Height());
 
commit d65ca4394166675335a8c3061c6c0f179271f65e
Author: Noel Power <noel.power at novell.com>
Date:   Wed Dec 7 15:40:28 2011 +0000

    better sizing of inputbar ( removed weird calculations I didn't understand )
    
    gsoc input bar now (should) snuggly wrap the text when collapsed, if multilines exist then scrolling with the keys should be clean and no spill from upper or lower lines visible. Removed some strange ( pseudo padding ) apparently for taking into account the window border and reorganized the resize logic so the padding is added ( and commented why ) in just one place.

diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 8b32bc9..a04451f 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -864,7 +864,7 @@ ScInputBarGroup::ScInputBarGroup(Window* pParent)
       // too bad at the size from 'Settings' for me
       // set button width to scrollbar width then for the moment
       aButton.SetClickHdl	( LINK( this, ScInputBarGroup, ClickHdl ) );
-      aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), TBX_WINDOW_HEIGHT) );
+      aButton.SetSizePixel(Size(GetSettings().GetStyleSettings().GetScrollBarSize(), aMultiTextWnd.GetPixelHeightForLines(1)) );
       aButton.Enable();
       aButton.SetSymbol( SYMBOL_SPIN_DOWN  );
       aButton.SetQuickHelpText( ScResId( SCSTR_QHELP_EXPAND_FORMULA ) );
@@ -1123,18 +1123,16 @@ void ScMultiTextWnd::Paint( const Rectangle& rRec )
     }
 }
 
-long ScMultiTextWnd::GetPixelTextHeight()
+
+long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
 {
     long height = ( LogicToPixel(Size(0,GetTextHeight())).Height() );
     // need to figure out why GetTextHeight is not set up when I need it
     // some initialisation timing issue ?
-    return Max ( long( 14 ), height );
-}
-
-
-long ScMultiTextWnd::GetPixelHeightForLines( long nLines )
-{
-    return nLines *  GetPixelTextHeight();
+    height = Max ( long( 14 ), height );
+    // add padding ( for the borders of the window I guess ) otherwise we
+    // chop slightly the top and bottom of whatever is in the inputbox
+    return ( nLines *  height ) + 4;
 }
 
 void ScMultiTextWnd::SetNumLines( long nLines )
@@ -1153,14 +1151,14 @@ void ScMultiTextWnd::Resize()
     // parent/container window
     Size aTextBoxSize  = GetSizePixel();
 
-    aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) ) + 8;
+    aTextBoxSize.Height()=( GetPixelHeightForLines( mnLines ) );
+    SetSizePixel(aTextBoxSize);
 
     if(pEditView)
     {
         Size aOutputSize = GetOutputSizePixel();
-        Size aLineSize = Size(0,GetPixelTextHeight());
-        int nDiff = (aOutputSize.Height() - ( mnLines *aLineSize.Height()))/2;
-        Point aPos1(TEXT_STARTPOS,nDiff);
+        Size aLineSize = Size(0,aTextBoxSize.Height());
+        Point aPos1(TEXT_STARTPOS,0);
         Point aPos2(aOutputSize.Width(),aOutputSize.Height());
 
         pEditView->SetOutputArea(
@@ -1170,7 +1168,6 @@ void ScMultiTextWnd::Resize()
     }
 
     SetScrollBarRange();
-    SetSizePixel(aTextBoxSize);
 }
 
 IMPL_LINK(ScMultiTextWnd, ModifyHdl, EENotify*, pNotify)
diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx
index 76730b6..7a1da05 100644
--- a/sc/source/ui/inc/inputwin.hxx
+++ b/sc/source/ui/inc/inputwin.hxx
@@ -176,7 +176,6 @@ public:
     virtual void StopEditEngine( sal_Bool bAll );
     int GetLineCount();
     virtual void Resize();
-    long GetPixelTextHeight();
     long GetPixelHeightForLines( long nLines );
     long GetEditEngTxtHeight();
 
@@ -193,6 +192,7 @@ protected:
     DECL_LINK( NotifyHdl, EENotify* );
     DECL_LINK( ModifyHdl, EENotify* );
 private:
+    long GetPixelTextHeight();
     ScInputBarGroup& mrGroupBar;
     long mnLines;
     long mnLastExpandedLines;


More information about the Libreoffice-commits mailing list