diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-09-16 14:24:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-09-17 16:06:08 +0200 |
commit | a7e9db8338e93921ede5892545ce18655d08aad5 (patch) | |
tree | 49bc83e5724edde36908285b7cf681de2c07f6d9 /sd/source | |
parent | 95401c5b3eef03497af6a85afc6e907c659ef6f7 (diff) |
weld SdPageDlg
Change-Id: Id9c78651d3eb315bf2e982eef48ef24071bfc79b
Reviewed-on: https://gerrit.libreoffice.org/60550
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/dlg/dlgpage.cxx | 29 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.cxx | 40 | ||||
-rw-r--r-- | sd/source/ui/dlg/sddlgfact.hxx | 22 | ||||
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/dlgpage.hxx | 9 |
5 files changed, 76 insertions, 26 deletions
diff --git a/sd/source/ui/dlg/dlgpage.cxx b/sd/source/ui/dlg/dlgpage.cxx index 75933ae73271..97e03977ef1a 100644 --- a/sd/source/ui/dlg/dlgpage.cxx +++ b/sd/source/ui/dlg/dlgpage.cxx @@ -33,12 +33,9 @@ /** * Constructor of tab dialog: appends pages to the dialog */ -SdPageDlg::SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage ) : - SfxTabDialog ( pParent - ,"DrawPageDialog" - ,"modules/sdraw/ui/drawpagedialog.ui" - , pAttr ), - mpDocShell ( pDocSh ) +SdPageDlg::SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage) + : SfxTabDialogController(pParent, "modules/sdraw/ui/drawpagedialog.ui", "DrawPageDialog", pAttr) + , mpDocShell(pDocSh) { SvxColorListItem const * pColorListItem = mpDocShell->GetItem( SID_COLOR_TABLE ); SvxGradientListItem const * pGradientListItem = mpDocShell->GetItem( SID_GRADIENT_LIST ); @@ -54,28 +51,28 @@ SdPageDlg::SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); - mnPage = AddTabPage( "RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_PAGE ), nullptr ); - mnArea = AddTabPage( "RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_AREA ), nullptr ); - mnTransparence = AddTabPage( "RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc( RID_SVXPAGE_TRANSPARENCE ), nullptr ); + AddTabPage("RID_SVXPAGE_PAGE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_PAGE), nullptr); + AddTabPage("RID_SVXPAGE_AREA", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_AREA), nullptr); + AddTabPage("RID_SVXPAGE_TRANSPARENCE", pFact->GetTabPageCreatorFunc(RID_SVXPAGE_TRANSPARENCE), nullptr); - if(!bAreaPage) // I have to add the page before I remove it ! + if (!bAreaPage) // I have to add the page before I remove it ! { - RemoveTabPage( "RID_SVXPAGE_AREA" ); - RemoveTabPage( "RID_SVXPAGE_TRANSPARENCE" ); + RemoveTabPage("RID_SVXPAGE_AREA"); + RemoveTabPage("RID_SVXPAGE_TRANSPARENCE"); } } -void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) +void SdPageDlg::PageCreated(const OString& rId, SfxTabPage& rPage) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - if (nId == mnPage) + if (rId == "RID_SVXPAGE_PAGE") { aSet.Put (SfxAllEnumItem(sal_uInt16(SID_ENUM_PAGE_MODE), SVX_PAGE_MODE_PRESENTATION)); aSet.Put (SfxAllEnumItem(sal_uInt16(SID_PAPER_START), PAPER_A0)); aSet.Put (SfxAllEnumItem(sal_uInt16(SID_PAPER_END), PAPER_E)); rPage.PageCreated(aSet); } - else if (nId == mnArea) + else if (rId == "RID_SVXPAGE_AREA") { aSet.Put (SvxColorListItem(mpColorList,SID_COLOR_TABLE)); aSet.Put (SvxGradientListItem(mpGradientList,SID_GRADIENT_LIST)); @@ -87,7 +84,7 @@ void SdPageDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) aSet.Put (SfxUInt16Item(SID_TABPAGE_POS,0)); rPage.PageCreated(aSet); } - else if (nId == mnTransparence) + else if (rId == "RID_SVXPAGE_TRANSPARENCE") { aSet.Put(SfxUInt16Item(SID_PAGE_TYPE,0)); aSet.Put(SfxUInt16Item(SID_DLG_TYPE,1)); diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx index 22581ad31aaa..7173bfc0c533 100644 --- a/sd/source/ui/dlg/sddlgfact.cxx +++ b/sd/source/ui/dlg/sddlgfact.cxx @@ -164,6 +164,42 @@ void SdAbstractTabDialog_Impl::SetText( const OUString& rStr ) pDlg->SetText( rStr ); } +short SdAbstractTabController_Impl::Execute() +{ + return m_xDlg->execute(); +} + +void SdAbstractTabController_Impl::SetCurPageId( const OString &rName ) +{ + m_xDlg->SetCurPageId( rName ); +} + +const SfxItemSet* SdAbstractTabController_Impl::GetOutputItemSet() const +{ + return m_xDlg->GetOutputItemSet(); +} + +const sal_uInt16* SdAbstractTabController_Impl::GetInputRanges(const SfxItemPool& pItem ) +{ + return m_xDlg->GetInputRanges( pItem ); +} + +void SdAbstractTabController_Impl::SetInputSet( const SfxItemSet* pInSet ) +{ + m_xDlg->SetInputSet( pInSet ); +} + +bool SdAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + +//From class Window. +void SdAbstractTabController_Impl::SetText( const OUString& rStr ) +{ + m_xDlg->set_title(rStr); +} + void AbstractBulletDialog_Impl::SetCurPageId( const OString& rName ) { static_cast< ::sd::OutlineBulletDlg*>(pDlg.get())->SetCurPageId( rName ); @@ -353,9 +389,9 @@ VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdTabCharDialo return VclPtr<SdAbstractTabDialog_Impl>::Create( VclPtr<SdCharDlg>::Create(pParent, pAttr, pDocShell) ); } -VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdTabPageDialog(vcl::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage ) +VclPtr<SfxAbstractTabDialog> SdAbstractDialogFactory_Impl::CreateSdTabPageDialog(weld::Window* pParent, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage ) { - return VclPtr<SdAbstractTabDialog_Impl>::Create( VclPtr<SdPageDlg>::Create( pDocShell, pParent, pAttr, bAreaPage ) ); + return VclPtr<SdAbstractTabController_Impl>::Create(o3tl::make_unique<SdPageDlg>(pDocShell, pParent, pAttr, bAreaPage)); } VclPtr<AbstractSdModifyFieldDlg> SdAbstractDialogFactory_Impl::CreateSdModifyFieldDlg(weld::Window* pParent, const SvxFieldData* pInField, const SfxItemSet& rSet) diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx index 10880bd9b46f..16c0b0be361d 100644 --- a/sd/source/ui/dlg/sddlgfact.hxx +++ b/sd/source/ui/dlg/sddlgfact.hxx @@ -128,6 +128,26 @@ class SdAbstractTabDialog_Impl : public SfxAbstractTabDialog virtual void SetText( const OUString& rStr ) override; }; +class SdAbstractTabController_Impl : public SfxAbstractTabDialog +{ +protected: + std::shared_ptr<SfxTabDialogController> m_xDlg; +public: + explicit SdAbstractTabController_Impl(std::unique_ptr<SfxTabDialogController> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; + virtual bool StartExecuteAsync(AsyncContext &rCtx) override; + virtual void SetCurPageId( const OString &rName ) override; + virtual const SfxItemSet* GetOutputItemSet() const override; + virtual const sal_uInt16* GetInputRanges( const SfxItemPool& pItem ) override; + virtual void SetInputSet( const SfxItemSet* pInSet ) override; + //From class Window. + virtual void SetText( const OUString& rStr ) override; +}; + + class AbstractBulletDialog_Impl : public SfxAbstractTabDialog { DECL_ABSTDLG_BASE( AbstractBulletDialog_Impl,SfxTabDialog ) @@ -291,7 +311,7 @@ public: virtual VclPtr<AbstractCopyDlg> CreateCopyDlg(vcl::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr<AbstractSdCustomShowDlg> CreateSdCustomShowDlg(weld::Window* pParent, SdDrawDocument& rDrawDoc) override; virtual VclPtr<SfxAbstractTabDialog> CreateSdTabCharDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(vcl::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; + virtual VclPtr<SfxAbstractTabDialog> CreateSdTabPageDialog(weld::Window* pWindow, const SfxItemSet* pAttr, SfxObjectShell* pDocShell, bool bAreaPage) override; virtual VclPtr<AbstractSdModifyFieldDlg> CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSdSnapLineDlg> CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, ::sd::View* pView) override; virtual VclPtr<AbstractSdInsertLayerDlg> CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool bDeletable, const OUString& aStr) override; diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index c5b38dba95be..a514f84be3cd 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -330,7 +330,7 @@ const SfxItemSet* FuPage::ExecuteDialog(weld::Window* pParent) { // create the dialog SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create(); - ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetActiveWindow(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) ); + ScopedVclPtr<SfxAbstractTabDialog> pDlg( pFact->CreateSdTabPageDialog(mpViewShell->GetFrameWeld(), &aMergedAttr, mpDocSh, mbDisplayBackgroundTabPage) ); if( pDlg->Execute() == RET_OK ) pTempSet.reset( new SfxItemSet(*pDlg->GetOutputItemSet()) ); } diff --git a/sd/source/ui/inc/dlgpage.hxx b/sd/source/ui/inc/dlgpage.hxx index 632ae583ebfa..b0ffd2aa7454 100644 --- a/sd/source/ui/inc/dlgpage.hxx +++ b/sd/source/ui/inc/dlgpage.hxx @@ -28,7 +28,7 @@ enum class ChangeType; /** * Page configuration-tab-dialog */ -class SdPageDlg : public SfxTabDialog +class SdPageDlg : public SfxTabDialogController { private: const SfxObjectShell* mpDocShell; @@ -38,14 +38,11 @@ private: XHatchListRef mpHatchingList; XBitmapListRef mpBitmapList; XPatternListRef mpPatternList; - sal_uInt16 mnArea; - sal_uInt16 mnPage; - sal_uInt16 mnTransparence; public: - SdPageDlg( SfxObjectShell const * pDocSh, vcl::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage ); + SdPageDlg(SfxObjectShell const * pDocSh, weld::Window* pParent, const SfxItemSet* pAttr, bool bAreaPage); - virtual void PageCreated(sal_uInt16 nId, SfxTabPage& rPage) override; + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; }; #endif // INCLUDED_SD_SOURCE_UI_INC_DLGPAGE_HXX |