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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 27 07:06:59 PDT 2012


 sc/source/ui/optdlg/tpdefaults.cxx |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit 530a899b1399f0aa192cc8eebaed36ca6613b3eb
Author: Jean-Baptiste FAURE <jbf.faure at orange.fr>
Date:   Tue Aug 21 22:15:32 2012 +0200

    The label size is computed from the length of the string it contains
    
    Change-Id: I586a31a5d563ea8a11282836ca1d54b0c8be1bf4
    
    Signed-off-by: Arnaud Versini <arnaud.versini at gmail.com>
    Signed-off-by: Kohei Yoshida <kohei.yoshida at gmail.com>

diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index b67e87b..c0db2c1 100644
--- a/sc/source/ui/optdlg/tpdefaults.cxx
+++ b/sc/source/ui/optdlg/tpdefaults.cxx
@@ -48,16 +48,23 @@ ScTpDefaultsOptions::ScTpDefaultsOptions(Window *pParent, const SfxItemSet &rCor
 {
     FreeResource();
 
-    long nTxtW = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
-    long nCtrlW = aFtNSheets.GetSizePixel().Width();
-    if ( nTxtW >= nCtrlW )
+    // the following computation must be modified accordingly if a third line is added to this dialog
+    long nTxtW1 = aFtNSheets.GetCtrlTextWidth( aFtNSheets.GetText() );
+    long nCtrlW1 = aFtNSheets.GetSizePixel().Width();
+    long nTxtW2 = aFtSheetPrefix.GetCtrlTextWidth(aFtSheetPrefix.GetText() );
+    long nCtrlW2 = aFtSheetPrefix.GetSizePixel().Width();
+    if ( nTxtW1 >= nCtrlW1 || nTxtW2 >= nCtrlW2)
     {
+        long nTxtW = std::max(nTxtW1,nTxtW2);
         Size aNewSize = aFtNSheets.GetSizePixel();
-        aNewSize.Width() += ( nTxtW - nCtrlW );
+        aNewSize.Width() = nTxtW;
         aFtNSheets.SetSizePixel( aNewSize );
+        aFtSheetPrefix.SetSizePixel( aNewSize );
         Point aNewPoint = aEdNSheets.GetPosPixel();
-        aNewPoint.X() += ( nTxtW - nCtrlW );
+        aNewPoint.X() += (nTxtW - nCtrlW1);
         aEdNSheets.SetPosPixel( aNewPoint );
+        aNewPoint.Y() = aEdSheetPrefix.GetPosPixel().Y();
+        aEdSheetPrefix.SetPosPixel( aNewPoint );
    }
     aEdNSheets.SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) );
     aEdSheetPrefix.SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) );


More information about the Libreoffice-commits mailing list