LibreOffice Module sfx2 (master) 1
templatedlg.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
10#ifndef INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
11#define INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
12
13#include <sal/config.h>
14#include <sfx2/dllapi.h>
15
16#include <set>
17#include <string_view>
18
19#include <vcl/idle.hxx>
20#include <vcl/timer.hxx>
21#include <vcl/weld.hxx>
22
24
26
27namespace com
28{
29namespace sun::star::frame
30{
31class XDesktop2;
32class XModel;
33}
34}
35
37{
38 typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*, const ThumbnailViewItem*);
39
40public:
42
43 virtual ~SfxTemplateManagerDlg() override;
44 virtual short run() override;
45
46 void setDocumentModel(const css::uno::Reference<css::frame::XModel>& rModel);
47 void setTemplateViewMode(TemplateViewMode eViewMode);
48 TemplateViewMode getTemplateViewMode() const;
49
50protected:
51 void getApplicationSpecificSettings();
52
53 void readSettings();
54
55 void writeSettings();
56
57 void fillFolderComboBox();
58
59 DECL_DLLPRIVATE_LINK(SelectApplicationHdl, weld::ComboBox&, void);
60 DECL_DLLPRIVATE_LINK(SelectRegionHdl, weld::ComboBox&, void);
61
63 void ImportActionHdl();
64 static void ExtensionsActionHdl();
65
66 DECL_DLLPRIVATE_LINK(TVItemStateHdl, const ThumbnailViewItem*, void);
67
68 DECL_DLLPRIVATE_LINK(MenuSelectHdl, const OUString&, void);
69 void DefaultTemplateMenuSelectHdl(std::u16string_view rIdent);
70
71 DECL_DLLPRIVATE_LINK(OpenRegionHdl, void*, void);
72 DECL_DLLPRIVATE_LINK(CreateContextMenuHdl, ThumbnailViewItem*, void);
73 DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
74 DECL_DLLPRIVATE_LINK(EditTemplateHdl, ThumbnailViewItem*, void);
75 DECL_DLLPRIVATE_LINK(DeleteTemplateHdl, void*, void);
76 DECL_DLLPRIVATE_LINK(DefaultTemplateHdl, ThumbnailViewItem*, void);
77 DECL_DLLPRIVATE_LINK(MoveTemplateHdl, void*, void);
78 DECL_DLLPRIVATE_LINK(ExportTemplateHdl, void*, void);
79
80 void SearchUpdate();
81
82 DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry&, void);
83 DECL_DLLPRIVATE_LINK(GetFocusHdl, weld::Widget&, void);
84 DECL_DLLPRIVATE_LINK(LoseFocusHdl, weld::Widget&, void);
85 DECL_DLLPRIVATE_LINK(ImplUpdateDataHdl, Timer*, void);
86 DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent&, bool);
87
89 DECL_DLLPRIVATE_LINK(ThumbnailViewHdl, weld::Toggleable&, void);
91
92 void OnTemplateImportCategory(std::u16string_view sCategory);
93 // static void OnTemplateLink ();
94 void OnTemplateOpen();
95 void OnTemplateExport();
96
97 void OnTemplateState(const ThumbnailViewItem* pItem);
98
99 void OnCategoryNew();
100 void OnCategoryRename();
101 void OnCategoryDelete();
102
103 void updateMenuItems();
104
111 void localMoveTo(sal_uInt16 nMenuId);
112
114 FILTER_APPLICATION getCurrentApplicationFilter() const;
115
116protected:
117 std::set<const ThumbnailViewItem*, selection_cmp_fn> maSelTemplates;
118 css::uno::Reference<css::frame::XModel> m_xModel;
119 css::uno::Reference<css::frame::XDesktop2> mxDesktop;
120
122
123 std::unique_ptr<weld::Entry> mxSearchFilter;
124 std::unique_ptr<weld::ComboBox> mxCBApp;
125 std::unique_ptr<weld::ComboBox> mxCBFolder;
126
127 std::unique_ptr<weld::Button> mxOKButton;
128 std::unique_ptr<weld::CheckButton> mxCBXHideDlg;
129 std::unique_ptr<weld::MenuButton> mxActionBar;
130 std::unique_ptr<TemplateDlgLocalView> mxLocalView;
131 std::unique_ptr<weld::CustomWeld> mxLocalViewWeld;
132 std::unique_ptr<weld::Toggleable> mxListViewButton;
133 std::unique_ptr<weld::Toggleable> mxThumbnailViewButton;
136};
137
138// class SfxTemplateCategoryDialog -------------------------------------------------------------------
139
141{
142private:
145
146 std::unique_ptr<weld::TreeView> mxLBCategory;
147 std::unique_ptr<weld::Entry> mxNewCategoryEdit;
148 std::unique_ptr<weld::Button> mxOKButton;
149
150public:
151 DECL_LINK(NewCategoryEditHdl, weld::Entry&, void);
152 DECL_LINK(SelectCategoryHdl, weld::TreeView&, void);
153
154 void SetCategoryLBEntries(std::vector<OUString> names);
155
156 const OUString& GetSelectedCategory() const { return msSelectedCategory; };
157
158 bool IsNewCategoryCreated() const { return mbIsNewCategory; }
159
160public:
161 explicit SfxTemplateCategoryDialog(weld::Window* pParent);
162
163 virtual ~SfxTemplateCategoryDialog() override;
164};
165
166// class SfxTemplateSelectionDialog -------------------------------------------------------------------
167
169{
170public:
172
173 virtual ~SfxTemplateSelectionDlg() override;
174 virtual short run() override;
175
176 OUString const& getTemplatePath() const { return msTemplatePath; };
177 bool IsStartWithTemplate() const { return mxCBXHideDlg->get_active(); };
178
179private:
180 DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem*, void);
182 DECL_DLLPRIVATE_LINK(TimeOut, Timer*, void);
183
186};
187
188#endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
189
190/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::TreeView > mxLBCategory
std::unique_ptr< weld::Entry > mxNewCategoryEdit
DECL_LINK(NewCategoryEditHdl, weld::Entry &, void)
virtual ~SfxTemplateCategoryDialog() override
const OUString & GetSelectedCategory() const
bool IsNewCategoryCreated() const
DECL_LINK(SelectCategoryHdl, weld::TreeView &, void)
void SetCategoryLBEntries(std::vector< OUString > names)
SfxTemplateCategoryDialog(weld::Window *pParent)
std::unique_ptr< weld::Button > mxOKButton
DECL_DLLPRIVATE_LINK(SearchUpdateHdl, weld::Entry &, void)
DECL_DLLPRIVATE_LINK(KeyInputHdl, const KeyEvent &, bool)
DECL_DLLPRIVATE_LINK(CreateContextMenuHdl, ThumbnailViewItem *, void)
DECL_DLLPRIVATE_LINK(DefaultTemplateHdl, ThumbnailViewItem *, void)
css::uno::Reference< css::frame::XDesktop2 > mxDesktop
std::unique_ptr< weld::Entry > mxSearchFilter
TemplateViewMode mViewMode
std::unique_ptr< weld::MenuButton > mxActionBar
DECL_DLLPRIVATE_LINK(OpenRegionHdl, void *, void)
DECL_DLLPRIVATE_LINK(ThumbnailViewHdl, weld::Toggleable &, void)
DECL_DLLPRIVATE_LINK(GetFocusHdl, weld::Widget &, void)
DECL_DLLPRIVATE_LINK(EditTemplateHdl, ThumbnailViewItem *, void)
std::set< const ThumbnailViewItem *, selection_cmp_fn > maSelTemplates
DECL_DLLPRIVATE_LINK(FocusRectLocalHdl, weld::Widget &, tools::Rectangle)
DECL_DLLPRIVATE_LINK(ExportTemplateHdl, void *, void)
std::unique_ptr< weld::CheckButton > mxCBXHideDlg
DECL_DLLPRIVATE_LINK(OkClickHdl, weld::Button &, void)
std::unique_ptr< weld::Toggleable > mxThumbnailViewButton
DECL_DLLPRIVATE_LINK(ListViewHdl, weld::Toggleable &, void)
std::unique_ptr< weld::CustomWeld > mxLocalViewWeld
DECL_DLLPRIVATE_LINK(SelectApplicationHdl, weld::ComboBox &, void)
DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem *, void)
css::uno::Reference< css::frame::XModel > m_xModel
DECL_DLLPRIVATE_LINK(SelectRegionHdl, weld::ComboBox &, void)
std::unique_ptr< weld::ComboBox > mxCBApp
std::unique_ptr< weld::Button > mxOKButton
std::unique_ptr< TemplateDlgLocalView > mxLocalView
DECL_DLLPRIVATE_LINK(MoveTemplateHdl, void *, void)
std::unique_ptr< weld::Toggleable > mxListViewButton
DECL_DLLPRIVATE_LINK(DeleteTemplateHdl, void *, void)
DECL_DLLPRIVATE_LINK(MenuSelectHdl, const OUString &, void)
DECL_DLLPRIVATE_LINK(ImplUpdateDataHdl, Timer *, void)
DECL_DLLPRIVATE_LINK(TVItemStateHdl, const ThumbnailViewItem *, void)
std::unique_ptr< weld::ComboBox > mxCBFolder
DECL_DLLPRIVATE_LINK(LoseFocusHdl, weld::Widget &, void)
DECL_DLLPRIVATE_LINK(OkClickHdl, weld::Button &, void)
DECL_DLLPRIVATE_LINK(OpenTemplateHdl, ThumbnailViewItem *, void)
DECL_DLLPRIVATE_LINK(TimeOut, Timer *, void)
OUString const & getTemplatePath() const
bool IsStartWithTemplate() const
virtual short run()
#define SFX2_DLLPUBLIC
Definition: dllapi.h:29
TemplateViewMode
Definition: listview.hxx:15
FILTER_APPLICATION