1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #ifndef INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
11 #define INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
13 #include <sal/config.h>
14 #include <sfx2/dllapi.h>
18 #include <vcl/dialog.hxx>
19 #include <vcl/button.hxx>
20 #include <vcl/tabctrl.hxx>
21 #include <vcl/tabpage.hxx>
22 #include <com/sun/star/frame/XDesktop2.hpp>
24 #include <sfx2/templateabstractview.hxx>
28 class SfxTemplateInfoDlg
;
29 class TemplateAbstractView
;
30 class TemplateLocalView
;
31 class TemplateRemoteView
;
32 class TemplateRepository
;
33 class TemplateSearchView
;
35 class ThumbnailViewItem
;
39 namespace sun
{ namespace star
{ namespace frame
{
40 class XComponentLoader
;
45 class SFX2_DLLPUBLIC SfxTemplateManagerDlg
: public ModalDialog
47 typedef bool (*selection_cmp_fn
)(const ThumbnailViewItem
*,const ThumbnailViewItem
*);
51 SfxTemplateManagerDlg(vcl::Window
*parent
= NULL
);
53 virtual ~SfxTemplateManagerDlg();
54 virtual void dispose() SAL_OVERRIDE
;
58 void setDocumentModel (const com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
);
60 DECL_LINK(ActivatePageHdl
, void*);
66 void writeSettings ();
68 DECL_LINK_TYPED(TBXViewHdl
, ToolBox
*, void);
69 DECL_LINK_TYPED(TBXActionHdl
, ToolBox
*, void);
70 DECL_LINK_TYPED(TBXTemplateHdl
, ToolBox
*, void);
71 DECL_LINK_TYPED(TBXDropdownHdl
, ToolBox
*, void);
73 DECL_LINK(TVItemStateHdl
, const ThumbnailViewItem
*);
75 DECL_LINK(MenuSelectHdl
, Menu
*);
76 DECL_LINK(MoveMenuSelectHdl
, Menu
*);
77 DECL_LINK(RepositoryMenuSelectHdl
, Menu
*);
78 DECL_LINK(DefaultTemplateMenuSelectHdl
, Menu
*);
80 DECL_LINK(OpenRegionHdl
, void*);
81 DECL_LINK(OpenTemplateHdl
, ThumbnailViewItem
*);
83 DECL_LINK(SearchUpdateHdl
, void*);
85 void OnTemplateImport ();
86 void OnTemplateSearch ();
87 static void OnTemplateLink ();
88 void OnTemplateOpen ();
89 void OnTemplateEdit ();
90 void OnTemplateProperties ();
91 void OnTemplateDelete ();
92 void OnTemplateAsDefault ();
93 void OnTemplateExport ();
95 void OnTemplateState (const ThumbnailViewItem
*pItem
);
98 void OnFolderDelete ();
100 void OnRegionState (const ThumbnailViewItem
*pItem
);
102 void OnRepositoryDelete ();
103 void OnTemplateSaveAs ();
105 void createRepositoryMenu ();
107 void createDefaultTemplateMenu ();
109 // Exchange view between local/online view.
110 void switchMainView (bool bDisplayLocal
);
114 * Move templates stored in the filesystem to another folder.
118 void localMoveTo (sal_uInt16 nMenuId
);
120 void remoteMoveTo (const sal_uInt16 nMenuId
);
124 * Move search result templates stored in the filesystem to another folder.
128 void localSearchMoveTo (sal_uInt16 nMenuId
);
130 // Remote repositories handling methods
131 void loadRepositories ();
133 const std::vector
<TemplateRepository
*>& getRepositories () const { return maRepositories
; }
135 bool insertRepository (const OUString
&rName
, const OUString
&rURL
);
137 bool deleteRepository (const sal_uInt16 nRepositoryId
);
139 void syncRepositories () const;
141 /// Return filter according to the currently selected tab page.
142 FILTER_APPLICATION
getCurrentFilter();
146 VclPtr
<TabControl
> mpTabControl
;
148 VclPtr
<Edit
> mpSearchEdit
;
149 VclPtr
<ToolBox
> mpViewBar
;
150 VclPtr
<ToolBox
> mpActionBar
;
151 VclPtr
<ToolBox
> mpTemplateBar
;
152 VclPtr
<TemplateSearchView
> mpSearchView
;
153 VclPtr
<TemplateAbstractView
> mpCurView
;
154 VclPtr
<TemplateLocalView
> mpLocalView
;
155 VclPtr
<TemplateRemoteView
> mpRemoteView
;
156 PopupMenu
*mpActionMenu
;
157 PopupMenu
*mpRepositoryMenu
;
158 PopupMenu
*mpTemplateDefaultMenu
;
160 std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> maSelTemplates
;
161 std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> maSelFolders
;
163 bool mbIsSaveMode
; ///< Flag that indicates if we are in save mode or not.
164 com::sun::star::uno::Reference
< com::sun::star::frame::XModel
> m_xModel
;
165 com::sun::star::uno::Reference
< com::sun::star::frame::XDesktop2
> mxDesktop
;
167 bool mbIsSynced
; ///< Tells whether maRepositories is synchronized with the user config
168 std::vector
<TemplateRepository
*> maRepositories
; ///< Stores the remote repositories for templates
171 #endif // INCLUDED_SFX2_INC_TEMPLATEDLG_HXX
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */