Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
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>
30 :
31 :
32 : // namespaces
33 :
34 :
35 : using namespace ::utl ;
36 : using namespace ::osl ;
37 : using namespace ::com::sun::star::uno ;
38 :
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
45 :
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
51 :
52 : // #i74769#, #i75172#
53 : #define DEFAULT_PAINTBUFFER_CALC true
54 : #define DEFAULT_PAINTBUFFER_WRITER true
55 : #define DEFAULT_PAINTBUFFER_DRAWIMPRESS true
56 :
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
64 :
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
73 :
74 : // #i97672# selection settings
75 : #define DEFAULT_TRANSPARENTSELECTION true
76 : #define DEFAULT_TRANSPARENTSELECTIONPERCENT 75
77 : #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70
78 :
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" )
84 :
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")
89 :
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")
94 :
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")
102 :
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")
111 :
112 : // #i97672# selection settings
113 : #define PROPERTYNAME_TRANSPARENTSELECTION OUString("TransparentSelection")
114 : #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString("TransparentSelectionPercent")
115 : #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString("SelectionMaximumLuminancePercent")
116 :
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
122 :
123 : // #i73602#
124 : #define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5
125 : #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6
126 : #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7
127 :
128 : // #i74769#, #i75172#
129 : #define PROPERTYHANDLE_PAINTBUFFER_CALC 8
130 : #define PROPERTYHANDLE_PAINTBUFFER_WRITER 9
131 : #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10
132 :
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
140 :
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
149 :
150 : // #i97672# selection settings
151 : #define PROPERTYHANDLE_TRANSPARENTSELECTION 24
152 : #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25
153 : #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
154 :
155 : #define PROPERTYCOUNT 27
156 :
157 : class SvtOptionsDrawinglayer_Impl : public ConfigItem
158 : {
159 : public:
160 :
161 :
162 : // constructor / destructor
163 :
164 :
165 : SvtOptionsDrawinglayer_Impl();
166 : virtual ~SvtOptionsDrawinglayer_Impl();
167 :
168 :
169 : // override methods of baseclass
170 :
171 : virtual void Notify( const com::sun::star::uno::Sequence<OUString>& aPropertyNames) SAL_OVERRIDE;
172 :
173 :
174 : // public interface
175 :
176 :
177 4412 : bool IsOverlayBuffer() const { return m_bOverlayBuffer;}
178 14309 : bool IsPaintBuffer() const { return m_bPaintBuffer;}
179 1312 : Color GetStripeColorA() const { return m_bStripeColorA;}
180 1312 : Color GetStripeColorB() const { return m_bStripeColorB;}
181 1312 : sal_uInt16 GetStripeLength() const { return m_nStripeLength;}
182 :
183 : // #i73602#
184 348 : bool IsOverlayBuffer_Calc() const { return m_bOverlayBuffer_Calc;}
185 3109 : bool IsOverlayBuffer_Writer() const { return m_bOverlayBuffer_Writer;}
186 323 : bool IsOverlayBuffer_DrawImpress() const { return m_bOverlayBuffer_DrawImpress;}
187 :
188 : // #i74769#, #i75172#
189 348 : bool IsPaintBuffer_Calc() const { return m_bPaintBuffer_Calc;}
190 3109 : bool IsPaintBuffer_Writer() const { return m_bPaintBuffer_Writer;}
191 323 : bool IsPaintBuffer_DrawImpress() const { return m_bPaintBuffer_DrawImpress;}
192 :
193 : // #i4219#
194 0 : sal_uInt32 GetMaximumPaperWidth() const { return m_nMaximumPaperWidth;}
195 0 : sal_uInt32 GetMaximumPaperHeight() const { return m_nMaximumPaperHeight;}
196 0 : sal_uInt32 GetMaximumPaperLeftMargin() const { return m_nMaximumPaperLeftMargin;}
197 0 : sal_uInt32 GetMaximumPaperRightMargin() const { return m_nMaximumPaperRightMargin;}
198 0 : sal_uInt32 GetMaximumPaperTopMargin() const { return m_nMaximumPaperTopMargin;}
199 0 : sal_uInt32 GetMaximumPaperBottomMargin() const { return m_nMaximumPaperBottomMargin;}
200 :
201 : // helper
202 : bool IsAAPossibleOnThisSystem() const;
203 :
204 : // primitives
205 245861 : bool IsAntiAliasing() const { return m_bAntiAliasing;}
206 0 : bool IsSnapHorVerLinesToDiscrete() const { return m_bSnapHorVerLinesToDiscrete;}
207 11369 : bool IsSolidDragCreate() const { return m_bSolidDragCreate;}
208 3227 : bool IsRenderDecoratedTextDirect() const { return m_bRenderDecoratedTextDirect;}
209 13454 : bool IsRenderSimpleTextDirect() const { return m_bRenderSimpleTextDirect;}
210 13 : sal_uInt32 GetQuadratic3DRenderLimit() const { return m_nQuadratic3DRenderLimit;}
211 1 : sal_uInt32 GetQuadraticFormControlRenderLimit() const { return m_nQuadraticFormControlRenderLimit;}
212 :
213 : void SetAntiAliasing( bool bState );
214 :
215 : // #i97672# selection settings
216 13026 : bool IsTransparentSelection() const { return m_bTransparentSelection;}
217 13133 : sal_uInt16 GetTransparentSelectionPercent() const { return m_nTransparentSelectionPercent;}
218 464 : sal_uInt16 GetSelectionMaximumLuminancePercent() const { return m_nSelectionMaximumLuminancePercent;}
219 :
220 : void SetTransparentSelection( bool bState );
221 : void SetTransparentSelectionPercent( sal_uInt16 nPercent );
222 :
223 : // private methods
224 :
225 : private:
226 :
227 : virtual void ImplCommit() SAL_OVERRIDE;
228 :
229 : static Sequence< OUString > impl_GetPropertyNames();
230 :
231 : // private member
232 :
233 : private:
234 :
235 : bool m_bOverlayBuffer;
236 : bool m_bPaintBuffer;
237 : Color m_bStripeColorA;
238 : Color m_bStripeColorB;
239 : sal_uInt16 m_nStripeLength;
240 :
241 : // #i73602#
242 : bool m_bOverlayBuffer_Calc;
243 : bool m_bOverlayBuffer_Writer;
244 : bool m_bOverlayBuffer_DrawImpress;
245 :
246 : // #i74769#, #i75172#
247 : bool m_bPaintBuffer_Calc;
248 : bool m_bPaintBuffer_Writer;
249 : bool m_bPaintBuffer_DrawImpress;
250 :
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;
258 :
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;
267 :
268 : // #i97672# selection settings
269 : sal_uInt16 m_nTransparentSelectionPercent;
270 : sal_uInt16 m_nSelectionMaximumLuminancePercent;
271 : bool m_bTransparentSelection;
272 :
273 : // local values
274 : bool m_bAllowAA : 1;
275 : bool m_bAllowAAChecked : 1;
276 : };
277 :
278 :
279 : // constructor
280 :
281 3539 : 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),
288 :
289 : // #i73602#
290 : m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
291 : m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
292 : m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
293 :
294 : // #i74769#, #i75172#
295 : m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
296 : m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
297 : m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
298 :
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),
306 :
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),
315 :
316 : // #i97672# selection settings
317 : m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
318 : m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
319 : m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
320 :
321 : // local values
322 : m_bAllowAA(true),
323 3539 : m_bAllowAAChecked(false)
324 : {
325 3539 : Sequence< OUString > seqNames( impl_GetPropertyNames() );
326 7078 : Sequence< Any > seqValues = GetProperties( seqNames ) ;
327 :
328 : DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
329 :
330 : // Copy values from list in right order to our internal member.
331 3539 : sal_Int32 nPropertyCount = seqValues.getLength();
332 99092 : for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
333 : {
334 95553 : if (!seqValues[nProperty].hasValue())
335 0 : continue;
336 :
337 95553 : switch( nProperty )
338 : {
339 : case PROPERTYHANDLE_OVERLAYBUFFER:
340 : {
341 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
342 3539 : seqValues[nProperty] >>= m_bOverlayBuffer;
343 : }
344 3539 : break;
345 :
346 : case PROPERTYHANDLE_PAINTBUFFER:
347 : {
348 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
349 3539 : seqValues[nProperty] >>= m_bPaintBuffer;
350 : }
351 3539 : break;
352 :
353 : case PROPERTYHANDLE_STRIPE_COLOR_A:
354 : {
355 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
356 3539 : sal_Int32 nValue = 0;
357 3539 : seqValues[nProperty] >>= nValue;
358 3539 : m_bStripeColorA = nValue;
359 : }
360 3539 : break;
361 :
362 : case PROPERTYHANDLE_STRIPE_COLOR_B:
363 : {
364 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
365 3539 : sal_Int32 nValue = 0;
366 3539 : seqValues[nProperty] >>= nValue;
367 3539 : m_bStripeColorB = nValue;
368 : }
369 3539 : break;
370 :
371 : case PROPERTYHANDLE_STRIPE_LENGTH:
372 : {
373 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
374 3539 : seqValues[nProperty] >>= m_nStripeLength;
375 : }
376 3539 : break;
377 :
378 : // #i73602#
379 : case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
380 : {
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 3539 : seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
383 : }
384 3539 : break;
385 :
386 : case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
387 : {
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 3539 : seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
390 : }
391 3539 : break;
392 :
393 : case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
394 : {
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 3539 : seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
397 : }
398 3539 : break;
399 :
400 : // #i74769#, #i75172#
401 : case PROPERTYHANDLE_PAINTBUFFER_CALC:
402 : {
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 3539 : seqValues[nProperty] >>= m_bPaintBuffer_Calc;
405 : }
406 3539 : break;
407 :
408 : case PROPERTYHANDLE_PAINTBUFFER_WRITER:
409 : {
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 3539 : seqValues[nProperty] >>= m_bPaintBuffer_Writer;
412 : }
413 3539 : break;
414 :
415 : case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
416 : {
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 3539 : seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
419 : }
420 3539 : break;
421 :
422 : // #i4219#
423 : case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
424 : {
425 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
426 3539 : seqValues[nProperty] >>= m_nMaximumPaperWidth;
427 : }
428 3539 : break;
429 :
430 : case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
431 : {
432 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
433 3539 : seqValues[nProperty] >>= m_nMaximumPaperHeight;
434 : }
435 3539 : break;
436 :
437 : case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
438 : {
439 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
440 3539 : seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
441 : }
442 3539 : break;
443 :
444 : case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
445 : {
446 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
447 3539 : seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
448 : }
449 3539 : break;
450 :
451 : case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
452 : {
453 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
454 3539 : seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
455 : }
456 3539 : break;
457 :
458 : case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
459 : {
460 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
461 3539 : seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
462 : }
463 3539 : break;
464 :
465 : // primitives
466 : case PROPERTYHANDLE_ANTIALIASING:
467 : {
468 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
469 3539 : seqValues[nProperty] >>= m_bAntiAliasing;
470 : }
471 3539 : break;
472 :
473 : // primitives
474 : case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
475 : {
476 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
477 3539 : seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
478 : }
479 3539 : break;
480 :
481 : case PROPERTYHANDLE_SOLIDDRAGCREATE:
482 : {
483 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
484 3539 : seqValues[nProperty] >>= m_bSolidDragCreate;
485 : }
486 3539 : break;
487 :
488 : case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
489 : {
490 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
491 3539 : seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
492 : }
493 3539 : break;
494 :
495 : case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
496 : {
497 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
498 3539 : seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
499 : }
500 3539 : break;
501 :
502 : case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
503 : {
504 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
505 3539 : seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
506 : }
507 3539 : break;
508 :
509 : case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
510 : {
511 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
512 3539 : seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
513 : }
514 3539 : break;
515 :
516 : // #i97672# selection settings
517 : case PROPERTYHANDLE_TRANSPARENTSELECTION:
518 : {
519 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
520 3539 : seqValues[nProperty] >>= m_bTransparentSelection;
521 : }
522 3539 : break;
523 :
524 : case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
525 : {
526 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
527 3539 : seqValues[nProperty] >>= m_nTransparentSelectionPercent;
528 : }
529 3539 : break;
530 :
531 : case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
532 : {
533 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
534 3539 : seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
535 : }
536 3539 : break;
537 : }
538 3539 : }
539 3539 : }
540 :
541 :
542 : // destructor
543 :
544 7058 : SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
545 : {
546 : assert(!IsModified()); // should have been committed
547 7058 : }
548 :
549 :
550 : // Commit
551 :
552 0 : void SvtOptionsDrawinglayer_Impl::ImplCommit()
553 : {
554 0 : Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
555 0 : Sequence< Any > aSeqValues( aSeqNames.getLength() );
556 :
557 0 : for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
558 : {
559 0 : switch( nProperty )
560 : {
561 : case PROPERTYHANDLE_OVERLAYBUFFER:
562 0 : aSeqValues[nProperty] <<= m_bOverlayBuffer;
563 0 : break;
564 :
565 : case PROPERTYHANDLE_PAINTBUFFER:
566 0 : aSeqValues[nProperty] <<= m_bPaintBuffer;
567 0 : break;
568 :
569 : case PROPERTYHANDLE_STRIPE_COLOR_A:
570 0 : aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
571 0 : break;
572 :
573 : case PROPERTYHANDLE_STRIPE_COLOR_B:
574 0 : aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
575 0 : break;
576 :
577 : case PROPERTYHANDLE_STRIPE_LENGTH:
578 0 : aSeqValues[nProperty] <<= m_nStripeLength;
579 0 : break;
580 :
581 : // #i73602#
582 : case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
583 0 : aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
584 0 : break;
585 :
586 : case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
587 0 : aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
588 0 : break;
589 :
590 : case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
591 0 : aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
592 0 : break;
593 :
594 : // #i74769#, #i75172#
595 : case PROPERTYHANDLE_PAINTBUFFER_CALC:
596 0 : aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
597 0 : break;
598 :
599 : case PROPERTYHANDLE_PAINTBUFFER_WRITER:
600 0 : aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
601 0 : break;
602 :
603 : case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
604 0 : aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
605 0 : break;
606 :
607 : // #i4219#
608 : case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
609 0 : aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
610 0 : break;
611 :
612 : case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
613 0 : aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
614 0 : break;
615 :
616 : case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
617 0 : aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
618 0 : break;
619 :
620 : case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
621 0 : aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
622 0 : break;
623 :
624 : case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
625 0 : aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
626 0 : break;
627 :
628 : case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
629 0 : aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
630 0 : break;
631 :
632 : // primitives
633 : case PROPERTYHANDLE_ANTIALIASING:
634 0 : aSeqValues[nProperty] <<= m_bAntiAliasing;
635 0 : break;
636 :
637 : case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
638 0 : aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
639 0 : break;
640 :
641 : case PROPERTYHANDLE_SOLIDDRAGCREATE:
642 0 : aSeqValues[nProperty] <<= m_bSolidDragCreate;
643 0 : break;
644 :
645 : case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
646 0 : aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
647 0 : break;
648 :
649 : case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
650 0 : aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
651 0 : break;
652 :
653 : case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
654 0 : aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
655 0 : break;
656 :
657 : case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
658 0 : aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
659 0 : break;
660 :
661 : // #i97672# selection settings
662 : case PROPERTYHANDLE_TRANSPARENTSELECTION:
663 0 : aSeqValues[nProperty] <<= m_bTransparentSelection;
664 0 : break;
665 :
666 : case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
667 0 : aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
668 0 : break;
669 :
670 : case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
671 0 : aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
672 0 : break;
673 : }
674 : }
675 :
676 0 : PutProperties( aSeqNames, aSeqValues );
677 0 : }
678 :
679 0 : void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<OUString>& )
680 : {
681 0 : }
682 :
683 :
684 : // public method
685 :
686 :
687 :
688 : // public method
689 :
690 :
691 :
692 : // public method
693 :
694 :
695 :
696 : // public method
697 :
698 :
699 :
700 : // public method
701 :
702 :
703 : // #i73602#
704 :
705 :
706 :
707 : // #i74769#, #i75172#
708 :
709 :
710 :
711 : // #i4219#
712 :
713 :
714 :
715 :
716 :
717 :
718 : // helper
719 245861 : bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
720 : {
721 245861 : if(!m_bAllowAAChecked)
722 : {
723 1516 : SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
724 1516 : pThat->m_bAllowAAChecked = true;
725 :
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
732 :
733 : // check XRenderExtension
734 1516 : if(m_bAllowAA && !Application::GetDefaultDevice()->SupportsOperation( OutDevSupport_TransparentRect ))
735 : {
736 1516 : pThat->m_bAllowAA = false;
737 : }
738 : }
739 :
740 245861 : return m_bAllowAA;
741 : }
742 :
743 : // primitives
744 :
745 :
746 :
747 :
748 :
749 :
750 :
751 0 : void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( bool bState )
752 : {
753 0 : if(m_bAntiAliasing != bState)
754 : {
755 0 : m_bAntiAliasing = bState;
756 0 : SetModified();
757 : }
758 0 : }
759 :
760 : // #i97672# selection settings
761 :
762 0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( bool bState )
763 : {
764 0 : if(m_bTransparentSelection != bState)
765 : {
766 0 : m_bTransparentSelection = bState;
767 0 : SetModified();
768 : }
769 0 : }
770 :
771 0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
772 : {
773 0 : if(m_nTransparentSelectionPercent != nPercent)
774 : {
775 0 : m_nTransparentSelectionPercent = nPercent;
776 0 : SetModified();
777 : }
778 0 : }
779 :
780 :
781 :
782 :
783 : // private method
784 :
785 3539 : Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
786 : {
787 : // Build list of configuration key names.
788 : const OUString pProperties[] =
789 : {
790 : PROPERTYNAME_OVERLAYBUFFER ,
791 : PROPERTYNAME_PAINTBUFFER ,
792 : PROPERTYNAME_STRIPE_COLOR_A ,
793 : PROPERTYNAME_STRIPE_COLOR_B ,
794 : PROPERTYNAME_STRIPE_LENGTH ,
795 :
796 : // #i73602#
797 : PROPERTYNAME_OVERLAYBUFFER_CALC,
798 : PROPERTYNAME_OVERLAYBUFFER_WRITER,
799 : PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
800 :
801 : // #i74769#, #i75172#
802 : PROPERTYNAME_PAINTBUFFER_CALC,
803 : PROPERTYNAME_PAINTBUFFER_WRITER,
804 : PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
805 :
806 : // #i4219#
807 : PROPERTYNAME_MAXIMUMPAPERWIDTH,
808 : PROPERTYNAME_MAXIMUMPAPERHEIGHT,
809 : PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
810 : PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
811 : PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
812 : PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
813 :
814 : // primitives
815 : PROPERTYNAME_ANTIALIASING,
816 : PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
817 : PROPERTYNAME_SOLIDDRAGCREATE,
818 : PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
819 : PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
820 : PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
821 : PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
822 :
823 : // #i97672# selection settings
824 : PROPERTYNAME_TRANSPARENTSELECTION,
825 : PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
826 : PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
827 99092 : };
828 :
829 : // Initialize return sequence with these list ...
830 3539 : const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
831 : // ... and return it.
832 99092 : return seqPropertyNames;
833 : }
834 :
835 :
836 : // initialize static member
837 : // DON'T DO IT IN YOUR HEADER!
838 : // see definition for further information
839 :
840 : SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
841 : sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
842 :
843 :
844 : // constructor
845 :
846 95234 : SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
847 : {
848 : // Global access, must be guarded (multithreading!).
849 95234 : MutexGuard aGuard( GetOwnStaticMutex() );
850 : // Increase our refcount ...
851 95234 : ++m_nRefCount;
852 : // ... and initialize our data container only if it not already!
853 95234 : if( m_pDataContainer == NULL )
854 : {
855 3539 : m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
856 95234 : }
857 95234 : }
858 :
859 :
860 : // destructor
861 :
862 95147 : SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
863 : {
864 : // Global access, must be guarded (multithreading!)
865 95147 : MutexGuard aGuard( GetOwnStaticMutex() );
866 : // Decrease our refcount.
867 95147 : --m_nRefCount;
868 : // If last instance was deleted ...
869 : // we must destroy our static data container!
870 95147 : if( m_nRefCount <= 0 )
871 : {
872 3529 : delete m_pDataContainer;
873 3529 : m_pDataContainer = NULL;
874 95147 : }
875 95147 : }
876 :
877 :
878 : // public method
879 :
880 4412 : bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
881 : {
882 4412 : MutexGuard aGuard( GetOwnStaticMutex() );
883 4412 : return m_pDataContainer->IsOverlayBuffer();
884 : }
885 :
886 :
887 : // public method
888 :
889 14309 : bool SvtOptionsDrawinglayer::IsPaintBuffer() const
890 : {
891 14309 : MutexGuard aGuard( GetOwnStaticMutex() );
892 14309 : return m_pDataContainer->IsPaintBuffer();
893 : }
894 :
895 :
896 : // public method
897 :
898 1312 : Color SvtOptionsDrawinglayer::GetStripeColorA() const
899 : {
900 1312 : MutexGuard aGuard( GetOwnStaticMutex() );
901 1312 : return m_pDataContainer->GetStripeColorA();
902 : }
903 :
904 :
905 : // public method
906 :
907 1312 : Color SvtOptionsDrawinglayer::GetStripeColorB() const
908 : {
909 1312 : MutexGuard aGuard( GetOwnStaticMutex() );
910 1312 : return m_pDataContainer->GetStripeColorB();
911 : }
912 :
913 :
914 : // public method
915 :
916 1312 : sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
917 : {
918 1312 : MutexGuard aGuard( GetOwnStaticMutex() );
919 1312 : return m_pDataContainer->GetStripeLength();
920 : }
921 :
922 : // #i73602#
923 348 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
924 : {
925 348 : MutexGuard aGuard( GetOwnStaticMutex() );
926 348 : return m_pDataContainer->IsOverlayBuffer_Calc();
927 : }
928 :
929 3109 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
930 : {
931 3109 : MutexGuard aGuard( GetOwnStaticMutex() );
932 3109 : return m_pDataContainer->IsOverlayBuffer_Writer();
933 : }
934 :
935 323 : bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
936 : {
937 323 : MutexGuard aGuard( GetOwnStaticMutex() );
938 323 : return m_pDataContainer->IsOverlayBuffer_DrawImpress();
939 : }
940 :
941 : // #i74769#, #i75172#
942 348 : bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
943 : {
944 348 : MutexGuard aGuard( GetOwnStaticMutex() );
945 348 : return m_pDataContainer->IsPaintBuffer_Calc();
946 : }
947 :
948 3109 : bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
949 : {
950 3109 : MutexGuard aGuard( GetOwnStaticMutex() );
951 3109 : return m_pDataContainer->IsPaintBuffer_Writer();
952 : }
953 :
954 323 : bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
955 : {
956 323 : MutexGuard aGuard( GetOwnStaticMutex() );
957 323 : return m_pDataContainer->IsPaintBuffer_DrawImpress();
958 : }
959 :
960 : // #i4219#
961 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
962 : {
963 0 : MutexGuard aGuard( GetOwnStaticMutex() );
964 0 : return m_pDataContainer->GetMaximumPaperWidth();
965 : }
966 :
967 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
968 : {
969 0 : MutexGuard aGuard( GetOwnStaticMutex() );
970 0 : return m_pDataContainer->GetMaximumPaperHeight();
971 : }
972 :
973 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
974 : {
975 0 : MutexGuard aGuard( GetOwnStaticMutex() );
976 0 : return m_pDataContainer->GetMaximumPaperLeftMargin();
977 : }
978 :
979 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
980 : {
981 0 : MutexGuard aGuard( GetOwnStaticMutex() );
982 0 : return m_pDataContainer->GetMaximumPaperRightMargin();
983 : }
984 :
985 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
986 : {
987 0 : MutexGuard aGuard( GetOwnStaticMutex() );
988 0 : return m_pDataContainer->GetMaximumPaperTopMargin();
989 : }
990 :
991 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
992 : {
993 0 : MutexGuard aGuard( GetOwnStaticMutex() );
994 0 : return m_pDataContainer->GetMaximumPaperBottomMargin();
995 : }
996 :
997 : // helper
998 245861 : bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
999 : {
1000 245861 : return m_pDataContainer->IsAAPossibleOnThisSystem();
1001 : }
1002 :
1003 : // primitives
1004 245861 : bool SvtOptionsDrawinglayer::IsAntiAliasing() const
1005 : {
1006 245861 : MutexGuard aGuard( GetOwnStaticMutex() );
1007 245861 : return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
1008 : }
1009 :
1010 0 : bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
1011 : {
1012 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1013 0 : return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
1014 : }
1015 :
1016 11369 : bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
1017 : {
1018 11369 : MutexGuard aGuard( GetOwnStaticMutex() );
1019 11369 : return m_pDataContainer->IsSolidDragCreate();
1020 : }
1021 :
1022 3227 : bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
1023 : {
1024 3227 : MutexGuard aGuard( GetOwnStaticMutex() );
1025 3227 : return m_pDataContainer->IsRenderDecoratedTextDirect();
1026 : }
1027 :
1028 13454 : bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
1029 : {
1030 13454 : MutexGuard aGuard( GetOwnStaticMutex() );
1031 13454 : return m_pDataContainer->IsRenderSimpleTextDirect();
1032 : }
1033 :
1034 13 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
1035 : {
1036 13 : MutexGuard aGuard( GetOwnStaticMutex() );
1037 13 : return m_pDataContainer->GetQuadratic3DRenderLimit();
1038 : }
1039 :
1040 1 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
1041 : {
1042 1 : MutexGuard aGuard( GetOwnStaticMutex() );
1043 1 : return m_pDataContainer->GetQuadraticFormControlRenderLimit();
1044 : }
1045 :
1046 0 : void SvtOptionsDrawinglayer::SetAntiAliasing( bool bState )
1047 : {
1048 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1049 0 : m_pDataContainer->SetAntiAliasing( bState );
1050 0 : }
1051 :
1052 : // #i97672# selection settings
1053 13026 : bool SvtOptionsDrawinglayer::IsTransparentSelection() const
1054 : {
1055 13026 : MutexGuard aGuard( GetOwnStaticMutex() );
1056 13026 : return m_pDataContainer->IsTransparentSelection();
1057 : }
1058 :
1059 0 : void SvtOptionsDrawinglayer::SetTransparentSelection( bool bState )
1060 : {
1061 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1062 0 : m_pDataContainer->SetTransparentSelection( bState );
1063 0 : }
1064 :
1065 13133 : sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
1066 : {
1067 13133 : MutexGuard aGuard( GetOwnStaticMutex() );
1068 13133 : sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
1069 :
1070 : // crop to range [10% .. 90%]
1071 13133 : if(aRetval < 10)
1072 : {
1073 0 : aRetval = 10;
1074 : }
1075 :
1076 13133 : if(aRetval > 90)
1077 : {
1078 0 : aRetval = 90;
1079 : }
1080 :
1081 13133 : return aRetval;
1082 : }
1083 :
1084 0 : void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1085 : {
1086 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1087 :
1088 : // crop to range [10% .. 90%]
1089 0 : if(nPercent < 10)
1090 : {
1091 0 : nPercent = 10;
1092 : }
1093 :
1094 0 : if(nPercent > 90)
1095 : {
1096 0 : nPercent = 90;
1097 : }
1098 :
1099 0 : m_pDataContainer->SetTransparentSelectionPercent( nPercent );
1100 0 : }
1101 :
1102 464 : sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
1103 : {
1104 464 : MutexGuard aGuard( GetOwnStaticMutex() );
1105 464 : sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
1106 :
1107 : // crop to range [0% .. 100%]
1108 464 : if(aRetval > 90)
1109 : {
1110 0 : aRetval = 90;
1111 : }
1112 :
1113 464 : return aRetval;
1114 : }
1115 :
1116 464 : Color SvtOptionsDrawinglayer::getHilightColor() const
1117 : {
1118 464 : Color aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
1119 464 : const basegfx::BColor aSelection(aRetval.getBColor());
1120 464 : const double fLuminance(aSelection.luminance());
1121 464 : const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
1122 :
1123 464 : if(fLuminance > fMaxLum)
1124 : {
1125 0 : const double fFactor(fMaxLum / fLuminance);
1126 : const basegfx::BColor aNewSelection(
1127 0 : aSelection.getRed() * fFactor,
1128 0 : aSelection.getGreen() * fFactor,
1129 0 : aSelection.getBlue() * fFactor);
1130 :
1131 0 : aRetval = Color(aNewSelection);
1132 : }
1133 :
1134 464 : return aRetval;
1135 : }
1136 :
1137 : namespace
1138 : {
1139 : class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
1140 : }
1141 :
1142 :
1143 : // private method
1144 :
1145 521146 : Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
1146 : {
1147 521146 : return theOptionsDrawinglayerMutex::get();
1148 : }
1149 :
1150 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|