xref: /AOO41X/main/unotools/inc/unotools/cacheoptions.hxx (revision bae3752ec30c258ca902793e4eea3c818b0bcaad)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
25 #define INCLUDED_unotools_CACHEOPTIONS_HXX
26 
27 //_________________________________________________________________________________________________________________
28 //  includes
29 //_________________________________________________________________________________________________________________
30 
31 #include "unotools/unotoolsdllapi.h"
32 #include <sal/types.h>
33 #include <osl/mutex.hxx>
34 #include <rtl/ustring.hxx>
35 
36 //_________________________________________________________________________________________________________________
37 //  forward declarations
38 //_________________________________________________________________________________________________________________
39 
40 /*-************************************************************************************************************//**
41     @short          forward declaration to our private date container implementation
42     @descr          We use these class as internal member to support small memory requirements.
43                     You can create the container if it is neccessary. The class which use these mechanism
44                     is faster and smaller then a complete implementation!
45 *//*-*************************************************************************************************************/
46 
47 class SvtCacheOptions_Impl;
48 
49 //_________________________________________________________________________________________________________________
50 //  declarations
51 //_________________________________________________________________________________________________________________
52 
53 /*-************************************************************************************************************//**
54     @short          collect informations about startup features
55     @descr          -
56 
57     @implements     -
58     @base           -
59 
60     @devstatus      ready to use
61 *//*-*************************************************************************************************************/
62 
63 class UNOTOOLS_DLLPUBLIC SvtCacheOptions
64 {
65     //-------------------------------------------------------------------------------------------------------------
66     //  public methods
67     //-------------------------------------------------------------------------------------------------------------
68 
69     public:
70 
71         //---------------------------------------------------------------------------------------------------------
72         //  constructor / destructor
73         //---------------------------------------------------------------------------------------------------------
74 
75         /*-****************************************************************************************************//**
76             @short      standard constructor and destructor
77             @descr      This will initialize an instance with default values.
78                         We implement these class with a refcount mechanism! Every instance of this class increase it
79                         at create and decrease it at delete time - but all instances use the same data container!
80                         He is implemented as a static member ...
81 
82             @seealso    member m_nRefCount
83             @seealso    member m_pDataContainer
84 
85             @param      -
86             @return     -
87 
88             @onerror    -
89         *//*-*****************************************************************************************************/
90 
91          SvtCacheOptions();
92         ~SvtCacheOptions();
93 
94         //---------------------------------------------------------------------------------------------------------
95         //  interface
96         //---------------------------------------------------------------------------------------------------------
97 
98         /*-****************************************************************************************************//**
99             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/_3D-Engine/..."
100             @descr      These options describe internal states to enable/disable features of installed office.
101 
102                         GetWriterOLE_Objects()
103                         SetWriterOLE_Objects()              =>  set the number of Writer OLE objects to be cached
104 
105                         GetDrawingEngineOLE_Objects()
106                         SetDrawingEngineOLE_Objects()       =>  set the number of DrawingEngine OLE objects to be cached
107 
108                         GetGraphicManagerTotalCacheSize()
109                         SetGraphicManagerTotalCacheSize()   =>  set the maximum cache size used by GraphicManager to cache graphic objects
110 
111                         GetGraphicManagerObjectCacheSize()
112                         SetGraphicManagerObjectCacheSize()  =>  set the maximum cache size for one GraphicObject to be cached by GraphicManager
113 
114             @seealso    configuration package "org.openoffice.Office.Common/_3D-Engine"
115         *//*-*****************************************************************************************************/
116 
117         sal_Int32   GetWriterOLE_Objects() const;
118         sal_Int32   GetDrawingEngineOLE_Objects() const;
119         sal_Int32   GetGraphicManagerTotalCacheSize() const;
120         sal_Int32   GetGraphicManagerObjectCacheSize() const;
121         sal_Int32   GetGraphicManagerObjectReleaseTime() const;
122 
123         void        SetWriterOLE_Objects( sal_Int32 nObjects );
124         void        SetDrawingEngineOLE_Objects( sal_Int32 nObjects );
125         void        SetGraphicManagerTotalCacheSize( sal_Int32 nTotalCacheSize );
126         void        SetGraphicManagerObjectCacheSize( sal_Int32 nObjectCacheSize );
127         void        SetGraphicManagerObjectReleaseTime( sal_Int32 nReleaseTimeSeconds );
128 
129     //-------------------------------------------------------------------------------------------------------------
130     //  private methods
131     //-------------------------------------------------------------------------------------------------------------
132 
133     private:
134 
135         /*-****************************************************************************************************//**
136             @short      return a reference to a static mutex
137             @descr      These class use his own static mutex to be threadsafe.
138                         We create a static mutex only for one ime and use at different times.
139 
140             @seealso    -
141 
142             @param      -
143             @return     A reference to a static mutex member.
144 
145             @onerror    -
146         *//*-*****************************************************************************************************/
147 
148         UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
149 
150     //-------------------------------------------------------------------------------------------------------------
151     //  private member
152     //-------------------------------------------------------------------------------------------------------------
153 
154     private:
155 
156         /*Attention
157 
158             Don't initialize these static member in these header!
159             a) Double dfined symbols will be detected ...
160             b) and unresolved externals exist at linking time.
161             Do it in your source only.
162          */
163 
164         static SvtCacheOptions_Impl*    m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
165         static sal_Int32                m_nRefCount         ;   /// internal ref count mechanism
166 
167 };
168 
169 #endif // #ifndef INCLUDED_unotools_CACHEOPTIONS_HXX
170