diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-20 11:06:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-22 21:29:36 +0200 |
commit | 60f3e4b843da89678e022eed837ee66e726b1920 (patch) | |
tree | 4cffea5d364e3ed9bd3e68c7b471f313c237a98e /include | |
parent | 4a7ebfea57094b914c4b1c3e46936dbf67dec499 (diff) |
place an intermediate class as parent for SfxTabPages
so a SfxTabPage can be parented by a vcl::Window or a welded native notebook tabpage.
That ways the same SfxTabPage can be used at the same time in both a native dialog
or a vcl dialog. The impl can be changed to the weld api, and when hosted in a native
dialog the vcl impl of that will be instantiated, while native otherwise. e.g.
print options appearing in print options dialog and general options.
This allows incremental changeover.
Change-Id: I6f1fed1e8d0898b01853bb878757bad41cbf9bba
Reviewed-on: https://gerrit.libreoffice.org/53193
Tested-by: Jenkins <ci@libreoffice.org>
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/dinfdlg.hxx | 8 | ||||
-rw-r--r-- | include/sfx2/mgetempl.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/module.hxx | 3 | ||||
-rw-r--r-- | include/sfx2/printopt.hxx | 2 | ||||
-rw-r--r-- | include/sfx2/securitypage.hxx | 4 | ||||
-rw-r--r-- | include/sfx2/tabdlg.hxx | 26 | ||||
-rw-r--r-- | include/sfx2/viewsh.hxx | 2 | ||||
-rw-r--r-- | include/svx/hdft.hxx | 4 | ||||
-rw-r--r-- | include/vcl/svapp.hxx | 1 |
9 files changed, 38 insertions, 14 deletions
diff --git a/include/sfx2/dinfdlg.hxx b/include/sfx2/dinfdlg.hxx index c1f003832be6..9516b74868d8 100644 --- a/include/sfx2/dinfdlg.hxx +++ b/include/sfx2/dinfdlg.hxx @@ -214,7 +214,7 @@ protected: public: SfxDocumentPage( vcl::Window* pParent, const SfxItemSet& ); - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); void EnableUseUserData(); }; @@ -239,7 +239,7 @@ protected: public: SfxDocumentDescPage( vcl::Window* pParent, const SfxItemSet& ); - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; // class SfxDocumentInfoDialog ------------------------------------------- @@ -515,7 +515,7 @@ protected: public: SfxCustomPropertiesPage( vcl::Window* pParent, const SfxItemSet& ); - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; struct CmisValue : public VclBuilderContainer @@ -637,7 +637,7 @@ public: virtual ~SfxCmisPropertiesPage() override; virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); virtual void SetPosSizePixel(const Point& rAllocPos, const Size& rAllocation) override; virtual void SetSizePixel(const Size& rAllocation) override; virtual void SetPosPixel(const Point& rAllocPos) override; diff --git a/include/sfx2/mgetempl.hxx b/include/sfx2/mgetempl.hxx index 641af7abff96..2a86859b17cd 100644 --- a/include/sfx2/mgetempl.hxx +++ b/include/sfx2/mgetempl.hxx @@ -81,7 +81,7 @@ friend class SfxStyleDialog; virtual ~SfxManageStyleSheetPage() override; virtual void dispose() override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); virtual bool FillItemSet(SfxItemSet *) override; virtual void Reset(const SfxItemSet *) override; diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx index 352d1e46ba6f..ef60ed219326 100644 --- a/include/sfx2/module.hxx +++ b/include/sfx2/module.hxx @@ -25,6 +25,7 @@ #include <sfx2/dllapi.h> #include <sfx2/shell.hxx> #include <sfx2/styfitem.hxx> +#include <sfx2/tabdlg.hxx> #include <svtools/imgdef.hxx> #include <sal/types.h> #include <tools/fldunit.hxx> @@ -78,7 +79,7 @@ public: void RegisterStatusBarControl(const SfxStbCtrlFactory&); virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, - vcl::Window* pParent, + 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 82a94ed22747..cd8a43c97546 100644 --- a/include/sfx2/printopt.hxx +++ b/include/sfx2/printopt.hxx @@ -98,7 +98,7 @@ public: virtual vcl::Window* GetParentLabeledBy( const vcl::Window* pLabel ) const override; virtual vcl::Window* GetParentLabelFor( const vcl::Window* pLabel ) const override; - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* ); }; #endif // INCLUDED_SFX2_PRINTOPT_HXX diff --git a/include/sfx2/securitypage.hxx b/include/sfx2/securitypage.hxx index cfb28f1443b8..67d27d076b84 100644 --- a/include/sfx2/securitypage.hxx +++ b/include/sfx2/securitypage.hxx @@ -36,8 +36,8 @@ protected: virtual void Reset( const SfxItemSet* ) override; public: - SfxSecurityPage( vcl::Window* pParent, const SfxItemSet& ); - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* ); + SfxSecurityPage(vcl::Window* pParent, const SfxItemSet&); + static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet*); }; diff --git a/include/sfx2/tabdlg.hxx b/include/sfx2/tabdlg.hxx index 65eb615fe6f1..72ba2378fcfe 100644 --- a/include/sfx2/tabdlg.hxx +++ b/include/sfx2/tabdlg.hxx @@ -28,6 +28,7 @@ #include <vcl/tabctrl.hxx> #include <vcl/tabdlg.hxx> #include <vcl/tabpage.hxx> +#include <vcl/weld.hxx> #include <svl/itempool.hxx> #include <svl/itemset.hxx> #include <com/sun/star/frame/XFrame.hpp> @@ -39,7 +40,23 @@ class SfxViewFrame; class SfxTabPage; class SfxBindings; -typedef VclPtr<SfxTabPage> (*CreateTabPage)(vcl::Window *pParent, const SfxItemSet *rAttrSet); +struct TabPageParent +{ + TabPageParent(vcl::Window* _pParent) + : pParent(_pParent) + , pPage(nullptr) + { + } + TabPageParent(weld::Window* _pPage) + : pParent(nullptr) + , pPage(_pPage) + { + } + VclPtr<vcl::Window> pParent; + weld::Widget* pPage; +}; + +typedef VclPtr<SfxTabPage> (*CreateTabPage)(TabPageParent pParent, const SfxItemSet *rAttrSet); typedef const sal_uInt16* (*GetTabPageRanges)(); // provides international Which-value struct TabPageImpl; @@ -234,7 +251,12 @@ private: std::unique_ptr< TabPageImpl > pImpl; protected: - SfxTabPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet *rAttrSet); + std::unique_ptr<weld::Builder> m_xBuilder; + std::unique_ptr<weld::Container> m_xContainer; + +protected: + SfxTabPage(vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription, const SfxItemSet *rAttrSet); + SfxTabPage(TabPageParent pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet *rAttrSet); sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const { return pSet->GetPool()->GetWhich( nSlot, bDeep ); } diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 19356714b329..f29f94c87591 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -244,7 +244,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( vcl::Window *pParent, const SfxItemSet &rOptions ); + virtual VclPtr<SfxTabPage> CreatePrintOptionsPage( TabPageParent pParent, const SfxItemSet &rOptions ); Printer* GetActivePrinter() const; // Working set diff --git a/include/svx/hdft.hxx b/include/svx/hdft.hxx index 6ce1508b225a..dbca1f993e38 100644 --- a/include/svx/hdft.hxx +++ b/include/svx/hdft.hxx @@ -105,7 +105,7 @@ private: class SVX_DLLPUBLIC SvxHeaderPage : public SvxHFPage { public: - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); // returns the Which values to the range static const sal_uInt16* GetRanges() { return pRanges; } SVX_DLLPRIVATE SvxHeaderPage( vcl::Window* pParent, const SfxItemSet& rSet ); @@ -116,7 +116,7 @@ public: class SVX_DLLPUBLIC SvxFooterPage : public SvxHFPage { public: - static VclPtr<SfxTabPage> Create( vcl::Window* pParent, const SfxItemSet* rSet ); + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rSet ); static const sal_uInt16* GetRanges() { return pRanges; } SVX_DLLPRIVATE SvxFooterPage( vcl::Window* pParent, const SfxItemSet& rSet ); }; diff --git a/include/vcl/svapp.hxx b/include/vcl/svapp.hxx index 6d39a6b67efe..e28b774b98c5 100644 --- a/include/vcl/svapp.hxx +++ b/include/vcl/svapp.hxx @@ -1396,6 +1396,7 @@ public: static void setDeInitHook(Link<LinkParamNone*,void> const & hook); static weld::Builder* CreateBuilder(weld::Widget* pParent, const OUString &rUIFile); + static weld::Builder* CreateInterimBuilder(vcl::Window* pParent, const OUString &rUIFile); //for the duration of same SfxTabPages in mixed parent types static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString& rPrimaryMessage); |