Bump version to 5.0-14
[LibreOffice.git] / svtools / source / config / optionsdrawinglayer.cxx
blobb4bd909015c12bcd1bd0386bd921576d9d78eb0d
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 #include <svtools/optionsdrawinglayer.hxx>
21 #include <unotools/configmgr.hxx>
22 #include <unotools/configitem.hxx>
23 #include <tools/debug.hxx>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
26 #include <vcl/svapp.hxx>
27 #include <vcl/outdev.hxx>
28 #include <vcl/settings.hxx>
29 #include <rtl/instance.hxx>
32 // namespaces
35 using namespace ::utl ;
36 using namespace ::osl ;
37 using namespace ::com::sun::star::uno ;
39 #define ROOTNODE_START OUString("Office.Common/Drawinglayer" )
40 #define DEFAULT_OVERLAYBUFFER true
41 #define DEFAULT_PAINTBUFFER true
42 #define DEFAULT_STRIPE_COLOR_A 0
43 #define DEFAULT_STRIPE_COLOR_B 16581375
44 #define DEFAULT_STRIPE_LENGTH 4
46 // #i73602#
47 // #i74769#, #i75172# : Change default for Calc and Writer to True
48 #define DEFAULT_OVERLAYBUFFER_CALC true
49 #define DEFAULT_OVERLAYBUFFER_WRITER true
50 #define DEFAULT_OVERLAYBUFFER_DRAWIMPRESS true
52 // #i74769#, #i75172#
53 #define DEFAULT_PAINTBUFFER_CALC true
54 #define DEFAULT_PAINTBUFFER_WRITER true
55 #define DEFAULT_PAINTBUFFER_DRAWIMPRESS true
57 // #i4219#
58 #define DEFAULT_MAXIMUMPAPERWIDTH 300
59 #define DEFAULT_MAXIMUMPAPERHEIGHT 300
60 #define DEFAULT_MAXIMUMPAPERLEFTMARGIN 9999
61 #define DEFAULT_MAXIMUMPAPERRIGHTMARGIN 9999
62 #define DEFAULT_MAXIMUMPAPERTOPMARGIN 9999
63 #define DEFAULT_MAXIMUMPAPERBOTTOMMARGIN 9999
65 // primitives
66 #define DEFAULT_ANTIALIASING true
67 #define DEFAULT_SNAPHORVERLINESTODISCRETE true
68 #define DEFAULT_SOLIDDRAGCREATE true
69 #define DEFAULT_RENDERDECORATEDTEXTDIRECT true
70 #define DEFAULT_RENDERSIMPLETEXTDIRECT true
71 #define DEFAULT_QUADRATIC3DRENDERLIMIT 1000000
72 #define DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT 45000
74 // #i97672# selection settings
75 #define DEFAULT_TRANSPARENTSELECTION true
76 #define DEFAULT_TRANSPARENTSELECTIONPERCENT 75
77 #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70
79 #define PROPERTYNAME_OVERLAYBUFFER OUString("OverlayBuffer" )
80 #define PROPERTYNAME_PAINTBUFFER OUString("PaintBuffer" )
81 #define PROPERTYNAME_STRIPE_COLOR_A OUString("StripeColorA" )
82 #define PROPERTYNAME_STRIPE_COLOR_B OUString("StripeColorB" )
83 #define PROPERTYNAME_STRIPE_LENGTH OUString("StripeLength" )
85 // #i73602#
86 #define PROPERTYNAME_OVERLAYBUFFER_CALC OUString("OverlayBuffer_Calc")
87 #define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString("OverlayBuffer_Writer")
88 #define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString("OverlayBuffer_DrawImpress")
90 // #i74769#, #i75172#
91 #define PROPERTYNAME_PAINTBUFFER_CALC OUString("PaintBuffer_Calc")
92 #define PROPERTYNAME_PAINTBUFFER_WRITER OUString("PaintBuffer_Writer")
93 #define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString("PaintBuffer_DrawImpress")
95 // #i4219#
96 #define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString("MaximumPaperWidth")
97 #define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString("MaximumPaperHeight")
98 #define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString("MaximumPaperLeftMargin")
99 #define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString("MaximumPaperRightMargin")
100 #define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString("MaximumPaperTopMargin")
101 #define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString("MaximumPaperBottomMargin")
103 // primitives
104 #define PROPERTYNAME_ANTIALIASING OUString("AntiAliasing")
105 #define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString("SnapHorVerLinesToDiscrete")
106 #define PROPERTYNAME_SOLIDDRAGCREATE OUString("SolidDragCreate")
107 #define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString("RenderDecoratedTextDirect")
108 #define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString("RenderSimpleTextDirect")
109 #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString("Quadratic3DRenderLimit")
110 #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString("QuadraticFormControlRenderLimit")
112 // #i97672# selection settings
113 #define PROPERTYNAME_TRANSPARENTSELECTION OUString("TransparentSelection")
114 #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString("TransparentSelectionPercent")
115 #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString("SelectionMaximumLuminancePercent")
117 #define PROPERTYHANDLE_OVERLAYBUFFER 0
118 #define PROPERTYHANDLE_PAINTBUFFER 1
119 #define PROPERTYHANDLE_STRIPE_COLOR_A 2
120 #define PROPERTYHANDLE_STRIPE_COLOR_B 3
121 #define PROPERTYHANDLE_STRIPE_LENGTH 4
123 // #i73602#
124 #define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5
125 #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6
126 #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7
128 // #i74769#, #i75172#
129 #define PROPERTYHANDLE_PAINTBUFFER_CALC 8
130 #define PROPERTYHANDLE_PAINTBUFFER_WRITER 9
131 #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10
133 // #i4219#
134 #define PROPERTYHANDLE_MAXIMUMPAPERWIDTH 11
135 #define PROPERTYHANDLE_MAXIMUMPAPERHEIGHT 12
136 #define PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN 13
137 #define PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN 14
138 #define PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN 15
139 #define PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN 16
141 // primitives
142 #define PROPERTYHANDLE_ANTIALIASING 17
143 #define PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE 18
144 #define PROPERTYHANDLE_SOLIDDRAGCREATE 19
145 #define PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT 20
146 #define PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT 21
147 #define PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT 22
148 #define PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT 23
150 // #i97672# selection settings
151 #define PROPERTYHANDLE_TRANSPARENTSELECTION 24
152 #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25
153 #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
155 #define PROPERTYCOUNT 27
157 class SvtOptionsDrawinglayer_Impl : public ConfigItem
159 public:
162 // constructor / destructor
165 SvtOptionsDrawinglayer_Impl();
166 virtual ~SvtOptionsDrawinglayer_Impl();
169 // override methods of baseclass
171 virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames) SAL_OVERRIDE;
174 // public interface
177 bool IsOverlayBuffer() const { return m_bOverlayBuffer;}
178 bool IsPaintBuffer() const { return m_bPaintBuffer;}
179 Color GetStripeColorA() const { return m_bStripeColorA;}
180 Color GetStripeColorB() const { return m_bStripeColorB;}
181 sal_uInt16 GetStripeLength() const { return m_nStripeLength;}
183 // #i73602#
184 bool IsOverlayBuffer_Calc() const { return m_bOverlayBuffer_Calc;}
185 bool IsOverlayBuffer_Writer() const { return m_bOverlayBuffer_Writer;}
186 bool IsOverlayBuffer_DrawImpress() const { return m_bOverlayBuffer_DrawImpress;}
188 // #i74769#, #i75172#
189 bool IsPaintBuffer_Calc() const { return m_bPaintBuffer_Calc;}
190 bool IsPaintBuffer_Writer() const { return m_bPaintBuffer_Writer;}
191 bool IsPaintBuffer_DrawImpress() const { return m_bPaintBuffer_DrawImpress;}
193 // #i4219#
194 sal_uInt32 GetMaximumPaperWidth() const { return m_nMaximumPaperWidth;}
195 sal_uInt32 GetMaximumPaperHeight() const { return m_nMaximumPaperHeight;}
196 sal_uInt32 GetMaximumPaperLeftMargin() const { return m_nMaximumPaperLeftMargin;}
197 sal_uInt32 GetMaximumPaperRightMargin() const { return m_nMaximumPaperRightMargin;}
198 sal_uInt32 GetMaximumPaperTopMargin() const { return m_nMaximumPaperTopMargin;}
199 sal_uInt32 GetMaximumPaperBottomMargin() const { return m_nMaximumPaperBottomMargin;}
201 // helper
202 bool IsAAPossibleOnThisSystem() const;
204 // primitives
205 bool IsAntiAliasing() const { return m_bAntiAliasing;}
206 bool IsSnapHorVerLinesToDiscrete() const { return m_bSnapHorVerLinesToDiscrete;}
207 bool IsSolidDragCreate() const { return m_bSolidDragCreate;}
208 bool IsRenderDecoratedTextDirect() const { return m_bRenderDecoratedTextDirect;}
209 bool IsRenderSimpleTextDirect() const { return m_bRenderSimpleTextDirect;}
210 sal_uInt32 GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit;}
211 sal_uInt32 GetQuadraticFormControlRenderLimit() const { return m_nQuadraticFormControlRenderLimit;}
213 void SetAntiAliasing( bool bState );
215 // #i97672# selection settings
216 bool IsTransparentSelection() const { return m_bTransparentSelection;}
217 sal_uInt16 GetTransparentSelectionPercent() const { return m_nTransparentSelectionPercent;}
218 sal_uInt16 GetSelectionMaximumLuminancePercent() const { return m_nSelectionMaximumLuminancePercent;}
220 void SetTransparentSelection( bool bState );
221 void SetTransparentSelectionPercent( sal_uInt16 nPercent );
223 // private methods
225 private:
227 virtual void ImplCommit() SAL_OVERRIDE;
229 static Sequence< OUString > impl_GetPropertyNames();
231 // private member
233 private:
235 bool m_bOverlayBuffer;
236 bool m_bPaintBuffer;
237 Color m_bStripeColorA;
238 Color m_bStripeColorB;
239 sal_uInt16 m_nStripeLength;
241 // #i73602#
242 bool m_bOverlayBuffer_Calc;
243 bool m_bOverlayBuffer_Writer;
244 bool m_bOverlayBuffer_DrawImpress;
246 // #i74769#, #i75172#
247 bool m_bPaintBuffer_Calc;
248 bool m_bPaintBuffer_Writer;
249 bool m_bPaintBuffer_DrawImpress;
251 // #i4219#
252 sal_uInt32 m_nMaximumPaperWidth;
253 sal_uInt32 m_nMaximumPaperHeight;
254 sal_uInt32 m_nMaximumPaperLeftMargin;
255 sal_uInt32 m_nMaximumPaperRightMargin;
256 sal_uInt32 m_nMaximumPaperTopMargin;
257 sal_uInt32 m_nMaximumPaperBottomMargin;
259 // primitives
260 bool m_bAntiAliasing;
261 bool m_bSnapHorVerLinesToDiscrete;
262 bool m_bSolidDragCreate;
263 bool m_bRenderDecoratedTextDirect;
264 bool m_bRenderSimpleTextDirect;
265 sal_uInt32 m_nQuadratic3DRenderLimit;
266 sal_uInt32 m_nQuadraticFormControlRenderLimit;
268 // #i97672# selection settings
269 sal_uInt16 m_nTransparentSelectionPercent;
270 sal_uInt16 m_nSelectionMaximumLuminancePercent;
271 bool m_bTransparentSelection;
273 // local values
274 bool m_bAllowAA : 1;
275 bool m_bAllowAAChecked : 1;
279 // constructor
281 SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl() :
282 ConfigItem( ROOTNODE_START ),
283 m_bOverlayBuffer( DEFAULT_OVERLAYBUFFER ),
284 m_bPaintBuffer( DEFAULT_PAINTBUFFER ),
285 m_bStripeColorA(Color(DEFAULT_STRIPE_COLOR_A)),
286 m_bStripeColorB(Color(DEFAULT_STRIPE_COLOR_B)),
287 m_nStripeLength(DEFAULT_STRIPE_LENGTH),
289 // #i73602#
290 m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
291 m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
292 m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
294 // #i74769#, #i75172#
295 m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
296 m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
297 m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
299 // #i4219#
300 m_nMaximumPaperWidth(DEFAULT_MAXIMUMPAPERWIDTH),
301 m_nMaximumPaperHeight(DEFAULT_MAXIMUMPAPERHEIGHT),
302 m_nMaximumPaperLeftMargin(DEFAULT_MAXIMUMPAPERLEFTMARGIN),
303 m_nMaximumPaperRightMargin(DEFAULT_MAXIMUMPAPERRIGHTMARGIN),
304 m_nMaximumPaperTopMargin(DEFAULT_MAXIMUMPAPERTOPMARGIN),
305 m_nMaximumPaperBottomMargin(DEFAULT_MAXIMUMPAPERBOTTOMMARGIN),
307 // primitives
308 m_bAntiAliasing(DEFAULT_ANTIALIASING),
309 m_bSnapHorVerLinesToDiscrete(DEFAULT_SNAPHORVERLINESTODISCRETE),
310 m_bSolidDragCreate(DEFAULT_SOLIDDRAGCREATE),
311 m_bRenderDecoratedTextDirect(DEFAULT_RENDERDECORATEDTEXTDIRECT),
312 m_bRenderSimpleTextDirect(DEFAULT_RENDERSIMPLETEXTDIRECT),
313 m_nQuadratic3DRenderLimit(DEFAULT_QUADRATIC3DRENDERLIMIT),
314 m_nQuadraticFormControlRenderLimit(DEFAULT_QUADRATICFORMCONTROLRENDERLIMIT),
316 // #i97672# selection settings
317 m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
318 m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
319 m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
321 // local values
322 m_bAllowAA(true),
323 m_bAllowAAChecked(false)
325 Sequence< OUString > seqNames( impl_GetPropertyNames() );
326 Sequence< Any > seqValues = GetProperties( seqNames ) ;
328 DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
330 // Copy values from list in right order to our internal member.
331 sal_Int32 nPropertyCount = seqValues.getLength();
332 for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
334 if (!seqValues[nProperty].hasValue())
335 continue;
337 switch( nProperty )
339 case PROPERTYHANDLE_OVERLAYBUFFER:
341 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
342 seqValues[nProperty] >>= m_bOverlayBuffer;
344 break;
346 case PROPERTYHANDLE_PAINTBUFFER:
348 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
349 seqValues[nProperty] >>= m_bPaintBuffer;
351 break;
353 case PROPERTYHANDLE_STRIPE_COLOR_A:
355 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
356 sal_Int32 nValue = 0;
357 seqValues[nProperty] >>= nValue;
358 m_bStripeColorA = nValue;
360 break;
362 case PROPERTYHANDLE_STRIPE_COLOR_B:
364 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
365 sal_Int32 nValue = 0;
366 seqValues[nProperty] >>= nValue;
367 m_bStripeColorB = nValue;
369 break;
371 case PROPERTYHANDLE_STRIPE_LENGTH:
373 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
374 seqValues[nProperty] >>= m_nStripeLength;
376 break;
378 // #i73602#
379 case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
381 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Calc\"?" );
382 seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
384 break;
386 case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
388 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_Writer\"?" );
389 seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
391 break;
393 case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
395 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer_DrawImpress\"?" );
396 seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
398 break;
400 // #i74769#, #i75172#
401 case PROPERTYHANDLE_PAINTBUFFER_CALC:
403 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Calc\"?" );
404 seqValues[nProperty] >>= m_bPaintBuffer_Calc;
406 break;
408 case PROPERTYHANDLE_PAINTBUFFER_WRITER:
410 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_Writer\"?" );
411 seqValues[nProperty] >>= m_bPaintBuffer_Writer;
413 break;
415 case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
417 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer_DrawImpress\"?" );
418 seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
420 break;
422 // #i4219#
423 case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
425 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
426 seqValues[nProperty] >>= m_nMaximumPaperWidth;
428 break;
430 case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
432 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
433 seqValues[nProperty] >>= m_nMaximumPaperHeight;
435 break;
437 case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
439 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
440 seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
442 break;
444 case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
446 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
447 seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
449 break;
451 case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
453 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
454 seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
456 break;
458 case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
460 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
461 seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
463 break;
465 // primitives
466 case PROPERTYHANDLE_ANTIALIASING:
468 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
469 seqValues[nProperty] >>= m_bAntiAliasing;
471 break;
473 // primitives
474 case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
476 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
477 seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
479 break;
481 case PROPERTYHANDLE_SOLIDDRAGCREATE:
483 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
484 seqValues[nProperty] >>= m_bSolidDragCreate;
486 break;
488 case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
490 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
491 seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
493 break;
495 case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
497 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
498 seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
500 break;
502 case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
504 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
505 seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
507 break;
509 case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
511 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
512 seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
514 break;
516 // #i97672# selection settings
517 case PROPERTYHANDLE_TRANSPARENTSELECTION:
519 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
520 seqValues[nProperty] >>= m_bTransparentSelection;
522 break;
524 case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
526 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
527 seqValues[nProperty] >>= m_nTransparentSelectionPercent;
529 break;
531 case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
533 DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
534 seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
536 break;
542 // destructor
544 SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
546 assert(!IsModified()); // should have been committed
550 // Commit
552 void SvtOptionsDrawinglayer_Impl::ImplCommit()
554 Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
555 Sequence< Any > aSeqValues( aSeqNames.getLength() );
557 for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
559 switch( nProperty )
561 case PROPERTYHANDLE_OVERLAYBUFFER:
562 aSeqValues[nProperty] <<= m_bOverlayBuffer;
563 break;
565 case PROPERTYHANDLE_PAINTBUFFER:
566 aSeqValues[nProperty] <<= m_bPaintBuffer;
567 break;
569 case PROPERTYHANDLE_STRIPE_COLOR_A:
570 aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
571 break;
573 case PROPERTYHANDLE_STRIPE_COLOR_B:
574 aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
575 break;
577 case PROPERTYHANDLE_STRIPE_LENGTH:
578 aSeqValues[nProperty] <<= m_nStripeLength;
579 break;
581 // #i73602#
582 case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
583 aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
584 break;
586 case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
587 aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
588 break;
590 case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
591 aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
592 break;
594 // #i74769#, #i75172#
595 case PROPERTYHANDLE_PAINTBUFFER_CALC:
596 aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
597 break;
599 case PROPERTYHANDLE_PAINTBUFFER_WRITER:
600 aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
601 break;
603 case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
604 aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
605 break;
607 // #i4219#
608 case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
609 aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
610 break;
612 case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
613 aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
614 break;
616 case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
617 aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
618 break;
620 case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
621 aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
622 break;
624 case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
625 aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
626 break;
628 case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
629 aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
630 break;
632 // primitives
633 case PROPERTYHANDLE_ANTIALIASING:
634 aSeqValues[nProperty] <<= m_bAntiAliasing;
635 break;
637 case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
638 aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
639 break;
641 case PROPERTYHANDLE_SOLIDDRAGCREATE:
642 aSeqValues[nProperty] <<= m_bSolidDragCreate;
643 break;
645 case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
646 aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
647 break;
649 case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
650 aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
651 break;
653 case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
654 aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
655 break;
657 case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
658 aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
659 break;
661 // #i97672# selection settings
662 case PROPERTYHANDLE_TRANSPARENTSELECTION:
663 aSeqValues[nProperty] <<= m_bTransparentSelection;
664 break;
666 case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
667 aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
668 break;
670 case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
671 aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
672 break;
676 PutProperties( aSeqNames, aSeqValues );
679 void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<OUString>& )
684 // public method
688 // public method
692 // public method
696 // public method
700 // public method
703 // #i73602#
707 // #i74769#, #i75172#
711 // #i4219#
718 // helper
719 bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
721 if(!m_bAllowAAChecked)
723 SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
724 pThat->m_bAllowAAChecked = true;
726 #ifdef WIN32
727 // WIN32 uses GDIPlus with VCL forthe first incarnation; this will be enhanced
728 // in the future to use canvases and the canvas renderer, thus a AA-abled
729 // canvas needs to be checked here in the future.
730 // Currently, just allow AA for WIN32
731 #endif
733 // check XRenderExtension
734 if(m_bAllowAA && !Application::GetDefaultDevice()->SupportsOperation( OutDevSupport_TransparentRect ))
736 pThat->m_bAllowAA = false;
740 return m_bAllowAA;
743 // primitives
751 void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( bool bState )
753 if(m_bAntiAliasing != bState)
755 m_bAntiAliasing = bState;
756 SetModified();
760 // #i97672# selection settings
762 void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( bool bState )
764 if(m_bTransparentSelection != bState)
766 m_bTransparentSelection = bState;
767 SetModified();
771 void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
773 if(m_nTransparentSelectionPercent != nPercent)
775 m_nTransparentSelectionPercent = nPercent;
776 SetModified();
783 // private method
785 Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
787 // Build list of configuration key names.
788 const OUString pProperties[] =
790 PROPERTYNAME_OVERLAYBUFFER ,
791 PROPERTYNAME_PAINTBUFFER ,
792 PROPERTYNAME_STRIPE_COLOR_A ,
793 PROPERTYNAME_STRIPE_COLOR_B ,
794 PROPERTYNAME_STRIPE_LENGTH ,
796 // #i73602#
797 PROPERTYNAME_OVERLAYBUFFER_CALC,
798 PROPERTYNAME_OVERLAYBUFFER_WRITER,
799 PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
801 // #i74769#, #i75172#
802 PROPERTYNAME_PAINTBUFFER_CALC,
803 PROPERTYNAME_PAINTBUFFER_WRITER,
804 PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
806 // #i4219#
807 PROPERTYNAME_MAXIMUMPAPERWIDTH,
808 PROPERTYNAME_MAXIMUMPAPERHEIGHT,
809 PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
810 PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
811 PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
812 PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
814 // primitives
815 PROPERTYNAME_ANTIALIASING,
816 PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
817 PROPERTYNAME_SOLIDDRAGCREATE,
818 PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
819 PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
820 PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
821 PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
823 // #i97672# selection settings
824 PROPERTYNAME_TRANSPARENTSELECTION,
825 PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
826 PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
829 // Initialize return sequence with these list ...
830 const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
831 // ... and return it.
832 return seqPropertyNames;
836 // initialize static member
837 // DON'T DO IT IN YOUR HEADER!
838 // see definition for further information
840 SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
841 sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
844 // constructor
846 SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
848 // Global access, must be guarded (multithreading!).
849 MutexGuard aGuard( GetOwnStaticMutex() );
850 // Increase our refcount ...
851 ++m_nRefCount;
852 // ... and initialize our data container only if it not already!
853 if( m_pDataContainer == NULL )
855 m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
860 // destructor
862 SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
864 // Global access, must be guarded (multithreading!)
865 MutexGuard aGuard( GetOwnStaticMutex() );
866 // Decrease our refcount.
867 --m_nRefCount;
868 // If last instance was deleted ...
869 // we must destroy our static data container!
870 if( m_nRefCount <= 0 )
872 if (m_pDataContainer->IsModified())
873 m_pDataContainer->Commit();
874 delete m_pDataContainer;
875 m_pDataContainer = NULL;
880 // public method
882 bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
884 MutexGuard aGuard( GetOwnStaticMutex() );
885 return m_pDataContainer->IsOverlayBuffer();
889 // public method
891 bool SvtOptionsDrawinglayer::IsPaintBuffer() const
893 MutexGuard aGuard( GetOwnStaticMutex() );
894 return m_pDataContainer->IsPaintBuffer();
898 // public method
900 Color SvtOptionsDrawinglayer::GetStripeColorA() const
902 MutexGuard aGuard( GetOwnStaticMutex() );
903 return m_pDataContainer->GetStripeColorA();
907 // public method
909 Color SvtOptionsDrawinglayer::GetStripeColorB() const
911 MutexGuard aGuard( GetOwnStaticMutex() );
912 return m_pDataContainer->GetStripeColorB();
916 // public method
918 sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
920 MutexGuard aGuard( GetOwnStaticMutex() );
921 return m_pDataContainer->GetStripeLength();
924 // #i73602#
925 bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
927 MutexGuard aGuard( GetOwnStaticMutex() );
928 return m_pDataContainer->IsOverlayBuffer_Calc();
931 bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
933 MutexGuard aGuard( GetOwnStaticMutex() );
934 return m_pDataContainer->IsOverlayBuffer_Writer();
937 bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
939 MutexGuard aGuard( GetOwnStaticMutex() );
940 return m_pDataContainer->IsOverlayBuffer_DrawImpress();
943 // #i74769#, #i75172#
944 bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
946 MutexGuard aGuard( GetOwnStaticMutex() );
947 return m_pDataContainer->IsPaintBuffer_Calc();
950 bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
952 MutexGuard aGuard( GetOwnStaticMutex() );
953 return m_pDataContainer->IsPaintBuffer_Writer();
956 bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
958 MutexGuard aGuard( GetOwnStaticMutex() );
959 return m_pDataContainer->IsPaintBuffer_DrawImpress();
962 // #i4219#
963 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
965 MutexGuard aGuard( GetOwnStaticMutex() );
966 return m_pDataContainer->GetMaximumPaperWidth();
969 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
971 MutexGuard aGuard( GetOwnStaticMutex() );
972 return m_pDataContainer->GetMaximumPaperHeight();
975 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
977 MutexGuard aGuard( GetOwnStaticMutex() );
978 return m_pDataContainer->GetMaximumPaperLeftMargin();
981 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
983 MutexGuard aGuard( GetOwnStaticMutex() );
984 return m_pDataContainer->GetMaximumPaperRightMargin();
987 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
989 MutexGuard aGuard( GetOwnStaticMutex() );
990 return m_pDataContainer->GetMaximumPaperTopMargin();
993 sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
995 MutexGuard aGuard( GetOwnStaticMutex() );
996 return m_pDataContainer->GetMaximumPaperBottomMargin();
999 // helper
1000 bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
1002 return m_pDataContainer->IsAAPossibleOnThisSystem();
1005 // primitives
1006 bool SvtOptionsDrawinglayer::IsAntiAliasing() const
1008 MutexGuard aGuard( GetOwnStaticMutex() );
1009 return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
1012 bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
1014 MutexGuard aGuard( GetOwnStaticMutex() );
1015 return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
1018 bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
1020 MutexGuard aGuard( GetOwnStaticMutex() );
1021 return m_pDataContainer->IsSolidDragCreate();
1024 bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
1026 MutexGuard aGuard( GetOwnStaticMutex() );
1027 return m_pDataContainer->IsRenderDecoratedTextDirect();
1030 bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
1032 MutexGuard aGuard( GetOwnStaticMutex() );
1033 return m_pDataContainer->IsRenderSimpleTextDirect();
1036 sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
1038 MutexGuard aGuard( GetOwnStaticMutex() );
1039 return m_pDataContainer->GetQuadratic3DRenderLimit();
1042 sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
1044 MutexGuard aGuard( GetOwnStaticMutex() );
1045 return m_pDataContainer->GetQuadraticFormControlRenderLimit();
1048 void SvtOptionsDrawinglayer::SetAntiAliasing( bool bState )
1050 MutexGuard aGuard( GetOwnStaticMutex() );
1051 m_pDataContainer->SetAntiAliasing( bState );
1054 // #i97672# selection settings
1055 bool SvtOptionsDrawinglayer::IsTransparentSelection() const
1057 MutexGuard aGuard( GetOwnStaticMutex() );
1058 return m_pDataContainer->IsTransparentSelection();
1061 void SvtOptionsDrawinglayer::SetTransparentSelection( bool bState )
1063 MutexGuard aGuard( GetOwnStaticMutex() );
1064 m_pDataContainer->SetTransparentSelection( bState );
1067 sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
1069 MutexGuard aGuard( GetOwnStaticMutex() );
1070 sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
1072 // crop to range [10% .. 90%]
1073 if(aRetval < 10)
1075 aRetval = 10;
1078 if(aRetval > 90)
1080 aRetval = 90;
1083 return aRetval;
1086 void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1088 MutexGuard aGuard( GetOwnStaticMutex() );
1090 // crop to range [10% .. 90%]
1091 if(nPercent < 10)
1093 nPercent = 10;
1096 if(nPercent > 90)
1098 nPercent = 90;
1101 m_pDataContainer->SetTransparentSelectionPercent( nPercent );
1104 sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
1106 MutexGuard aGuard( GetOwnStaticMutex() );
1107 sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
1109 // crop to range [0% .. 100%]
1110 if(aRetval > 90)
1112 aRetval = 90;
1115 return aRetval;
1118 Color SvtOptionsDrawinglayer::getHilightColor() const
1120 Color aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
1121 const basegfx::BColor aSelection(aRetval.getBColor());
1122 const double fLuminance(aSelection.luminance());
1123 const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
1125 if(fLuminance > fMaxLum)
1127 const double fFactor(fMaxLum / fLuminance);
1128 const basegfx::BColor aNewSelection(
1129 aSelection.getRed() * fFactor,
1130 aSelection.getGreen() * fFactor,
1131 aSelection.getBlue() * fFactor);
1133 aRetval = Color(aNewSelection);
1136 return aRetval;
1139 namespace
1141 class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
1145 // private method
1147 Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
1149 return theOptionsDrawinglayerMutex::get();
1152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */