LibreOffice Module sfx2 (master) 1
templdgi.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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#ifndef INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
20#define INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
21
22#include <sal/config.h>
23
24#include <memory>
25
26#include <vcl/transfer.hxx>
27#include <vcl/weld.hxx>
28#include <svl/eitem.hxx>
29
30#include <svl/style.hxx>
31
32#include <sfx2/objsh.hxx>
33#include <sfx2/styfitem.hxx>
34#include <sfx2/templdlg.hxx>
35
36#include "StyleList.hxx"
37
40class SfxTemplateItem;
41class SfxBindings;
44class StyleTreeListBox_Impl;
47namespace com::sun::star::frame {
48 class XModuleManager2;
49}
50
52{
53private:
54 class DeletionWatcher;
55 friend class DeletionWatcher;
56
58
59protected:
60#define MAX_FAMILIES 6
61#define COUNT_BOUND_FUNC 14
62
64
66
67 css::uno::Reference<css::frame::XModuleManager2> xModuleManager;
69
71 std::unique_ptr<weld::CheckButton> mxPreviewCheckbox;
72 std::unique_ptr<weld::CheckButton> mxHighlightCheckbox;
73 std::unique_ptr<weld::ComboBox> mxFilterLb;
74
75 sal_uInt16 nActFamily; // Id in the ToolBox = Position - 1
76 sal_uInt16 nActFilter; // FilterIdx
77
78 bool bIsWater :1;
79 bool bUpdate :1;
84
98
99 DECL_LINK(FilterSelectHdl, weld::ComboBox&, void );
100 DECL_LINK(PreviewHdl, weld::Toggleable&, void);
101 DECL_LINK(HighlightHdl, weld::Toggleable&, void);
102
103 virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) = 0;
104 virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) = 0;
105 virtual void ClearFamilyList() = 0;
106 virtual void ReplaceUpdateButtonByMenu();
107
108 void Initialize();
109 void EnableHierarchical(bool, StyleList& rStyleList);
110
111 void FilterSelect( sal_uInt16 nFilterIdx );
112 void SetFamilyState( sal_uInt16 nSlotId, const SfxTemplateItem* );
113 void SetWaterCanState( const SfxBoolItem* pItem );
114 bool IsSafeForWaterCan() const;
115
116 void SetFamily(SfxStyleFamily nFamily);
117 void ActionSelect(const OUString& rId, StyleList& rStyleList);
118
119 void SaveFactoryStyleFilter(SfxObjectShell const* i_pObjSh, sal_Int32 i_nFilter);
120
121 DECL_LINK(ReadResource_Hdl, StyleList&, void);
122 DECL_LINK(ClearResource_Hdl, void*, void);
123 DECL_LINK(SaveSelection_Hdl, StyleList&, SfxObjectShell*);
124 DECL_LINK(LoadFactoryStyleFilter_Hdl, SfxObjectShell const*, sal_Int32);
125 DECL_LINK(UpdateStyles_Hdl, StyleFlags, void);
126 DECL_LINK(UpdateFamily_Hdl, StyleList&, void);
127 DECL_LINK(UpdateStyleDependents_Hdl, void*, void);
128
129public:
130 // Used in StyleList::NewMenuExecuteAction, StyleList::UpdateStyleDependents, StyleList::NewHdl, EditHdl...
131 // It comes into action whenever an existing style is selected for use, or a new style is created etc..
132 bool Execute_Impl(sal_uInt16 nId, const OUString& rStr, const OUString& rRefStr,
133 sal_uInt16 nFamily, StyleList& rStyleList, SfxStyleSearchBits nMask = SfxStyleSearchBits::Auto,
134 sal_uInt16* pIdx = nullptr, const sal_uInt16* pModifier = nullptr);
135
136 // This function handles drop of content into the treeview to create a new style
138 // This function is used when a newstyle is created
139 DECL_LINK(OnAsyncExecuteDrop, void*, void);
140
141 // Used in StyleList::UpdateStyles, StyleList::Update
142 // Whenever a new family(Eg. Character, List etc.) is selected it comes into action
143 void FamilySelect(sal_uInt16 nId, StyleList& rStyleList, bool bRefresh = false);
144
145 // Constructor
147
148 // Destructor
150
151 // Used in StyleList::SelectStyle, StyleList::Notify, IMPL_LINK(PopupFlatMenuHdl)
152 // These functions are used when a style is edited, deleted, created etc..
153 virtual void EnableEdit(bool b, StyleList* rStyleList);
154 void EnableDel(bool b, const StyleList* rStyleList);
155 void EnableNew(bool b, const StyleList* rStyleList);
156 void EnableHide(bool b, const StyleList* rStyleList);
157 void EnableShow(bool b, const StyleList* rStyleList);
158
159 // Used in TreeDrag
160 void EnableTreeDrag(bool b);
161 // It comes into action when a style is created or updated or newmenu is created
162 void EnableExample_Impl(sal_uInt16 nId, bool bEnable);
163
164 // This comes into action when a family is selected or a style is applied for use
165 virtual void CheckItem(const OUString& /*rMesId*/, bool /*bCheck*/ = true) {}
166 // This is used for watercan or when newmenu or watercan is enabled or updated
167 virtual void EnableItem(const OUString& /*rMesId*/, bool /*bCheck*/ = true) {}
168 // This is used for watercan
169 virtual bool IsCheckedItem(const OUString& /*rMesId*/) { return true; }
170
171 // This is used when a style is selected
172 void SelectStyle(const OUString& rStyle, bool bIsCallback, StyleList& rStyleList);
173
174 //When a new document is created, it comes into action
175 void IsUpdate(StyleList&);
176
177 // This function return the value of bUpdate in Stylelist
178 // This value is used in StyleList's Notify
179 bool GetNotifyUpdate() const { return bUpdate; }
180 // This function sets the value of bUpdate in Dialog
181 // This function is used in StyleList's Notify to update the value of bUpdate when required
182 void SetNotifyupdate(bool b) { bUpdate = b; }
183
196};
197
199class DropTargetHelper;
200
202{
203private:
206
207 std::unique_ptr<ToolbarDropTarget> m_xToolbarDropTargetHelper;
208 std::unique_ptr<weld::Toolbar> m_xActionTbL;
209 std::unique_ptr<weld::Toolbar> m_xActionTbR;
210 std::unique_ptr<weld::Menu> m_xToolMenu;
212
213 void FillToolMenu();
214
215 DECL_LINK(ToolBoxLSelect, const OUString&, void);
216 DECL_LINK(ToolBoxRSelect, const OUString&, void);
217 DECL_LINK(ToolMenuSelectHdl, const OUString&, void);
218
219 virtual void EnableEdit( bool, StyleList* rStyleList) override;
220 virtual void EnableItem(const OUString& rMesId, bool bCheck = true) override;
221 virtual void CheckItem(const OUString& rMesId, bool bCheck = true) override;
222 virtual bool IsCheckedItem(const OUString& rMesId) override;
223 virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem& rItem) override;
224 virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) override;
225 virtual void ClearFamilyList() override;
226 virtual void ReplaceUpdateButtonByMenu() override;
227
228public:
229 friend class SfxTemplateDialog;
230
232 virtual ~SfxTemplateDialog_Impl() override;
233
234 sal_Int8 AcceptToolbarDrop(const AcceptDropEvent& rEvt, const DropTargetHelper& rHelper);
235
236 void Initialize();
237};
238
239#endif // INCLUDED_SFX2_SOURCE_INC_TEMPLDGI_HXX
240
241
242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
StyleFlags
Definition: StyleList.hxx:40
void SetFamilyState(sal_uInt16 nSlotId, const SfxTemplateItem *)
Definition: templdlg.cxx:417
Link< void *, void > m_aStyleListNewMenu
Definition: templdgi.hxx:89
Link< bool, void > m_aStyleListEnableTreeDrag
Definition: templdgi.hxx:94
DECL_LINK(SaveSelection_Hdl, StyleList &, SfxObjectShell *)
void SetFamily(SfxStyleFamily nFamily)
Definition: templdlg.cxx:878
Link< void *, void > m_aStyleListUpdateFamily
Definition: templdgi.hxx:92
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: templdlg.cxx:96
void EnableHierarchical(bool, StyleList &rStyleList)
Definition: templdlg.cxx:489
void SelectStyle(const OUString &rStyle, bool bIsCallback, StyleList &rStyleList)
Definition: templdlg.cxx:372
Link< void *, bool > m_aStyleListHasSelectedStyle
Definition: templdgi.hxx:91
Link< void *, void > m_aStyleListEnableDelete
Definition: templdgi.hxx:95
virtual void EnableItem(const OUString &, bool=true)
Definition: templdgi.hxx:167
void EnableDel(bool b, const StyleList *rStyleList)
Definition: templdlg.cxx:937
DeletionWatcher * m_pDeletionWatcher
Definition: templdgi.hxx:68
virtual void ReplaceUpdateButtonByMenu()
Definition: templdlg.cxx:903
Link< const ExecuteDropEvent &, sal_Int8 > m_aStyleListExecuteDrop
Definition: templdgi.hxx:88
virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled)=0
Link< void *, void > m_aStyleListClear
Definition: templdgi.hxx:86
DECL_LINK(ReadResource_Hdl, StyleList &, void)
DECL_LINK(ClearResource_Hdl, void *, void)
void FamilySelect(sal_uInt16 nId, StyleList &rStyleList, bool bRefresh=false)
Definition: templdlg.cxx:547
DECL_LINK(HighlightHdl, weld::Toggleable &, void)
void IsUpdate(StyleList &)
Definition: templdlg.cxx:523
void ActionSelect(const OUString &rId, StyleList &rStyleList)
Definition: templdlg.cxx:571
void connect_stylelist_enable_delete(const Link< void *, void > rLink)
Definition: templdlg.cxx:181
void connect_stylelist_cleanup(const Link< void *, void > &rLink)
Definition: templdgi.hxx:186
bool Execute_Impl(sal_uInt16 nId, const OUString &rStr, const OUString &rRefStr, sal_uInt16 nFamily, StyleList &rStyleList, SfxStyleSearchBits nMask=SfxStyleSearchBits::Auto, sal_uInt16 *pIdx=nullptr, const sal_uInt16 *pModifier=nullptr)
Definition: templdlg.cxx:424
void FilterSelect(sal_uInt16 nFilterIdx)
Definition: templdlg.cxx:515
DECL_LINK(FilterSelectHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > mxFilterLb
Definition: templdgi.hxx:73
void EnableShow(bool b, const StyleList *rStyleList)
Definition: templdlg.cxx:952
void connect_stylelist_execute_new_menu(const Link< void *, void > &rLink)
Definition: templdgi.hxx:188
Link< const SfxBoolItem *, void > m_aStyleListSetWaterCanState
Definition: templdgi.hxx:96
void EnableExample_Impl(sal_uInt16 nId, bool bEnable)
Definition: templdlg.cxx:696
DeletionWatcher * impl_setDeletionWatcher(DeletionWatcher *pNewWatcher)
Definition: templdlg.cxx:268
SfxCommonTemplateDialog_Impl(SfxBindings *pB, weld::Container *, weld::Builder *pBuilder)
Definition: templdlg.cxx:194
void connect_stylelist_execute_drop(const Link< const ExecuteDropEvent &, sal_Int8 > &rLink)
Definition: templdlg.cxx:160
void SaveFactoryStyleFilter(SfxObjectShell const *i_pObjSh, sal_Int32 i_nFilter)
Definition: templdlg.cxx:648
Link< void *, size_t > m_aStyleListReadResource
Definition: templdgi.hxx:85
virtual void EnableEdit(bool b, StyleList *rStyleList)
Definition: templdlg.cxx:932
void EnableHide(bool b, const StyleList *rStyleList)
Definition: templdlg.cxx:947
void connect_stylelist_set_water_can_state(const Link< const SfxBoolItem *, void > rLink)
Definition: templdlg.cxx:186
void connect_stylelist_update_style_dependents(const Link< void *, void > &rLink)
Definition: templdlg.cxx:171
css::uno::Reference< css::frame::XModuleManager2 > xModuleManager
Definition: templdgi.hxx:67
void connect_stylelist_for_watercan(const Link< void *, bool > &rLink)
Definition: templdgi.hxx:189
void connect_stylelist_enable_tree_drag(const Link< bool, void > rLink)
Definition: templdlg.cxx:176
DECL_LINK(PreviewHdl, weld::Toggleable &, void)
bool IsSafeForWaterCan() const
Is it safe to show the water-can / fill icon.
Definition: templdlg.cxx:367
Link< void *, void > m_aStyleListCleanup
Definition: templdgi.hxx:87
void connect_stylelist_has_selected_style(const Link< void *, bool > &rLink)
Definition: templdlg.cxx:166
DECL_LINK(UpdateStyleDependents_Hdl, void *, void)
void EnableNew(bool b, const StyleList *rStyleList)
Definition: templdlg.cxx:942
Link< sal_uInt16, void > m_aStyleListSetFamily
Definition: templdgi.hxx:97
DECL_LINK(UpdateFamily_Hdl, StyleList &, void)
virtual bool IsCheckedItem(const OUString &)
Definition: templdgi.hxx:169
virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem &rItem)=0
DECL_LINK(LoadFactoryStyleFilter_Hdl, SfxObjectShell const *, sal_Int32)
void SetWaterCanState(const SfxBoolItem *pItem)
Definition: templdlg.cxx:388
void connect_set_family(const Link< sal_uInt16, void > rLink)
Definition: templdgi.hxx:195
void connect_stylelist_read_resource(const Link< void *, size_t > &rLink)
Definition: templdgi.hxx:184
virtual void CheckItem(const OUString &, bool=true)
Definition: templdgi.hxx:165
Link< void *, void > m_aStyleListUpdateStyleDependents
Definition: templdgi.hxx:93
virtual void ClearFamilyList()=0
void connect_stylelist_clear(const Link< void *, void > &rLink)
Definition: templdgi.hxx:185
Link< void *, bool > m_aStyleListWaterCan
Definition: templdgi.hxx:90
std::unique_ptr< weld::CheckButton > mxPreviewCheckbox
Definition: templdgi.hxx:71
DECL_LINK(OnAsyncExecuteDrop, void *, void)
DECL_LINK(UpdateStyles_Hdl, StyleFlags, void)
virtual ~SfxCommonTemplateDialog_Impl()
Definition: templdlg.cxx:349
std::unique_ptr< weld::CheckButton > mxHighlightCheckbox
Definition: templdgi.hxx:72
sal_uInt16 nId
Definition: ctrlitem.hxx:36
virtual void EnableItem(const OUString &rMesId, bool bCheck=true) override
Definition: templdlg.cxx:815
std::unique_ptr< weld::Toolbar > m_xActionTbR
Definition: templdgi.hxx:209
SfxTemplateDialog_Impl(SfxBindings *, SfxTemplatePanelControl *pDlgWindow)
Definition: templdlg.cxx:736
friend class SfxTemplatePanelControl
Definition: templdgi.hxx:205
virtual void EnableEdit(bool, StyleList *rStyleList) override
Definition: templdlg.cxx:215
sal_Int8 AcceptToolbarDrop(const AcceptDropEvent &rEvt, const DropTargetHelper &rHelper)
Definition: templdlg.cxx:908
virtual bool IsCheckedItem(const OUString &rMesId) override
Definition: templdlg.cxx:833
virtual void CheckItem(const OUString &rMesId, bool bCheck=true) override
Definition: templdlg.cxx:822
virtual void ReplaceUpdateButtonByMenu() override
Definition: templdlg.cxx:793
std::unique_ptr< weld::Menu > m_xToolMenu
Definition: templdgi.hxx:210
friend class SfxTemplateDialog
Definition: templdgi.hxx:229
std::unique_ptr< ToolbarDropTarget > m_xToolbarDropTargetHelper
Definition: templdgi.hxx:207
virtual void EnableFamilyItem(sal_uInt16 nId, bool bEnabled) override
Definition: templdlg.cxx:765
virtual void InsertFamilyItem(sal_uInt16 nId, const SfxStyleFamilyItem &rItem) override
Definition: templdlg.cxx:771
virtual ~SfxTemplateDialog_Impl() override
Definition: templdlg.cxx:808
DECL_LINK(ToolBoxLSelect, const OUString &, void)
DECL_LINK(ToolMenuSelectHdl, const OUString &, void)
std::unique_ptr< weld::Toolbar > m_xActionTbL
Definition: templdgi.hxx:208
DECL_LINK(ToolBoxRSelect, const OUString &, void)
virtual void ClearFamilyList() override
Definition: templdlg.cxx:801
SfxStyleFamily
SfxStyleSearchBits
signed char sal_Int8