1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
23 #include <vcl/graph.hxx>
24 #include <vcl/timer.hxx>
28 // - GraphicManagerCache -
32 class GraphicCacheEntry
;
33 class GraphicDisplayCacheEntry
;
39 typedef std::list
< GraphicCacheEntry
* > GraphicCacheEntryList
;
40 typedef std::list
< GraphicDisplayCacheEntry
* > GraphicDisplayCacheEntryList
;
43 GraphicCacheEntryList maGraphicCache
;
44 GraphicDisplayCacheEntryList maDisplayCache
;
45 sal_uLong mnReleaseTimeoutSeconds
;
46 sal_uLong mnMaxDisplaySize
;
47 sal_uLong mnMaxObjDisplaySize
;
48 sal_uLong mnUsedDisplaySize
;
50 bool ImplFreeDisplayCacheSpace( sal_uLong nSizeToFree
);
51 GraphicCacheEntry
* ImplGetCacheEntry( const GraphicObject
& rObj
);
54 DECL_LINK_TYPED( ReleaseTimeoutHdl
, Timer
* pTimer
, void );
59 sal_uLong nDisplayCacheSize
= 10000000UL,
60 sal_uLong nMaxObjDisplayCacheSize
= 2400000UL
67 void AddGraphicObject(
68 const GraphicObject
& rObj
,
71 const GraphicObject
* pCopyObj
74 void ReleaseGraphicObject( const GraphicObject
& rObj
);
76 void GraphicObjectWasSwappedOut( const GraphicObject
& rObj
);
77 void GraphicObjectWasSwappedIn( const GraphicObject
& rObj
);
79 OString
GetUniqueID( const GraphicObject
& rObj
) const;
83 void SetMaxDisplayCacheSize( sal_uLong nNewCacheSize
);
84 sal_uLong
GetMaxDisplayCacheSize() const { return mnMaxDisplaySize
; };
86 void SetMaxObjDisplayCacheSize(
87 sal_uLong nNewMaxObjSize
,
88 bool bDestroyGreaterCached
= false
91 sal_uLong
GetMaxObjDisplayCacheSize() const { return mnMaxObjDisplaySize
; }
93 sal_uLong
GetUsedDisplayCacheSize() const { return mnUsedDisplaySize
; }
94 sal_uLong
GetFreeDisplayCacheSize() const { return( mnMaxDisplaySize
- mnUsedDisplaySize
); }
96 void SetCacheTimeout( sal_uLong nTimeoutSeconds
);
97 sal_uLong
GetCacheTimeout() const { return mnReleaseTimeoutSeconds
; }
99 bool IsDisplayCacheable(
103 const GraphicObject
& rObj
,
104 const GraphicAttr
& rAttr
107 bool IsInDisplayCache(
111 const GraphicObject
& rObj
,
112 const GraphicAttr
& rAttr
115 bool CreateDisplayCacheObj(
119 const GraphicObject
& rObj
,
120 const GraphicAttr
& rAttr
,
121 const BitmapEx
& rBmpEx
124 bool CreateDisplayCacheObj(
128 const GraphicObject
& rObj
,
129 const GraphicAttr
& rAttr
,
130 const GDIMetaFile
& rMtf
133 bool DrawDisplayCacheObj(
137 const GraphicObject
& rObj
,
138 const GraphicAttr
& rAttr
142 #endif // INCLUDED_SVTOOLS_SOURCE_GRAPHIC_GRFCACHE_HXX
144 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */