diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-20 20:29:36 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-26 09:54:18 +0200 |
commit | a37e559ed123789f6bc8f7972242d6461ce692ab (patch) | |
tree | 7c6304b4541335b2bb706efda58b882132fe3819 /include | |
parent | b3f249c1351642be6f2774230ff80a6d20bd1401 (diff) |
disinherit OWizardPage and SfxTabPage from vcl TabPage
Now that there's no need to support weld/unwelded mixes of
pages in dialog any more.
inherit from a BuilderPage which contains a Builder and
Toplevel container
BuilderPage Activate and Deactivate replace TabPage ActivatePage and
DeactivatePage, allowing disambiguation wrt SfxTabPage ActivatePage and
DeactivatePage.
Change-Id: I5706e50fd92f712a25328ee9791e054bb9ad9812
Reviewed-on: https://gerrit.libreoffice.org/79317
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/basedlgs.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/dinfdlg.hxx | 22 | ||||
-rw-r--r-- | include/sfx2/mgetempl.hxx | 9 | ||||
-rw-r--r-- | include/sfx2/module.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/printopt.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/prnmon.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/securitypage.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/tabdlg.hxx | 17 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 2 | ||||
-rw-r--r-- | include/svx/dlgctrl.hxx | 4 | ||||
-rw-r--r-- | include/svx/hdft.hxx | 7 | ||||
-rw-r--r-- | include/svx/optgrid.hxx | 5 | ||||
-rw-r--r-- | include/vcl/builderpage.hxx | 51 | ||||
-rw-r--r-- | include/vcl/wizardmachine.hxx | 34 |
14 files changed, 93 insertions, 71 deletions
diff --git a/include/sfx2/basedlgs.hxx b/include/sfx2/basedlgs.hxx index 948b52f94d5a..c01d6bd72b73 100644 --- a/include/sfx2/basedlgs.hxx +++ b/include/sfx2/basedlgs.hxx @@ -182,7 +182,7 @@ public: virtual ~SfxSingleTabDialogController() override; - void SetTabPage(SfxTabPage* pTabPage); + void SetTabPage(std::unique_ptr<SfxTabPage> xTabPage); SfxTabPage* GetTabPage() const { return m_xSfxPage.get(); } virtual weld::Button& GetOKButton() const override { return *m_xOKBtn; } @@ -192,7 +192,7 @@ public: const SfxItemSet* GetInputItemSet() const { return m_pInputSet; } protected: - VclPtr<SfxTabPage> m_xSfxPage; + std::unique_ptr<SfxTabPage> m_xSfxPage; std::unique_ptr<weld::Container> m_xContainer; std::unique_ptr<weld::Button> m_xOKBtn; std::unique_ptr<weld::Button> m_xHelpBtn; diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index 87f83f339416..caa618f0466f 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -200,14 +200,13 @@ private: void ImplCheckPasswordState(); protected: - virtual ~SfxDocumentPage() override; - virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; public: SfxDocumentPage(TabPageParent pParent, const SfxItemSet&); - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + virtual ~SfxDocumentPage() override; void EnableUseUserData(); }; @@ -224,14 +223,13 @@ private: std::unique_ptr<weld::TextView> m_xCommentEd; protected: - virtual ~SfxDocumentDescPage() override; - virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; public: SfxDocumentDescPage(TabPageParent pParent, const SfxItemSet&); - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + virtual ~SfxDocumentDescPage() override; + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; // class SfxDocumentInfoDialog ------------------------------------------- @@ -447,22 +445,18 @@ class SfxCustomPropertiesPage : public SfxTabPage private: DECL_LINK(AddHdl, weld::Button&, void); - using TabPage::DeactivatePage; - std::unique_ptr<CustomPropertiesControl> m_xPropertiesCtrl; std::unique_ptr<weld::Button> m_xAdd; protected: - virtual ~SfxCustomPropertiesPage() override; - virtual void dispose() override; - virtual bool FillItemSet( SfxItemSet* ) override; virtual void Reset( const SfxItemSet* ) override; virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; public: SfxCustomPropertiesPage(TabPageParent pParent, const SfxItemSet&); - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + virtual ~SfxCustomPropertiesPage() override; }; struct CmisValue @@ -569,7 +563,6 @@ class SfxCmisPropertiesPage : public SfxTabPage { private: std::unique_ptr<CmisPropertiesControl> m_xPropertiesCtrl; - using TabPage::DeactivatePage; protected: virtual bool FillItemSet( SfxItemSet* ) override; @@ -578,9 +571,8 @@ protected: public: SfxCmisPropertiesPage(TabPageParent pParent, const SfxItemSet&); - virtual void dispose() override; virtual ~SfxCmisPropertiesPage() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + static std::unique_ptr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet*); }; #endif // #ifndef _ INCLUDED_SFX2_DINFDLG_HXX diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx index 86764728d8de..1f40b35bb958 100644 --- a/include/sfx2/mgetempl.hxx +++ b/include/sfx2/mgetempl.hxx @@ -62,7 +62,7 @@ class SfxManageStyleSheetPage final : public SfxTabPage std::unique_ptr<weld::Label> m_xDescFt; std::unique_ptr<weld::Label> m_xNameFt; -friend class SfxStyleDialogController; + friend class SfxStyleDialogController; DECL_LINK(GetFocusHdl, weld::Widget&, void); DECL_LINK(LoseFocusHdl, weld::Widget&, void); @@ -74,22 +74,19 @@ friend class SfxStyleDialogController; void UpdateName_Impl(weld::ComboBox*, const OUString &rNew); void SetDescriptionText_Impl(); - virtual ~SfxManageStyleSheetPage() override; - virtual void dispose() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); virtual bool FillItemSet(SfxItemSet *) override; virtual void Reset(const SfxItemSet *) override; static bool Execute_Impl( sal_uInt16 nId, const OUString& rStr, sal_uInt16 nFamily ); - using TabPage::ActivatePage; virtual void ActivatePage(const SfxItemSet &) override; - using TabPage::DeactivatePage; virtual DeactivateRC DeactivatePage(SfxItemSet *) override; public: SfxManageStyleSheetPage(TabPageParent pParent, const SfxItemSet &rAttrSet); + virtual ~SfxManageStyleSheetPage() override; }; #endif diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index c4ad3d89aebf..78d159d75236 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -73,7 +73,7 @@ public: void RegisterChildWindow(std::unique_ptr<SfxChildWinFactory>); void RegisterStatusBarControl(const SfxStbCtrlFactory&); - virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, + virtual std::unique_ptr<SfxTabPage> CreateTabPage( sal_uInt16 nId, TabPageParent pParent, const SfxItemSet& rSet ); virtual void Invalidate(sal_uInt16 nId = 0) override; diff --git a/include/sfx2/printopt.hxx b/include/sfx2/printopt.hxx index a30fba19b292..c6b47b88a1ea 100644 --- a/include/sfx2/printopt.hxx +++ b/include/sfx2/printopt.hxx @@ -72,7 +72,6 @@ private: protected: - using TabPage::DeactivatePage; virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ) override; public: @@ -82,7 +81,7 @@ public: virtual bool FillItemSet( SfxItemSet* rSet ) override; virtual void Reset( const SfxItemSet* rSet ) override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; #endif // INCLUDED_SFX2_PRINTOPT_HXX diff --git a/include/sfx2/prnmon.hxx b/include/sfx2/prnmon.hxx index 5e877532ef43..298aeac049ac 100644 --- a/include/sfx2/prnmon.hxx +++ b/include/sfx2/prnmon.hxx @@ -36,9 +36,9 @@ class SfxPrintOptionsDialog : public weld::GenericDialogController private: std::unique_ptr<SfxPrintOptDlg_Impl> pDlgImpl; std::unique_ptr<SfxItemSet> pOptions; - VclPtr<SfxTabPage> pPage; std::unique_ptr<weld::Widget> m_xHelpBtn; std::unique_ptr<weld::Container> m_xContainer; + std::unique_ptr<SfxTabPage> m_xPage; DECL_LINK(HelpRequestHdl, weld::Widget&, bool); public: diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx index deb7fe6d8f8c..14478eaf063c 100644 --- a/include/sfx2/securitypage.hxx +++ b/include/sfx2/securitypage.hxx @@ -34,7 +34,7 @@ protected: public: SfxSecurityPage(TabPageParent pParent, const SfxItemSet&); - static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet*); + static std::unique_ptr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet*); weld::Builder& GetBuilder() const { return *m_xBuilder; } }; diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index f8a0f99d0e5b..1ff48d364bfe 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -24,6 +24,7 @@ #include <sfx2/dllapi.h> #include <sfx2/basedlgs.hxx> #include <sal/types.h> +#include <vcl/builderpage.hxx> #include <vcl/tabpage.hxx> #include <svl/itempool.hxx> #include <svl/itemset.hxx> @@ -31,7 +32,7 @@ class SfxTabPage; -typedef VclPtr<SfxTabPage> (*CreateTabPage)(TabPageParent pParent, const SfxItemSet *rAttrSet); +typedef std::unique_ptr<SfxTabPage> (*CreateTabPage)(TabPageParent pParent, const SfxItemSet *rAttrSet); typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value struct TabPageImpl; @@ -162,7 +163,7 @@ namespace o3tl { template<> struct typed_flags<DeactivateRC> : is_typed_flags<DeactivateRC, 0x03> {}; } -class SFX2_DLLPUBLIC SfxTabPage: public TabPage +class SFX2_DLLPUBLIC SfxTabPage : public BuilderPage { friend class SfxTabDialog; friend class SfxTabDialogController; @@ -174,10 +175,6 @@ private: std::unique_ptr< TabPageImpl > pImpl; protected: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Container> m_xContainer; - -protected: SfxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet); sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const @@ -193,12 +190,10 @@ public: void SetDialogController(SfxOkDialogController* pDialog); public: virtual ~SfxTabPage() override; - virtual void dispose() override; void set_visible(bool bVisible) { m_xContainer->set_visible(bVisible); - Show(bVisible); } const SfxItemSet& GetItemSet() const { return *pSet; } @@ -211,8 +206,6 @@ public: void SetExchangeSupport() { bHasExchangeSupport = true; } - using TabPage::ActivatePage; - using TabPage::DeactivatePage; virtual void ActivatePage( const SfxItemSet& ); virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ); void SetUserData(const OUString& rString) @@ -233,7 +226,9 @@ public: const SfxItemSet* GetDialogExampleSet() const; - OString GetConfigId() const; + OString GetHelpId() const; + OString GetConfigId() const { return GetHelpId(); } + bool IsVisible() const { return m_xContainer->get_visible(); } //TODO rename to GetFrameWeld when SfxTabPage doesn't inherit from anything weld::Window* GetDialogFrameWeld() const; diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 9d3312b2fa60..0463c3a1eaa5 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -237,7 +237,7 @@ public: virtual SfxPrinter* GetPrinter( bool bCreate = false ); virtual sal_uInt16 SetPrinter( SfxPrinter *pNewPrinter, SfxPrinterChangeFlags nDiffFlags = SFX_PRINTER_ALL ); virtual bool HasPrintOptionsPage() const; - virtual VclPtr<SfxTabPage> CreatePrintOptionsPage(TabPageParent pParent, const SfxItemSet &rOptions); + virtual std::unique_ptr<SfxTabPage> CreatePrintOptionsPage(TabPageParent pParent, const SfxItemSet &rOptions); Printer* GetActivePrinter() const; // Working set diff --git a/include/svx/dlgctrl.hxx b/include/svx/dlgctrl.hxx index 3f31a827a35b..f2053d4b9c09 100644 --- a/include/svx/dlgctrl.hxx +++ b/include/svx/dlgctrl.hxx @@ -74,7 +74,7 @@ class SvxPixelCtlAccessible; class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxRectCtl : public weld::CustomWidgetController { private: - VclPtr<SvxTabPage> m_pPage; + SvxTabPage* m_pPage; SVX_DLLPRIVATE static void InitSettings(vcl::RenderContext& rRenderContext); SVX_DLLPRIVATE void InitRectBitmap(); @@ -148,7 +148,7 @@ private: static sal_uInt16 constexpr nLines = 8; static sal_uInt16 constexpr nSquares = nLines * nLines; - VclPtr<SvxTabPage> m_pPage; + SvxTabPage* m_pPage; Color aPixelColor; Color aBackgroundColor; diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx index a062476931a5..177323136b34 100644 --- a/include/svx/hdft.hxx +++ b/include/svx/hdft.hxx @@ -36,9 +36,6 @@ namespace svx class SVX_DLLPUBLIC SvxHFPage : public SfxTabPage { - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - public: virtual bool FillItemSet( SfxItemSet* rOutSet ) override; @@ -98,7 +95,7 @@ private: class SVX_DLLPUBLIC SvxHeaderPage : public SvxHFPage { public: - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); // returns the Which values to the range static const sal_uInt16* GetRanges() { return pRanges; } SVX_DLLPRIVATE SvxHeaderPage(TabPageParent pParent, const SfxItemSet& rSet); @@ -107,7 +104,7 @@ public: class SVX_DLLPUBLIC SvxFooterPage : public SvxHFPage { public: - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); + static std::unique_ptr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges() { return pRanges; } SVX_DLLPRIVATE SvxFooterPage(TabPageParent pParent, const SfxItemSet& rSet); }; diff --git a/include/svx/optgrid.hxx b/include/svx/optgrid.hxx index df86d3240391..5339bfd55ef3 100644 --- a/include/svx/optgrid.hxx +++ b/include/svx/optgrid.hxx @@ -88,14 +88,11 @@ public: class SVX_DLLPUBLIC SvxGridTabPage : public SfxTabPage { - using TabPage::ActivatePage; - using TabPage::DeactivatePage; - public: SvxGridTabPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~SvxGridTabPage() override; - static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet& rAttrSet); + static std::unique_ptr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet& rAttrSet); virtual bool FillItemSet( SfxItemSet* rSet ) override; virtual void Reset( const SfxItemSet* rSet ) override; diff --git a/include/vcl/builderpage.hxx b/include/vcl/builderpage.hxx new file mode 100644 index 000000000000..c29cc1a7b079 --- /dev/null +++ b/include/vcl/builderpage.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_VCL_BUILDERPAGE_HXX +#define INCLUDED_VCL_BUILDERPAGE_HXX + +#include <vcl/weld.hxx> + +class VCL_DLLPUBLIC BuilderPage +{ +public: + BuilderPage(weld::Widget* pParent, weld::DialogController* pController, + const OUString& rUIXMLDescription, const OString& rID); + virtual ~BuilderPage(); + + /* The title of the page, in an Assistant the dialog may append this page title to the + dialog title. + + While in a Dialog hosting a single Page it may use the title as + the dialog title. + */ + void SetPageTitle(const OUString& rPageTitle) { m_aPageTitle = rPageTitle; } + const OUString& GetPageTitle() const { return m_aPageTitle; } + + // In a Notebook or Assistant the controller typically calls Activate on entering + // this page, and Deactivate on leaving + virtual void Activate(); + virtual void Deactivate(); + + OString GetHelpId() const { return m_xContainer->get_help_id(); } + + weld::DialogController* GetController() const { return m_pDialogController; } + +protected: + weld::DialogController* m_pDialogController; + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + +private: + OUString m_aPageTitle; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/vcl/wizardmachine.hxx b/include/vcl/wizardmachine.hxx index 0ca764ce97bf..88788fdc549c 100644 --- a/include/vcl/wizardmachine.hxx +++ b/include/vcl/wizardmachine.hxx @@ -21,8 +21,7 @@ #include <memory> #include <vcl/dllapi.h> -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> +#include <vcl/builderpage.hxx> #include <vcl/idle.hxx> #include <vcl/tabpage.hxx> @@ -31,7 +30,7 @@ namespace weld { class Container; } -struct ImplWizPageData; +struct WizPageData; struct ImplWizButtonData; // wizard states @@ -79,11 +78,10 @@ namespace vcl }; //= OWizardPage - class VCL_DLLPUBLIC OWizardPage : public TabPage, public IWizardPageController + class VCL_DLLPUBLIC OWizardPage : public BuilderPage, public IWizardPageController { public: OWizardPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID); - virtual void dispose() override; virtual ~OWizardPage() override; // IWizardPageController overridables @@ -92,11 +90,8 @@ namespace vcl virtual bool canAdvance() const override; protected: - std::unique_ptr<weld::Builder> m_xBuilder; - std::unique_ptr<weld::Container> m_xContainer; - - // TabPage overridables - virtual void ActivatePage() override; + // BuilderPage overridables + virtual void Activate() override; /** updates the travel-related UI elements of the OWizardMachine we live in (if any) @@ -126,10 +121,10 @@ namespace vcl class VCL_DLLPUBLIC WizardMachine : public weld::AssistantController { private: - VclPtr<TabPage> m_xCurTabPage; + BuilderPage* m_pCurTabPage; WizardTypes::WizardState m_nCurState; - ImplWizPageData* m_pFirstPage; + WizPageData* m_pFirstPage; protected: std::unique_ptr<weld::Button> m_xFinish; @@ -152,10 +147,10 @@ namespace vcl bool ShowNextPage(); bool ShowPrevPage(); - void AddPage( TabPage* pPage ); - void RemovePage( TabPage* pPage ); - void SetPage( WizardTypes::WizardState nLevel, TabPage* pPage ); - TabPage* GetPage( WizardTypes::WizardState eState ) const; + void AddPage( std::unique_ptr<BuilderPage> xPage ); + void RemovePage( BuilderPage* pPage ); + void SetPage( WizardTypes::WizardState nLevel, std::unique_ptr<BuilderPage> xPage ); + BuilderPage* GetPage( WizardTypes::WizardState eState ) const; /// enable (or disable) buttons void enableButtons(WizardButtonFlags _nWizardButtonFlags, bool _bEnable); @@ -185,7 +180,7 @@ namespace vcl // our own overridables /// to override to create new pages - virtual VclPtr<TabPage> createPage(WizardTypes::WizardState _nState) = 0; + virtual std::unique_ptr<BuilderPage> createPage(WizardTypes::WizardState _nState) = 0; /// will be called when a new page is about to be displayed virtual void enterState(WizardTypes::WizardState _nState); @@ -303,8 +298,7 @@ namespace vcl */ WizardTypes::WizardState getCurrentState() const { return m_nCurState; } - virtual IWizardPageController* - getPageController( TabPage* _pCurrentPage ) const; + virtual IWizardPageController* getPageController(BuilderPage* pCurrentPage) const; /** retrieves a copy of the state history, i.e. all states we already visited */ @@ -323,7 +317,7 @@ namespace vcl bool isTravelingSuspended() const; protected: - TabPage* GetOrCreatePage(const WizardTypes::WizardState i_nState); + BuilderPage* GetOrCreatePage(const WizardTypes::WizardState i_nState); private: DECL_DLLPRIVATE_LINK(OnNextPage, weld::Button&, void); |