xref: /AOO41X/main/svtools/inc/svtools/optionsdrawinglayer.hxx (revision 47148b3bc50811ceb41802e4cc50a5db21535900)
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_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
25 #define INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
26 
27 //_________________________________________________________________________________________________________________
28 //  includes
29 //_________________________________________________________________________________________________________________
30 
31 #include "svtools/svtdllapi.h"
32 #include <sal/types.h>
33 #include <osl/mutex.hxx>
34 #include <rtl/ustring.hxx>
35 #include <tools/color.hxx>
36 
37 //_________________________________________________________________________________________________________________
38 //  forward declarations
39 //_________________________________________________________________________________________________________________
40 
41 /*-************************************************************************************************************//**
42     @short          forward declaration to our private date container implementation
43     @descr          We use these class as internal member to support small memory requirements.
44                     You can create the container if it is neccessary. The class which use these mechanism
45                     is faster and smaller then a complete implementation!
46 *//*-*************************************************************************************************************/
47 
48 class SvtOptionsDrawinglayer_Impl;
49 
50 //_________________________________________________________________________________________________________________
51 //  declarations
52 //_________________________________________________________________________________________________________________
53 
54 /*-************************************************************************************************************//**
55     @short          collect informations about startup features
56     @descr          -
57 
58     @implements     -
59     @base           -
60 
61     @devstatus      ready to use
62 *//*-*************************************************************************************************************/
63 
64 class SVT_DLLPUBLIC SvtOptionsDrawinglayer
65 {
66     //-------------------------------------------------------------------------------------------------------------
67     //  public methods
68     //-------------------------------------------------------------------------------------------------------------
69 
70     public:
71 
72         //---------------------------------------------------------------------------------------------------------
73         //  constructor / destructor
74         //---------------------------------------------------------------------------------------------------------
75 
76         /*-****************************************************************************************************//**
77             @short      standard constructor and destructor
78             @descr      This will initialize an instance with default values.
79                         We implement these class with a refcount mechanism! Every instance of this class increase it
80                         at create and decrease it at delete time - but all instances use the same data container!
81                         He is implemented as a static member ...
82 
83             @seealso    member m_nRefCount
84             @seealso    member m_pDataContainer
85 
86             @param      -
87             @return     -
88 
89             @onerror    -
90         *//*-*****************************************************************************************************/
91 
92          SvtOptionsDrawinglayer();
93         ~SvtOptionsDrawinglayer();
94 
95         //---------------------------------------------------------------------------------------------------------
96         //  interface
97         //---------------------------------------------------------------------------------------------------------
98 
99         /*-****************************************************************************************************//**
100             @short      interface methods to get and set value of config key "org.openoffice.Office.Common/Drawinglayer/..."
101             @descr      These options describe internal states to enable/disable features of installed office.
102 
103                         IsOverlayBuffer()
104                         SetOverlayBuffer()      =>  Activate this field for letting Overlay use a buffer
105 
106                         IsPaintBuffer()
107                         SetPaintBuffer()        =>  Activate this field for letting Paint use a prerender buffer
108 
109                         GetStripeColorA()
110                         SetStripeColorA()       =>  Set first of two colors which overlay uses to draw stripes
111 
112                         GetStripeColorB()
113                         SetStripeColorB()       =>  Set second of two colors which overlay uses to draw stripes
114 
115                         GetStripeLength()
116                         SetStripeLength()       =>  Set length of a single stripe in pixels
117 
118             @seealso    configuration package "org.openoffice.Office.Common/Drawinglayer"
119         *//*-*****************************************************************************************************/
120 
121         sal_Bool    IsOverlayBuffer() const;
122         sal_Bool    IsPaintBuffer() const;
123         Color       GetStripeColorA() const;
124         Color       GetStripeColorB() const;
125         sal_uInt16  GetStripeLength() const;
126 
127         void        SetOverlayBuffer( sal_Bool bState );
128         void        SetPaintBuffer( sal_Bool bState );
129         void        SetStripeColorA( Color aColor );
130         void        SetStripeColorB( Color aColor );
131         void        SetStripeLength( sal_uInt16 nLength );
132 
133         // #i73602#
134         sal_Bool    IsOverlayBuffer_Calc() const;
135         sal_Bool    IsOverlayBuffer_Writer() const;
136         sal_Bool    IsOverlayBuffer_DrawImpress() const;
137         void        SetOverlayBuffer_Calc( sal_Bool bState );
138         void        SetOverlayBuffer_Writer( sal_Bool bState );
139         void        SetOverlayBuffer_DrawImpress( sal_Bool bState );
140 
141         // #i74769#, #i75172#
142         sal_Bool    IsPaintBuffer_Calc() const;
143         sal_Bool    IsPaintBuffer_Writer() const;
144         sal_Bool    IsPaintBuffer_DrawImpress() const;
145         void        SetPaintBuffer_Calc( sal_Bool bState );
146         void        SetPaintBuffer_Writer( sal_Bool bState );
147         void        SetPaintBuffer_DrawImpress( sal_Bool bState );
148 
149         // #i4219#
150         sal_uInt32 GetMaximumPaperWidth() const;
151         sal_uInt32 GetMaximumPaperHeight() const;
152         sal_uInt32 GetMaximumPaperLeftMargin() const;
153         sal_uInt32 GetMaximumPaperRightMargin() const;
154         sal_uInt32 GetMaximumPaperTopMargin() const;
155         sal_uInt32 GetMaximumPaperBottomMargin() const;
156 
157         void SetMaximumPaperWidth(sal_uInt32 nNew);
158         void SetMaximumPaperHeight(sal_uInt32 nNew);
159         void SetMaximumPaperLeftMargin(sal_uInt32 nNew);
160         void SetMaximumPaperRightMargin(sal_uInt32 nNew);
161         void SetMaximumPaperTopMargin(sal_uInt32 nNew);
162         void SetMaximumPaperBottomMargin(sal_uInt32 nNew);
163 
164         // #i95644# helper to check if AA is allowed on this system. Currently, for WIN its disabled
165         // and OutDevSupport_TransparentRect is checked (this  hits XRenderExtension, e.g.
166         // currently for SunRay as long as not supported there)
167         sal_Bool IsAAPossibleOnThisSystem() const;
168 
169         // primitives
170         sal_Bool    IsAntiAliasing() const;
171         sal_Bool    IsSnapHorVerLinesToDiscrete() const;
172         sal_Bool    IsSolidDragCreate() const;
173         sal_Bool    IsRenderDecoratedTextDirect() const;
174         sal_Bool    IsRenderSimpleTextDirect() const;
175         sal_uInt32  GetQuadratic3DRenderLimit() const;
176         sal_uInt32  GetQuadraticFormControlRenderLimit() const;
177 
178         void        SetAntiAliasing( sal_Bool bState );
179         void        SetSnapHorVerLinesToDiscrete( sal_Bool bState );
180         void        SetSolidDragCreate( sal_Bool bState );
181         void        SetRenderDecoratedTextDirect( sal_Bool bState );
182         void        SetRenderSimpleTextDirect( sal_Bool bState );
183         void        SetQuadratic3DRenderLimit(sal_uInt32 nNew);
184         void        SetQuadraticFormControlRenderLimit(sal_uInt32 nNew);
185 
186         // #i97672# selection settings
187         sal_Bool    IsTransparentSelection() const;
188         sal_uInt16  GetTransparentSelectionPercent() const;
189         sal_uInt16  GetSelectionMaximumLuminancePercent() const;
190 
191         // get system hilight color, limited to the maximum allowed luminance
192         // (defined in GetSelectionMaximumLuminancePercent() in SvtOptionsDrawinglayer,
193         // combined with Application::GetSettings().GetStyleSettings().GetHighlightColor())
194         Color getHilightColor() const;
195 
196         void        SetTransparentSelection( sal_Bool bState );
197         void        SetTransparentSelectionPercent( sal_uInt16 nPercent );
198         void        SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent );
199 
200     //-------------------------------------------------------------------------------------------------------------
201     //  private methods
202     //-------------------------------------------------------------------------------------------------------------
203 
204     private:
205 
206         /*-****************************************************************************************************//**
207             @short      return a reference to a static mutex
208             @descr      These class use his own static mutex to be threadsafe.
209                         We create a static mutex only for one ime and use at different times.
210 
211             @seealso    -
212 
213             @param      -
214             @return     A reference to a static mutex member.
215 
216             @onerror    -
217         *//*-*****************************************************************************************************/
218         SVT_DLLPRIVATE static ::osl::Mutex& GetOwnStaticMutex();
219 
220     //-------------------------------------------------------------------------------------------------------------
221     //  private member
222     //-------------------------------------------------------------------------------------------------------------
223 
224     private:
225 
226         /*Attention
227 
228             Don't initialize these static member in these header!
229             a) Double dfined symbols will be detected ...
230             b) and unresolved externals exist at linking time.
231             Do it in your source only.
232          */
233 
234         static SvtOptionsDrawinglayer_Impl*     m_pDataContainer    ;   /// impl. data container as dynamic pointer for smaller memory requirements!
235         static sal_Int32                        m_nRefCount         ;   /// internal ref count mechanism
236 
237 };      // class SvtOptionsDrawinglayer
238 
239 #endif  // #ifndef INCLUDED_SVTOOLS_OPTIONSDRAWINGLAYER_HXX
240