/src/libreoffice/include/sfx2/SfxTabPage.hxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
5 | | * This Source Code Form is subject to the terms of the Mozilla Public |
6 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
7 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
11 | | * Licensed to the Apache Software Foundation (ASF) under one or more |
12 | | * contributor license agreements. See the NOTICE file distributed |
13 | | * with this work for additional information regarding copyright |
14 | | * ownership. The ASF licenses this file to you under the Apache |
15 | | * License, Version 2.0 (the "License"); you may not use this file |
16 | | * except in compliance with the License. You may obtain a copy of |
17 | | * the License at http://www.apache.org/licenses/LICENSE-2.0 . |
18 | | */ |
19 | | #pragma once |
20 | | |
21 | | #include <memory> |
22 | | #include <unordered_map> |
23 | | |
24 | | #include <sal/config.h> |
25 | | #include <sfx2/dllapi.h> |
26 | | #include <sfx2/basedlgs.hxx> |
27 | | #include <sal/types.h> |
28 | | #include <vcl/builderpage.hxx> |
29 | | #include <svl/itempool.hxx> |
30 | | #include <svl/itemset.hxx> |
31 | | #include <svl/setitem.hxx> |
32 | | #include <o3tl/typed_flags_set.hxx> |
33 | | |
34 | | namespace com::sun::star::frame { class XFrame; } |
35 | | |
36 | | enum class DeactivateRC { |
37 | | KeepPage = 0x00, // Error handling; page does not change |
38 | | // 2. Fill an itemset for update |
39 | | // parent examples, this pointer can be NULL all the time! |
40 | | LeavePage = 0x01, |
41 | | // Set, refresh and update other Page |
42 | | RefreshSet = 0x02 |
43 | | }; |
44 | | namespace o3tl { |
45 | | template<> struct typed_flags<DeactivateRC> : is_typed_flags<DeactivateRC, 0x03> {}; |
46 | | } |
47 | | |
48 | | class SFX2_DLLPUBLIC SfxTabPage : public BuilderPage |
49 | | { |
50 | | friend class SfxTabDialog; |
51 | | friend class SfxTabDialogController; |
52 | | |
53 | | private: |
54 | | const SfxItemSet* mpSet; |
55 | | OUString maUserString; |
56 | | bool mbHasExchangeSupport; |
57 | | bool mbCancel; |
58 | | std::unordered_map<OUString, css::uno::Any> maAdditionalProperties; |
59 | | |
60 | | bool mbStandard; |
61 | | SfxOkDialogController* const mpSfxDialogController; |
62 | | css::uno::Reference<css::frame::XFrame> mxFrame; |
63 | | |
64 | | protected: |
65 | | SfxTabPage(weld::Container* pPage, weld::DialogController* pController, const OUString& rUIXMLDescription, const OUString& rID, const SfxItemSet *rAttrSet); |
66 | | |
67 | | sal_uInt16 GetWhich( sal_uInt16 nSlot, bool bDeep = true ) const |
68 | 0 | { |
69 | 0 | return mpSet->GetPool()->GetWhichIDFromSlotID(nSlot, bDeep); |
70 | 0 | } |
71 | | template<class T> |
72 | | TypedWhichId<T> GetWhich( TypedWhichId<T> nSlot, bool bDeep = true ) const |
73 | 0 | { |
74 | 0 | return TypedWhichId<T>(GetWhich(sal_uInt16(nSlot), bDeep)); |
75 | 0 | } Unexecuted instantiation: TypedWhichId<SfxBoolItem> SfxTabPage::GetWhich<SfxBoolItem>(TypedWhichId<SfxBoolItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxSizeItem> SfxTabPage::GetWhich<SvxSizeItem>(TypedWhichId<SvxSizeItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxLRSpaceItem> SfxTabPage::GetWhich<SvxLRSpaceItem>(TypedWhichId<SvxLRSpaceItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxULSpaceItem> SfxTabPage::GetWhich<SvxULSpaceItem>(TypedWhichId<SvxULSpaceItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxBrushItem> SfxTabPage::GetWhich<SvxBrushItem>(TypedWhichId<SvxBrushItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxBoxItem> SfxTabPage::GetWhich<SvxBoxItem>(TypedWhichId<SvxBoxItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxBoxInfoItem> SfxTabPage::GetWhich<SvxBoxInfoItem>(TypedWhichId<SvxBoxInfoItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxShadowItem> SfxTabPage::GetWhich<SvxShadowItem>(TypedWhichId<SvxShadowItem>, bool) const Unexecuted instantiation: TypedWhichId<SvxSetItem> SfxTabPage::GetWhich<SvxSetItem>(TypedWhichId<SvxSetItem>, bool) const |
76 | | |
77 | | const SfxPoolItem* GetOldItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); |
78 | | template<class T> const T* GetOldItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) |
79 | | { |
80 | | return static_cast<const T*>(GetOldItem(rSet, sal_uInt16(nSlot), bDeep)); |
81 | | } |
82 | | |
83 | | SfxOkDialogController* GetDialogController() const; |
84 | | public: |
85 | | virtual ~SfxTabPage() override; |
86 | | |
87 | | void set_visible(bool bVisible) |
88 | 0 | { |
89 | 0 | m_xContainer->set_visible(bVisible); |
90 | 0 | } |
91 | | |
92 | | const SfxItemSet& GetItemSet() const |
93 | 0 | { |
94 | 0 | return *mpSet; |
95 | 0 | } |
96 | | |
97 | | virtual bool FillItemSet( SfxItemSet* ); |
98 | | virtual void Reset( const SfxItemSet* ); |
99 | | // Allows to postpone some initialization to the first activation |
100 | | virtual bool DeferResetToFirstActivation(); |
101 | | |
102 | | bool HasExchangeSupport() const |
103 | 0 | { |
104 | 0 | return mbHasExchangeSupport; |
105 | 0 | } |
106 | | |
107 | | void SetExchangeSupport() |
108 | 0 | { |
109 | 0 | mbHasExchangeSupport = true; |
110 | 0 | } |
111 | | |
112 | | virtual void ActivatePage( const SfxItemSet& ); |
113 | | virtual DeactivateRC DeactivatePage( SfxItemSet* pSet ); |
114 | | void SetUserData(const OUString& rString) |
115 | 0 | { |
116 | 0 | maUserString = rString; |
117 | 0 | } |
118 | | const OUString& GetUserData() const |
119 | 0 | { |
120 | 0 | return maUserString; |
121 | 0 | } |
122 | | virtual void FillUserData(); |
123 | | virtual bool IsReadOnly() const; |
124 | | // Whether the user has canceled the dialog. Allows to restore settings, etc. |
125 | 0 | bool IsCancelMode() { return mbCancel; } |
126 | 0 | void SetCancelMode(bool bCancel) { mbCancel = bCancel; } |
127 | | virtual void PageCreated (const SfxAllItemSet& aSet); |
128 | | virtual void ChangesApplied(); |
129 | | static const SfxPoolItem* GetItem( const SfxItemSet& rSet, sal_uInt16 nSlot, bool bDeep = true ); |
130 | | template<class T> static const T* GetItem( const SfxItemSet& rSet, TypedWhichId<T> nSlot, bool bDeep = true ) |
131 | 0 | { |
132 | 0 | return static_cast<const T*>(GetItem(rSet, sal_uInt16(nSlot), bDeep)); |
133 | 0 | } Unexecuted instantiation: SdrAngleItem const* SfxTabPage::GetItem<SdrAngleItem>(SfxItemSet const&, TypedWhichId<SdrAngleItem>, bool) Unexecuted instantiation: SfxBoolItem const* SfxTabPage::GetItem<SfxBoolItem>(SfxItemSet const&, TypedWhichId<SfxBoolItem>, bool) Unexecuted instantiation: SvxLRSpaceItem const* SfxTabPage::GetItem<SvxLRSpaceItem>(SfxItemSet const&, TypedWhichId<SvxLRSpaceItem>, bool) Unexecuted instantiation: SvxULSpaceItem const* SfxTabPage::GetItem<SvxULSpaceItem>(SfxItemSet const&, TypedWhichId<SvxULSpaceItem>, bool) Unexecuted instantiation: SvxPageItem const* SfxTabPage::GetItem<SvxPageItem>(SfxItemSet const&, TypedWhichId<SvxPageItem>, bool) Unexecuted instantiation: SvxSizeItem const* SfxTabPage::GetItem<SvxSizeItem>(SfxItemSet const&, TypedWhichId<SvxSizeItem>, bool) |
134 | | |
135 | | virtual OUString GetAllStrings(); |
136 | | void SetFrame(const css::uno::Reference< css::frame::XFrame >& xFrame); |
137 | | css::uno::Reference< css::frame::XFrame > GetFrame() const; |
138 | | |
139 | | const SfxItemSet* GetDialogExampleSet() const; |
140 | | |
141 | | OUString GetHelpId() const; |
142 | 0 | OUString GetConfigId() const { return GetHelpId(); } |
143 | 0 | bool IsVisible() const { return m_xContainer->get_visible(); } |
144 | | |
145 | | weld::Window* GetFrameWeld() const; |
146 | | |
147 | | std::unordered_map<OUString, css::uno::Any>& getAdditionalProperties() |
148 | 0 | { |
149 | 0 | return maAdditionalProperties; |
150 | 0 | } |
151 | | }; |
152 | | |
153 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |