sc/source/ui/optdlg/tpdefaults.cxx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
New commits: commit 530a899b1399f0aa192cc8eebaed36ca6613b3eb Author: Jean-Baptiste FAURE <jbf.fa...@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.vers...@gmail.com> Signed-off-by: Kohei Yoshida <kohei.yosh...@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) ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits