LCOV - code coverage report
Current view: top level - include/sfx2 - templateabstractview.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 10 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 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 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 class FILTER_APPLICATION
      35             : {
      36             :     NONE,
      37             :     WRITER,
      38             :     CALC,
      39             :     IMPRESS,
      40             :     DRAW
      41             : };
      42             : 
      43             : // Display template items depending on the generator application
      44           0 : class ViewFilter_Application
      45             : {
      46             : public:
      47             : 
      48           0 :     ViewFilter_Application (FILTER_APPLICATION App)
      49           0 :         : mApp(App)
      50           0 :     {}
      51             : 
      52           0 :     virtual ~ViewFilter_Application () {}
      53             : 
      54             :     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             :     virtual void dispose() SAL_OVERRIDE;
      88             : 
      89             :     void insertItem (const TemplateItemProperties &rTemplate);
      90             : 
      91             :     // Fill view with new item list
      92             :     void insertItems (const std::vector<TemplateItemProperties> &rTemplates);
      93             : 
      94             :     // Fill view with template folders thumbnails
      95           0 :     virtual void Populate () { }
      96             : 
      97           0 :     virtual void reload () { }
      98             : 
      99             :     virtual void showRootRegion () = 0;
     100             : 
     101             :     virtual void showRegion (ThumbnailViewItem *pItem) = 0;
     102             : 
     103             :     virtual sal_uInt16 createRegion (const OUString &rName) = 0;
     104             : 
     105             :     // Return if we can have regions inside the current region
     106             :     virtual bool isNestedRegionAllowed () const = 0;
     107             : 
     108             :     // Return if we can import templates to the current region
     109             :     virtual bool isImportAllowed () const = 0;
     110             : 
     111           0 :     sal_uInt16 getCurRegionId () const { return mnCurRegionId;}
     112             : 
     113           0 :     const OUString& getCurRegionName () const { return maCurRegionName;}
     114             : 
     115             :     // Check if the root region is visible or not.
     116           0 :     bool isNonRootRegionVisible () const { return mnCurRegionId > 0;}
     117             : 
     118             :     void setOpenRegionHdl(const Link<> &rLink);
     119             : 
     120             :     void setOpenTemplateHdl (const Link<> &rLink);
     121             : 
     122             :     static BitmapEx scaleImg (const BitmapEx &rImg, long width, long height);
     123             : 
     124             :     static BitmapEx getDefaultThumbnail( const OUString& rPath );
     125             : 
     126             :     static BitmapEx fetchThumbnail (const OUString &msURL, long width, long height);
     127             : 
     128             : protected:
     129             : 
     130             :     DECL_LINK(ShowRootRegionHdl, void*);
     131             : 
     132             :     virtual void OnItemDblClicked(ThumbnailViewItem *pItem) SAL_OVERRIDE;
     133             : 
     134             :     virtual void Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect) SAL_OVERRIDE;
     135             : 
     136             : protected:
     137             : 
     138             :     sal_uInt16 mnCurRegionId;
     139             :     OUString maCurRegionName;
     140             : 
     141             :     VclPtr<PushButton> maAllButton;
     142             :     VclPtr<FixedText>  maFTName;
     143             : 
     144             :     Link<> maOpenRegionHdl;
     145             :     Link<> maOpenTemplateHdl;
     146             : };
     147             : 
     148             : #endif // INCLUDED_SFX2_TEMPLATEABSTRACTVIEW_HXX
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11