diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-01 14:12:24 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-02 09:58:41 +0200 |
commit | 3c80f4880d0d3a8f7c71d76877efe234f4f3629c (patch) | |
tree | efbb64a152e15c125a2ada453585c8d32b4725d6 /cui/source | |
parent | tdf#115262 sc: fix cumulative placement error of images (diff) | |
download | core-3c80f4880d0d3a8f7c71d76877efe234f4f3629c.tar.gz core-3c80f4880d0d3a8f7c71d76877efe234f4f3629c.zip |
weld SvxLineTabDialog
Change-Id: Icb13a6eb2e8c6f6dbd3cf477051bc0bd682e2e7a
Reviewed-on: https://gerrit.libreoffice.org/61193
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui/source')
-rw-r--r-- | cui/source/factory/dlgfact.cxx | 10 | ||||
-rw-r--r-- | cui/source/factory/dlgfact.hxx | 5 | ||||
-rw-r--r-- | cui/source/inc/cuitabline.hxx | 31 | ||||
-rw-r--r-- | cui/source/tabpages/tabline.cxx | 81 | ||||
-rw-r--r-- | cui/source/tabpages/tpline.cxx | 8 | ||||
-rw-r--r-- | cui/source/tabpages/tplnedef.cxx | 2 | ||||
-rw-r--r-- | cui/source/tabpages/tplneend.cxx | 2 |
7 files changed, 61 insertions, 78 deletions
diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 0c024e2f8079..a49f2b240952 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -344,6 +344,11 @@ short CuiAbstractTabController_Impl::Execute() return m_xDlg->execute(); } +bool CuiAbstractTabController_Impl::StartExecuteAsync(AsyncContext &rCtx) +{ + return SfxTabDialogController::runAsync(m_xDlg, rCtx.maEndDialogFn); +} + void CuiAbstractTabController_Impl::SetCurPageId( const OString &rName ) { m_xDlg->SetCurPageId( rName ); @@ -1337,13 +1342,12 @@ VclPtr<AbstractSvxAreaTabDialog> AbstractDialogFactory_Impl::CreateSvxAreaTabDia return VclPtr<AbstractSvxAreaTabDialog_Impl>::Create(o3tl::make_unique<SvxAreaTabDialog>(pParent, pAttr, pModel, bShadow)); } -VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog +VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, //add forSvxLineTabDialog SdrModel* pModel, const SdrObject* pObj , bool bHasObj) { - VclPtrInstance<SvxLineTabDialog> pDlg( pParent, pAttr, pModel,pObj,bHasObj ); - return VclPtr<CuiAbstractTabDialog_Impl>::Create( pDlg ); + return VclPtr<CuiAbstractTabController_Impl>::Create(o3tl::make_unique<SvxLineTabDialog>(pParent, pAttr, pModel, pObj,bHasObj)); } VclPtr<SfxAbstractDialog> AbstractDialogFactory_Impl::CreateCharMapDialog(weld::Window* pParent, const SfxItemSet& rAttr, bool bInsert) diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 505ff1481b96..ba317dd531c8 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -145,13 +145,14 @@ class CuiAbstractTabDialog_Impl : public SfxAbstractTabDialog class CuiAbstractTabController_Impl : public SfxAbstractTabDialog { protected: - std::unique_ptr<SfxTabDialogController> m_xDlg; + std::shared_ptr<SfxTabDialogController> m_xDlg; public: explicit CuiAbstractTabController_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; @@ -800,7 +801,7 @@ public: const SfxItemSet* pAttr, SdrModel* pModel, bool bShadow) override; - virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, + virtual VclPtr<SfxAbstractTabDialog> CreateSvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, SdrModel* pModel, const SdrObject* pObj, bool bHasObj ) override; diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 36edebfd8330..53430d0967ad 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -27,23 +27,18 @@ enum class PageType; class ColorListBox; -class SvxLineTabDialog final : public SfxTabDialog +class SvxLineTabDialog final : public SfxTabDialogController { - sal_uInt16 m_nLineTabPage; - sal_uInt16 m_nShadowTabPage; - sal_uInt16 m_nStyleTabPage; - sal_uInt16 m_nEndTabPage; - SdrModel* pDrawModel; const SdrObject* pObj; - XColorListRef pColorList; - XColorListRef mpNewColorList; - XDashListRef pDashList; - XDashListRef pNewDashList; - XLineEndListRef pLineEndList; - XLineEndListRef pNewLineEndList; - bool bObjSelected; + XColorListRef pColorList; + XColorListRef mpNewColorList; + XDashListRef pDashList; + XDashListRef pNewDashList; + XLineEndListRef pLineEndList; + XLineEndListRef pNewLineEndList; + bool bObjSelected; ChangeType nLineEndListState; ChangeType nDashListState; @@ -53,16 +48,16 @@ class SvxLineTabDialog final : public SfxTabDialog sal_Int32 nPosDashLb; sal_Int32 nPosLineEndLb; - virtual void PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) override; + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; virtual short Ok() override; - DECL_LINK( CancelHdlImpl, Button*, void ); + DECL_LINK(CancelHdlImpl, weld::Button&, void); void SavePalettes(); public: - SvxLineTabDialog( vcl::Window* pParent, const SfxItemSet* pAttr, - SdrModel* pModel, const SdrObject* pObj, - bool bHasObj ); + SvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, + SdrModel* pModel, const SdrObject* pObj, + bool bHasObj); void SetNewDashList( XDashListRef const & pInLst) { pNewDashList = pInLst; } diff --git a/cui/source/tabpages/tabline.cxx b/cui/source/tabpages/tabline.cxx index 526886134a4b..df1b6a3ba9d9 100644 --- a/cui/source/tabpages/tabline.cxx +++ b/cui/source/tabpages/tabline.cxx @@ -28,38 +28,24 @@ #include <svx/xtable.hxx> #include <svx/drawitem.hxx> -SvxLineTabDialog::SvxLineTabDialog -( - vcl::Window* pParent, - const SfxItemSet* pAttr, - SdrModel* pModel, - const SdrObject* pSdrObj, - bool bHasObj -) : - - SfxTabDialog ( pParent - , "LineDialog" - , "cui/ui/linedialog.ui" - , pAttr ), - m_nLineTabPage(0), - m_nShadowTabPage(0), - m_nStyleTabPage(0), - m_nEndTabPage(0), - pDrawModel ( pModel ), - pObj ( pSdrObj ), - pColorList ( pModel->GetColorList() ), - mpNewColorList ( pModel->GetColorList() ), - pDashList ( pModel->GetDashList() ), - pNewDashList ( pModel->GetDashList() ), - pLineEndList ( pModel->GetLineEndList() ), - pNewLineEndList ( pModel->GetLineEndList() ), - bObjSelected ( bHasObj ), - nLineEndListState( ChangeType::NONE ), - nDashListState( ChangeType::NONE ), - mnColorListState( ChangeType::NONE ), - nPageType( PageType::Area ), // We use it here primarily to get the right attributes with FillItemSet - nPosDashLb( 0 ), - nPosLineEndLb( 0 ) +SvxLineTabDialog::SvxLineTabDialog(weld::Window* pParent, const SfxItemSet* pAttr, + SdrModel* pModel, const SdrObject* pSdrObj, bool bHasObj) + : SfxTabDialogController(pParent, "cui/ui/linedialog.ui", "LineDialog", pAttr) + , pDrawModel(pModel) + , pObj(pSdrObj) + , pColorList(pModel->GetColorList()) + , mpNewColorList(pModel->GetColorList()) + , pDashList(pModel->GetDashList()) + , pNewDashList(pModel->GetDashList()) + , pLineEndList(pModel->GetLineEndList()) + , pNewLineEndList(pModel->GetLineEndList()) + , bObjSelected(bHasObj) + , nLineEndListState(ChangeType::NONE) + , nDashListState(ChangeType::NONE) + , mnColorListState(ChangeType::NONE) + , nPageType(PageType::Area) // We use it here primarily to get the right attributes with FillItemSet + , nPosDashLb(0) + , nPosLineEndLb(0) { bool bLineOnly = false; if( pObj && pObj->GetObjInventor() == SdrInventor::Default ) @@ -81,20 +67,19 @@ SvxLineTabDialog::SvxLineTabDialog } - m_nLineTabPage = AddTabPage( "RID_SVXPAGE_LINE", SvxLineTabPage::Create, nullptr); + AddTabPage("RID_SVXPAGE_LINE", SvxLineTabPage::Create, nullptr); if( bLineOnly ) - m_nShadowTabPage = AddTabPage( "RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, nullptr ); + AddTabPage("RID_SVXPAGE_SHADOW", SvxShadowTabPage::Create, nullptr); else RemoveTabPage( "RID_SVXPAGE_SHADOW" ); - m_nStyleTabPage = AddTabPage( "RID_SVXPAGE_LINE_DEF", SvxLineDefTabPage::Create, nullptr); - m_nEndTabPage = AddTabPage( "RID_SVXPAGE_LINEEND_DEF", SvxLineEndDefTabPage::Create, nullptr); + AddTabPage("RID_SVXPAGE_LINE_DEF", SvxLineDefTabPage::Create, nullptr); + AddTabPage("RID_SVXPAGE_LINEEND_DEF", SvxLineEndDefTabPage::Create, nullptr); - CancelButton& rBtnCancel = GetCancelButton(); - rBtnCancel.SetClickHdl( LINK( this, SvxLineTabDialog, CancelHdlImpl ) ); + weld::Button& rBtnCancel = GetCancelButton(); + rBtnCancel.connect_clicked(LINK(this, SvxLineTabDialog, CancelHdlImpl)); } - void SvxLineTabDialog::SavePalettes() { SfxObjectShell* pShell = SfxObjectShell::Current(); @@ -161,27 +146,25 @@ void SvxLineTabDialog::SavePalettes() } } - short SvxLineTabDialog::Ok() { SavePalettes(); // We return RET_OK if at least one TabPage in FillItemSet() returns sal_True. // We do this by default at the moment. - return SfxTabDialog::Ok(); + return SfxTabDialogController::Ok(); } - -IMPL_LINK_NOARG(SvxLineTabDialog, CancelHdlImpl, Button*, void) +IMPL_LINK_NOARG(SvxLineTabDialog, CancelHdlImpl, weld::Button&, void) { SavePalettes(); - EndDialog(); + m_xDialog->response(RET_CANCEL); } -void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +void SvxLineTabDialog::PageCreated(const OString& rId, SfxTabPage &rPage) { - if( nId == m_nLineTabPage) + if (rId == "RID_SVXPAGE_LINE") { static_cast<SvxLineTabPage&>(rPage).SetColorList( pColorList ); static_cast<SvxLineTabPage&>(rPage).SetDashList( pDashList ); @@ -196,7 +179,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) static_cast<SvxLineTabPage&>(rPage).Construct(); static_cast<SvxLineTabPage&>(rPage).SetColorChgd( &mnColorListState ); } - else if(nId == m_nStyleTabPage) + else if (rId == "RID_SVXPAGE_LINE_DEF") { static_cast<SvxLineDefTabPage&>(rPage).SetDashList( pDashList ); static_cast<SvxLineDefTabPage&>(rPage).SetDlgType( 0 ); @@ -205,7 +188,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) static_cast<SvxLineDefTabPage&>(rPage).SetDashChgd( &nDashListState ); static_cast<SvxLineDefTabPage&>(rPage).Construct(); } - else if(nId == m_nEndTabPage) + else if (rId == "RID_SVXPAGE_LINEEND_DEF") { static_cast<SvxLineEndDefTabPage&>(rPage).SetLineEndList( pLineEndList ); static_cast<SvxLineEndDefTabPage&>(rPage).SetPolyObj( pObj ); @@ -215,7 +198,7 @@ void SvxLineTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) static_cast<SvxLineEndDefTabPage&>(rPage).SetLineEndChgd( &nLineEndListState ); static_cast<SvxLineEndDefTabPage&>(rPage).Construct(); } - else if (nId == m_nShadowTabPage) + else if (rId == "RID_SVXPAGE_SHADOW") { static_cast<SvxShadowTabPage&>(rPage).SetColorList( pColorList ); static_cast<SvxShadowTabPage&>(rPage).SetPageType( nPageType ); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index 053389519570..eb6a22d3288d 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -71,7 +71,7 @@ const sal_uInt16 SvxLineTabPage::pLineRanges[] = }; SvxLineTabPage::SvxLineTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs) - : SfxTabPage(pParent, "cui/ui/linetabpage.ui", "SvxLineTabPage", &rInAttrs) + : SfxTabPage(pParent, "cui/ui/linetabpage.ui", "LineTabPage", &rInAttrs) , m_pSymbolList(nullptr) , m_bNewSize(false) , m_nNumMenuGalleryItems(0) @@ -258,7 +258,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) ( *m_pnDashListState & ChangeType::CHANGED ) ) { if( *m_pnDashListState & ChangeType::CHANGED ) - m_pDashList = static_cast<SvxLineTabDialog*>( GetParentDialog() )->GetNewDashList(); + m_pDashList = static_cast<SvxLineTabDialog*>(GetDialogController() )->GetNewDashList(); *m_pnDashListState = ChangeType::NONE; @@ -287,7 +287,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) if( ( *m_pnLineEndListState & ChangeType::MODIFIED ) || ( *m_pnLineEndListState & ChangeType::CHANGED ) ) { if( *m_pnLineEndListState & ChangeType::CHANGED ) - m_pLineEndList = static_cast<SvxLineTabDialog*>( GetParentDialog() )->GetNewLineEndList(); + m_pLineEndList = static_cast<SvxLineTabDialog*>(GetDialogController())->GetNewLineEndList(); *m_pnLineEndListState = ChangeType::NONE; @@ -342,7 +342,7 @@ void SvxLineTabPage::ActivatePage( const SfxItemSet& rSet ) if( *m_pnColorListState != ChangeType::NONE ) { if( *m_pnColorListState & ChangeType::CHANGED ) - m_pColorList = static_cast<SvxLineTabDialog*>( GetParentDialog() )->GetNewColorList(); + m_pColorList = static_cast<SvxLineTabDialog*>(GetDialogController())->GetNewColorList(); ChangePreviewHdl_Impl( nullptr ); } diff --git a/cui/source/tabpages/tplnedef.cxx b/cui/source/tabpages/tplnedef.cxx index bdc61de0d594..7a3063896738 100644 --- a/cui/source/tabpages/tplnedef.cxx +++ b/cui/source/tabpages/tplnedef.cxx @@ -698,7 +698,7 @@ IMPL_LINK_NOARG(SvxLineDefTabPage, ClickLoadHdl_Impl, weld::Button&, void) if( pDshLst->Load() ) { pDashList = pDshLst; - static_cast<SvxLineTabDialog*>( GetParentDialog() )->SetNewDashList( pDashList ); + static_cast<SvxLineTabDialog*>(GetDialogController())->SetNewDashList( pDashList ); m_xLbLineStyles->clear(); m_xLbLineStyles->Fill( pDashList ); diff --git a/cui/source/tabpages/tplneend.cxx b/cui/source/tabpages/tplneend.cxx index 4222266e3656..38f42d51d71b 100644 --- a/cui/source/tabpages/tplneend.cxx +++ b/cui/source/tabpages/tplneend.cxx @@ -536,7 +536,7 @@ IMPL_LINK_NOARG(SvxLineEndDefTabPage, ClickLoadHdl_Impl, weld::Button&, void) if( pLeList->Load() ) { pLineEndList = pLeList; - static_cast<SvxLineTabDialog*>( GetParentDialog() )->SetNewLineEndList( pLineEndList ); + static_cast<SvxLineTabDialog*>(GetDialogController())->SetNewLineEndList( pLineEndList ); m_xLbLineEnds->clear(); m_xLbLineEnds->Fill( pLineEndList ); Reset( &rOutAttrs ); |