xref: /AOO41X/main/unotools/source/config/optionsdrawinglayer.cxx (revision b5088357f810cb81479bbbd0e021cd3c9835ca0d)
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 #ifdef _MSC_VER
24 #pragma hdrstop
25 #endif
26 
27 //_________________________________________________________________________________________________________________
28 //  includes
29 //_________________________________________________________________________________________________________________
30 
31 #include <unotools/optionsdrawinglayer.hxx>
32 #include <unotools/configmgr.hxx>
33 #include <unotools/configitem.hxx>
34 #include <tools/debug.hxx>
35 #include <com/sun/star/uno/Any.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
37 #include <vcl/svapp.hxx>
38 #include <vcl/outdev.hxx>
39 
40 //_________________________________________________________________________________________________________________
41 //  namespaces
42 //_________________________________________________________________________________________________________________
43 
44 using namespace ::utl                   ;
45 using namespace ::rtl                   ;
46 using namespace ::osl                   ;
47 using namespace ::com::sun::star::uno   ;
48 
49 //_________________________________________________________________________________________________________________
50 //  const
51 //_________________________________________________________________________________________________________________
52 
53 #define ROOTNODE_START                  OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Common/Drawinglayer"   ))
54 #define DEFAULT_OVERLAYBUFFER           sal_True
55 #define DEFAULT_PAINTBUFFER             sal_True
56 #define DEFAULT_STRIPE_COLOR_A          0
57 #define DEFAULT_STRIPE_COLOR_B          16581375
58 #define DEFAULT_STRIPE_LENGTH           4
59 
60 // #i73602#
61 // #i74769#, #i75172# : Change default for Calc and Writer to True
62 #define DEFAULT_OVERLAYBUFFER_CALC          sal_True
63 #define DEFAULT_OVERLAYBUFFER_WRITER        sal_True
64 #define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS   sal_True
65 
66 // #i74769#, #i75172#
67 #define DEFAULT_PAINTBUFFER_CALC            sal_True
68 #define DEFAULT_PAINTBUFFER_WRITER          sal_True
69 #define DEFAULT_PAINTBUFFER_DRAWIMPRESS     sal_True
70 
71 // #i4219#
72 #define DEFAULT_MAXIMUMPAPERWIDTH           300
73 #define DEFAULT_MAXIMUMPAPERHEIGHT          300
74 #define DEFAULT_MAXIMUMPAPERLEFTMARGIN      9999
75 #define DEFAULT_MAXIMUMPAPERRIGHTMARGIN     9999
76 #define DEFAULT_MAXIMUMPAPERTOPMARGIN       9999
77 #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN    9999
78 
79 // primitives
80 #define DEFAULT_ANTIALIASING                        sal_True
81 #define DEFAULT_SNAPHORVERLINESTODISCRETE           sal_True
82 #define DEFAULT_SOLIDDRAGCREATE                     sal_True
83 #define DEFAULT_RENDERDECORATEDTEXTDIRECT           sal_True
84 #define DEFAULT_RENDERSIMPLETEXTDIRECT              sal_True
85 #define DEFAULT_QUADRATIC3DRENDERLIMIT              1000000
86 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT     45000
87 
88 // #i97672# selection settings
89 #define DEFAULT_TRANSPARENTSELECTION                sal_True
90 #define DEFAULT_TRANSPARENTSELECTIONPERCENT         75
91 #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT    70
92 
93 #define PROPERTYNAME_OVERLAYBUFFER      OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer"    ))
94 #define PROPERTYNAME_PAINTBUFFER        OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer"      ))
95 #define PROPERTYNAME_STRIPE_COLOR_A     OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorA"     ))
96 #define PROPERTYNAME_STRIPE_COLOR_B     OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorB"     ))
97 #define PROPERTYNAME_STRIPE_LENGTH      OUString(RTL_CONSTASCII_USTRINGPARAM("StripeLength"     ))
98 
99 // #i73602#
100 #define PROPERTYNAME_OVERLAYBUFFER_CALC         OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Calc"))
101 #define PROPERTYNAME_OVERLAYBUFFER_WRITER       OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Writer"))
102 #define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS  OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_DrawImpress"))
103 
104 // #i74769#, #i75172#
105 #define PROPERTYNAME_PAINTBUFFER_CALC           OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Calc"))
106 #define PROPERTYNAME_PAINTBUFFER_WRITER         OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Writer"))
107 #define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS    OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_DrawImpress"))
108 
109 // #i4219#
110 #define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperWidth"))
111 #define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperHeight"))
112 #define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperLeftMargin"))
113 #define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperRightMargin"))
114 #define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperTopMargin"))
115 #define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperBottomMargin"))
116 
117 // primitives
118 #define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing"))
119 #define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete"))
120 #define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate"))
121 #define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect"))
122 #define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect"))
123 #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit"))
124 #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit"))
125 
126 // #i97672# selection settings
127 #define PROPERTYNAME_TRANSPARENTSELECTION OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelection"))
128 #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelectionPercent"))
129 #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionMaximumLuminancePercent"))
130 
131 #define PROPERTYHANDLE_OVERLAYBUFFER                0
132 #define PROPERTYHANDLE_PAINTBUFFER                  1
133 #define PROPERTYHANDLE_STRIPE_COLOR_A               2
134 #define PROPERTYHANDLE_STRIPE_COLOR_B               3
135 #define PROPERTYHANDLE_STRIPE_LENGTH                4
136 
137 // #i73602#
138 #define PROPERTYHANDLE_OVERLAYBUFFER_CALC           5
139 #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER         6
140 #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS    7
141 
142 // #i74769#, #i75172#
143 #define PROPERTYHANDLE_PAINTBUFFER_CALC             8
144 #define PROPERTYHANDLE_PAINTBUFFER_WRITER           9
145 #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS      10
146 
147 // #i4219#
148 #define PROPERTYHANDLE_MAXIMUMPAPERWIDTH            11
149 #define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT           12
150 #define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN       13
151 #define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN      14
152 #define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN        15
153 #define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN     16
154 
155 // primitives
156 #define PROPERTYHANDLE_ANTIALIASING                     17
157 #define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE        18
158 #define PROPERTYHANDLE_SOLIDDRAGCREATE                  19
159 #define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT        20
160 #define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT           21
161 #define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT           22
162 #define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT  23
163 
164 // #i97672# selection settings
165 #define PROPERTYHANDLE_TRANSPARENTSELECTION             24
166 #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT      25
167 #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
168 
169 #define PROPERTYCOUNT                               27
170 
171 class SvtOptionsDrawinglayer_Impl : public ConfigItem
172 {
173 public:
174 
175 //---------------------------------------------------------------------------------------------------------
176 //  constructor / destructor
177 //---------------------------------------------------------------------------------------------------------
178 
179      SvtOptionsDrawinglayer_Impl();
180     ~SvtOptionsDrawinglayer_Impl();
181 
182 //---------------------------------------------------------------------------------------------------------
183 //  overloaded methods of baseclass
184 //---------------------------------------------------------------------------------------------------------
185 
186     virtual void Commit();
187 
188 //---------------------------------------------------------------------------------------------------------
189 //  public interface
190 //---------------------------------------------------------------------------------------------------------
191 
192     sal_Bool    IsOverlayBuffer() const;
193     sal_Bool    IsPaintBuffer() const;
194     Color       GetStripeColorA() const;
195     Color       GetStripeColorB() const;
196     sal_uInt16  GetStripeLength() const;
197 
198     // #i73602#
199     sal_Bool    IsOverlayBuffer_Calc() const;
200     sal_Bool    IsOverlayBuffer_Writer() const;
201     sal_Bool    IsOverlayBuffer_DrawImpress() const;
202 
203     // #i74769#, #i75172#
204     sal_Bool    IsPaintBuffer_Calc() const;
205     sal_Bool    IsPaintBuffer_Writer() const;
206     sal_Bool    IsPaintBuffer_DrawImpress() const;
207 
208     void        SetOverlayBuffer( sal_Bool bState );
209     void        SetPaintBuffer( sal_Bool bState );
210     void        SetStripeColorA( Color aColor );
211     void        SetStripeColorB( Color aColor );
212     void        SetStripeLength( sal_uInt16 nLength );
213 
214     // #i73602#
215     void        SetOverlayBuffer_Calc( sal_Bool bState );
216     void        SetOverlayBuffer_Writer( sal_Bool bState );
217     void        SetOverlayBuffer_DrawImpress( sal_Bool bState );
218 
219     // #i74769#, #i75172#
220     void        SetPaintBuffer_Calc( sal_Bool bState );
221     void        SetPaintBuffer_Writer( sal_Bool bState );
222     void        SetPaintBuffer_DrawImpress( sal_Bool bState );
223 
224     // #i4219#
225     sal_uInt32 GetMaximumPaperWidth() const;
226     sal_uInt32 GetMaximumPaperHeight() const;
227     sal_uInt32 GetMaximumPaperLeftMargin() const;
228     sal_uInt32 GetMaximumPaperRightMargin() const;
229     sal_uInt32 GetMaximumPaperTopMargin() const;
230     sal_uInt32 GetMaximumPaperBottomMargin() const;
231 
232     void SetMaximumPaperWidth(sal_uInt32 nNew);
233     void SetMaximumPaperHeight(sal_uInt32 nNew);
234     void SetMaximumPaperLeftMargin(sal_uInt32 nNew);
235     void SetMaximumPaperRightMargin(sal_uInt32 nNew);
236     void SetMaximumPaperTopMargin(sal_uInt32 nNew);
237     void SetMaximumPaperBottomMargin(sal_uInt32 nNew);
238 
239     // helper
240     sal_Bool IsAAPossibleOnThisSystem() const;
241 
242     // primitives
243     sal_Bool    IsAntiAliasing() const;
244     sal_Bool    IsSnapHorVerLinesToDiscrete() const;
245     sal_Bool    IsSolidDragCreate() const;
246     sal_Bool    IsRenderDecoratedTextDirect() const;
247     sal_Bool    IsRenderSimpleTextDirect() const;
248     sal_uInt32  GetQuadratic3DRenderLimit() const;
249     sal_uInt32  GetQuadraticFormControlRenderLimit() const;
250 
251     void        SetAntiAliasing( sal_Bool bState );
252     void        SetSnapHorVerLinesToDiscrete( sal_Bool bState );
253     void        SetSolidDragCreate( sal_Bool bState );
254     void        SetRenderDecoratedTextDirect( sal_Bool bState );
255     void        SetRenderSimpleTextDirect( sal_Bool bState );
256     void        SetQuadratic3DRenderLimit(sal_uInt32 nNew);
257     void        SetQuadraticFormControlRenderLimit(sal_uInt32 nNew);
258 
259     // #i97672# selection settings
260     sal_Bool    IsTransparentSelection() const;
261     sal_uInt16  GetTransparentSelectionPercent() const;
262     sal_uInt16  GetSelectionMaximumLuminancePercent() const;
263 
264     void        SetTransparentSelection( sal_Bool bState );
265     void        SetTransparentSelectionPercent( sal_uInt16 nPercent );
266     void        SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent );
267 
268 //-------------------------------------------------------------------------------------------------------------
269 //  private methods
270 //-------------------------------------------------------------------------------------------------------------
271 
272 private:
273 
274     static Sequence< OUString > impl_GetPropertyNames();
275 
276 //-------------------------------------------------------------------------------------------------------------
277 //  private member
278 //-------------------------------------------------------------------------------------------------------------
279 
280 private:
281 
282         sal_Bool    m_bOverlayBuffer;
283         sal_Bool    m_bPaintBuffer;
284         Color       m_bStripeColorA;
285         Color       m_bStripeColorB;
286         sal_uInt16  m_nStripeLength;
287 
288         // #i73602#
289         sal_Bool    m_bOverlayBuffer_Calc;
290         sal_Bool    m_bOverlayBuffer_Writer;
291         sal_Bool    m_bOverlayBuffer_DrawImpress;
292 
293         // #i74769#, #i75172#
294         sal_Bool    m_bPaintBuffer_Calc;
295         sal_Bool    m_bPaintBuffer_Writer;
296         sal_Bool    m_bPaintBuffer_DrawImpress;
297 
298         // #i4219#
299         sal_uInt32  m_nMaximumPaperWidth;
300         sal_uInt32  m_nMaximumPaperHeight;
301         sal_uInt32  m_nMaximumPaperLeftMargin;
302         sal_uInt32  m_nMaximumPaperRightMargin;
303         sal_uInt32  m_nMaximumPaperTopMargin;
304         sal_uInt32  m_nMaximumPaperBottomMargin;
305 
306         // primitives
307         sal_Bool    m_bAntiAliasing;
308         sal_Bool    m_bSnapHorVerLinesToDiscrete;
309         sal_Bool    m_bSolidDragCreate;
310         sal_Bool    m_bRenderDecoratedTextDirect;
311         sal_Bool    m_bRenderSimpleTextDirect;
312         sal_uInt32  m_nQuadratic3DRenderLimit;
313         sal_uInt32  m_nQuadraticFormControlRenderLimit;
314 
315         // #i97672# selection settings
316         sal_uInt16  m_nTransparentSelectionPercent;
317         sal_uInt16  m_nSelectionMaximumLuminancePercent;
318         sal_Bool    m_bTransparentSelection;
319 
320         // local values
321         bool        m_bAllowAA : 1;
322         bool        m_bAllowAAChecked : 1;
323 };
324 
325 //_________________________________________________________________________________________________________________
326 //  definitions
327 //_________________________________________________________________________________________________________________
328 
329 //*****************************************************************************************************************
330 //  constructor
331 //*****************************************************************************************************************
SvtOptionsDrawinglayer_Impl()332 SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
333     ConfigItem( ROOTNODE_START  ),
334     m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ),
335     m_bPaintBuffer( DEFAULT_PAINTBUFFER ),
336     m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)),
337     m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)),
338     m_nStripeLength(DEFAULT_STRIPE_LENGTH),
339 
340     // #i73602#
341     m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
342     m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
343     m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
344 
345     // #i74769#, #i75172#
346     m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
347     m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
348     m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
349 
350     // #i4219#
351     m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH),
352     m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT),
353     m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN),
354     m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN),
355     m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN),
356     m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN),
357 
358     // primitives
359     m_bAntiAliasing(DEFAULT_ANTIALIASING),
360     m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE),
361     m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE),
362     m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT),
363     m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT),
364     m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT),
365     m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT),
366 
367     // #i97672# selection settings
368     m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
369     m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
370     m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
371 
372     // local values
373     m_bAllowAA(true),
374     m_bAllowAAChecked(false)
375 {
376     Sequence< OUString >    seqNames( impl_GetPropertyNames() );
377     Sequence< Any >         seqValues   = GetProperties( seqNames ) ;
378 
379     DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
380 
381     // Copy values from list in right order to ouer internal member.
382     sal_Int32 nPropertyCount = seqValues.getLength();
383     sal_Int32 nProperty = 0;
384 
385     for( nProperty=0; nProperty<nPropertyCount; ++nProperty )
386     {
387         DBG_ASSERT( !(seqValues[nProperty].hasValue()==sal_False), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nInvalid property value for property detected!\n" );
388 
389         switch( nProperty )
390         {
391             case PROPERTYHANDLE_OVERLAYBUFFER:
392             {
393                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
394                 seqValues[nProperty] >>= m_bOverlayBuffer;
395             }
396             break;
397 
398             case PROPERTYHANDLE_PAINTBUFFER:
399             {
400                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
401                 seqValues[nProperty] >>= m_bPaintBuffer;
402             }
403             break;
404 
405             case PROPERTYHANDLE_STRIPE_COLOR_A:
406             {
407                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
408                 sal_Int32 nValue = 0;
409                 seqValues[nProperty] >>= nValue;
410                 m_bStripeColorA = nValue;
411             }
412             break;
413 
414             case PROPERTYHANDLE_STRIPE_COLOR_B:
415             {
416                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
417                 sal_Int32 nValue = 0;
418                 seqValues[nProperty] >>= nValue;
419                 m_bStripeColorB = nValue;
420             }
421             break;
422 
423             case PROPERTYHANDLE_STRIPE_LENGTH:
424             {
425                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
426                 seqValues[nProperty] >>= m_nStripeLength;
427             }
428             break;
429 
430             // #i73602#
431             case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
432             {
433                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" );
434                 seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
435             }
436             break;
437 
438             case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
439             {
440                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" );
441                 seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
442             }
443             break;
444 
445             case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
446             {
447                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" );
448                 seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
449             }
450             break;
451 
452             // #i74769#, #i75172#
453             case PROPERTYHANDLE_PAINTBUFFER_CALC:
454             {
455                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" );
456                 seqValues[nProperty] >>= m_bPaintBuffer_Calc;
457             }
458             break;
459 
460             case PROPERTYHANDLE_PAINTBUFFER_WRITER:
461             {
462                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" );
463                 seqValues[nProperty] >>= m_bPaintBuffer_Writer;
464             }
465             break;
466 
467             case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
468             {
469                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" );
470                 seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
471             }
472             break;
473 
474             // #i4219#
475             case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
476             {
477                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
478                 seqValues[nProperty] >>= m_nMaximumPaperWidth;
479             }
480             break;
481 
482             case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
483             {
484                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
485                 seqValues[nProperty] >>= m_nMaximumPaperHeight;
486             }
487             break;
488 
489             case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
490             {
491                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
492                 seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
493             }
494             break;
495 
496             case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
497             {
498                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
499                 seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
500             }
501             break;
502 
503             case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
504             {
505                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
506                 seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
507             }
508             break;
509 
510             case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
511             {
512                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
513                 seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
514             }
515             break;
516 
517             // primitives
518             case PROPERTYHANDLE_ANTIALIASING:
519             {
520                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
521                 seqValues[nProperty] >>= m_bAntiAliasing;
522             }
523             break;
524 
525             // primitives
526             case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
527             {
528                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
529                 seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
530             }
531             break;
532 
533             case PROPERTYHANDLE_SOLIDDRAGCREATE:
534             {
535                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
536                 seqValues[nProperty] >>= m_bSolidDragCreate;
537             }
538             break;
539 
540             case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
541             {
542                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
543                 seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
544             }
545             break;
546 
547             case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
548             {
549                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
550                 seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
551             }
552             break;
553 
554             case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
555             {
556                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
557                 seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
558             }
559             break;
560 
561             case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
562             {
563                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
564                 seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
565             }
566             break;
567 
568             // #i97672# selection settings
569             case PROPERTYHANDLE_TRANSPARENTSELECTION:
570             {
571                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
572                 seqValues[nProperty] >>= m_bTransparentSelection;
573             }
574             break;
575 
576             case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
577             {
578                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
579                 seqValues[nProperty] >>= m_nTransparentSelectionPercent;
580             }
581 
582             case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
583             {
584                 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
585                 seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
586             }
587             break;
588         }
589     }
590 }
591 
592 //*****************************************************************************************************************
593 //  destructor
594 //*****************************************************************************************************************
~SvtOptionsDrawinglayer_Impl()595 SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
596 {
597     if( IsModified() )
598         Commit();
599 }
600 
601 //*****************************************************************************************************************
602 //  Commit
603 //*****************************************************************************************************************
Commit()604 void SvtOptionsDrawinglayer_Impl::Commit()
605 {
606     Sequence< OUString >    aSeqNames( impl_GetPropertyNames() );
607     Sequence< Any >         aSeqValues( aSeqNames.getLength() );
608 
609     for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
610     {
611         switch( nProperty )
612         {
613             case PROPERTYHANDLE_OVERLAYBUFFER:
614                 aSeqValues[nProperty] <<= m_bOverlayBuffer;
615             break;
616 
617             case PROPERTYHANDLE_PAINTBUFFER:
618                 aSeqValues[nProperty] <<= m_bPaintBuffer;
619             break;
620 
621             case PROPERTYHANDLE_STRIPE_COLOR_A:
622                 aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
623             break;
624 
625             case PROPERTYHANDLE_STRIPE_COLOR_B:
626                 aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
627             break;
628 
629             case PROPERTYHANDLE_STRIPE_LENGTH:
630                 aSeqValues[nProperty] <<= m_nStripeLength;
631             break;
632 
633             // #i73602#
634             case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
635                 aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
636             break;
637 
638             case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
639                 aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
640             break;
641 
642             case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
643                 aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
644             break;
645 
646             // #i74769#, #i75172#
647             case PROPERTYHANDLE_PAINTBUFFER_CALC:
648                 aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
649             break;
650 
651             case PROPERTYHANDLE_PAINTBUFFER_WRITER:
652                 aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
653             break;
654 
655             case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
656                 aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
657             break;
658 
659             // #i4219#
660             case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
661                 aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
662             break;
663 
664             case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
665                 aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
666             break;
667 
668             case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
669                 aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
670             break;
671 
672             case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
673                 aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
674             break;
675 
676             case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
677                 aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
678             break;
679 
680             case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
681                 aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
682             break;
683 
684             // primitives
685             case PROPERTYHANDLE_ANTIALIASING:
686                 aSeqValues[nProperty] <<= m_bAntiAliasing;
687             break;
688 
689             case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
690                 aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
691             break;
692 
693             case PROPERTYHANDLE_SOLIDDRAGCREATE:
694                 aSeqValues[nProperty] <<= m_bSolidDragCreate;
695             break;
696 
697             case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
698                 aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
699             break;
700 
701             case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
702                 aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
703             break;
704 
705             case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
706                 aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
707             break;
708 
709             case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
710                 aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
711             break;
712 
713             // #i97672# selection settings
714             case PROPERTYHANDLE_TRANSPARENTSELECTION:
715                 aSeqValues[nProperty] <<= m_bTransparentSelection;
716             break;
717 
718             case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
719                 aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
720             break;
721 
722             case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
723                 aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
724             break;
725         }
726     }
727 
728     PutProperties( aSeqNames, aSeqValues );
729 }
730 
731 //*****************************************************************************************************************
732 //  public method
733 //*****************************************************************************************************************
IsOverlayBuffer() const734 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const
735 {
736     return m_bOverlayBuffer;
737 }
738 
739 //*****************************************************************************************************************
740 //  public method
741 //*****************************************************************************************************************
IsPaintBuffer() const742 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const
743 {
744     return m_bPaintBuffer;
745 }
746 
747 //*****************************************************************************************************************
748 //  public method
749 //*****************************************************************************************************************
GetStripeColorA() const750 Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const
751 {
752     return m_bStripeColorA;
753 }
754 
755 //*****************************************************************************************************************
756 //  public method
757 //*****************************************************************************************************************
GetStripeColorB() const758 Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const
759 {
760     return m_bStripeColorB;
761 }
762 
763 //*****************************************************************************************************************
764 //  public method
765 //*****************************************************************************************************************
GetStripeLength() const766 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const
767 {
768     return m_nStripeLength;
769 }
770 
771 // #i73602#
IsOverlayBuffer_Calc() const772 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const
773 {
774     return m_bOverlayBuffer_Calc;
775 }
776 
IsOverlayBuffer_Writer() const777 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const
778 {
779     return m_bOverlayBuffer_Writer;
780 }
781 
IsOverlayBuffer_DrawImpress() const782 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const
783 {
784     return m_bOverlayBuffer_DrawImpress;
785 }
786 
787 // #i74769#, #i75172#
IsPaintBuffer_Calc() const788 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const
789 {
790     return m_bPaintBuffer_Calc;
791 }
792 
IsPaintBuffer_Writer() const793 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const
794 {
795     return m_bPaintBuffer_Writer;
796 }
797 
IsPaintBuffer_DrawImpress() const798 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const
799 {
800     return m_bPaintBuffer_DrawImpress;
801 }
802 
803 // #i4219#
GetMaximumPaperWidth() const804 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const
805 {
806     return m_nMaximumPaperWidth;
807 }
808 
GetMaximumPaperHeight() const809 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const
810 {
811     return m_nMaximumPaperHeight;
812 }
813 
GetMaximumPaperLeftMargin() const814 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const
815 {
816     return m_nMaximumPaperLeftMargin;
817 }
818 
GetMaximumPaperRightMargin() const819 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const
820 {
821     return m_nMaximumPaperRightMargin;
822 }
823 
GetMaximumPaperTopMargin() const824 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const
825 {
826     return m_nMaximumPaperTopMargin;
827 }
828 
GetMaximumPaperBottomMargin() const829 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const
830 {
831     return m_nMaximumPaperBottomMargin;
832 }
833 
834 //*****************************************************************************************************************
835 //  public method
836 //*****************************************************************************************************************
SetOverlayBuffer(sal_Bool bState)837 void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer( sal_Bool bState )
838 {
839     if(m_bOverlayBuffer != bState)
840     {
841         m_bOverlayBuffer = bState;
842         SetModified();
843     }
844 }
845 
846 //*****************************************************************************************************************
847 //  public method
848 //*****************************************************************************************************************
SetPaintBuffer(sal_Bool bState)849 void SvtOptionsDrawinglayer_Impl::SetPaintBuffer( sal_Bool bState )
850 {
851     if(m_bPaintBuffer != bState)
852     {
853         m_bPaintBuffer = bState;
854         SetModified();
855     }
856 }
857 
858 //*****************************************************************************************************************
859 //  public method
860 //*****************************************************************************************************************
SetStripeColorA(Color aColor)861 void SvtOptionsDrawinglayer_Impl::SetStripeColorA( Color aColor )
862 {
863     if(m_bStripeColorA != aColor)
864     {
865         m_bStripeColorA = aColor;
866         SetModified();
867     }
868 }
869 
870 //*****************************************************************************************************************
871 //  public method
872 //*****************************************************************************************************************
SetStripeColorB(Color aColor)873 void SvtOptionsDrawinglayer_Impl::SetStripeColorB( Color aColor )
874 {
875     if(m_bStripeColorB != aColor)
876     {
877         m_bStripeColorB = aColor;
878         SetModified();
879     }
880 }
881 
882 //*****************************************************************************************************************
883 //  public method
884 //*****************************************************************************************************************
SetStripeLength(sal_uInt16 nLength)885 void SvtOptionsDrawinglayer_Impl::SetStripeLength( sal_uInt16 nLength )
886 {
887     if(m_nStripeLength != nLength)
888     {
889         m_nStripeLength = nLength;
890         SetModified();
891     }
892 }
893 
894 // #i73602#
SetOverlayBuffer_Calc(sal_Bool bState)895 void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Calc( sal_Bool bState )
896 {
897     if(m_bOverlayBuffer_Calc != bState)
898     {
899         m_bOverlayBuffer_Calc = bState;
900         SetModified();
901     }
902 }
903 
SetOverlayBuffer_Writer(sal_Bool bState)904 void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_Writer( sal_Bool bState )
905 {
906     if(m_bOverlayBuffer_Writer != bState)
907     {
908         m_bOverlayBuffer_Writer = bState;
909         SetModified();
910     }
911 }
912 
SetOverlayBuffer_DrawImpress(sal_Bool bState)913 void SvtOptionsDrawinglayer_Impl::SetOverlayBuffer_DrawImpress( sal_Bool bState )
914 {
915     if(m_bOverlayBuffer_DrawImpress != bState)
916     {
917         m_bOverlayBuffer_DrawImpress = bState;
918         SetModified();
919     }
920 }
921 
922 // #i74769#, #i75172#
SetPaintBuffer_Calc(sal_Bool bState)923 void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Calc( sal_Bool bState )
924 {
925     if(m_bPaintBuffer_Calc != bState)
926     {
927         m_bPaintBuffer_Calc = bState;
928         SetModified();
929     }
930 }
931 
SetPaintBuffer_Writer(sal_Bool bState)932 void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_Writer( sal_Bool bState )
933 {
934     if(m_bPaintBuffer_Writer != bState)
935     {
936         m_bPaintBuffer_Writer = bState;
937         SetModified();
938     }
939 }
940 
SetPaintBuffer_DrawImpress(sal_Bool bState)941 void SvtOptionsDrawinglayer_Impl::SetPaintBuffer_DrawImpress( sal_Bool bState )
942 {
943     if(m_bPaintBuffer_DrawImpress != bState)
944     {
945         m_bPaintBuffer_DrawImpress = bState;
946         SetModified();
947     }
948 }
949 
950 // #i4219#
SetMaximumPaperWidth(sal_uInt32 nNew)951 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperWidth( sal_uInt32 nNew )
952 {
953     if(m_nMaximumPaperWidth != nNew)
954     {
955         m_nMaximumPaperWidth = nNew;
956         SetModified();
957     }
958 }
959 
SetMaximumPaperHeight(sal_uInt32 nNew)960 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperHeight( sal_uInt32 nNew )
961 {
962     if(m_nMaximumPaperHeight != nNew)
963     {
964         m_nMaximumPaperHeight = nNew;
965         SetModified();
966     }
967 }
968 
SetMaximumPaperLeftMargin(sal_uInt32 nNew)969 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperLeftMargin( sal_uInt32 nNew )
970 {
971     if(m_nMaximumPaperLeftMargin != nNew)
972     {
973         m_nMaximumPaperLeftMargin = nNew;
974         SetModified();
975     }
976 }
977 
SetMaximumPaperRightMargin(sal_uInt32 nNew)978 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperRightMargin( sal_uInt32 nNew )
979 {
980     if(m_nMaximumPaperRightMargin != nNew)
981     {
982         m_nMaximumPaperRightMargin = nNew;
983         SetModified();
984     }
985 }
986 
SetMaximumPaperTopMargin(sal_uInt32 nNew)987 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperTopMargin( sal_uInt32 nNew )
988 {
989     if(m_nMaximumPaperTopMargin != nNew)
990     {
991         m_nMaximumPaperTopMargin = nNew;
992         SetModified();
993     }
994 }
995 
SetMaximumPaperBottomMargin(sal_uInt32 nNew)996 void SvtOptionsDrawinglayer_Impl::SetMaximumPaperBottomMargin( sal_uInt32 nNew )
997 {
998     if(m_nMaximumPaperBottomMargin != nNew)
999     {
1000         m_nMaximumPaperBottomMargin = nNew;
1001         SetModified();
1002     }
1003 }
1004 
1005 // helper
IsAAPossibleOnThisSystem() const1006 sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
1007 {
1008     if(!m_bAllowAAChecked)
1009     {
1010         SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
1011         pThat->m_bAllowAAChecked = true;
1012 
1013 #ifdef WIN32
1014         // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced
1015         // in the future to use canvases and the canvas renderer, thus a AA-abled
1016         // canvas needs to be checked here in the future.
1017         // Currently, just allow AA for WIN32
1018 #endif
1019 
1020         // check XRenderExtension
1021         if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect ))
1022         {
1023             pThat->m_bAllowAA = false;
1024         }
1025     }
1026 
1027     return m_bAllowAA;
1028 }
1029 
1030 // primitives
IsAntiAliasing() const1031 sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const
1032 {
1033     return m_bAntiAliasing;
1034 }
1035 
IsSnapHorVerLinesToDiscrete() const1036 sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const
1037 {
1038     return m_bSnapHorVerLinesToDiscrete;
1039 }
1040 
IsSolidDragCreate() const1041 sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const
1042 {
1043     return m_bSolidDragCreate;
1044 }
1045 
IsRenderDecoratedTextDirect() const1046 sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const
1047 {
1048     return m_bRenderDecoratedTextDirect;
1049 }
1050 
IsRenderSimpleTextDirect() const1051 sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const
1052 {
1053     return m_bRenderSimpleTextDirect;
1054 }
1055 
GetQuadratic3DRenderLimit() const1056 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const
1057 {
1058     return m_nQuadratic3DRenderLimit;
1059 }
1060 
GetQuadraticFormControlRenderLimit() const1061 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const
1062 {
1063     return m_nQuadraticFormControlRenderLimit;
1064 }
1065 
SetAntiAliasing(sal_Bool bState)1066 void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState )
1067 {
1068     if(m_bAntiAliasing != bState)
1069     {
1070         m_bAntiAliasing = bState;
1071         SetModified();
1072     }
1073 }
1074 
SetSnapHorVerLinesToDiscrete(sal_Bool bState)1075 void SvtOptionsDrawinglayer_Impl::SetSnapHorVerLinesToDiscrete( sal_Bool bState )
1076 {
1077     if(m_bSnapHorVerLinesToDiscrete != bState)
1078     {
1079         m_bSnapHorVerLinesToDiscrete = bState;
1080         SetModified();
1081     }
1082 }
1083 
SetSolidDragCreate(sal_Bool bState)1084 void SvtOptionsDrawinglayer_Impl::SetSolidDragCreate( sal_Bool bState )
1085 {
1086     if(m_bSolidDragCreate != bState)
1087     {
1088         m_bSolidDragCreate = bState;
1089         SetModified();
1090     }
1091 }
1092 
SetRenderDecoratedTextDirect(sal_Bool bState)1093 void SvtOptionsDrawinglayer_Impl::SetRenderDecoratedTextDirect( sal_Bool bState )
1094 {
1095     if(m_bRenderDecoratedTextDirect != bState)
1096     {
1097         m_bRenderDecoratedTextDirect = bState;
1098         SetModified();
1099     }
1100 }
1101 
SetRenderSimpleTextDirect(sal_Bool bState)1102 void SvtOptionsDrawinglayer_Impl::SetRenderSimpleTextDirect( sal_Bool bState )
1103 {
1104     if(m_bRenderSimpleTextDirect != bState)
1105     {
1106         m_bRenderSimpleTextDirect = bState;
1107         SetModified();
1108     }
1109 }
1110 
SetQuadratic3DRenderLimit(sal_uInt32 nNew)1111 void SvtOptionsDrawinglayer_Impl::SetQuadratic3DRenderLimit(sal_uInt32 nNew)
1112 {
1113     if(m_nQuadratic3DRenderLimit != nNew)
1114     {
1115         m_nQuadratic3DRenderLimit = nNew;
1116         SetModified();
1117     }
1118 }
1119 
SetQuadraticFormControlRenderLimit(sal_uInt32 nNew)1120 void SvtOptionsDrawinglayer_Impl::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew)
1121 {
1122     if(m_nQuadraticFormControlRenderLimit != nNew)
1123     {
1124         m_nQuadraticFormControlRenderLimit = nNew;
1125         SetModified();
1126     }
1127 }
1128 
1129 // #i97672# selection settings
IsTransparentSelection() const1130 sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const
1131 {
1132     return m_bTransparentSelection;
1133 }
1134 
SetTransparentSelection(sal_Bool bState)1135 void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState )
1136 {
1137     if(m_bTransparentSelection != bState)
1138     {
1139         m_bTransparentSelection = bState;
1140         SetModified();
1141     }
1142 }
1143 
SetTransparentSelectionPercent(sal_uInt16 nPercent)1144 void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1145 {
1146     if(m_nTransparentSelectionPercent != nPercent)
1147     {
1148         m_nTransparentSelectionPercent = nPercent;
1149         SetModified();
1150     }
1151 }
1152 
GetTransparentSelectionPercent() const1153 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const
1154 {
1155     return m_nTransparentSelectionPercent;
1156 }
1157 
SetSelectionMaximumLuminancePercent(sal_uInt16 nPercent)1158 void SvtOptionsDrawinglayer_Impl::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent )
1159 {
1160     if(m_nSelectionMaximumLuminancePercent != nPercent)
1161     {
1162         m_nSelectionMaximumLuminancePercent = nPercent;
1163         SetModified();
1164     }
1165 }
1166 
GetSelectionMaximumLuminancePercent() const1167 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const
1168 {
1169     return m_nSelectionMaximumLuminancePercent;
1170 }
1171 
1172 //*****************************************************************************************************************
1173 //  private method
1174 //*****************************************************************************************************************
impl_GetPropertyNames()1175 Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
1176 {
1177     // Build static list of configuration key names.
1178     static const OUString pProperties[] =
1179     {
1180         PROPERTYNAME_OVERLAYBUFFER      ,
1181         PROPERTYNAME_PAINTBUFFER        ,
1182         PROPERTYNAME_STRIPE_COLOR_A     ,
1183         PROPERTYNAME_STRIPE_COLOR_B     ,
1184         PROPERTYNAME_STRIPE_LENGTH      ,
1185 
1186         // #i73602#
1187         PROPERTYNAME_OVERLAYBUFFER_CALC,
1188         PROPERTYNAME_OVERLAYBUFFER_WRITER,
1189         PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
1190 
1191         // #i74769#, #i75172#
1192         PROPERTYNAME_PAINTBUFFER_CALC,
1193         PROPERTYNAME_PAINTBUFFER_WRITER,
1194         PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
1195 
1196         // #i4219#
1197         PROPERTYNAME_MAXIMUMPAPERWIDTH,
1198         PROPERTYNAME_MAXIMUMPAPERHEIGHT,
1199         PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
1200         PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
1201         PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
1202         PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
1203 
1204         // primitives
1205         PROPERTYNAME_ANTIALIASING,
1206         PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
1207         PROPERTYNAME_SOLIDDRAGCREATE,
1208         PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
1209         PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
1210         PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
1211         PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
1212 
1213         // #i97672# selection settings
1214         PROPERTYNAME_TRANSPARENTSELECTION,
1215         PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
1216         PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
1217     };
1218 
1219     // Initialize return sequence with these list ...
1220     static const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
1221     // ... and return it.
1222     return seqPropertyNames;
1223 }
1224 
1225 //*****************************************************************************************************************
1226 //  initialize static member
1227 //  DON'T DO IT IN YOUR HEADER!
1228 //  see definition for further informations
1229 //*****************************************************************************************************************
1230 SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
1231 sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
1232 
1233 //*****************************************************************************************************************
1234 //  constructor
1235 //*****************************************************************************************************************
SvtOptionsDrawinglayer()1236 SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
1237 {
1238     // Global access, must be guarded (multithreading!).
1239     MutexGuard aGuard( GetOwnStaticMutex() );
1240     // Increase ouer refcount ...
1241     ++m_nRefCount;
1242     // ... and initialize ouer data container only if it not already!
1243     if( m_pDataContainer == NULL )
1244     {
1245         m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
1246     }
1247 }
1248 
1249 //*****************************************************************************************************************
1250 //  destructor
1251 //*****************************************************************************************************************
~SvtOptionsDrawinglayer()1252 SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
1253 {
1254     // Global access, must be guarded (multithreading!)
1255     MutexGuard aGuard( GetOwnStaticMutex() );
1256     // Decrease ouer refcount.
1257     --m_nRefCount;
1258     // If last instance was deleted ...
1259     // we must destroy ouer static data container!
1260     if( m_nRefCount <= 0 )
1261     {
1262         delete m_pDataContainer;
1263         m_pDataContainer = NULL;
1264     }
1265 }
1266 
1267 //*****************************************************************************************************************
1268 //  public method
1269 //*****************************************************************************************************************
IsOverlayBuffer() const1270 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
1271 {
1272     MutexGuard aGuard( GetOwnStaticMutex() );
1273     return m_pDataContainer->IsOverlayBuffer();
1274 }
1275 
1276 //*****************************************************************************************************************
1277 //  public method
1278 //*****************************************************************************************************************
IsPaintBuffer() const1279 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const
1280 {
1281     MutexGuard aGuard( GetOwnStaticMutex() );
1282     return m_pDataContainer->IsPaintBuffer();
1283 }
1284 
1285 //*****************************************************************************************************************
1286 //  public method
1287 //*****************************************************************************************************************
GetStripeColorA() const1288 Color SvtOptionsDrawinglayer::GetStripeColorA() const
1289 {
1290     MutexGuard aGuard( GetOwnStaticMutex() );
1291     return m_pDataContainer->GetStripeColorA();
1292 }
1293 
1294 //*****************************************************************************************************************
1295 //  public method
1296 //*****************************************************************************************************************
GetStripeColorB() const1297 Color SvtOptionsDrawinglayer::GetStripeColorB() const
1298 {
1299     MutexGuard aGuard( GetOwnStaticMutex() );
1300     return m_pDataContainer->GetStripeColorB();
1301 }
1302 
1303 //*****************************************************************************************************************
1304 //  public method
1305 //*****************************************************************************************************************
GetStripeLength() const1306 sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
1307 {
1308     MutexGuard aGuard( GetOwnStaticMutex() );
1309     return m_pDataContainer->GetStripeLength();
1310 }
1311 
1312 // #i73602#
IsOverlayBuffer_Calc() const1313 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
1314 {
1315     MutexGuard aGuard( GetOwnStaticMutex() );
1316     return m_pDataContainer->IsOverlayBuffer_Calc();
1317 }
1318 
IsOverlayBuffer_Writer() const1319 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
1320 {
1321     MutexGuard aGuard( GetOwnStaticMutex() );
1322     return m_pDataContainer->IsOverlayBuffer_Writer();
1323 }
1324 
IsOverlayBuffer_DrawImpress() const1325 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
1326 {
1327     MutexGuard aGuard( GetOwnStaticMutex() );
1328     return m_pDataContainer->IsOverlayBuffer_DrawImpress();
1329 }
1330 
1331 // #i74769#, #i75172#
IsPaintBuffer_Calc() const1332 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
1333 {
1334     MutexGuard aGuard( GetOwnStaticMutex() );
1335     return m_pDataContainer->IsPaintBuffer_Calc();
1336 }
1337 
IsPaintBuffer_Writer() const1338 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
1339 {
1340     MutexGuard aGuard( GetOwnStaticMutex() );
1341     return m_pDataContainer->IsPaintBuffer_Writer();
1342 }
1343 
IsPaintBuffer_DrawImpress() const1344 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
1345 {
1346     MutexGuard aGuard( GetOwnStaticMutex() );
1347     return m_pDataContainer->IsPaintBuffer_DrawImpress();
1348 }
1349 
1350 // #i4219#
GetMaximumPaperWidth() const1351 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
1352 {
1353     MutexGuard aGuard( GetOwnStaticMutex() );
1354     return m_pDataContainer->GetMaximumPaperWidth();
1355 }
1356 
GetMaximumPaperHeight() const1357 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
1358 {
1359     MutexGuard aGuard( GetOwnStaticMutex() );
1360     return m_pDataContainer->GetMaximumPaperHeight();
1361 }
1362 
GetMaximumPaperLeftMargin() const1363 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
1364 {
1365     MutexGuard aGuard( GetOwnStaticMutex() );
1366     return m_pDataContainer->GetMaximumPaperLeftMargin();
1367 }
1368 
GetMaximumPaperRightMargin() const1369 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
1370 {
1371     MutexGuard aGuard( GetOwnStaticMutex() );
1372     return m_pDataContainer->GetMaximumPaperRightMargin();
1373 }
1374 
GetMaximumPaperTopMargin() const1375 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
1376 {
1377     MutexGuard aGuard( GetOwnStaticMutex() );
1378     return m_pDataContainer->GetMaximumPaperTopMargin();
1379 }
1380 
GetMaximumPaperBottomMargin() const1381 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
1382 {
1383     MutexGuard aGuard( GetOwnStaticMutex() );
1384     return m_pDataContainer->GetMaximumPaperBottomMargin();
1385 }
1386 
1387 //*****************************************************************************************************************
1388 //  public method
1389 //*****************************************************************************************************************
SetOverlayBuffer(sal_Bool bState)1390 void SvtOptionsDrawinglayer::SetOverlayBuffer( sal_Bool bState )
1391 {
1392     MutexGuard aGuard( GetOwnStaticMutex() );
1393     m_pDataContainer->SetOverlayBuffer( bState );
1394 }
1395 
1396 //*****************************************************************************************************************
1397 //  public method
1398 //*****************************************************************************************************************
SetPaintBuffer(sal_Bool bState)1399 void SvtOptionsDrawinglayer::SetPaintBuffer( sal_Bool bState )
1400 {
1401     MutexGuard aGuard( GetOwnStaticMutex() );
1402     m_pDataContainer->SetPaintBuffer( bState );
1403 }
1404 
1405 //*****************************************************************************************************************
1406 //  public method
1407 //*****************************************************************************************************************
SetStripeColorA(Color aColor)1408 void SvtOptionsDrawinglayer::SetStripeColorA( Color aColor )
1409 {
1410     MutexGuard aGuard( GetOwnStaticMutex() );
1411     m_pDataContainer->SetStripeColorA( aColor );
1412 }
1413 
1414 //*****************************************************************************************************************
1415 //  public method
1416 //*****************************************************************************************************************
SetStripeColorB(Color aColor)1417 void SvtOptionsDrawinglayer::SetStripeColorB( Color aColor )
1418 {
1419     MutexGuard aGuard( GetOwnStaticMutex() );
1420     m_pDataContainer->SetStripeColorB( aColor );
1421 }
1422 
1423 //*****************************************************************************************************************
1424 //  public method
1425 //*****************************************************************************************************************
SetStripeLength(sal_uInt16 nLength)1426 void SvtOptionsDrawinglayer::SetStripeLength( sal_uInt16 nLength )
1427 {
1428     MutexGuard aGuard( GetOwnStaticMutex() );
1429     m_pDataContainer->SetStripeLength( nLength );
1430 }
1431 
1432 // #i73602#
SetOverlayBuffer_Calc(sal_Bool bState)1433 void SvtOptionsDrawinglayer::SetOverlayBuffer_Calc( sal_Bool bState )
1434 {
1435     MutexGuard aGuard( GetOwnStaticMutex() );
1436     m_pDataContainer->SetOverlayBuffer_Calc( bState );
1437 }
1438 
SetOverlayBuffer_Writer(sal_Bool bState)1439 void SvtOptionsDrawinglayer::SetOverlayBuffer_Writer( sal_Bool bState )
1440 {
1441     MutexGuard aGuard( GetOwnStaticMutex() );
1442     m_pDataContainer->SetOverlayBuffer_Writer( bState );
1443 }
1444 
SetOverlayBuffer_DrawImpress(sal_Bool bState)1445 void SvtOptionsDrawinglayer::SetOverlayBuffer_DrawImpress( sal_Bool bState )
1446 {
1447     MutexGuard aGuard( GetOwnStaticMutex() );
1448     m_pDataContainer->SetOverlayBuffer_DrawImpress( bState );
1449 }
1450 
1451 // #i74769#, #i75172#
SetPaintBuffer_Calc(sal_Bool bState)1452 void SvtOptionsDrawinglayer::SetPaintBuffer_Calc( sal_Bool bState )
1453 {
1454     MutexGuard aGuard( GetOwnStaticMutex() );
1455     m_pDataContainer->SetPaintBuffer_Calc( bState );
1456 }
1457 
SetPaintBuffer_Writer(sal_Bool bState)1458 void SvtOptionsDrawinglayer::SetPaintBuffer_Writer( sal_Bool bState )
1459 {
1460     MutexGuard aGuard( GetOwnStaticMutex() );
1461     m_pDataContainer->SetPaintBuffer_Writer( bState );
1462 }
1463 
SetPaintBuffer_DrawImpress(sal_Bool bState)1464 void SvtOptionsDrawinglayer::SetPaintBuffer_DrawImpress( sal_Bool bState )
1465 {
1466     MutexGuard aGuard( GetOwnStaticMutex() );
1467     m_pDataContainer->SetPaintBuffer_DrawImpress( bState );
1468 }
1469 
1470 // #i4219#
SetMaximumPaperWidth(sal_uInt32 nNew)1471 void SvtOptionsDrawinglayer::SetMaximumPaperWidth( sal_uInt32 nNew )
1472 {
1473     MutexGuard aGuard( GetOwnStaticMutex() );
1474     m_pDataContainer->SetMaximumPaperWidth( nNew );
1475 }
1476 
SetMaximumPaperHeight(sal_uInt32 nNew)1477 void SvtOptionsDrawinglayer::SetMaximumPaperHeight( sal_uInt32 nNew )
1478 {
1479     MutexGuard aGuard( GetOwnStaticMutex() );
1480     m_pDataContainer->SetMaximumPaperHeight( nNew );
1481 }
1482 
SetMaximumPaperLeftMargin(sal_uInt32 nNew)1483 void SvtOptionsDrawinglayer::SetMaximumPaperLeftMargin( sal_uInt32 nNew )
1484 {
1485     MutexGuard aGuard( GetOwnStaticMutex() );
1486     m_pDataContainer->SetMaximumPaperLeftMargin( nNew );
1487 }
1488 
SetMaximumPaperRightMargin(sal_uInt32 nNew)1489 void SvtOptionsDrawinglayer::SetMaximumPaperRightMargin( sal_uInt32 nNew )
1490 {
1491     MutexGuard aGuard( GetOwnStaticMutex() );
1492     m_pDataContainer->SetMaximumPaperRightMargin( nNew );
1493 }
1494 
SetMaximumPaperTopMargin(sal_uInt32 nNew)1495 void SvtOptionsDrawinglayer::SetMaximumPaperTopMargin( sal_uInt32 nNew )
1496 {
1497     MutexGuard aGuard( GetOwnStaticMutex() );
1498     m_pDataContainer->SetMaximumPaperTopMargin( nNew );
1499 }
1500 
SetMaximumPaperBottomMargin(sal_uInt32 nNew)1501 void SvtOptionsDrawinglayer::SetMaximumPaperBottomMargin( sal_uInt32 nNew )
1502 {
1503     MutexGuard aGuard( GetOwnStaticMutex() );
1504     m_pDataContainer->SetMaximumPaperBottomMargin( nNew );
1505 }
1506 
1507 // helper
IsAAPossibleOnThisSystem() const1508 sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
1509 {
1510     return m_pDataContainer->IsAAPossibleOnThisSystem();
1511 }
1512 
1513 // primitives
IsAntiAliasing() const1514 sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const
1515 {
1516     MutexGuard aGuard( GetOwnStaticMutex() );
1517     return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
1518 }
1519 
IsSnapHorVerLinesToDiscrete() const1520 sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
1521 {
1522     MutexGuard aGuard( GetOwnStaticMutex() );
1523     return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
1524 }
1525 
IsSolidDragCreate() const1526 sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
1527 {
1528     MutexGuard aGuard( GetOwnStaticMutex() );
1529     return m_pDataContainer->IsSolidDragCreate();
1530 }
1531 
IsRenderDecoratedTextDirect() const1532 sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
1533 {
1534     MutexGuard aGuard( GetOwnStaticMutex() );
1535     return m_pDataContainer->IsRenderDecoratedTextDirect();
1536 }
1537 
IsRenderSimpleTextDirect() const1538 sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
1539 {
1540     MutexGuard aGuard( GetOwnStaticMutex() );
1541     return m_pDataContainer->IsRenderSimpleTextDirect();
1542 }
1543 
GetQuadratic3DRenderLimit() const1544 sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
1545 {
1546     MutexGuard aGuard( GetOwnStaticMutex() );
1547     return m_pDataContainer->GetQuadratic3DRenderLimit();
1548 }
1549 
GetQuadraticFormControlRenderLimit() const1550 sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
1551 {
1552     MutexGuard aGuard( GetOwnStaticMutex() );
1553     return m_pDataContainer->GetQuadraticFormControlRenderLimit();
1554 }
1555 
SetAntiAliasing(sal_Bool bState)1556 void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState )
1557 {
1558     MutexGuard aGuard( GetOwnStaticMutex() );
1559     m_pDataContainer->SetAntiAliasing( bState );
1560 }
1561 
SetSnapHorVerLinesToDiscrete(sal_Bool bState)1562 void SvtOptionsDrawinglayer::SetSnapHorVerLinesToDiscrete( sal_Bool bState )
1563 {
1564     MutexGuard aGuard( GetOwnStaticMutex() );
1565     m_pDataContainer->SetSnapHorVerLinesToDiscrete( bState );
1566 }
1567 
SetSolidDragCreate(sal_Bool bState)1568 void SvtOptionsDrawinglayer::SetSolidDragCreate( sal_Bool bState )
1569 {
1570     MutexGuard aGuard( GetOwnStaticMutex() );
1571     m_pDataContainer->SetSolidDragCreate( bState );
1572 }
1573 
SetRenderDecoratedTextDirect(sal_Bool bState)1574 void SvtOptionsDrawinglayer::SetRenderDecoratedTextDirect( sal_Bool bState )
1575 {
1576     MutexGuard aGuard( GetOwnStaticMutex() );
1577     m_pDataContainer->SetRenderDecoratedTextDirect( bState );
1578 }
1579 
SetRenderSimpleTextDirect(sal_Bool bState)1580 void SvtOptionsDrawinglayer::SetRenderSimpleTextDirect( sal_Bool bState )
1581 {
1582     MutexGuard aGuard( GetOwnStaticMutex() );
1583     m_pDataContainer->SetRenderSimpleTextDirect( bState );
1584 }
1585 
SetQuadratic3DRenderLimit(sal_uInt32 nNew)1586 void SvtOptionsDrawinglayer::SetQuadratic3DRenderLimit(sal_uInt32 nNew)
1587 {
1588     MutexGuard aGuard( GetOwnStaticMutex() );
1589     m_pDataContainer->SetQuadratic3DRenderLimit( nNew );
1590 }
1591 
SetQuadraticFormControlRenderLimit(sal_uInt32 nNew)1592 void SvtOptionsDrawinglayer::SetQuadraticFormControlRenderLimit(sal_uInt32 nNew)
1593 {
1594     MutexGuard aGuard( GetOwnStaticMutex() );
1595     m_pDataContainer->SetQuadraticFormControlRenderLimit( nNew );
1596 }
1597 
1598 // #i97672# selection settings
IsTransparentSelection() const1599 sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const
1600 {
1601     MutexGuard aGuard( GetOwnStaticMutex() );
1602     return m_pDataContainer->IsTransparentSelection();
1603 }
1604 
SetTransparentSelection(sal_Bool bState)1605 void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState )
1606 {
1607     MutexGuard aGuard( GetOwnStaticMutex() );
1608     m_pDataContainer->SetTransparentSelection( bState );
1609 }
1610 
GetTransparentSelectionPercent() const1611 sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
1612 {
1613     MutexGuard aGuard( GetOwnStaticMutex() );
1614     sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
1615 
1616     // crop to range [10% .. 90%]
1617     if(aRetval < 10)
1618     {
1619         aRetval = 10;
1620     }
1621 
1622     if(aRetval > 90)
1623     {
1624         aRetval = 90;
1625     }
1626 
1627     return aRetval;
1628 }
1629 
SetTransparentSelectionPercent(sal_uInt16 nPercent)1630 void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1631 {
1632     MutexGuard aGuard( GetOwnStaticMutex() );
1633 
1634     // crop to range [10% .. 90%]
1635     if(nPercent < 10)
1636     {
1637         nPercent = 10;
1638     }
1639 
1640     if(nPercent > 90)
1641     {
1642         nPercent = 90;
1643     }
1644 
1645     m_pDataContainer->SetTransparentSelectionPercent( nPercent );
1646 }
1647 
GetSelectionMaximumLuminancePercent() const1648 sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
1649 {
1650     MutexGuard aGuard( GetOwnStaticMutex() );
1651     sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
1652 
1653     // crop to range [0% .. 100%]
1654     if(aRetval > 90)
1655     {
1656         aRetval = 90;
1657     }
1658 
1659     return aRetval;
1660 }
1661 
SetSelectionMaximumLuminancePercent(sal_uInt16 nPercent)1662 void SvtOptionsDrawinglayer::SetSelectionMaximumLuminancePercent( sal_uInt16 nPercent )
1663 {
1664     MutexGuard aGuard( GetOwnStaticMutex() );
1665 
1666     // crop to range [0% .. 100%]
1667     if(nPercent > 90)
1668     {
1669         nPercent = 90;
1670     }
1671 
1672     m_pDataContainer->SetSelectionMaximumLuminancePercent( nPercent );
1673 }
1674 
1675 //*****************************************************************************************************************
1676 //  private method
1677 //*****************************************************************************************************************
GetOwnStaticMutex()1678 Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
1679 {
1680     // Initialize static mutex only for one time!
1681     static Mutex* pMutex = NULL;
1682     // If these method first called (Mutex not already exist!) ...
1683     if( pMutex == NULL )
1684     {
1685         // ... we must create a new one. Protect follow code with the global mutex -
1686         // It must be - we create a static variable!
1687         MutexGuard aGuard( Mutex::getGlobalMutex() );
1688         // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these!
1689         if( pMutex == NULL )
1690         {
1691             // Create the new mutex and set it for return on static variable.
1692             static Mutex aMutex;
1693             pMutex = &aMutex;
1694         }
1695     }
1696     // Return new created or already existing mutex object.
1697     return *pMutex;
1698 }
1699 
1700 // eof
1701 
1702