LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/slidesorter/cache - SlsCacheCompactor.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-12-27 Functions: 0 2 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             :  * 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 SD_SLIDESORTER_CACHE_COMPACTOR_HXX
      21             : #define SD_SLIDESORTER_CACHE_COMPACTOR_HXX
      22             : 
      23             : #include <sal/types.h>
      24             : #include <vcl/timer.hxx>
      25             : #include <memory>
      26             : 
      27             : namespace sd { namespace slidesorter { namespace cache {
      28             : 
      29             : class BitmapCache;
      30             : 
      31             : /** This is an interface class whose implementations are created via the
      32             :     Create() factory method.
      33             : */
      34             : class CacheCompactor
      35             : {
      36             : public:
      37           0 :     virtual ~CacheCompactor (void) {};
      38             : 
      39             :     /** Create a new instance of the CacheCompactor interface class.  The
      40             :         type of compaction algorithm used depends on values from the
      41             :         configuration: the SlideSorter/PreviewCache/CompactionPolicy
      42             :         property of the Impress.xcs file currently supports the values
      43             :         "None" and "Compress".  With the later the CompressionPolicy
      44             :         property is evaluated which implementation of the BitmapCompress
      45             :         interface class to use as bitmap compressor.
      46             :         @param rCache
      47             :             The bitmap cache on which to operate.
      48             :         @param nMaximalCacheSize
      49             :             The total number of bytes the off-screen bitmaps in the cache
      50             :             may have.  When the Run() method is (indirectly) called the
      51             :             compactor tries to reduce that summed size of off-screen bitmaps
      52             :             under this number.  However, it is not guaranteed that this
      53             :             works in all cases.
      54             :     */
      55             :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
      56             :     static ::std::auto_ptr<CacheCompactor> Create (
      57             :         BitmapCache& rCache,
      58             :         sal_Int32 nMaximalCacheSize);
      59             :     SAL_WNODEPRECATED_DECLARATIONS_POP
      60             : 
      61             :     /** Request a compaction of the off-screen previews in the bitmap
      62             :         cache.  This calls via a timer the Run() method.
      63             :     */
      64             :     virtual void RequestCompaction (void);
      65             : 
      66             : protected:
      67             :     BitmapCache& mrCache;
      68             :     sal_Int32 mnMaximalCacheSize;
      69             : 
      70             :     CacheCompactor(
      71             :         BitmapCache& rCache,
      72             :         sal_Int32 nMaximalCacheSize);
      73             : 
      74             :     /** This method actually tries to reduce the total number of bytes used
      75             :         by the off-screen preview bitmaps.
      76             :     */
      77             :     virtual void Run (void) = 0;
      78             : 
      79             : private:
      80             :     /** This timer is used to collect calles to RequestCompaction() and
      81             :         eventually call Run().
      82             :     */
      83             :     Timer maCompactionTimer;
      84             :     bool mbIsCompactionRunning;
      85             :     DECL_LINK(CompactionCallback, void *);
      86             : };
      87             : 
      88             : 
      89             : 
      90             : 
      91             : } } } // end of namespace ::sd::slidesorter::cache
      92             : 
      93             : #endif
      94             : 
      95             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10