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_TEMPLATELOCALVIEW_HXX
11 #define INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
15 #include <sfx2/templateabstractview.hxx>
17 class SfxDocumentTemplates
;
18 class TemplateContainerItem
;
21 namespace sun
{ namespace star
{ namespace frame
{
26 class SFX2_DLLPUBLIC TemplateLocalView
: public TemplateAbstractView
28 typedef bool (*selection_cmp_fn
)(const ThumbnailViewItem
*,const ThumbnailViewItem
*);
32 TemplateLocalView ( vcl::Window
* pParent
);
34 virtual ~TemplateLocalView ();
35 virtual void dispose() SAL_OVERRIDE
;
37 // Fill view with template folders thumbnails
38 virtual void Populate () SAL_OVERRIDE
;
40 virtual void reload () SAL_OVERRIDE
;
42 virtual void showRootRegion () SAL_OVERRIDE
;
44 virtual void showRegion (ThumbnailViewItem
*pItem
) SAL_OVERRIDE
;
46 void showRegion (const OUString
&rName
);
48 sal_uInt16
getCurRegionItemId () const;
50 sal_uInt16
getRegionId (size_t pos
) const;
52 OUString
getRegionName(const sal_uInt16 nRegionId
) const;
54 OUString
getRegionItemName(const sal_uInt16 nItemId
) const;
56 std::vector
<OUString
> getFolderNames ();
58 std::vector
<TemplateItemProperties
>
59 getFilteredItems (const boost::function
<bool (const TemplateItemProperties
&) > &rFunc
) const;
61 virtual sal_uInt16
createRegion (const OUString
&rName
) SAL_OVERRIDE
;
63 virtual bool isNestedRegionAllowed () const SAL_OVERRIDE
;
65 virtual bool isImportAllowed () const SAL_OVERRIDE
;
67 bool removeRegion (const sal_uInt16 nItemId
);
69 bool removeTemplate (const sal_uInt16 nItemId
, const sal_uInt16 nSrcItemId
);
71 bool moveTemplate (const ThumbnailViewItem
* pItem
, const sal_uInt16 nSrcItem
,
72 const sal_uInt16 nTargetItem
);
74 bool moveTemplates (const std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> &rItems
, const sal_uInt16 nTargetItem
);
76 bool copyFrom (const sal_uInt16 nRegionItemId
, const BitmapEx
&rThumbnail
, const OUString
&rPath
);
78 // Import a template to the current region
79 bool copyFrom (const OUString
&rPath
);
81 bool copyFrom(TemplateContainerItem
*pItem
, const OUString
&rPath
);
83 bool exportTo (const sal_uInt16 nItemId
, const sal_uInt16 nRegionItemId
, const OUString
&rName
);
85 bool saveTemplateAs (sal_uInt16 nItemId
,
86 com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
,
87 const OUString
&rName
);
89 bool saveTemplateAs (TemplateContainerItem
*pDstItem
,
90 com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
,
91 const OUString
&rName
);
93 bool isTemplateNameUnique (const sal_uInt16 nRegionItemId
, const OUString
&rName
) const;
95 virtual bool renameItem(ThumbnailViewItem
* pItem
, const OUString
& sNewTitle
) SAL_OVERRIDE
;
99 SfxDocumentTemplates
*mpDocTemplates
;
100 std::vector
<TemplateContainerItem
* > maRegions
;
103 #endif // INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */