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__
|
|
|
|
|
|
|
|
#include <sfx2/thumbnailview.hxx>
|
|
|
|
|
2012-07-14 19:55:13 -05:00
|
|
|
class TemplateView;
|
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)
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator () (const ThumbnailViewItem *pItem);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
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 );
|
|
|
|
|
|
|
|
virtual ~TemplateAbstractView ();
|
2012-07-14 19:55:13 -05:00
|
|
|
|
2012-07-15 07:17:31 -05:00
|
|
|
// Fill view with template folders thumbnails
|
|
|
|
virtual void Populate () = 0;
|
|
|
|
|
2012-07-29 23:00:47 -05:00
|
|
|
virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp) = 0;
|
|
|
|
|
2012-07-15 07:17:31 -05:00
|
|
|
virtual void showOverlay (bool bVisible) = 0;
|
|
|
|
|
2012-07-28 21:57:31 -05:00
|
|
|
sal_uInt16 getOverlayRegionId () const;
|
|
|
|
|
2012-07-14 22:31:55 -05:00
|
|
|
// Check if the overlay is visible or not.
|
|
|
|
bool isOverlayVisible () const;
|
|
|
|
|
|
|
|
void sortOverlayItems (const boost::function<bool (const ThumbnailViewItem*,
|
|
|
|
const ThumbnailViewItem*) > &func);
|
|
|
|
|
2012-08-02 20:41:18 -05:00
|
|
|
virtual void filterTemplatesByKeyword (const OUString &rKeyword);
|
|
|
|
|
2012-07-29 18:43:14 -05:00
|
|
|
void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; }
|
|
|
|
|
2012-07-14 22:31:55 -05:00
|
|
|
void setOverlayDblClickHdl (const Link &rLink);
|
|
|
|
|
|
|
|
void setOverlayCloseHdl (const Link &rLink);
|
|
|
|
|
2012-07-29 15:13:18 -05:00
|
|
|
static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
|
|
|
|
|
|
|
|
static BitmapEx fetchThumbnail (const rtl::OUString &msURL, long width, long height);
|
|
|
|
|
2012-07-14 22:31:55 -05:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual void OnSelectionMode (bool bMode);
|
|
|
|
|
2012-07-29 18:43:14 -05:00
|
|
|
DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
|
|
|
|
|
2012-07-14 19:55:13 -05:00
|
|
|
protected:
|
|
|
|
|
|
|
|
TemplateView *mpItemView;
|
2012-07-29 18:43:14 -05:00
|
|
|
Link maOverlayItemStateHdl;
|
2012-07-14 17:46:22 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__
|
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|