2012-07-14 17:46:22 -05:00
|
|
|
/* -*- 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 __SFX2_TEMPLATEABSTRACTVIEW_HXX__
|
|
|
|
#define __SFX2_TEMPLATEABSTRACTVIEW_HXX__
|
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
#include <sfx2/templateproperties.hxx>
|
2012-07-14 17:46:22 -05:00
|
|
|
#include <sfx2/thumbnailview.hxx>
|
2013-03-25 20:19:29 -05:00
|
|
|
#include <vcl/button.hxx>
|
|
|
|
#include <vcl/fixed.hxx>
|
2012-07-14 17:46:22 -05:00
|
|
|
|
2012-08-12 19:50:34 -05:00
|
|
|
//template thumbnail item defines
|
2012-12-13 06:57:59 -06:00
|
|
|
#define TEMPLATE_ITEM_MAX_WIDTH 160
|
2013-06-17 10:41:27 -05:00
|
|
|
#define TEMPLATE_ITEM_MAX_HEIGHT 148
|
2012-08-12 19:50:34 -05:00
|
|
|
#define TEMPLATE_ITEM_PADDING 5
|
|
|
|
#define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
|
2013-06-17 10:41:27 -05:00
|
|
|
#define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 96
|
2012-08-12 19:50:34 -05:00
|
|
|
|
2013-03-28 14:52:12 -05:00
|
|
|
//template thumbnail height with a subtitle
|
|
|
|
#define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160
|
|
|
|
|
2012-08-12 19:50:34 -05:00
|
|
|
//template thumbnail image defines
|
2012-12-13 06:57:59 -06:00
|
|
|
#define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING
|
2012-08-12 19:50:34 -05:00
|
|
|
#define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
|
|
|
|
|
2012-07-29 23:00:47 -05:00
|
|
|
class SfxDocumentTemplates;
|
|
|
|
|
|
|
|
enum FILTER_APPLICATION
|
|
|
|
{
|
|
|
|
FILTER_APP_NONE,
|
|
|
|
FILTER_APP_WRITER,
|
|
|
|
FILTER_APP_CALC,
|
|
|
|
FILTER_APP_IMPRESS,
|
|
|
|
FILTER_APP_DRAW
|
|
|
|
};
|
|
|
|
|
|
|
|
// Display template items depending on the generator application
|
|
|
|
class ViewFilter_Application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ViewFilter_Application (FILTER_APPLICATION App)
|
|
|
|
: mApp(App)
|
|
|
|
{}
|
|
|
|
|
2012-12-12 15:33:49 -06:00
|
|
|
virtual ~ViewFilter_Application () {}
|
2012-07-29 23:00:47 -05:00
|
|
|
|
2012-12-12 15:33:49 -06:00
|
|
|
virtual bool operator () (const ThumbnailViewItem *pItem);
|
|
|
|
|
2013-08-11 12:35:15 -05:00
|
|
|
static bool isFilteredExtension(FILTER_APPLICATION filter, const OUString &rExt);
|
2013-04-07 05:06:47 -05:00
|
|
|
bool isValid (const OUString& rPath) const;
|
2012-12-12 15:33:49 -06:00
|
|
|
|
|
|
|
protected:
|
2012-07-29 23:00:47 -05:00
|
|
|
|
|
|
|
FILTER_APPLICATION mApp;
|
|
|
|
};
|
2012-07-14 19:55:13 -05:00
|
|
|
|
2012-08-02 20:41:18 -05:00
|
|
|
class ViewFilter_Keyword
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ViewFilter_Keyword (const OUString &rKeyword)
|
|
|
|
: maKeyword(rKeyword)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator () (const ThumbnailViewItem *pItem);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
OUString maKeyword;
|
|
|
|
};
|
|
|
|
|
2012-07-14 17:46:22 -05:00
|
|
|
class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
|
|
|
|
TemplateAbstractView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
|
2013-08-14 08:53:13 -05:00
|
|
|
TemplateAbstractView ( Window* pParent );
|
2012-07-14 17:46:22 -05:00
|
|
|
|
|
|
|
virtual ~TemplateAbstractView ();
|
2012-07-14 19:55:13 -05:00
|
|
|
|
2013-03-27 17:49:53 -05:00
|
|
|
void insertItem (const TemplateItemProperties &rTemplate);
|
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
// Fill view with new item list
|
|
|
|
void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
|
2012-08-07 09:57:44 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
// Fill view with template folders thumbnails
|
|
|
|
virtual void Populate () { }
|
2012-08-12 19:50:34 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
virtual void reload () { }
|
2012-07-28 21:57:31 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
virtual void showRootRegion () = 0;
|
2012-08-12 16:44:16 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
virtual void showRegion (ThumbnailViewItem *pItem) = 0;
|
2012-07-14 22:31:55 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
virtual sal_uInt16 createRegion (const OUString &rName) = 0;
|
2012-08-11 15:40:01 -05:00
|
|
|
|
2013-03-27 16:29:50 -05:00
|
|
|
// Return if we can have regions inside the current region
|
|
|
|
virtual bool isNestedRegionAllowed () const = 0;
|
|
|
|
|
2013-03-27 16:33:02 -05:00
|
|
|
// Return if we can import templates to the current region
|
|
|
|
virtual bool isImportAllowed () const = 0;
|
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
sal_uInt16 getCurRegionId () const;
|
2012-07-14 22:31:55 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
const OUString& getCurRegionName () const;
|
2012-08-02 20:41:18 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
// Check if the root region is visible or not.
|
|
|
|
bool isNonRootRegionVisible () const;
|
2012-07-29 18:43:14 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
void setOpenRegionHdl(const Link &rLink);
|
2012-07-14 22:31:55 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
void setOpenTemplateHdl (const Link &rLink);
|
2012-07-14 22:31:55 -05:00
|
|
|
|
2012-07-29 15:13:18 -05:00
|
|
|
static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
|
|
|
|
|
2013-04-07 05:06:47 -05:00
|
|
|
static BitmapEx getDefaultThumbnail( const OUString& rPath );
|
2012-07-29 15:13:18 -05:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
|
2012-08-03 10:47:07 -05:00
|
|
|
|
2012-12-13 07:29:52 -06:00
|
|
|
protected:
|
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
DECL_LINK(ShowRootRegionHdl, void*);
|
2012-07-29 18:43:14 -05:00
|
|
|
|
2012-12-21 08:37:49 -06:00
|
|
|
virtual void OnItemDblClicked(ThumbnailViewItem *pItem);
|
|
|
|
|
2012-07-14 19:55:13 -05:00
|
|
|
protected:
|
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
sal_uInt16 mnCurRegionId;
|
|
|
|
OUString maCurRegionName;
|
|
|
|
|
|
|
|
PushButton maAllButton;
|
|
|
|
FixedText maFTName;
|
2012-12-18 03:18:03 -06:00
|
|
|
|
2013-03-25 20:19:29 -05:00
|
|
|
Link maOpenRegionHdl;
|
|
|
|
Link maOpenTemplateHdl;
|
2012-07-14 17:46:22 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|