Fraction->double in CopyDlg
Change-Id: If57bb9ea9c39602946eeffbb6a09b8b8d3bd6c4d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202565 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
@@ -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<sal_uInt16>(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 ) )
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
|
||||
private:
|
||||
const SfxItemSet& mrOutAttrs;
|
||||
Fraction maUIScale;
|
||||
double mfUIScale;
|
||||
::sd::View* mpView;
|
||||
|
||||
std::unique_ptr<weld::SpinButton> m_xNumFldCopies;
|
||||
|
||||
Reference in New Issue
Block a user