summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste FAURE <jbf.faure@orange.fr>2012-08-21 22:15:32 +0200
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-08-27 10:06:39 -0400
commit530a899b1399f0aa192cc8eebaed36ca6613b3eb (patch)
treea13137884edc52682741c1b6aecf9e4cb24287de
parent546f1a008482ca5227897faaf4e588a7d8f5dd58 (diff)
The label size is computed from the length of the string it contains
Change-Id: I586a31a5d563ea8a11282836ca1d54b0c8be1bf4 Signed-off-by: Arnaud Versini <arnaud.versini@gmail.com> Signed-off-by: Kohei Yoshida <kohei.yoshida@gmail.com>
-rw-r--r--sc/source/ui/optdlg/tpdefaults.cxx17
1 files changed, 12 insertions, 5 deletions
diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx
index b67e87be20a3..c0db2c11271e 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) );