diff options
author | Jean-Baptiste FAURE <jbf.faure@orange.fr> | 2012-08-21 22:15:32 +0200 |
---|---|---|
committer | Arnaud Versini <arnaud.versini@gmail.com> | 2012-08-25 12:41:29 +0200 |
commit | f92fcff04a6a88fd004e721294a4817249cabf26 (patch) | |
tree | 620476b7e9e6a5e68d958a8a3cb49582872e42ca /sc | |
parent | Replace usage of rtl/memory.h in comphelper with equivalent from string.h (diff) | |
download | core-f92fcff04a6a88fd004e721294a4817249cabf26.tar.gz core-f92fcff04a6a88fd004e721294a4817249cabf26.zip |
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>
Diffstat (limited to 'sc')
-rw-r--r-- | 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 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) ); |