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 TEMPLATEDLG_HXX
11 #define TEMPLATEDLG_HXX
15 #include <vcl/dialog.hxx>
16 #include <vcl/button.hxx>
17 #include <vcl/tabctrl.hxx>
18 #include <vcl/tabpage.hxx>
19 #include <com/sun/star/frame/XDesktop2.hpp>
23 class SfxTemplateInfoDlg
;
24 class TemplateAbstractView
;
25 class TemplateLocalView
;
26 class TemplateRemoteView
;
27 class TemplateRepository
;
28 class TemplateSearchView
;
30 class ThumbnailViewItem
;
34 namespace sun
{ namespace star
{ namespace frame
{
35 class XComponentLoader
;
40 class SfxTemplateManagerDlg
: public ModelessDialog
42 typedef bool (*selection_cmp_fn
)(const ThumbnailViewItem
*,const ThumbnailViewItem
*);
46 SfxTemplateManagerDlg (Window
*parent
= DIALOG_NO_PARENT
);
48 ~SfxTemplateManagerDlg ();
50 void setSaveMode (bool bMode
);
52 void setDocumentModel (const com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
);
54 DECL_LINK(ActivatePageHdl
, void*);
60 void writeSettings ();
62 virtual void Resize ();
64 DECL_LINK(TBXViewHdl
, void*);
65 DECL_LINK(TBXActionHdl
, void*);
66 DECL_LINK(TBXTemplateHdl
, void*);
67 DECL_LINK(TBXDropdownHdl
, ToolBox
*);
69 DECL_LINK(TVItemStateHdl
, const ThumbnailViewItem
*);
71 DECL_LINK(MenuSelectHdl
, Menu
*);
72 DECL_LINK(MoveMenuSelectHdl
, Menu
*);
73 DECL_LINK(RepositoryMenuSelectHdl
, Menu
*);
74 DECL_LINK(DefaultTemplateMenuSelectHdl
, Menu
*);
76 DECL_LINK(OpenRegionHdl
, void*);
77 DECL_LINK(OpenTemplateHdl
, ThumbnailViewItem
*);
79 DECL_LINK(SearchUpdateHdl
, void*);
81 void OnTemplateImport ();
82 void OnTemplateSearch ();
83 void OnTemplateOpen ();
84 void OnTemplateEdit ();
85 void OnTemplateProperties ();
86 void OnTemplateDelete ();
87 void OnTemplateAsDefault ();
88 void OnTemplateExport ();
90 void OnTemplateState (const ThumbnailViewItem
*pItem
);
93 void OnFolderDelete ();
95 void OnRegionState (const ThumbnailViewItem
*pItem
);
97 void OnRepositoryDelete ();
98 void OnTemplateSaveAs ();
100 void createRepositoryMenu ();
102 void createDefaultTemplateMenu ();
104 // Exchange view between local/online view.
105 void switchMainView (bool bDisplayLocal
);
109 * Move templates stored in the filesystem to another folder.
113 void localMoveTo (sal_uInt16 nMenuId
);
115 void remoteMoveTo (const sal_uInt16 nMenuId
);
119 * Move search result templates stored in the filesystem to another folder.
123 void localSearchMoveTo (sal_uInt16 nMenuId
);
125 // Remote repositories handling methods
126 void loadRepositories ();
128 const std::vector
<TemplateRepository
*>& getRepositories () const { return maRepositories
; }
130 bool insertRepository (const OUString
&rName
, const OUString
&rURL
);
132 bool deleteRepository (const sal_uInt16 nRepositoryId
);
134 void syncRepositories () const;
138 TabControl maTabControl
;
143 ToolBox
*mpActionBar
;
144 ToolBox
*mpTemplateBar
;
145 TemplateSearchView
*mpSearchView
;
146 TemplateAbstractView
*mpCurView
;
147 TemplateLocalView
*mpLocalView
;
148 TemplateRemoteView
*mpRemoteView
;
149 PopupMenu
*mpActionMenu
;
150 PopupMenu
*mpRepositoryMenu
;
151 PopupMenu
*mpTemplateDefaultMenu
;
153 std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> maSelTemplates
;
154 std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> maSelFolders
;
156 bool mbIsSaveMode
; ///< Flag that indicates if we are in save mode or not.
157 com::sun::star::uno::Reference
< com::sun::star::frame::XModel
> m_xModel
;
158 com::sun::star::uno::Reference
< com::sun::star::frame::XDesktop2
> mxDesktop
;
160 bool mbIsSynced
; ///< Tells whether maRepositories is synchronized with the user config
161 std::vector
<TemplateRepository
*> maRepositories
; ///< Stores the remote repositories for templates
164 #endif // TEMPLATEDLG_HXX
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */