diff options
author | Katarina Behrens <bubli@bubli.org> | 2014-11-28 11:20:04 +0100 |
---|---|---|
committer | Katarina Behrens <bubli@bubli.org> | 2014-11-29 08:18:34 +0000 |
commit | 1386c348f81738a9966d1217db89d1f603466317 (patch) | |
tree | e4b1771a865a23b9f0ecd8bc43c4a2d947add396 /cui | |
parent | e22325ca9076de4cf11c82f21da611b8c7ba1b5a (diff) |
fdo#82616: set limits on spinboxes according to size of workarea
Do it the same way as position'n'size dialog does, for that matter
move shared code into a separate header/class.
This fixes regression from .ui migration that omitted spinbox limits
Change-Id: I884904719b2608dd80aecc5d7ffb3923de71774d
Reviewed-on: https://gerrit.libreoffice.org/13174
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Katarina Behrens <bubli@bubli.org>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/tabpages/transfrm.cxx | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx index e1193c14a266..310a1a135b41 100644 --- a/cui/source/tabpages/transfrm.cxx +++ b/cui/source/tabpages/transfrm.cxx @@ -24,6 +24,7 @@ #include <svx/svdotext.hxx> #include <svx/sderitm.hxx> #include <svx/dialogs.hrc> +#include <svx/transfrmhelper.hxx> #include <cuires.hrc> #include <editeng/sizeitem.hxx> @@ -78,24 +79,6 @@ static const sal_uInt16 pSlantRanges[] = 0 }; -static void lcl_ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) -{ - const basegfx::B2DPoint aTopLeft( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); - const basegfx::B2DPoint aBottomRight( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); - - rRange = basegfx::B2DRange(aTopLeft, aBottomRight); -} - -static void lcl_ScaleRect(basegfx::B2DRange& rRange, const Fraction aUIScale) -{ - const double fFactor(1.0 / double(aUIScale)); - rRange = basegfx::B2DRange(rRange.getMinimum() * fFactor, rRange.getMaximum() * fFactor); -} - /************************************************************************* |* |* constructor of the tab dialog: adds the pages to the dialog @@ -255,11 +238,11 @@ void SvxAngleTabPage::Construct() // take scale into account const Fraction aUIScale(pView->GetModel()->GetUIScale()); - lcl_ScaleRect(maRange, aUIScale); + TransfrmHelper::ScaleRect(maRange, aUIScale); // take UI units into account sal_uInt16 nDigits(m_pMtrPosX->GetDecimalDigits()); - lcl_ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); + TransfrmHelper::ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit); if(!pView->IsRotateAllowed()) { @@ -759,13 +742,13 @@ void SvxPositionSizeTabPage::Construct() // take scale into account const Fraction aUIScale(mpView->GetModel()->GetUIScale()); - lcl_ScaleRect( maWorkRange, aUIScale ); - lcl_ScaleRect( maRange, aUIScale ); + TransfrmHelper::ScaleRect( maWorkRange, aUIScale ); + TransfrmHelper::ScaleRect( maRange, aUIScale ); // take UI units into account const sal_uInt16 nDigits(m_pMtrPosX->GetDecimalDigits()); - lcl_ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); - lcl_ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); + TransfrmHelper::ConvertRect( maWorkRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); + TransfrmHelper::ConvertRect( maRange, nDigits, (MapUnit) mePoolUnit, meDlgUnit ); SetMinMaxPosition(); } |