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 TEMPLATEFOLDERVIEW_HXX
11 #define TEMPLATEFOLDERVIEW_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 ( Window
* pParent
, const ResId
& rResId
, bool bDisableTransientChildren
= false );
34 virtual ~TemplateLocalView ();
36 // Fill view with template folders thumbnails
37 virtual void Populate ();
39 virtual void reload ();
41 virtual void showRootRegion ();
43 virtual void showRegion (ThumbnailViewItem
*pItem
);
45 void showRegion (const OUString
&rName
);
47 sal_uInt16
getCurRegionItemId () const;
49 sal_uInt16
getRegionId (size_t pos
) const;
51 OUString
getRegionName(const sal_uInt16 nRegionId
) const;
53 OUString
getRegionItemName(const sal_uInt16 nItemId
) const;
55 std::vector
<OUString
> getFolderNames ();
57 std::vector
<TemplateItemProperties
>
58 getFilteredItems (const boost::function
<bool (const TemplateItemProperties
&) > &rFunc
) const;
60 virtual sal_uInt16
createRegion (const OUString
&rName
);
62 virtual bool isNestedRegionAllowed () const;
64 virtual bool isImportAllowed () const;
66 bool removeRegion (const sal_uInt16 nItemId
);
68 bool removeTemplate (const sal_uInt16 nItemId
, const sal_uInt16 nSrcItemId
);
70 bool moveTemplate (const ThumbnailViewItem
* pItem
, const sal_uInt16 nSrcItem
,
71 const sal_uInt16 nTargetItem
);
73 bool moveTemplates (const std::set
<const ThumbnailViewItem
*,selection_cmp_fn
> &rItems
, const sal_uInt16 nTargetItem
);
75 bool copyFrom (const sal_uInt16 nRegionItemId
, const BitmapEx
&rThumbnail
, const OUString
&rPath
);
77 // Import a template to the current region
78 bool copyFrom (const OUString
&rPath
);
80 bool copyFrom(TemplateContainerItem
*pItem
, const OUString
&rPath
);
82 bool exportTo (const sal_uInt16 nItemId
, const sal_uInt16 nRegionItemId
, const OUString
&rName
);
84 bool saveTemplateAs (sal_uInt16 nItemId
,
85 com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
,
86 const OUString
&rName
);
88 bool saveTemplateAs (TemplateContainerItem
*pDstItem
,
89 com::sun::star::uno::Reference
<com::sun::star::frame::XModel
> &rModel
,
90 const OUString
&rName
);
92 bool isTemplateNameUnique (const sal_uInt16 nRegionItemId
, const OUString
&rName
) const;
94 virtual bool renameItem(ThumbnailViewItem
* pItem
, OUString sNewTitle
);
98 SfxDocumentTemplates
*mpDocTemplates
;
99 std::vector
<TemplateContainerItem
* > maRegions
;
102 #endif // TEMPLATEFOLDERVIEW_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */