fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / sfx2 / templateabstractview.hxx
blob5f1eca6a80fae0a9c253ac2df8812108ee9e4dc3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__
11 #define __SFX2_TEMPLATEABSTRACTVIEW_HXX__
13 #include <sfx2/templateproperties.hxx>
14 #include <sfx2/thumbnailview.hxx>
15 #include <vcl/button.hxx>
16 #include <vcl/fixed.hxx>
18 //template thumbnail item defines
19 #define TEMPLATE_ITEM_MAX_WIDTH 160
20 #define TEMPLATE_ITEM_MAX_HEIGHT 140
21 #define TEMPLATE_ITEM_PADDING 5
22 #define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
23 #define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 88
25 //template thumbnail height with a subtitle
26 #define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160
28 //template thumbnail image defines
29 #define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING
30 #define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
32 class SfxDocumentTemplates;
34 enum FILTER_APPLICATION
36 FILTER_APP_NONE,
37 FILTER_APP_WRITER,
38 FILTER_APP_CALC,
39 FILTER_APP_IMPRESS,
40 FILTER_APP_DRAW
43 // Display template items depending on the generator application
44 class ViewFilter_Application
46 public:
48 ViewFilter_Application (FILTER_APPLICATION App)
49 : mApp(App)
52 virtual ~ViewFilter_Application () {}
54 virtual bool operator () (const ThumbnailViewItem *pItem);
56 bool isValid (const OUString& rPath) const;
58 protected:
60 FILTER_APPLICATION mApp;
63 class ViewFilter_Keyword
65 public:
67 ViewFilter_Keyword (const OUString &rKeyword)
68 : maKeyword(rKeyword)
71 bool operator () (const ThumbnailViewItem *pItem);
73 private:
75 OUString maKeyword;
78 class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView
80 public:
82 TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
84 TemplateAbstractView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
86 virtual ~TemplateAbstractView ();
88 void insertItem (const TemplateItemProperties &rTemplate);
90 // Fill view with new item list
91 void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
93 // Fill view with template folders thumbnails
94 virtual void Populate () { }
96 virtual void reload () { }
98 virtual void showRootRegion () = 0;
100 virtual void showRegion (ThumbnailViewItem *pItem) = 0;
102 virtual sal_uInt16 createRegion (const OUString &rName) = 0;
104 // Return if we can have regions inside the current region
105 virtual bool isNestedRegionAllowed () const = 0;
107 // Return if we can import templates to the current region
108 virtual bool isImportAllowed () const = 0;
110 sal_uInt16 getCurRegionId () const;
112 const OUString& getCurRegionName () const;
114 // Check if the root region is visible or not.
115 bool isNonRootRegionVisible () const;
117 void setOpenRegionHdl(const Link &rLink);
119 void setOpenTemplateHdl (const Link &rLink);
121 static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
123 static BitmapEx getDefaultThumbnail( const OUString& rPath );
125 static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
127 protected:
129 DECL_LINK(ShowRootRegionHdl, void*);
131 virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
133 protected:
135 sal_uInt16 mnCurRegionId;
136 OUString maCurRegionName;
138 PushButton maAllButton;
139 FixedText maFTName;
141 Link maOpenRegionHdl;
142 Link maOpenTemplateHdl;
145 #endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */