update credits
[LibreOffice.git] / svtools / source / config / optionsdrawinglayer.cxx
blob025a2bc4e92ce8fbc19373e02b678886d6a4d34b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifdef _MSC_VER
21 #pragma hdrstop
22 #endif
24 #include <svtools/optionsdrawinglayer.hxx>
25 #include <unotools/configmgr.hxx>
26 #include <unotools/configitem.hxx>
27 #include <tools/debug.hxx>
28 #include <com/sun/star/uno/Any.hxx>
29 #include <com/sun/star/uno/Sequence.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/outdev.hxx>
32 #include <rtl/instance.hxx>
34 //_________________________________________________________________________________________________________________
35 // namespaces
36 //_________________________________________________________________________________________________________________
38 using namespace ::utl ;
39 using namespace ::rtl ;
40 using namespace ::osl ;
41 using namespace ::com::sun::star::uno ;
43 #define ROOTNODE_START OUString("Office.Common/Drawinglayer" )
44 #define DEFAULT_OVERLAYBUFFER sal_True
45 #define DEFAULT_PAINTBUFFER sal_True
46 #define DEFAULT_STRIPE_COLOR_A 0
47 #define DEFAULT_STRIPE_COLOR_B 16581375
48 #define DEFAULT_STRIPE_LENGTH 4
50 // #i73602#
51 // #i74769#, #i75172# : Change default for Calc and Writer to True
52 #define DEFAULT_OVERLAYBUFFER_CALC sal_True
53 #define DEFAULT_OVERLAYBUFFER_WRITER sal_True
54 #define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS sal_True
56 // #i74769#, #i75172#
57 #define DEFAULT_PAINTBUFFER_CALC sal_True
58 #define DEFAULT_PAINTBUFFER_WRITER sal_True
59 #define DEFAULT_PAINTBUFFER_DRAWIMPRESS sal_True
61 // #i4219#
62 #define DEFAULT_MAXIMUMPAPERWIDTH 300
63 #define DEFAULT_MAXIMUMPAPERHEIGHT 300
64 #define DEFAULT_MAXIMUMPAPERLEFTMARGIN 9999
65 #define DEFAULT_MAXIMUMPAPERRIGHTMARGIN 9999
66 #define DEFAULT_MAXIMUMPAPERTOPMARGIN 9999
67 #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999
69 // primitives
70 #define DEFAULT_ANTIALIASING sal_True
71 #define DEFAULT_SNAPHORVERLINESTODISCRETE sal_True
72 #define DEFAULT_SOLIDDRAGCREATE sal_True
73 #define DEFAULT_RENDERDECORATEDTEXTDIRECT sal_True
74 #define DEFAULT_RENDERSIMPLETEXTDIRECT sal_True
75 #define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000
76 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000
78 // #i97672# selection settings
79 #define DEFAULT_TRANSPARENTSELECTION sal_True
80 #define DEFAULT_TRANSPARENTSELECTIONPERCENT 75
81 #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70
83 #define PROPERTYNAME_OVERLAYBUFFER OUString("OverlayBuffer" )
84 #define PROPERTYNAME_PAINTBUFFER OUString("PaintBuffer" )
85 #define PROPERTYNAME_STRIPE_COLOR_A OUString("StripeColorA" )
86 #define PROPERTYNAME_STRIPE_COLOR_B OUString("StripeColorB" )
87 #define PROPERTYNAME_STRIPE_LENGTH OUString("StripeLength" )
89 // #i73602#
90 #define PROPERTYNAME_OVERLAYBUFFER_CALC OUString("OverlayBuffer_Calc")
91 #define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString("OverlayBuffer_Writer")
92 #define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString("OverlayBuffer_DrawImpress")
94 // #i74769#, #i75172#
95 #define PROPERTYNAME_PAINTBUFFER_CALC OUString("PaintBuffer_Calc")
96 #define PROPERTYNAME_PAINTBUFFER_WRITER OUString("PaintBuffer_Writer")
97 #define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString("PaintBuffer_DrawImpress")
99 // #i4219#
100 #define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString("MaximumPaperWidth")
101 #define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString("MaximumPaperHeight")
102 #define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString("MaximumPaperLeftMargin")
103 #define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString("MaximumPaperRightMargin")
104 #define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString("MaximumPaperTopMargin")
105 #define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString("MaximumPaperBottomMargin")
107 // primitives
108 #define PROPERTYNAME_ANTIALIASING OUString("AntiAliasing")
109 #define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString("SnapHorVerLinesToDiscrete")
110 #define PROPERTYNAME_SOLIDDRAGCREATE OUString("SolidDragCreate")
111 #define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString("RenderDecoratedTextDirect")
112 #define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString("RenderSimpleTextDirect")
113 #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString("Quadratic3DRenderLimit")
114 #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString("QuadraticFormControlRenderLimit")
116 // #i97672# selection settings
117 #define PROPERTYNAME_TRANSPARENTSELECTION OUString("TransparentSelection")
118 #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString("TransparentSelectionPercent")
119 #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString("SelectionMaximumLuminancePercent")
121 #define PROPERTYHANDLE_OVERLAYBUFFER 0
122 #define PROPERTYHANDLE_PAINTBUFFER 1
123 #define PROPERTYHANDLE_STRIPE_COLOR_A 2
124 #define PROPERTYHANDLE_STRIPE_COLOR_B 3
125 #define PROPERTYHANDLE_STRIPE_LENGTH 4
127 // #i73602#
128 #define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5
129 #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6
130 #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7
132 // #i74769#, #i75172#
133 #define PROPERTYHANDLE_PAINTBUFFER_CALC 8
134 #define PROPERTYHANDLE_PAINTBUFFER_WRITER 9
135 #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10
137 // #i4219#
138 #define PROPERTYHANDLE_MAXIMUMPAPERWIDTH 11
139 #define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT 12
140 #define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN 13
141 #define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN 14
142 #define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN 15
143 #define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN 16
145 // primitives
146 #define PROPERTYHANDLE_ANTIALIASING 17
147 #define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18
148 #define PROPERTYHANDLE_SOLIDDRAGCREATE 19
149 #define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20
150 #define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21
151 #define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22
152 #define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23
154 // #i97672# selection settings
155 #define PROPERTYHANDLE_TRANSPARENTSELECTION 24
156 #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25
157 #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
159 #define PROPERTYCOUNT 27
161 class SvtOptionsDrawinglayer_Impl : public ConfigItem
163 public:
165 //---------------------------------------------------------------------------------------------------------
166 // constructor / destructor
167 //---------------------------------------------------------------------------------------------------------
169 SvtOptionsDrawinglayer_Impl();
170 ~SvtOptionsDrawinglayer_Impl();
172 //---------------------------------------------------------------------------------------------------------
173 // overloaded methods of baseclass
174 //---------------------------------------------------------------------------------------------------------
176 virtual void Commit();
177 virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames);
179 //---------------------------------------------------------------------------------------------------------
180 // public interface
181 //---------------------------------------------------------------------------------------------------------
183 sal_Bool IsOverlayBuffer() const;
184 sal_Bool IsPaintBuffer() const;
185 Color GetStripeColorA() const;
186 Color GetStripeColorB() const;
187 sal_uInt16 GetStripeLength() const;
189 // #i73602#
190 sal_Bool IsOverlayBuffer_Calc() const;
191 sal_Bool IsOverlayBuffer_Writer() const;
192 sal_Bool IsOverlayBuffer_DrawImpress() const;
194 // #i74769#, #i75172#
195 sal_Bool IsPaintBuffer_Calc() const;
196 sal_Bool IsPaintBuffer_Writer() const;
197 sal_Bool IsPaintBuffer_DrawImpress() const;
199 // #i4219#
200 sal_uInt32 GetMaximumPaperWidth() const;
201 sal_uInt32 GetMaximumPaperHeight() const;
202 sal_uInt32 GetMaximumPaperLeftMargin() const;
203 sal_uInt32 GetMaximumPaperRightMargin() const;
204 sal_uInt32 GetMaximumPaperTopMargin() const;
205 sal_uInt32 GetMaximumPaperBottomMargin() const;
207 // helper
208 sal_Bool IsAAPossibleOnThisSystem() const;
210 // primitives
211 sal_Bool IsAntiAliasing() const;
212 sal_Bool IsSnapHorVerLinesToDiscrete() const;
213 sal_Bool IsSolidDragCreate() const;
214 sal_Bool IsRenderDecoratedTextDirect() const;
215 sal_Bool IsRenderSimpleTextDirect() const;
216 sal_uInt32 GetQuadratic3DRenderLimit() const;
217 sal_uInt32 GetQuadraticFormControlRenderLimit() const;
219 void SetAntiAliasing( sal_Bool bState );
221 // #i97672# selection settings
222 sal_Bool IsTransparentSelection() const;
223 sal_uInt16 GetTransparentSelectionPercent() const;
224 sal_uInt16 GetSelectionMaximumLuminancePercent() const;
226 void SetTransparentSelection( sal_Bool bState );
227 void SetTransparentSelectionPercent( sal_uInt16 nPercent );
229 //-------------------------------------------------------------------------------------------------------------
230 // private methods
231 //-------------------------------------------------------------------------------------------------------------
233 private:
235 static Sequence< OUString > impl_GetPropertyNames();
237 //-------------------------------------------------------------------------------------------------------------
238 // private member
239 //-------------------------------------------------------------------------------------------------------------
241 private:
243 sal_Bool m_bOverlayBuffer;
244 sal_Bool m_bPaintBuffer;
245 Color m_bStripeColorA;
246 Color m_bStripeColorB;
247 sal_uInt16 m_nStripeLength;
249 // #i73602#
250 sal_Bool m_bOverlayBuffer_Calc;
251 sal_Bool m_bOverlayBuffer_Writer;
252 sal_Bool m_bOverlayBuffer_DrawImpress;
254 // #i74769#, #i75172#
255 sal_Bool m_bPaintBuffer_Calc;
256 sal_Bool m_bPaintBuffer_Writer;
257 sal_Bool m_bPaintBuffer_DrawImpress;
259 // #i4219#
260 sal_uInt32 m_nMaximumPaperWidth;
261 sal_uInt32 m_nMaximumPaperHeight;
262 sal_uInt32 m_nMaximumPaperLeftMargin;
263 sal_uInt32 m_nMaximumPaperRightMargin;
264 sal_uInt32 m_nMaximumPaperTopMargin;
265 sal_uInt32 m_nMaximumPaperBottomMargin;
267 // primitives
268 sal_Bool m_bAntiAliasing;
269 sal_Bool m_bSnapHorVerLinesToDiscrete;
270 sal_Bool m_bSolidDragCreate;
271 sal_Bool m_bRenderDecoratedTextDirect;
272 sal_Bool m_bRenderSimpleTextDirect;
273 sal_uInt32 m_nQuadratic3DRenderLimit;
274 sal_uInt32 m_nQuadraticFormControlRenderLimit;
276 // #i97672# selection settings
277 sal_uInt16 m_nTransparentSelectionPercent;
278 sal_uInt16 m_nSelectionMaximumLuminancePercent;
279 sal_Bool m_bTransparentSelection;
281 // local values
282 bool m_bAllowAA : 1;
283 bool m_bAllowAAChecked : 1;
286 //*****************************************************************************************************************
287 // constructor
288 //*****************************************************************************************************************
289 SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
290 ConfigItem( ROOTNODE_START ),
291 m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ),
292 m_bPaintBuffer( DEFAULT_PAINTBUFFER ),
293 m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)),
294 m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)),
295 m_nStripeLength(DEFAULT_STRIPE_LENGTH),
297 // #i73602#
298 m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
299 m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
300 m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
302 // #i74769#, #i75172#
303 m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
304 m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
305 m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
307 // #i4219#
308 m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH),
309 m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT),
310 m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN),
311 m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN),
312 m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN),
313 m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN),
315 // primitives
316 m_bAntiAliasing(DEFAULT_ANTIALIASING),
317 m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE),
318 m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE),
319 m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT),
320 m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT),
321 m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT),
322 m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT),
324 // #i97672# selection settings
325 m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
326 m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
327 m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
329 // local values
330 m_bAllowAA(true),
331 m_bAllowAAChecked(false)
333 Sequence< OUString > seqNames( impl_GetPropertyNames() );
334 Sequence< Any > seqValues = GetProperties( seqNames ) ;
336 DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
338 // Copy values from list in right order to our internal member.
339 sal_Int32 nPropertyCount = seqValues.getLength();
340 for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
342 if (seqValues[nProperty].hasValue()==sal_False)
343 continue;
345 switch( nProperty )
347 case PROPERTYHANDLE_OVERLAYBUFFER:
349 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
350 seqValues[nProperty] >>= m_bOverlayBuffer;
352 break;
354 case PROPERTYHANDLE_PAINTBUFFER:
356 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
357 seqValues[nProperty] >>= m_bPaintBuffer;
359 break;
361 case PROPERTYHANDLE_STRIPE_COLOR_A:
363 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
364 sal_Int32 nValue = 0;
365 seqValues[nProperty] >>= nValue;
366 m_bStripeColorA = nValue;
368 break;
370 case PROPERTYHANDLE_STRIPE_COLOR_B:
372 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
373 sal_Int32 nValue = 0;
374 seqValues[nProperty] >>= nValue;
375 m_bStripeColorB = nValue;
377 break;
379 case PROPERTYHANDLE_STRIPE_LENGTH:
381 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
382 seqValues[nProperty] >>= m_nStripeLength;
384 break;
386 // #i73602#
387 case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
389 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" );
390 seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
392 break;
394 case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
396 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" );
397 seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
399 break;
401 case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
403 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" );
404 seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
406 break;
408 // #i74769#, #i75172#
409 case PROPERTYHANDLE_PAINTBUFFER_CALC:
411 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" );
412 seqValues[nProperty] >>= m_bPaintBuffer_Calc;
414 break;
416 case PROPERTYHANDLE_PAINTBUFFER_WRITER:
418 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" );
419 seqValues[nProperty] >>= m_bPaintBuffer_Writer;
421 break;
423 case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
425 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" );
426 seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
428 break;
430 // #i4219#
431 case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
433 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
434 seqValues[nProperty] >>= m_nMaximumPaperWidth;
436 break;
438 case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
440 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
441 seqValues[nProperty] >>= m_nMaximumPaperHeight;
443 break;
445 case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
447 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
448 seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
450 break;
452 case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
454 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
455 seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
457 break;
459 case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
461 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
462 seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
464 break;
466 case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
468 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
469 seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
471 break;
473 // primitives
474 case PROPERTYHANDLE_ANTIALIASING:
476 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
477 seqValues[nProperty] >>= m_bAntiAliasing;
479 break;
481 // primitives
482 case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
484 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
485 seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
487 break;
489 case PROPERTYHANDLE_SOLIDDRAGCREATE:
491 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
492 seqValues[nProperty] >>= m_bSolidDragCreate;
494 break;
496 case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
498 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
499 seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
501 break;
503 case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
505 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
506 seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
508 break;
510 case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
512 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
513 seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
515 break;
517 case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
519 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
520 seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
522 break;
524 // #i97672# selection settings
525 case PROPERTYHANDLE_TRANSPARENTSELECTION:
527 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
528 seqValues[nProperty] >>= m_bTransparentSelection;
530 break;
532 case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
534 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
535 seqValues[nProperty] >>= m_nTransparentSelectionPercent;
538 case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
540 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
541 seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
543 break;
548 //*****************************************************************************************************************
549 // destructor
550 //*****************************************************************************************************************
551 SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
553 if( IsModified() )
554 Commit();
557 //*****************************************************************************************************************
558 // Commit
559 //*****************************************************************************************************************
560 void SvtOptionsDrawinglayer_Impl::Commit()
562 Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
563 Sequence< Any > aSeqValues( aSeqNames.getLength() );
565 for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
567 switch( nProperty )
569 case PROPERTYHANDLE_OVERLAYBUFFER:
570 aSeqValues[nProperty] <<= m_bOverlayBuffer;
571 break;
573 case PROPERTYHANDLE_PAINTBUFFER:
574 aSeqValues[nProperty] <<= m_bPaintBuffer;
575 break;
577 case PROPERTYHANDLE_STRIPE_COLOR_A:
578 aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
579 break;
581 case PROPERTYHANDLE_STRIPE_COLOR_B:
582 aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
583 break;
585 case PROPERTYHANDLE_STRIPE_LENGTH:
586 aSeqValues[nProperty] <<= m_nStripeLength;
587 break;
589 // #i73602#
590 case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
591 aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
592 break;
594 case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
595 aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
596 break;
598 case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
599 aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
600 break;
602 // #i74769#, #i75172#
603 case PROPERTYHANDLE_PAINTBUFFER_CALC:
604 aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
605 break;
607 case PROPERTYHANDLE_PAINTBUFFER_WRITER:
608 aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
609 break;
611 case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
612 aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
613 break;
615 // #i4219#
616 case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
617 aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
618 break;
620 case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
621 aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
622 break;
624 case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
625 aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
626 break;
628 case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
629 aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
630 break;
632 case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
633 aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
634 break;
636 case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
637 aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
638 break;
640 // primitives
641 case PROPERTYHANDLE_ANTIALIASING:
642 aSeqValues[nProperty] <<= m_bAntiAliasing;
643 break;
645 case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
646 aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
647 break;
649 case PROPERTYHANDLE_SOLIDDRAGCREATE:
650 aSeqValues[nProperty] <<= m_bSolidDragCreate;
651 break;
653 case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
654 aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
655 break;
657 case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
658 aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
659 break;
661 case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
662 aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
663 break;
665 case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
666 aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
667 break;
669 // #i97672# selection settings
670 case PROPERTYHANDLE_TRANSPARENTSELECTION:
671 aSeqValues[nProperty] <<= m_bTransparentSelection;
672 break;
674 case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
675 aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
676 break;
678 case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
679 aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
680 break;
684 PutProperties( aSeqNames, aSeqValues );
687 void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<OUString>& )
691 //*****************************************************************************************************************
692 // public method
693 //*****************************************************************************************************************
694 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const
696 return m_bOverlayBuffer;
699 //*****************************************************************************************************************
700 // public method
701 //*****************************************************************************************************************
702 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const
704 return m_bPaintBuffer;
707 //*****************************************************************************************************************
708 // public method
709 //*****************************************************************************************************************
710 Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const
712 return m_bStripeColorA;
715 //*****************************************************************************************************************
716 // public method
717 //*****************************************************************************************************************
718 Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const
720 return m_bStripeColorB;
723 //*****************************************************************************************************************
724 // public method
725 //*****************************************************************************************************************
726 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const
728 return m_nStripeLength;
731 // #i73602#
732 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const
734 return m_bOverlayBuffer_Calc;
737 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const
739 return m_bOverlayBuffer_Writer;
742 sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const
744 return m_bOverlayBuffer_DrawImpress;
747 // #i74769#, #i75172#
748 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const
750 return m_bPaintBuffer_Calc;
753 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const
755 return m_bPaintBuffer_Writer;
758 sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const
760 return m_bPaintBuffer_DrawImpress;
763 // #i4219#
764 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const
766 return m_nMaximumPaperWidth;
769 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const
771 return m_nMaximumPaperHeight;
774 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const
776 return m_nMaximumPaperLeftMargin;
779 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const
781 return m_nMaximumPaperRightMargin;
784 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const
786 return m_nMaximumPaperTopMargin;
789 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const
791 return m_nMaximumPaperBottomMargin;
794 // helper
795 sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
797 if(!m_bAllowAAChecked)
799 SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
800 pThat->m_bAllowAAChecked = true;
802 #ifdef WIN32
803 // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced
804 // in the future to use canvases and the canvas renderer, thus a AA-abled
805 // canvas needs to be checked here in the future.
806 // Currently, just allow AA for WIN32
807 #endif
809 // check XRenderExtension
810 if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect ))
812 pThat->m_bAllowAA = false;
816 return m_bAllowAA;
819 // primitives
820 sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const
822 return m_bAntiAliasing;
825 sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const
827 return m_bSnapHorVerLinesToDiscrete;
830 sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const
832 return m_bSolidDragCreate;
835 sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const
837 return m_bRenderDecoratedTextDirect;
840 sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const
842 return m_bRenderSimpleTextDirect;
845 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const
847 return m_nQuadratic3DRenderLimit;
850 sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const
852 return m_nQuadraticFormControlRenderLimit;
855 void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState )
857 if(m_bAntiAliasing != bState)
859 m_bAntiAliasing = bState;
860 SetModified();
864 // #i97672# selection settings
865 sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const
867 return m_bTransparentSelection;
870 void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState )
872 if(m_bTransparentSelection != bState)
874 m_bTransparentSelection = bState;
875 SetModified();
879 void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
881 if(m_nTransparentSelectionPercent != nPercent)
883 m_nTransparentSelectionPercent = nPercent;
884 SetModified();
888 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const
890 return m_nTransparentSelectionPercent;
893 sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const
895 return m_nSelectionMaximumLuminancePercent;
898 //*****************************************************************************************************************
899 // private method
900 //*****************************************************************************************************************
901 Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
903 // Build list of configuration key names.
904 const OUString pProperties[] =
906 PROPERTYNAME_OVERLAYBUFFER ,
907 PROPERTYNAME_PAINTBUFFER ,
908 PROPERTYNAME_STRIPE_COLOR_A ,
909 PROPERTYNAME_STRIPE_COLOR_B ,
910 PROPERTYNAME_STRIPE_LENGTH ,
912 // #i73602#
913 PROPERTYNAME_OVERLAYBUFFER_CALC,
914 PROPERTYNAME_OVERLAYBUFFER_WRITER,
915 PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
917 // #i74769#, #i75172#
918 PROPERTYNAME_PAINTBUFFER_CALC,
919 PROPERTYNAME_PAINTBUFFER_WRITER,
920 PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
922 // #i4219#
923 PROPERTYNAME_MAXIMUMPAPERWIDTH,
924 PROPERTYNAME_MAXIMUMPAPERHEIGHT,
925 PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
926 PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
927 PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
928 PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
930 // primitives
931 PROPERTYNAME_ANTIALIASING,
932 PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
933 PROPERTYNAME_SOLIDDRAGCREATE,
934 PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
935 PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
936 PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
937 PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
939 // #i97672# selection settings
940 PROPERTYNAME_TRANSPARENTSELECTION,
941 PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
942 PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
945 // Initialize return sequence with these list ...
946 const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
947 // ... and return it.
948 return seqPropertyNames;
951 //*****************************************************************************************************************
952 // initialize static member
953 // DON'T DO IT IN YOUR HEADER!
954 // see definition for further information
955 //*****************************************************************************************************************
956 SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
957 sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
959 //*****************************************************************************************************************
960 // constructor
961 //*****************************************************************************************************************
962 SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
964 // Global access, must be guarded (multithreading!).
965 MutexGuard aGuard( GetOwnStaticMutex() );
966 // Increase our refcount ...
967 ++m_nRefCount;
968 // ... and initialize our data container only if it not already!
969 if( m_pDataContainer == NULL )
971 m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
975 //*****************************************************************************************************************
976 // destructor
977 //*****************************************************************************************************************
978 SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
980 // Global access, must be guarded (multithreading!)
981 MutexGuard aGuard( GetOwnStaticMutex() );
982 // Decrease our refcount.
983 --m_nRefCount;
984 // If last instance was deleted ...
985 // we must destroy our static data container!
986 if( m_nRefCount <= 0 )
988 delete m_pDataContainer;
989 m_pDataContainer = NULL;
993 //*****************************************************************************************************************
994 // public method
995 //*****************************************************************************************************************
996 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
998 MutexGuard aGuard( GetOwnStaticMutex() );
999 return m_pDataContainer->IsOverlayBuffer();
1002 //*****************************************************************************************************************
1003 // public method
1004 //*****************************************************************************************************************
1005 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const
1007 MutexGuard aGuard( GetOwnStaticMutex() );
1008 return m_pDataContainer->IsPaintBuffer();
1011 //*****************************************************************************************************************
1012 // public method
1013 //*****************************************************************************************************************
1014 Color SvtOptionsDrawinglayer::GetStripeColorA() const
1016 MutexGuard aGuard( GetOwnStaticMutex() );
1017 return m_pDataContainer->GetStripeColorA();
1020 //*****************************************************************************************************************
1021 // public method
1022 //*****************************************************************************************************************
1023 Color SvtOptionsDrawinglayer::GetStripeColorB() const
1025 MutexGuard aGuard( GetOwnStaticMutex() );
1026 return m_pDataContainer->GetStripeColorB();
1029 //*****************************************************************************************************************
1030 // public method
1031 //*****************************************************************************************************************
1032 sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
1034 MutexGuard aGuard( GetOwnStaticMutex() );
1035 return m_pDataContainer->GetStripeLength();
1038 // #i73602#
1039 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
1041 MutexGuard aGuard( GetOwnStaticMutex() );
1042 return m_pDataContainer->IsOverlayBuffer_Calc();
1045 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
1047 MutexGuard aGuard( GetOwnStaticMutex() );
1048 return m_pDataContainer->IsOverlayBuffer_Writer();
1051 sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
1053 MutexGuard aGuard( GetOwnStaticMutex() );
1054 return m_pDataContainer->IsOverlayBuffer_DrawImpress();
1057 // #i74769#, #i75172#
1058 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
1060 MutexGuard aGuard( GetOwnStaticMutex() );
1061 return m_pDataContainer->IsPaintBuffer_Calc();
1064 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
1066 MutexGuard aGuard( GetOwnStaticMutex() );
1067 return m_pDataContainer->IsPaintBuffer_Writer();
1070 sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
1072 MutexGuard aGuard( GetOwnStaticMutex() );
1073 return m_pDataContainer->IsPaintBuffer_DrawImpress();
1076 // #i4219#
1077 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
1079 MutexGuard aGuard( GetOwnStaticMutex() );
1080 return m_pDataContainer->GetMaximumPaperWidth();
1083 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
1085 MutexGuard aGuard( GetOwnStaticMutex() );
1086 return m_pDataContainer->GetMaximumPaperHeight();
1089 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
1091 MutexGuard aGuard( GetOwnStaticMutex() );
1092 return m_pDataContainer->GetMaximumPaperLeftMargin();
1095 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
1097 MutexGuard aGuard( GetOwnStaticMutex() );
1098 return m_pDataContainer->GetMaximumPaperRightMargin();
1101 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
1103 MutexGuard aGuard( GetOwnStaticMutex() );
1104 return m_pDataContainer->GetMaximumPaperTopMargin();
1107 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
1109 MutexGuard aGuard( GetOwnStaticMutex() );
1110 return m_pDataContainer->GetMaximumPaperBottomMargin();
1113 // helper
1114 sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
1116 return m_pDataContainer->IsAAPossibleOnThisSystem();
1119 // primitives
1120 sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const
1122 MutexGuard aGuard( GetOwnStaticMutex() );
1123 return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
1126 sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
1128 MutexGuard aGuard( GetOwnStaticMutex() );
1129 return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
1132 sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
1134 MutexGuard aGuard( GetOwnStaticMutex() );
1135 return m_pDataContainer->IsSolidDragCreate();
1138 sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
1140 MutexGuard aGuard( GetOwnStaticMutex() );
1141 return m_pDataContainer->IsRenderDecoratedTextDirect();
1144 sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
1146 MutexGuard aGuard( GetOwnStaticMutex() );
1147 return m_pDataContainer->IsRenderSimpleTextDirect();
1150 sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
1152 MutexGuard aGuard( GetOwnStaticMutex() );
1153 return m_pDataContainer->GetQuadratic3DRenderLimit();
1156 sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
1158 MutexGuard aGuard( GetOwnStaticMutex() );
1159 return m_pDataContainer->GetQuadraticFormControlRenderLimit();
1162 void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState )
1164 MutexGuard aGuard( GetOwnStaticMutex() );
1165 m_pDataContainer->SetAntiAliasing( bState );
1168 // #i97672# selection settings
1169 sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const
1171 MutexGuard aGuard( GetOwnStaticMutex() );
1172 return m_pDataContainer->IsTransparentSelection();
1175 void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState )
1177 MutexGuard aGuard( GetOwnStaticMutex() );
1178 m_pDataContainer->SetTransparentSelection( bState );
1181 sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
1183 MutexGuard aGuard( GetOwnStaticMutex() );
1184 sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
1186 // crop to range [10% .. 90%]
1187 if(aRetval < 10)
1189 aRetval = 10;
1192 if(aRetval > 90)
1194 aRetval = 90;
1197 return aRetval;
1200 void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1202 MutexGuard aGuard( GetOwnStaticMutex() );
1204 // crop to range [10% .. 90%]
1205 if(nPercent < 10)
1207 nPercent = 10;
1210 if(nPercent > 90)
1212 nPercent = 90;
1215 m_pDataContainer->SetTransparentSelectionPercent( nPercent );
1218 sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
1220 MutexGuard aGuard( GetOwnStaticMutex() );
1221 sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
1223 // crop to range [0% .. 100%]
1224 if(aRetval > 90)
1226 aRetval = 90;
1229 return aRetval;
1232 namespace
1234 class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
1237 //*****************************************************************************************************************
1238 // private method
1239 //*****************************************************************************************************************
1240 Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
1242 return theOptionsDrawinglayerMutex::get();
1245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */