LCOV - code coverage report
Current view: top level - include/sfx2 - templateabstractview.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 5 10 50.0 %
Date: 2014-11-03 Functions: 3 9 33.3 %
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 INCLUDED_SFX2_TEMPLATEABSTRACTVIEW_HXX
      11             : #define INCLUDED_SFX2_TEMPLATEABSTRACTVIEW_HXX
      12             : 
      13             : #include <sfx2/templateproperties.hxx>
      14             : #include <sfx2/thumbnailview.hxx>
      15             : #include <vcl/button.hxx>
      16             : #include <vcl/fixed.hxx>
      17             : 
      18             : //template thumbnail item defines
      19             : #define TEMPLATE_ITEM_MAX_WIDTH 160
      20             : #define TEMPLATE_ITEM_MAX_HEIGHT 148
      21             : #define TEMPLATE_ITEM_PADDING 5
      22             : #define TEMPLATE_ITEM_MAX_TEXT_LENGTH 20
      23             : #define TEMPLATE_ITEM_THUMBNAIL_MAX_HEIGHT 96
      24             : 
      25             : //template thumbnail height with a subtitle
      26             : #define TEMPLATE_ITEM_MAX_HEIGHT_SUB 160
      27             : 
      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
      31             : 
      32             : class SfxDocumentTemplates;
      33             : 
      34             : enum FILTER_APPLICATION
      35             : {
      36             :     FILTER_APP_NONE,
      37             :     FILTER_APP_WRITER,
      38             :     FILTER_APP_CALC,
      39             :     FILTER_APP_IMPRESS,
      40             :     FILTER_APP_DRAW
      41             : };
      42             : 
      43             : // Display template items depending on the generator application
      44          18 : class ViewFilter_Application
      45             : {
      46             : public:
      47             : 
      48           2 :     ViewFilter_Application (FILTER_APPLICATION App)
      49           2 :         : mApp(App)
      50           2 :     {}
      51             : 
      52          20 :     virtual ~ViewFilter_Application () {}
      53             : 
      54             :     virtual bool operator () (const ThumbnailViewItem *pItem);
      55             : 
      56             :     static bool isFilteredExtension(FILTER_APPLICATION filter, const OUString &rExt);
      57             :     bool isValid (const OUString& rPath) const;
      58             : 
      59             : protected:
      60             : 
      61             :     FILTER_APPLICATION mApp;
      62             : };
      63             : 
      64             : class ViewFilter_Keyword
      65             : {
      66             : public:
      67             : 
      68             :     ViewFilter_Keyword (const OUString &rKeyword)
      69             :         : maKeyword(rKeyword)
      70             :     {}
      71             : 
      72             :     bool operator () (const ThumbnailViewItem *pItem);
      73             : 
      74             : private:
      75             : 
      76             :     OUString maKeyword;
      77             : };
      78             : 
      79             : class SFX2_DLLPUBLIC TemplateAbstractView : public ThumbnailView
      80             : {
      81             : public:
      82             : 
      83             :     TemplateAbstractView(vcl::Window *pParent, WinBits nWinStyle, bool bDisableTransientChildren);
      84             :     TemplateAbstractView(vcl::Window* pParent);
      85             : 
      86             :     virtual ~TemplateAbstractView ();
      87             : 
      88             :     void insertItem (const TemplateItemProperties &rTemplate);
      89             : 
      90             :     // Fill view with new item list
      91             :     void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
      92             : 
      93             :     // Fill view with template folders thumbnails
      94           0 :     virtual void Populate () { }
      95             : 
      96           0 :     virtual void reload () { }
      97             : 
      98             :     virtual void showRootRegion () = 0;
      99             : 
     100             :     virtual void showRegion (ThumbnailViewItem *pItem) = 0;
     101             : 
     102             :     virtual sal_uInt16 createRegion (const OUString &rName) = 0;
     103             : 
     104             :     // Return if we can have regions inside the current region
     105             :     virtual bool isNestedRegionAllowed () const = 0;
     106             : 
     107             :     // Return if we can import templates to the current region
     108             :     virtual bool isImportAllowed () const = 0;
     109             : 
     110           0 :     sal_uInt16 getCurRegionId () const { return mnCurRegionId;}
     111             : 
     112           0 :     const OUString& getCurRegionName () const { return maCurRegionName;}
     113             : 
     114             :     // Check if the root region is visible or not.
     115           0 :     bool isNonRootRegionVisible () const { return mnCurRegionId > 0;}
     116             : 
     117             :     void setOpenRegionHdl(const Link &rLink);
     118             : 
     119             :     void setOpenTemplateHdl (const Link &rLink);
     120             : 
     121             :     static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
     122             : 
     123             :     static BitmapEx getDefaultThumbnail( const OUString& rPath );
     124             : 
     125             :     static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
     126             : 
     127             : protected:
     128             : 
     129             :     DECL_LINK(ShowRootRegionHdl, void*);
     130             : 
     131             :     virtual void OnItemDblClicked(ThumbnailViewItem *pItem) SAL_OVERRIDE;
     132             : 
     133             :     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     134             : 
     135             : protected:
     136             : 
     137             :     sal_uInt16 mnCurRegionId;
     138             :     OUString maCurRegionName;
     139             : 
     140             :     PushButton maAllButton;
     141             :     FixedText  maFTName;
     142             : 
     143             :     Link maOpenRegionHdl;
     144             :     Link maOpenTemplateHdl;
     145             : };
     146             : 
     147             : #endif // INCLUDED_SFX2_TEMPLATEABSTRACTVIEW_HXX
     148             : 
     149             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10