diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-19 21:16:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-20 09:59:56 +0200 |
commit | 87b5e2c0589ae7735f27d39186ced432eed7f7d0 (patch) | |
tree | 29ebe2f89b1ab7acdd843730f33dc9314ddab93c /sd | |
parent | d5d943fdc729763a5277cd0ac2093ae8acb6fccd (diff) |
weld CopyDlg
Change-Id: Ic55ce7c8297f6a5122cfb4716b9d153a5856aff5
Reviewed-on: https://gerrit.libreoffice.org/60783
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdabstdlg.hxx | 2 | ||||
-rw-r--r-- | sd/qa/unit/dialogs-test.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/copydlg.cxx | 202 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.cxx | 11 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.hxx | 11 | ||||
-rw-r--r-- | sd/source/ui/func/fucopy.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/copydlg.hxx | 49 | ||||
-rw-r--r-- | sd/uiconfig/sdraw/ui/copydlg.ui | 108 |
8 files changed, 208 insertions, 179 deletions
diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx index 44b6376dfed9..f3c24d82fbf9 100644 --- a/sd/inc/sdabstdlg.hxx +++ b/sd/inc/sdabstdlg.hxx @@ -168,7 +168,7 @@ public: SD_DLLPUBLIC static SdAbstractDialogFactory* Create(); virtual VclPtr<VclAbstractDialog> CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount ) = 0; - virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView ) = 0; virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) = 0; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) = 0; diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx index b4bd349e7e31..f56e09bffcb5 100644 --- a/sd/qa/unit/dialogs-test.cxx +++ b/sd/qa/unit/dialogs-test.cxx @@ -294,7 +294,7 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID) { // needs an SfxItemSet, use the one from the 1st object pRetval = getSdAbstractDialogFactory()->CreateCopyDlg( - getViewShell()->GetActiveWindow(), + getViewShell()->GetFrameWeld(), getSfxItemSetFromSdrObject(), getDrawView()); break; diff --git a/sd/source/ui/dlg/copydlg.cxx b/sd/source/ui/dlg/copydlg.cxx index 2da9daec85f1..ea414a9bdf7b 100644 --- a/sd/source/ui/dlg/copydlg.cxx +++ b/sd/source/ui/dlg/copydlg.cxx @@ -28,6 +28,7 @@ #include <svx/xenum.hxx> #include <sfx2/app.hxx> +#include <unotools/viewoptions.hxx> #include <sdattr.hxx> @@ -39,67 +40,50 @@ namespace sd { #define TOKEN ';' -CopyDlg::CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) - : SfxModalDialog(pWindow, "DuplicateDialog", "modules/sdraw/ui/copydlg.ui") +CopyDlg::CopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pInView) + : GenericDialogController(pWindow, "modules/sdraw/ui/copydlg.ui", "DuplicateDialog") , mrOutAttrs(rInAttrs) , maUIScale(pInView->GetDoc().GetUIScale()) , mpView(pInView) + , m_xNumFldCopies(m_xBuilder->weld_spin_button("copies")) + , m_xBtnSetViewData(m_xBuilder->weld_button("viewdata")) + , m_xMtrFldMoveX(m_xBuilder->weld_metric_spin_button("x", FUNIT_CM)) + , m_xMtrFldMoveY(m_xBuilder->weld_metric_spin_button("y", FUNIT_CM)) + , m_xMtrFldAngle(m_xBuilder->weld_metric_spin_button("angle", FUNIT_DEGREE)) + , m_xMtrFldWidth(m_xBuilder->weld_metric_spin_button("width", FUNIT_CM)) + , m_xMtrFldHeight(m_xBuilder->weld_metric_spin_button("height", FUNIT_CM)) + , m_xFtEndColor(m_xBuilder->weld_label("endlabel")) + , m_xBtnSetDefault(m_xBuilder->weld_button("default")) + , m_xLbStartColor(new ColorListBox(m_xBuilder->weld_menu_button("start"), pWindow)) + , m_xLbEndColor(new ColorListBox(m_xBuilder->weld_menu_button("end"), pWindow)) { - get(m_pNumFldCopies, "copies"); - get(m_pBtnSetViewData, "viewdata"); - get(m_pMtrFldMoveX, "x"); - get(m_pMtrFldMoveY, "y"); - get(m_pMtrFldAngle, "angle"); - get(m_pMtrFldWidth, "width"); - get(m_pMtrFldHeight, "height"); - get(m_pLbStartColor, "start"); - get(m_pFtEndColor, "endlabel"); - get(m_pLbEndColor, "end"); - get(m_pBtnSetDefault, "default"); - - m_pLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); - m_pBtnSetViewData->SetClickHdl( LINK( this, CopyDlg, SetViewData ) ); - m_pBtnSetDefault->SetClickHdl( LINK( this, CopyDlg, SetDefault ) ); + m_xLbStartColor->SetSelectHdl( LINK( this, CopyDlg, SelectColorHdl ) ); + m_xBtnSetViewData->connect_clicked( LINK( this, CopyDlg, SetViewData ) ); + m_xBtnSetDefault->connect_clicked( LINK( this, CopyDlg, SetDefault ) ); FieldUnit eFUnit( SfxModule::GetCurrentFieldUnit() ); - SetFieldUnit( *m_pMtrFldMoveX, eFUnit, true ); - SetFieldUnit( *m_pMtrFldMoveY, eFUnit, true ); - SetFieldUnit( *m_pMtrFldWidth, eFUnit, true ); - SetFieldUnit( *m_pMtrFldHeight, eFUnit, true ); + SetFieldUnit( *m_xMtrFldMoveX, eFUnit, true ); + SetFieldUnit( *m_xMtrFldMoveY, eFUnit, true ); + SetFieldUnit( *m_xMtrFldWidth, eFUnit, true ); + SetFieldUnit( *m_xMtrFldHeight, eFUnit, true ); Reset(); } CopyDlg::~CopyDlg() { - disposeOnce(); -} - -void CopyDlg::dispose() -{ - GetExtraData() = - OUString::number(m_pNumFldCopies->GetValue()) + OUString(TOKEN) + - OUString::number(m_pMtrFldMoveX->GetValue()) + OUString(TOKEN) + - OUString::number(m_pMtrFldMoveY->GetValue()) + OUString(TOKEN) + - OUString::number(m_pMtrFldAngle->GetValue()) + OUString(TOKEN) + - OUString::number(m_pMtrFldWidth->GetValue()) + OUString(TOKEN) + - OUString::number(m_pMtrFldHeight->GetValue()) + OUString(TOKEN) + - OUString::number(static_cast<sal_uInt32>(m_pLbStartColor->GetSelectEntryColor())) + OUString(TOKEN) + - OUString::number(static_cast<sal_uInt32>(m_pLbEndColor->GetSelectEntryColor())); - - m_pNumFldCopies.clear(); - m_pBtnSetViewData.clear(); - m_pMtrFldMoveX.clear(); - m_pMtrFldMoveY.clear(); - m_pMtrFldAngle.clear(); - m_pMtrFldWidth.clear(); - m_pMtrFldHeight.clear(); - m_pLbStartColor.clear(); - m_pFtEndColor.clear(); - m_pLbEndColor.clear(); - m_pBtnSetDefault.clear(); - SfxModalDialog::dispose(); + SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + OUString sStr = + OUString::number(m_xNumFldCopies->get_value()) + OUString(TOKEN) + + OUString::number(m_xMtrFldMoveX->get_value(FUNIT_NONE)) + OUString(TOKEN) + + OUString::number(m_xMtrFldMoveY->get_value(FUNIT_NONE)) + OUString(TOKEN) + + OUString::number(m_xMtrFldAngle->get_value(FUNIT_NONE)) + OUString(TOKEN) + + OUString::number(m_xMtrFldWidth->get_value(FUNIT_NONE)) + OUString(TOKEN) + + OUString::number(m_xMtrFldHeight->get_value(FUNIT_NONE)) + OUString(TOKEN) + + OUString::number(static_cast<sal_uInt32>(m_xLbStartColor->GetSelectEntryColor())) + OUString(TOKEN) + + OUString::number(static_cast<sal_uInt32>(m_xLbEndColor->GetSelectEntryColor())); + aDlgOpt.SetUserItem("UserItem", css::uno::makeAny(sStr)); } /** @@ -110,82 +94,84 @@ void CopyDlg::Reset() // Set Min/Max values ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); Size aPageSize = mpView->GetSdrPageView()->GetPage()->GetSize(); - SetMetricValue( *m_pMtrFldMoveX, long(1000000 / maUIScale), MapUnit::Map100thMM); - double fScaleFactor = m_pMtrFldMoveX->GetValue()/1000000.0; + SetMetricValue( *m_xMtrFldMoveX, long(1000000 / maUIScale), MapUnit::Map100thMM); + double fScaleFactor = m_xMtrFldMoveX->get_value(FUNIT_NONE)/1000000.0; long nPageWidth = aPageSize.Width() * fScaleFactor; long nPageHeight = aPageSize.Height() * fScaleFactor; long nRectWidth = aRect.GetWidth() * fScaleFactor; long nRectHeight = aRect.GetHeight() * fScaleFactor; - m_pMtrFldMoveX->SetMin( -nPageWidth ); - m_pMtrFldMoveX->SetMax( nPageWidth ); - m_pMtrFldMoveY->SetMin( -nPageHeight ); - m_pMtrFldMoveY->SetMax( nPageHeight ); - m_pMtrFldWidth->SetMin( -nRectWidth ); - m_pMtrFldWidth->SetMax( nPageWidth ); - m_pMtrFldHeight->SetMin( -nRectHeight ); - m_pMtrFldHeight->SetMax( nPageHeight ); + m_xMtrFldMoveX->set_range(-nPageWidth, nPageWidth, FUNIT_NONE); + m_xMtrFldMoveY->set_range(-nPageHeight, nPageHeight, FUNIT_NONE); + m_xMtrFldWidth->set_range(-nRectWidth, nPageWidth, FUNIT_NONE); + m_xMtrFldHeight->set_range(-nRectHeight, nPageHeight, FUNIT_NONE); const SfxPoolItem* pPoolItem = nullptr; - const OUString aStr( GetExtraData() ); + OUString aStr; + SvtViewOptions aDlgOpt(EViewType::Dialog, OStringToOUString(m_xDialog->get_help_id(), RTL_TEXTENCODING_UTF8)); + if (aDlgOpt.Exists()) + { + css::uno::Any aUserItem = aDlgOpt.GetUserItem("UserItem"); + aUserItem >>= aStr; + } if (aStr.isEmpty()) { if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_NUMBER, true, &pPoolItem ) ) - m_pNumFldCopies->SetValue( static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue() ); + m_xNumFldCopies->set_value(static_cast<const SfxUInt16Item*>(pPoolItem)->GetValue()); else - m_pNumFldCopies->SetValue( 1 ); + m_xNumFldCopies->set_value(1); long nMoveX = 500; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_X, true, &pPoolItem ) ) nMoveX = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveX, long(nMoveX / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveX, long(nMoveX / maUIScale), MapUnit::Map100thMM); long nMoveY = 500; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_MOVE_Y, true, &pPoolItem ) ) nMoveY = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldMoveY, long(nMoveY / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveY, long(nMoveY / maUIScale), MapUnit::Map100thMM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_ANGLE, true, &pPoolItem ) ) - m_pMtrFldAngle->SetValue( static_cast<const SfxInt32Item*>( pPoolItem )->GetValue() ); + m_xMtrFldAngle->set_value(static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(), FUNIT_NONE); else - m_pMtrFldAngle->SetValue( 0 ); + m_xMtrFldAngle->set_value(0, FUNIT_NONE); long nWidth = 0; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_WIDTH, true, &pPoolItem ) ) nWidth = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldWidth, long(nWidth / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldWidth, long(nWidth / maUIScale), MapUnit::Map100thMM); long nHeight = 0; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_HEIGHT, true, &pPoolItem ) ) nHeight = static_cast<const SfxInt32Item*>( pPoolItem )->GetValue(); - SetMetricValue( *m_pMtrFldHeight, long(nHeight / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldHeight, long(nHeight / maUIScale), MapUnit::Map100thMM); if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue(); - m_pLbStartColor->SelectEntry( aColor ); - m_pLbEndColor->SelectEntry( aColor ); + m_xLbStartColor->SelectEntry( aColor ); + m_xLbEndColor->SelectEntry( aColor ); } else { - m_pLbStartColor->SetNoSelection(); - m_pLbEndColor->SetNoSelection(); - m_pLbEndColor->Disable(); - m_pFtEndColor->Disable(); + m_xLbStartColor->SetNoSelection(); + m_xLbEndColor->SetNoSelection(); + m_xLbEndColor->set_sensitive(false); + m_xFtEndColor->set_sensitive(false); } } else { sal_Int32 nIdx {0}; - m_pNumFldCopies->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pMtrFldMoveX->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pMtrFldMoveY->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pMtrFldAngle->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pMtrFldWidth->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pMtrFldHeight->SetValue( aStr.getToken(0, TOKEN, nIdx).toInt64() ); - m_pLbStartColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) ); - m_pLbEndColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) ); + m_xNumFldCopies->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64()); + m_xMtrFldMoveX->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FUNIT_NONE); + m_xMtrFldMoveY->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FUNIT_NONE); + m_xMtrFldAngle->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FUNIT_NONE); + m_xMtrFldWidth->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FUNIT_NONE); + m_xMtrFldHeight->set_value(aStr.getToken(0, TOKEN, nIdx).toInt64(), FUNIT_NONE); + m_xLbStartColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) ); + m_xLbEndColor->SelectEntry( Color( aStr.getToken(0, TOKEN, nIdx).toUInt32() ) ); } } @@ -195,49 +181,49 @@ void CopyDlg::Reset() */ void CopyDlg::GetAttr( SfxItemSet& rOutAttrs ) { - long nMoveX = long( GetCoreValue( *m_pMtrFldMoveX, MapUnit::Map100thMM) * maUIScale); - long nMoveY = long( GetCoreValue( *m_pMtrFldMoveY, MapUnit::Map100thMM) * maUIScale); - long nHeight = long( GetCoreValue( *m_pMtrFldHeight, MapUnit::Map100thMM) * maUIScale); - long nWidth = long( GetCoreValue( *m_pMtrFldWidth, MapUnit::Map100thMM) * maUIScale); + long nMoveX = long( GetCoreValue( *m_xMtrFldMoveX, MapUnit::Map100thMM) * maUIScale); + long nMoveY = long( GetCoreValue( *m_xMtrFldMoveY, MapUnit::Map100thMM) * maUIScale); + long nHeight = long( GetCoreValue( *m_xMtrFldHeight, MapUnit::Map100thMM) * maUIScale); + long nWidth = long( GetCoreValue( *m_xMtrFldWidth, MapUnit::Map100thMM) * maUIScale); - rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, static_cast<sal_uInt16>(m_pNumFldCopies->GetValue()) ) ); + rOutAttrs.Put( SfxUInt16Item( ATTR_COPY_NUMBER, static_cast<sal_uInt16>(m_xNumFldCopies->get_value()) ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_X, nMoveX ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_MOVE_Y, nMoveY ) ); - rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(m_pMtrFldAngle->GetValue()) ) ); + rOutAttrs.Put( SfxInt32Item( ATTR_COPY_ANGLE, static_cast<sal_Int32>(m_xMtrFldAngle->get_value(FUNIT_DEGREE)) ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_WIDTH, nWidth ) ); rOutAttrs.Put( SfxInt32Item( ATTR_COPY_HEIGHT, nHeight ) ); - NamedColor aColor = m_pLbStartColor->GetSelectedEntry(); + NamedColor aColor = m_xLbStartColor->GetSelectedEntry(); rOutAttrs.Put(XColorItem(ATTR_COPY_START_COLOR, aColor.second, aColor.first)); - aColor = m_pLbEndColor->GetSelectedEntry(); + aColor = m_xLbEndColor->GetSelectedEntry(); rOutAttrs.Put(XColorItem(ATTR_COPY_END_COLOR, aColor.second, aColor.first)); } /** * enables and selects end color LB */ -IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, SvxColorListBox&, void) +IMPL_LINK_NOARG(CopyDlg, SelectColorHdl, ColorListBox&, void) { - const Color aColor = m_pLbStartColor->GetSelectEntryColor(); + const Color aColor = m_xLbStartColor->GetSelectEntryColor(); - if (!m_pLbEndColor->IsEnabled()) + if (!m_xLbEndColor->get_sensitive()) { - m_pLbEndColor->SelectEntry(aColor); - m_pLbEndColor->Enable(); - m_pFtEndColor->Enable(); + m_xLbEndColor->SelectEntry(aColor); + m_xLbEndColor->set_sensitive(true); + m_xFtEndColor->set_sensitive(true); } } /** * sets values of selection */ -IMPL_LINK_NOARG(CopyDlg, SetViewData, Button*, void) +IMPL_LINK_NOARG(CopyDlg, SetViewData, weld::Button&, void) { ::tools::Rectangle aRect = mpView->GetAllMarkedRect(); - SetMetricValue( *m_pMtrFldMoveX, long( aRect.GetWidth() / + SetMetricValue( *m_xMtrFldMoveX, long( aRect.GetWidth() / maUIScale ), MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldMoveY, long( aRect.GetHeight() / + SetMetricValue( *m_xMtrFldMoveY, long( aRect.GetHeight() / maUIScale ), MapUnit::Map100thMM); // sets color attribute @@ -245,33 +231,33 @@ IMPL_LINK_NOARG(CopyDlg, SetViewData, Button*, void) if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue(); - m_pLbStartColor->SelectEntry( aColor ); + m_xLbStartColor->SelectEntry( aColor ); } } /** * resets values to default */ -IMPL_LINK_NOARG(CopyDlg, SetDefault, Button*, void) +IMPL_LINK_NOARG(CopyDlg, SetDefault, weld::Button&, void) { - m_pNumFldCopies->SetValue( 1 ); + m_xNumFldCopies->set_value(1); long nValue = 500; - SetMetricValue( *m_pMtrFldMoveX, long(nValue / maUIScale), MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldMoveY, long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveX, long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldMoveY, long(nValue / maUIScale), MapUnit::Map100thMM); nValue = 0; - m_pMtrFldAngle->SetValue( nValue ); - SetMetricValue( *m_pMtrFldWidth, long(nValue / maUIScale), MapUnit::Map100thMM); - SetMetricValue( *m_pMtrFldHeight, long(nValue / maUIScale), MapUnit::Map100thMM); + m_xMtrFldAngle->set_value(nValue, FUNIT_DEGREE); + SetMetricValue( *m_xMtrFldWidth, long(nValue / maUIScale), MapUnit::Map100thMM); + SetMetricValue( *m_xMtrFldHeight, long(nValue / maUIScale), MapUnit::Map100thMM); // set color attribute const SfxPoolItem* pPoolItem = nullptr; if( SfxItemState::SET == mrOutAttrs.GetItemState( ATTR_COPY_START_COLOR, true, &pPoolItem ) ) { Color aColor = static_cast<const XColorItem*>( pPoolItem )->GetColorValue(); - m_pLbStartColor->SelectEntry( aColor ); - m_pLbEndColor->SelectEntry( aColor ); + m_xLbStartColor->SelectEntry( aColor ); + m_xLbEndColor->SelectEntry( aColor ); } } diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 871ec0d51f80..2070defa11b7 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -54,7 +54,10 @@ short SdAbstractGenericDialog_Impl::Execute() return m_xDlg->run(); } -IMPL_ABSTDLG_BASE(AbstractCopyDlg_Impl); +short AbstractCopyDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractSdCustomShowDlg_Impl::Execute() { @@ -125,7 +128,7 @@ short AbstractMasterLayoutDialog_Impl::Execute() void AbstractCopyDlg_Impl::GetAttr( SfxItemSet& rOutAttrs ) { - pDlg->GetAttr( rOutAttrs ); + m_xDlg->GetAttr( rOutAttrs ); } bool AbstractSdCustomShowDlg_Impl::IsModified() const @@ -372,11 +375,11 @@ VclPtr<VclAbstractDialog> SdAbstractDialogFactory_Impl::CreateBreakDlg( return VclPtr<AbstractBreakDlg_Impl>::Create(o3tl::make_unique<::sd::BreakDlg>(pParent, pDrView, pShell, nSumActionCount, nObjCount)); } -VclPtr<AbstractCopyDlg> SdAbstractDialogFactory_Impl::CreateCopyDlg(vcl::Window* pParent, +VclPtr<AbstractCopyDlg> SdAbstractDialogFactory_Impl::CreateCopyDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView ) { - return VclPtr<AbstractCopyDlg_Impl>::Create( VclPtr<::sd::CopyDlg>::Create( pParent, rInAttrs, pView ) ); + return VclPtr<AbstractCopyDlg_Impl>::Create(o3tl::make_unique<::sd::CopyDlg>(pParent, rInAttrs, pView)); } VclPtr<AbstractSdCustomShowDlg> SdAbstractDialogFactory_Impl::CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc ) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 5f8665da184a..9f83019cc2ff 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -97,7 +97,14 @@ public: class AbstractCopyDlg_Impl : public AbstractCopyDlg { - DECL_ABSTDLG_BASE(AbstractCopyDlg_Impl,::sd::CopyDlg) +private: + std::unique_ptr<sd::CopyDlg> m_xDlg; +public: + AbstractCopyDlg_Impl(std::unique_ptr<::sd::CopyDlg> pDlg) + : m_xDlg(std::move(pDlg)) + { + } + virtual short Execute() override; virtual void GetAttr( SfxItemSet& rOutAttrs ) override; }; @@ -308,7 +315,7 @@ public: virtual ~SdAbstractDialogFactory_Impl() {} virtual VclPtr<VclAbstractDialog> CreateBreakDlg(weld::Window* pWindow, ::sd::DrawView* pDrView, ::sd::DrawDocShell* pShell, sal_uLong nSumActionCount, sal_uLong nObjCount) override; - virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; + virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; diff --git a/sd/source/ui/func/fucopy.cxx b/sd/source/ui/func/fucopy.cxx index e6b1c95f35e2..f81d5ae4a0c2 100644 --- a/sd/source/ui/func/fucopy.cxx +++ b/sd/source/ui/func/fucopy.cxx @@ -99,7 +99,7 @@ void FuCopy::DoExecute( SfxRequest& rReq ) } SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetActiveWindow(), aSet, mpView )); + ScopedVclPtr<AbstractCopyDlg> pDlg(pFact->CreateCopyDlg(mpViewShell->GetFrameWeld(), aSet, mpView )); sal_uInt16 nResult = pDlg->Execute(); diff --git a/sd/source/ui/inc/copydlg.hxx b/sd/source/ui/inc/copydlg.hxx index 52a6146c230e..db0181efe2d4 100644 --- a/sd/source/ui/inc/copydlg.hxx +++ b/sd/source/ui/inc/copydlg.hxx @@ -20,13 +20,12 @@ #ifndef INCLUDED_SD_SOURCE_UI_INC_COPYDLG_HXX #define INCLUDED_SD_SOURCE_UI_INC_COPYDLG_HXX -#include <vcl/button.hxx> -#include <vcl/field.hxx> -#include <vcl/fixed.hxx> +#include <vcl/customweld.hxx> +#include <vcl/weld.hxx> #include <sfx2/basedlgs.hxx> #include <tools/fract.hxx> -class SvxColorListBox; +class ColorListBox; namespace sd { @@ -35,41 +34,35 @@ class View; /** * dialog to adjust screen */ -class CopyDlg - : public SfxModalDialog +class CopyDlg : public weld::GenericDialogController { public: - CopyDlg(vcl::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); + CopyDlg(weld::Window* pWindow, const SfxItemSet& rInAttrs, ::sd::View* pView); virtual ~CopyDlg() override; - virtual void dispose() override; - void GetAttr( SfxItemSet& rOutAttrs ); + void GetAttr( SfxItemSet& rOutAttrs ); void Reset(); private: - VclPtr<NumericField> m_pNumFldCopies; - VclPtr<Button> m_pBtnSetViewData; - - VclPtr<MetricField> m_pMtrFldMoveX; - VclPtr<MetricField> m_pMtrFldMoveY; - VclPtr<MetricField> m_pMtrFldAngle; - - VclPtr<MetricField> m_pMtrFldWidth; - VclPtr<MetricField> m_pMtrFldHeight; - - VclPtr<SvxColorListBox> m_pLbStartColor; - VclPtr<FixedText> m_pFtEndColor; - VclPtr<SvxColorListBox> m_pLbEndColor; - - VclPtr<PushButton> m_pBtnSetDefault; - const SfxItemSet& mrOutAttrs; Fraction maUIScale; ::sd::View* mpView; - DECL_LINK( SelectColorHdl, SvxColorListBox&, void ); - DECL_LINK( SetViewData, Button*, void ); - DECL_LINK( SetDefault, Button*, void ); + std::unique_ptr<weld::SpinButton> m_xNumFldCopies; + std::unique_ptr<weld::Button> m_xBtnSetViewData; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldMoveX; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldMoveY; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldAngle; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldWidth; + std::unique_ptr<weld::MetricSpinButton> m_xMtrFldHeight; + std::unique_ptr<weld::Label> m_xFtEndColor; + std::unique_ptr<weld::Button> m_xBtnSetDefault; + std::unique_ptr<ColorListBox> m_xLbStartColor; + std::unique_ptr<ColorListBox> m_xLbEndColor; + + DECL_LINK(SelectColorHdl, ColorListBox&, void); + DECL_LINK(SetViewData, weld::Button&, void); + DECL_LINK(SetDefault, weld::Button&, void); }; } // end of namespace sd diff --git a/sd/uiconfig/sdraw/ui/copydlg.ui b/sd/uiconfig/sdraw/ui/copydlg.ui index 39c34b220946..31f2a48f0cf9 100644 --- a/sd/uiconfig/sdraw/ui/copydlg.ui +++ b/sd/uiconfig/sdraw/ui/copydlg.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sd"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">1</property> <property name="upper">999</property> @@ -19,37 +18,59 @@ <object class="GtkAdjustment" id="adjustment3"> <property name="lower">-1000000</property> <property name="upper">1000000</property> - <property name="step_increment">0.1</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment4"> + <property name="lower">-1000000</property> + <property name="upper">1000000</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment5"> + <property name="lower">-1000000</property> + <property name="upper">1000000</property> + <property name="step_increment">0.10000000000000001</property> + <property name="page_increment">1</property> + </object> + <object class="GtkAdjustment" id="adjustment6"> + <property name="lower">-1000000</property> + <property name="upper">1000000</property> + <property name="step_increment">0.10000000000000001</property> <property name="page_increment">1</property> </object> <object class="GtkImage" id="image1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="pixbuf">sd/res/pipette.png</property> + <property name="icon_name">sd/res/pipette.png</property> </object> <object class="GtkDialog" id="DuplicateDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="copydlg|DuplicateDialog">Duplicate</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> + <property name="orientation">vertical</property> <property name="spacing">12</property> <child internal-child="action_area"> <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> - <property name="orientation">vertical</property> - <property name="layout_style">start</property> + <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="default"> + <property name="label" translatable="yes" context="copydlg|default">_Default</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> - <property name="use_stock">True</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> @@ -58,10 +79,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -72,12 +95,12 @@ </packing> </child> <child> - <object class="GtkButton" id="default"> - <property name="label" translatable="yes" context="copydlg|default">_Default</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="use_underline">True</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -141,6 +164,7 @@ <property name="can_focus">True</property> <property name="margin_left">12</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> </object> <packing> @@ -156,6 +180,7 @@ <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="copydlg|viewdata|tooltip_text">Values from Selection</property> <property name="image">image1</property> + <property name="always_show_image">True</property> <child internal-child="accessible"> <object class="AtkObject" id="viewdata-atkobject"> <property name="AtkObject::accessible-name" translatable="yes" context="copydlg|viewdata-atkobject">Values from Selection</property> @@ -202,7 +227,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="copydlg|label5">_X axis:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">x:0.00cm</property> + <property name="mnemonic_widget">x</property> <property name="xalign">0</property> </object> <packing> @@ -216,7 +241,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="copydlg|label6">_Y axis:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">y:0.00cm</property> + <property name="mnemonic_widget">y</property> <property name="xalign">0</property> </object> <packing> @@ -230,7 +255,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="copydlg|label7">_Angle:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">angle:0degrees</property> + <property name="mnemonic_widget">angle</property> <property name="xalign">0</property> </object> <packing> @@ -239,10 +264,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="x:0.00cm"> + <object class="GtkSpinButton" id="x"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment3</property> <property name="digits">2</property> </object> @@ -252,11 +278,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="y:0.00cm"> + <object class="GtkSpinButton" id="y"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="adjustment">adjustment3</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment4</property> <property name="digits">2</property> </object> <packing> @@ -265,10 +292,11 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="angle:0degrees"> + <object class="GtkSpinButton" id="angle"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment2</property> <property name="digits">2</property> </object> @@ -325,7 +353,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="copydlg|label8">_Width:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">width:0.00cm</property> + <property name="mnemonic_widget">width</property> <property name="xalign">0</property> </object> <packing> @@ -339,7 +367,7 @@ <property name="can_focus">False</property> <property name="label" translatable="yes" context="copydlg|label9">_Height:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">height:0.00cm</property> + <property name="mnemonic_widget">height</property> <property name="xalign">0</property> </object> <packing> @@ -348,11 +376,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="width:0.00cm"> + <object class="GtkSpinButton" id="width"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="adjustment">adjustment3</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment5</property> <property name="digits">2</property> </object> <packing> @@ -361,11 +390,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="height:0.00cm"> + <object class="GtkSpinButton" id="height"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> - <property name="adjustment">adjustment3</property> + <property name="activates_default">True</property> + <property name="adjustment">adjustment6</property> <property name="digits">2</property> </object> <packing> @@ -444,10 +474,15 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="start"> + <object class="GtkMenuButton" id="start"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="hexpand">True</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">1</property> @@ -455,10 +490,15 @@ </packing> </child> <child> - <object class="svxcorelo-SvxColorListBox" id="end"> + <object class="GtkMenuButton" id="end"> <property name="visible">True</property> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> <property name="hexpand">True</property> + <property name="xalign">0</property> + <child> + <placeholder/> + </child> </object> <packing> <property name="left_attach">1</property> @@ -496,9 +536,9 @@ </object> </child> <action-widgets> + <action-widget response="101">default</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> - <action-widget response="0">default</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> </object> |