LCOV - code coverage report
Current view: top level - svtools/source/graphic - grfcache.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 5 20.0 %
Date: 2014-11-03 Functions: 1 5 20.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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
      21             : #define INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
      22             : 
      23             : #include <vcl/graph.hxx>
      24             : #include <vcl/timer.hxx>
      25             : #include <list>
      26             : 
      27             : 
      28             : // - GraphicManagerCache -
      29             : 
      30             : 
      31             : class GraphicAttr;
      32             : class GraphicCacheEntry;
      33             : class GraphicDisplayCacheEntry;
      34             : class GraphicObject;
      35             : 
      36             : class GraphicCache
      37             : {
      38             : private:
      39             :     typedef std::list< GraphicCacheEntry* > GraphicCacheEntryList;
      40             :     typedef std::list< GraphicDisplayCacheEntry* > GraphicDisplayCacheEntryList;
      41             : 
      42             :     Timer                   maReleaseTimer;
      43             :     GraphicCacheEntryList   maGraphicCache;
      44             :     GraphicDisplayCacheEntryList maDisplayCache;
      45             :     sal_uLong               mnReleaseTimeoutSeconds;
      46             :     sal_uLong               mnMaxDisplaySize;
      47             :     sal_uLong               mnMaxObjDisplaySize;
      48             :     sal_uLong               mnUsedDisplaySize;
      49             : 
      50             :     bool                ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree );
      51             :     GraphicCacheEntry*      ImplGetCacheEntry( const GraphicObject& rObj );
      52             : 
      53             : 
      54             :                             DECL_LINK( ReleaseTimeoutHdl, Timer* pTimer );
      55             : 
      56             : public:
      57             : 
      58             :                             GraphicCache(
      59             :                                 sal_uLong nDisplayCacheSize = 10000000UL,
      60             :                                 sal_uLong nMaxObjDisplayCacheSize = 2400000UL
      61             :                             );
      62             : 
      63             :                             ~GraphicCache();
      64             : 
      65             : public:
      66             : 
      67             :     void                    AddGraphicObject(
      68             :                                 const GraphicObject& rObj,
      69             :                                 Graphic& rSubstitute,
      70             :                                 const OString* pID,
      71             :                                 const GraphicObject* pCopyObj
      72             :                             );
      73             : 
      74             :     void                    ReleaseGraphicObject( const GraphicObject& rObj );
      75             : 
      76             :     void                    GraphicObjectWasSwappedOut( const GraphicObject& rObj );
      77             :     bool                FillSwappedGraphicObject( const GraphicObject& rObj, Graphic& rSubstitute );
      78             :     void                    GraphicObjectWasSwappedIn( const GraphicObject& rObj );
      79             : 
      80             :     OString            GetUniqueID( const GraphicObject& rObj ) const;
      81             : 
      82             : public:
      83             : 
      84             :     void                    SetMaxDisplayCacheSize( sal_uLong nNewCacheSize );
      85        2746 :     sal_uLong               GetMaxDisplayCacheSize() const { return mnMaxDisplaySize; };
      86             : 
      87             :     void                    SetMaxObjDisplayCacheSize(
      88             :                                 sal_uLong nNewMaxObjSize,
      89             :                                 bool bDestroyGreaterCached = false
      90             :                             );
      91             : 
      92           0 :     sal_uLong               GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize; }
      93             : 
      94           0 :     sal_uLong               GetUsedDisplayCacheSize() const { return mnUsedDisplaySize; }
      95           0 :     sal_uLong               GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize - mnUsedDisplaySize ); }
      96             : 
      97             :     void                    SetCacheTimeout( sal_uLong nTimeoutSeconds );
      98           0 :     sal_uLong               GetCacheTimeout() const { return mnReleaseTimeoutSeconds; }
      99             : 
     100             :     bool                IsDisplayCacheable(
     101             :                                 OutputDevice* pOut,
     102             :                                 const Point& rPt,
     103             :                                 const Size& rSz,
     104             :                                 const GraphicObject& rObj,
     105             :                                 const GraphicAttr& rAttr
     106             :                             ) const;
     107             : 
     108             :     bool                IsInDisplayCache(
     109             :                                 OutputDevice* pOut,
     110             :                                 const Point& rPt,
     111             :                                 const Size& rSz,
     112             :                                 const GraphicObject& rObj,
     113             :                                 const GraphicAttr& rAttr
     114             :                             ) const;
     115             : 
     116             :     bool                CreateDisplayCacheObj(
     117             :                                 OutputDevice* pOut,
     118             :                                 const Point& rPt,
     119             :                                 const Size& rSz,
     120             :                                 const GraphicObject& rObj,
     121             :                                 const GraphicAttr& rAttr,
     122             :                                 const BitmapEx& rBmpEx
     123             :                             );
     124             : 
     125             :     bool                CreateDisplayCacheObj(
     126             :                                 OutputDevice* pOut,
     127             :                                 const Point& rPt,
     128             :                                 const Size& rSz,
     129             :                                 const GraphicObject& rObj,
     130             :                                 const GraphicAttr& rAttr,
     131             :                                 const GDIMetaFile& rMtf
     132             :                             );
     133             : 
     134             :     bool                DrawDisplayCacheObj(
     135             :                                 OutputDevice* pOut,
     136             :                                 const Point& rPt,
     137             :                                 const Size& rSz,
     138             :                                 const GraphicObject& rObj,
     139             :                                 const GraphicAttr& rAttr
     140             :                             );
     141             : };
     142             : 
     143             : #endif // INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10