1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#ifndef INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
#define INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
#include <set>
#include <functional>
#include <sfx2/templateabstractview.hxx>
class SfxDocumentTemplates;
class TemplateContainerItem;
class PopupMenu;
namespace com {
namespace sun { namespace star { namespace frame {
class XModel;
} } }
}
class SFX2_DLLPUBLIC TemplateLocalView : public TemplateAbstractView
{
typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*);
public:
TemplateLocalView ( vcl::Window* pParent );
virtual ~TemplateLocalView ();
virtual void dispose() override;
// Fill view with template folders thumbnails
virtual void Populate () override;
virtual void reload () override;
virtual void showAllTemplates () override;
virtual void showRegion (TemplateContainerItem *pItem) override;
void showRegion (const OUString &rName);
void createContextMenu(const bool bIsDefault );
DECL_LINK_TYPED(ContextMenuSelectHdl, Menu*, bool);
TemplateContainerItem* getRegion(OUString const & sStr);
sal_uInt16 getRegionId (size_t pos) const;
sal_uInt16 getRegionId (OUString const & sRegionName) const;
OUString getRegionName(const sal_uInt16 nRegionId) const;
OUString getRegionItemName(const sal_uInt16 nItemId) const;
std::vector<OUString> getFolderNames ();
std::vector<TemplateItemProperties>
getFilteredItems (const std::function<bool (const TemplateItemProperties&) > &rFunc) const;
virtual sal_uInt16 createRegion (const OUString &rName) override;
bool renameRegion(const OUString &rTitle, const OUString &rNewTitle);
bool removeRegion (const sal_uInt16 nItemId);
bool removeTemplate (const sal_uInt16 nItemId, const sal_uInt16 nSrcItemId);
bool moveTemplate (const ThumbnailViewItem* pItem, const sal_uInt16 nSrcItem,
const sal_uInt16 nTargetItem);
bool moveTemplates (const std::set<const ThumbnailViewItem*,selection_cmp_fn> &rItems, const sal_uInt16 nTargetItem);
bool copyFrom (const sal_uInt16 nRegionItemId, const BitmapEx &rThumbnail, const OUString &rPath);
bool copyFrom(TemplateContainerItem *pItem, const OUString &rPath);
bool exportTo (const sal_uInt16 nItemId, const sal_uInt16 nRegionItemId, const OUString &rName);
virtual bool renameItem(ThumbnailViewItem* pItem, const OUString& sNewTitle) override;
private:
SfxDocumentTemplates *mpDocTemplates;
std::vector<TemplateContainerItem* > maRegions;
std::vector<TemplateItemProperties > maAllTemplates;
};
#endif // INCLUDED_SFX2_TEMPLATELOCALVIEW_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|