From 69af36db01340549308f37af72cd08541684ae52 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 23 Mar 2026 11:45:27 +0200 Subject: [PATCH] Fraction->double in CopyDlg Change-Id: If57bb9ea9c39602946eeffbb6a09b8b8d3bd6c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202565 Reviewed-by: Noel Grandin Tested-by: Jenkins --- sd/source/ui/dlg/copydlg.cxx | 38 ++++++++++++++++++------------------ sd/source/ui/inc/copydlg.hxx | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 3eeaa82c8fd6..5432288d7022 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -43,7 +43,7 @@ constexpr char TOKEN = ';'; CopyDlg::CopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) : SfxDialogController(pWindow, u"modules/sdraw/ui/copydlg.ui"_ustr, u"DuplicateDialog"_ustr) , mrOutAttrs(rInAttrs) - , maUIScale(pInView->GetDoc().GetUIScale()) + , mfUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) , m_xNumFldCopies(m_xBuilder->weld_spin_button(u"copies"_ustr)) , m_xBtnSetViewData(m_xBuilder->weld_button(u"viewdata"_ustr)) @@ -98,10 +98,10 @@ void CopyDlg::Reset() // tdf#125011 draw/impress sizes are in mm_100th already, "normalize" to // decimal shift by number of decimal places the widgets are using (2) then // scale by the ui scaling factor - auto nPageWidth = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Width()) / maUIScale); - auto nPageHeight = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Height()) / maUIScale); - auto nRectWidth = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetWidth()) / maUIScale); - auto nRectHeight = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetHeight()) / maUIScale); + auto nPageWidth = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Width()) / mfUIScale); + auto nPageHeight = tools::Long(m_xMtrFldMoveX->normalize(aPageSize.Height()) / mfUIScale); + auto nRectWidth = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetWidth()) / mfUIScale); + auto nRectHeight = tools::Long(m_xMtrFldMoveX->normalize(aRect.GetHeight()) / mfUIScale); m_xMtrFldMoveX->set_range(-nPageWidth, nPageWidth, FieldUnit::MM_100TH); m_xMtrFldMoveY->set_range(-nPageHeight, nPageHeight, FieldUnit::MM_100TH); @@ -126,12 +126,12 @@ void CopyDlg::Reset() tools::Long nMoveX = 500; if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_MOVE_X ) ) nMoveX = pPoolItem->GetValue(); - SetMetricValue( *m_xMtrFldMoveX, tools::Long(nMoveX / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveX, tools::Long(nMoveX / mfUIScale), MapUnit::Map100thMM); tools::Long nMoveY = 500; if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_MOVE_Y ) ) nMoveY = pPoolItem->GetValue(); - SetMetricValue( *m_xMtrFldMoveY, tools::Long(nMoveY / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveY, tools::Long(nMoveY / mfUIScale), MapUnit::Map100thMM); if( const SdrAngleItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_ANGLE ) ) m_xMtrFldAngle->set_value( pPoolItem->GetValue().get(), FieldUnit::NONE); @@ -141,12 +141,12 @@ void CopyDlg::Reset() tools::Long nWidth = 0; if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_WIDTH ) ) nWidth = pPoolItem->GetValue(); - SetMetricValue( *m_xMtrFldWidth, tools::Long(nWidth / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldWidth, tools::Long(nWidth / mfUIScale), MapUnit::Map100thMM); tools::Long nHeight = 0; if( const SfxInt32Item* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_HEIGHT ) ) nHeight = pPoolItem->GetValue(); - SetMetricValue( *m_xMtrFldHeight, tools::Long(nHeight / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldHeight, tools::Long(nHeight / mfUIScale), MapUnit::Map100thMM); if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) ) { @@ -182,10 +182,10 @@ void CopyDlg::Reset() */ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) { - tools::Long nMoveX = tools::Long( GetCoreValue( *m_xMtrFldMoveX, MapUnit::Map100thMM) * maUIScale); - tools::Long nMoveY = tools::Long( GetCoreValue( *m_xMtrFldMoveY, MapUnit::Map100thMM) * maUIScale); - tools::Long nHeight = tools::Long( GetCoreValue( *m_xMtrFldHeight, MapUnit::Map100thMM) * maUIScale); - tools::Long nWidth = tools::Long( GetCoreValue( *m_xMtrFldWidth, MapUnit::Map100thMM) * maUIScale); + tools::Long nMoveX = tools::Long( GetCoreValue( *m_xMtrFldMoveX, MapUnit::Map100thMM) * mfUIScale); + tools::Long nMoveY = tools::Long( GetCoreValue( *m_xMtrFldMoveY, MapUnit::Map100thMM) * mfUIScale); + tools::Long nHeight = tools::Long( GetCoreValue( *m_xMtrFldHeight, MapUnit::Map100thMM) * mfUIScale); + tools::Long nWidth = tools::Long( GetCoreValue( *m_xMtrFldWidth, MapUnit::Map100thMM) * mfUIScale); rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, static_cast(m_xNumFldCopies->get_value()) ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); @@ -223,9 +223,9 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData, weld::Button&, void) ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); SetMetricValue( *m_xMtrFldMoveX, tools::Long( aRect.GetWidth() / - maUIScale ), MapUnit::Map100thMM); + mfUIScale ), MapUnit::Map100thMM); SetMetricValue( *m_xMtrFldMoveY, tools::Long( aRect.GetHeight() / - maUIScale ), MapUnit::Map100thMM); + mfUIScale ), MapUnit::Map100thMM); // sets color attribute if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) ) @@ -243,13 +243,13 @@ IMPL_LINK_NOARG(CopyDlg, SetDefault, weld::Button&, void) m_xNumFldCopies->set_value(1); tools::Long nValue = 500; - SetMetricValue( *m_xMtrFldMoveX, tools::Long(nValue / maUIScale), MapUnit::Map100thMM); - SetMetricValue( *m_xMtrFldMoveY, tools::Long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveX, tools::Long(nValue / mfUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveY, tools::Long(nValue / mfUIScale), MapUnit::Map100thMM); nValue = 0; m_xMtrFldAngle->set_value(nValue, FieldUnit::DEGREE); - SetMetricValue( *m_xMtrFldWidth, tools::Long(nValue / maUIScale), MapUnit::Map100thMM); - SetMetricValue( *m_xMtrFldHeight, tools::Long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldWidth, tools::Long(nValue / mfUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldHeight, tools::Long(nValue / mfUIScale), MapUnit::Map100thMM); // set color attribute if( const XColorItem* pPoolItem = mrOutAttrs.GetItemIfSet( ATTR_COPY_START_COLOR ) ) diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 5e5d9a2a3b7e..04f518223fbc 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -44,7 +44,7 @@ public: private: const SfxItemSet& mrOutAttrs; - Fraction maUIScale; + double mfUIScale; ::sd::View* mpView; std::unique_ptr m_xNumFldCopies;