LibreOffice Module sd (master) 1
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
sd::slidesorter::cache::CacheCompactor Class Referenceabstract

This is an interface class whose implementations are created via the Create() factory method. More...

#include <SlsCacheCompactor.hxx>

Collaboration diagram for sd::slidesorter::cache::CacheCompactor:
[legend]

Public Member Functions

virtual ~CacheCompactor ()
 
static ::std::unique_ptr< CacheCompactorCreate (BitmapCache &rCache, sal_Int32 nMaximalCacheSize)
 Create a new instance of the CacheCompactor interface class. More...
 
virtual void RequestCompaction ()
 Request a compaction of the off-screen previews in the bitmap cache. More...
 

Protected Member Functions

 CacheCompactor (BitmapCache &rCache, sal_Int32 nMaximalCacheSize)
 
virtual void Run ()=0
 This method actually tries to reduce the total number of bytes used by the off-screen preview bitmaps. More...
 

Protected Attributes

BitmapCachemrCache
 
sal_Int32 mnMaximalCacheSize
 

Private Member Functions

 DECL_LINK (CompactionCallback, Timer *, void)
 

Private Attributes

Timer maCompactionTimer
 This timer is used to collect calls to RequestCompaction() and eventually call Run(). More...
 
bool mbIsCompactionRunning
 

Detailed Description

This is an interface class whose implementations are created via the Create() factory method.

Definition at line 33 of file SlsCacheCompactor.hxx.

Constructor & Destructor Documentation

◆ ~CacheCompactor()

virtual sd::slidesorter::cache::CacheCompactor::~CacheCompactor ( )
inlinevirtual

Definition at line 36 of file SlsCacheCompactor.hxx.

◆ CacheCompactor()

sd::slidesorter::cache::CacheCompactor::CacheCompactor ( BitmapCache rCache,
sal_Int32  nMaximalCacheSize 
)
protected

Member Function Documentation

◆ Create()

std::unique_ptr< CacheCompactor > sd::slidesorter::cache::CacheCompactor::Create ( BitmapCache rCache,
sal_Int32  nMaximalCacheSize 
)

Create a new instance of the CacheCompactor interface class.

The type of compaction algorithm used depends on values from the configuration: the SlideSorter/PreviewCache/CompactionPolicy property of the Impress.xcs file currently supports the values "None" and "Compress". With the later the CompressionPolicy property is evaluated which implementation of the BitmapCompress interface class to use as bitmap compressor.

Parameters
rCacheThe bitmap cache on which to operate.
nMaximalCacheSizeThe total number of bytes the off-screen bitmaps in the cache may have. When the Run() method is (indirectly) called the compactor tries to reduce that summed size of off-screen bitmaps under this number. However, it is not guaranteed that this works in all cases.

Definition at line 82 of file SlsCacheCompactor.cxx.

References Any, GetValue, sd::slidesorter::cache::CacheConfiguration::Instance(), and sNone.

Referenced by sd::slidesorter::cache::BitmapCache::BitmapCache().

◆ DECL_LINK()

sd::slidesorter::cache::CacheCompactor::DECL_LINK ( CompactionCallback  ,
Timer ,
void   
)
private

◆ RequestCompaction()

void sd::slidesorter::cache::CacheCompactor::RequestCompaction ( )
virtual

Request a compaction of the off-screen previews in the bitmap cache.

This calls via a timer the Run() method.

Definition at line 115 of file SlsCacheCompactor.cxx.

References Task::IsActive(), maCompactionTimer, mbIsCompactionRunning, and Timer::Start().

◆ Run()

virtual void sd::slidesorter::cache::CacheCompactor::Run ( )
protectedpure virtual

This method actually tries to reduce the total number of bytes used by the off-screen preview bitmaps.

Member Data Documentation

◆ maCompactionTimer

Timer sd::slidesorter::cache::CacheCompactor::maCompactionTimer
private

This timer is used to collect calls to RequestCompaction() and eventually call Run().

Definition at line 80 of file SlsCacheCompactor.hxx.

Referenced by CacheCompactor(), and RequestCompaction().

◆ mbIsCompactionRunning

bool sd::slidesorter::cache::CacheCompactor::mbIsCompactionRunning
private

Definition at line 81 of file SlsCacheCompactor.hxx.

Referenced by RequestCompaction().

◆ mnMaximalCacheSize

sal_Int32 sd::slidesorter::cache::CacheCompactor::mnMaximalCacheSize
protected

Definition at line 65 of file SlsCacheCompactor.hxx.

◆ mrCache

BitmapCache& sd::slidesorter::cache::CacheCompactor::mrCache
protected

Definition at line 64 of file SlsCacheCompactor.hxx.


The documentation for this class was generated from the following files: