LCOV - code coverage report
Current view: top level - libreoffice/sfx2/inc/sfx2 - templateabstractview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 10 0.0 %
Date: 2012-12-17 Functions: 0 8 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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             :  */
       9             : 
      10             : #ifndef __SFX2_TEMPLATEABSTRACTVIEW_HXX__
      11             : #define __SFX2_TEMPLATEABSTRACTVIEW_HXX__
      12             : 
      13             : #include <sfx2/thumbnailview.hxx>
      14             : 
      15             : //template thumbnail item defines
      16             : #define TEMPLATE_ITEM_MAX_WIDTH 160
      17             : #define TEMPLATE_ITEM_MAX_HEIGHT 160
      18             : #define TEMPLATE_ITEM_PADDING 5
      19             : #define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
      20             : #define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 88
      21             : 
      22             : //template thumbnail image defines
      23             : #define TEMPLATE_THUMBNAIL_MAX_HEIGHT TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT - 2*TEMPLATE_ITEM_PADDING
      24             : #define TEMPLATE_THUMBNAIL_MAX_WIDTH TEMPLATE_ITEM_MAX_WIDTH - 2*TEMPLATE_ITEM_PADDING
      25             : 
      26             : class TemplateView;
      27             : class SfxDocumentTemplates;
      28             : 
      29             : enum FILTER_APPLICATION
      30             : {
      31             :     FILTER_APP_NONE,
      32             :     FILTER_APP_WRITER,
      33             :     FILTER_APP_CALC,
      34             :     FILTER_APP_IMPRESS,
      35             :     FILTER_APP_DRAW
      36             : };
      37             : 
      38             : // Display template items depending on the generator application
      39           0 : class ViewFilter_Application
      40             : {
      41             : public:
      42             : 
      43           0 :     ViewFilter_Application (FILTER_APPLICATION App)
      44           0 :         : mApp(App)
      45           0 :     {}
      46             : 
      47           0 :     virtual ~ViewFilter_Application () {}
      48             : 
      49             :     virtual bool operator () (const ThumbnailViewItem *pItem);
      50             : 
      51             :     bool isValid (const rtl::OUString& rPath) const;
      52             : 
      53             : protected:
      54             : 
      55             :     FILTER_APPLICATION mApp;
      56             : };
      57             : 
      58           0 : class ViewFilter_Keyword
      59             : {
      60             : public:
      61             : 
      62           0 :     ViewFilter_Keyword (const OUString &rKeyword)
      63           0 :         : maKeyword(rKeyword)
      64           0 :     {}
      65             : 
      66             :     bool operator () (const ThumbnailViewItem *pItem);
      67             : 
      68             : private:
      69             : 
      70             :     OUString maKeyword;
      71             : };
      72             : 
      73             : class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView
      74             : {
      75             : public:
      76             : 
      77             :     TemplateAbstractView (Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
      78             : 
      79             :     TemplateAbstractView ( Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false );
      80             : 
      81             :     virtual ~TemplateAbstractView ();
      82             : 
      83             :     // Fill view with template folders thumbnails
      84             :     virtual void Populate () = 0;
      85             : 
      86             :     virtual void reload () = 0;
      87             : 
      88             :     virtual void filterTemplatesByApp (const FILTER_APPLICATION &eApp) = 0;
      89             : 
      90             :     virtual void showOverlay (bool bVisible) = 0;
      91             : 
      92             :     void setItemDimensions (long ItemWidth, long ThumbnailHeight, long DisplayHeight, int itemPadding);
      93             : 
      94             :     sal_uInt16 getOverlayRegionId () const;
      95             : 
      96             :     const OUString& getOverlayName () const;
      97             : 
      98             :     // Check if the overlay is visible or not.
      99             :     bool isOverlayVisible () const;
     100             : 
     101             :     void deselectOverlayItems ();
     102             : 
     103             :     void deselectOverlayItem (const sal_uInt16 nItemId);
     104             : 
     105             :     void sortOverlayItems (const boost::function<bool (const ThumbnailViewItem*,
     106             :                                                        const ThumbnailViewItem*) > &func);
     107             : 
     108             :     virtual void filterTemplatesByKeyword (const OUString &rKeyword);
     109             : 
     110           0 :     void setOverlayItemStateHdl (const Link &aLink) { maOverlayItemStateHdl = aLink; }
     111             : 
     112             :     void setOverlayDblClickHdl (const Link &rLink);
     113             : 
     114             :     void setOverlayCloseHdl (const Link &rLink);
     115             : 
     116             :     static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
     117             : 
     118             :     static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
     119             : 
     120             :     virtual void Resize();
     121             : 
     122             : protected:
     123             : 
     124             :     virtual void Paint( const Rectangle& rRect );
     125             : 
     126             :     virtual void DrawItem (ThumbnailViewItem *pItem);
     127             : 
     128             :     DECL_LINK(OverlayItemStateHdl, const ThumbnailViewItem*);
     129             : 
     130             : protected:
     131             : 
     132             :     TemplateView *mpItemView;
     133             :     Link maOverlayItemStateHdl;
     134             : };
     135             : 
     136             : #endif // __SFX2_TEMPLATEABSTRACTVIEW_HXX__
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10