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


Hi,

Here is a small patch which makes the Calc options dialog "Default" able
to have translated labels longer than the original English. For example
in French the label on the second line (Nom de préfixe pour la nouvelle
feuille de calcul / Prefix name for new worksheet) is truncated before
the last word under Linux and before the last letter under MS-Windows.

The current code compare the length of the label and the length of the
string it contains. If the string is longer, the size of the label is
recalculated. It does that only for the first line of the option dialog.
My patch extends this code to both lines of the dialog.

Thank you to Arnaud for his kind advices.

Best regards.
JBF

-- 
Seuls des formats ouverts peuvent assurer la pérennité de vos documents.

From 164dafedd121460785e5c56ce4bc9ce7b1892940 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste FAURE <jbf.faure@orange.fr>
Date: Tue, 21 Aug 2012 22:15:32 +0200
Subject: [PATCH] The label size is computed from the length of the string it
 contains

Change-Id: I586a31a5d563ea8a11282836ca1d54b0c8be1bf4
---
 sc/source/ui/optdlg/tpdefaults.cxx |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

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) );
-- 
1.7.5.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.