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 : #ifdef _MSC_VER
21 : #pragma hdrstop
22 : #endif
23 :
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>
33 :
34 : //_________________________________________________________________________________________________________________
35 : // namespaces
36 : //_________________________________________________________________________________________________________________
37 :
38 : using namespace ::utl ;
39 : using namespace ::rtl ;
40 : using namespace ::osl ;
41 : using namespace ::com::sun::star::uno ;
42 :
43 : #define ROOTNODE_START OUString(RTL_CONSTASCII_USTRINGPARAM("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
49 :
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
55 :
56 : // #i74769#, #i75172#
57 : #define DEFAULT_PAINTBUFFER_CALC sal_True
58 : #define DEFAULT_PAINTBUFFER_WRITER sal_True
59 : #define DEFAULT_PAINTBUFFER_DRAWIMPRESS sal_True
60 :
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
68 :
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
77 :
78 : // #i97672# selection settings
79 : #define DEFAULT_TRANSPARENTSELECTION sal_True
80 : #define DEFAULT_TRANSPARENTSELECTIONPERCENT 75
81 : #define DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT 70
82 :
83 : #define PROPERTYNAME_OVERLAYBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer" ))
84 : #define PROPERTYNAME_PAINTBUFFER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer" ))
85 : #define PROPERTYNAME_STRIPE_COLOR_A OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorA" ))
86 : #define PROPERTYNAME_STRIPE_COLOR_B OUString(RTL_CONSTASCII_USTRINGPARAM("StripeColorB" ))
87 : #define PROPERTYNAME_STRIPE_LENGTH OUString(RTL_CONSTASCII_USTRINGPARAM("StripeLength" ))
88 :
89 : // #i73602#
90 : #define PROPERTYNAME_OVERLAYBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Calc"))
91 : #define PROPERTYNAME_OVERLAYBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_Writer"))
92 : #define PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("OverlayBuffer_DrawImpress"))
93 :
94 : // #i74769#, #i75172#
95 : #define PROPERTYNAME_PAINTBUFFER_CALC OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Calc"))
96 : #define PROPERTYNAME_PAINTBUFFER_WRITER OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_Writer"))
97 : #define PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS OUString(RTL_CONSTASCII_USTRINGPARAM("PaintBuffer_DrawImpress"))
98 :
99 : // #i4219#
100 : #define PROPERTYNAME_MAXIMUMPAPERWIDTH OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperWidth"))
101 : #define PROPERTYNAME_MAXIMUMPAPERHEIGHT OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperHeight"))
102 : #define PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperLeftMargin"))
103 : #define PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperRightMargin"))
104 : #define PROPERTYNAME_MAXIMUMPAPERTOPMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperTopMargin"))
105 : #define PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN OUString(RTL_CONSTASCII_USTRINGPARAM("MaximumPaperBottomMargin"))
106 :
107 : // primitives
108 : #define PROPERTYNAME_ANTIALIASING OUString(RTL_CONSTASCII_USTRINGPARAM("AntiAliasing"))
109 : #define PROPERTYNAME_SNAPHORVERLINESTODISCRETE OUString(RTL_CONSTASCII_USTRINGPARAM("SnapHorVerLinesToDiscrete"))
110 : #define PROPERTYNAME_SOLIDDRAGCREATE OUString(RTL_CONSTASCII_USTRINGPARAM("SolidDragCreate"))
111 : #define PROPERTYNAME_RENDERDECORATEDTEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderDecoratedTextDirect"))
112 : #define PROPERTYNAME_RENDERSIMPLETEXTDIRECT OUString(RTL_CONSTASCII_USTRINGPARAM("RenderSimpleTextDirect"))
113 : #define PROPERTYNAME_QUADRATIC3DRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("Quadratic3DRenderLimit"))
114 : #define PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT OUString(RTL_CONSTASCII_USTRINGPARAM("QuadraticFormControlRenderLimit"))
115 :
116 : // #i97672# selection settings
117 : #define PROPERTYNAME_TRANSPARENTSELECTION OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelection"))
118 : #define PROPERTYNAME_TRANSPARENTSELECTIONPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("TransparentSelectionPercent"))
119 : #define PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT OUString(RTL_CONSTASCII_USTRINGPARAM("SelectionMaximumLuminancePercent"))
120 :
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
126 :
127 : // #i73602#
128 : #define PROPERTYHANDLE_OVERLAYBUFFER_CALC 5
129 : #define PROPERTYHANDLE_OVERLAYBUFFER_WRITER 6
130 : #define PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS 7
131 :
132 : // #i74769#, #i75172#
133 : #define PROPERTYHANDLE_PAINTBUFFER_CALC 8
134 : #define PROPERTYHANDLE_PAINTBUFFER_WRITER 9
135 : #define PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS 10
136 :
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
144 :
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
153 :
154 : // #i97672# selection settings
155 : #define PROPERTYHANDLE_TRANSPARENTSELECTION 24
156 : #define PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT 25
157 : #define PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT 26
158 :
159 : #define PROPERTYCOUNT 27
160 :
161 : class SvtOptionsDrawinglayer_Impl : public ConfigItem
162 : {
163 : public:
164 :
165 : //---------------------------------------------------------------------------------------------------------
166 : // constructor / destructor
167 : //---------------------------------------------------------------------------------------------------------
168 :
169 : SvtOptionsDrawinglayer_Impl();
170 : ~SvtOptionsDrawinglayer_Impl();
171 :
172 : //---------------------------------------------------------------------------------------------------------
173 : // overloaded methods of baseclass
174 : //---------------------------------------------------------------------------------------------------------
175 :
176 : virtual void Commit();
177 : virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames);
178 :
179 : //---------------------------------------------------------------------------------------------------------
180 : // public interface
181 : //---------------------------------------------------------------------------------------------------------
182 :
183 : sal_Bool IsOverlayBuffer() const;
184 : sal_Bool IsPaintBuffer() const;
185 : Color GetStripeColorA() const;
186 : Color GetStripeColorB() const;
187 : sal_uInt16 GetStripeLength() const;
188 :
189 : // #i73602#
190 : sal_Bool IsOverlayBuffer_Calc() const;
191 : sal_Bool IsOverlayBuffer_Writer() const;
192 : sal_Bool IsOverlayBuffer_DrawImpress() const;
193 :
194 : // #i74769#, #i75172#
195 : sal_Bool IsPaintBuffer_Calc() const;
196 : sal_Bool IsPaintBuffer_Writer() const;
197 : sal_Bool IsPaintBuffer_DrawImpress() const;
198 :
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;
206 :
207 : // helper
208 : sal_Bool IsAAPossibleOnThisSystem() const;
209 :
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;
218 :
219 : void SetAntiAliasing( sal_Bool bState );
220 :
221 : // #i97672# selection settings
222 : sal_Bool IsTransparentSelection() const;
223 : sal_uInt16 GetTransparentSelectionPercent() const;
224 : sal_uInt16 GetSelectionMaximumLuminancePercent() const;
225 :
226 : void SetTransparentSelection( sal_Bool bState );
227 : void SetTransparentSelectionPercent( sal_uInt16 nPercent );
228 :
229 : //-------------------------------------------------------------------------------------------------------------
230 : // private methods
231 : //-------------------------------------------------------------------------------------------------------------
232 :
233 : private:
234 :
235 : static Sequence< OUString > impl_GetPropertyNames();
236 :
237 : //-------------------------------------------------------------------------------------------------------------
238 : // private member
239 : //-------------------------------------------------------------------------------------------------------------
240 :
241 : private:
242 :
243 : sal_Bool m_bOverlayBuffer;
244 : sal_Bool m_bPaintBuffer;
245 : Color m_bStripeColorA;
246 : Color m_bStripeColorB;
247 : sal_uInt16 m_nStripeLength;
248 :
249 : // #i73602#
250 : sal_Bool m_bOverlayBuffer_Calc;
251 : sal_Bool m_bOverlayBuffer_Writer;
252 : sal_Bool m_bOverlayBuffer_DrawImpress;
253 :
254 : // #i74769#, #i75172#
255 : sal_Bool m_bPaintBuffer_Calc;
256 : sal_Bool m_bPaintBuffer_Writer;
257 : sal_Bool m_bPaintBuffer_DrawImpress;
258 :
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;
266 :
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;
275 :
276 : // #i97672# selection settings
277 : sal_uInt16 m_nTransparentSelectionPercent;
278 : sal_uInt16 m_nSelectionMaximumLuminancePercent;
279 : sal_Bool m_bTransparentSelection;
280 :
281 : // local values
282 : bool m_bAllowAA : 1;
283 : bool m_bAllowAAChecked : 1;
284 : };
285 :
286 : //*****************************************************************************************************************
287 : // constructor
288 : //*****************************************************************************************************************
289 38 : 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),
296 :
297 : // #i73602#
298 : m_bOverlayBuffer_Calc( DEFAULT_OVERLAYBUFFER_CALC ),
299 : m_bOverlayBuffer_Writer( DEFAULT_OVERLAYBUFFER_WRITER ),
300 : m_bOverlayBuffer_DrawImpress( DEFAULT_OVERLAYBUFFER_DRAWIMPRESS ),
301 :
302 : // #i74769#, #i75172#
303 : m_bPaintBuffer_Calc( DEFAULT_PAINTBUFFER_CALC ),
304 : m_bPaintBuffer_Writer( DEFAULT_PAINTBUFFER_WRITER ),
305 : m_bPaintBuffer_DrawImpress( DEFAULT_PAINTBUFFER_DRAWIMPRESS ),
306 :
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),
314 :
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),
323 :
324 : // #i97672# selection settings
325 : m_nTransparentSelectionPercent(DEFAULT_TRANSPARENTSELECTIONPERCENT),
326 : m_nSelectionMaximumLuminancePercent(DEFAULT_SELECTIONMAXIMUMLUMINANCEPERCENT),
327 : m_bTransparentSelection(DEFAULT_TRANSPARENTSELECTION),
328 :
329 : // local values
330 : m_bAllowAA(true),
331 38 : m_bAllowAAChecked(false)
332 : {
333 38 : Sequence< OUString > seqNames( impl_GetPropertyNames() );
334 38 : Sequence< Any > seqValues = GetProperties( seqNames ) ;
335 :
336 : DBG_ASSERT( !(seqNames.getLength()!=seqValues.getLength()), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nI miss some values of configuration keys!\n" );
337 :
338 : // Copy values from list in right order to our internal member.
339 38 : sal_Int32 nPropertyCount = seqValues.getLength();
340 1064 : for(sal_Int32 nProperty=0; nProperty<nPropertyCount; ++nProperty )
341 : {
342 1026 : if (seqValues[nProperty].hasValue()==sal_False)
343 0 : continue;
344 :
345 1026 : switch( nProperty )
346 : {
347 : case PROPERTYHANDLE_OVERLAYBUFFER:
348 : {
349 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\OverlayBuffer\"?" );
350 38 : seqValues[nProperty] >>= m_bOverlayBuffer;
351 : }
352 38 : break;
353 :
354 : case PROPERTYHANDLE_PAINTBUFFER:
355 : {
356 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\PaintBuffer\"?" );
357 38 : seqValues[nProperty] >>= m_bPaintBuffer;
358 : }
359 38 : break;
360 :
361 : case PROPERTYHANDLE_STRIPE_COLOR_A:
362 : {
363 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorA\"?" );
364 38 : sal_Int32 nValue = 0;
365 38 : seqValues[nProperty] >>= nValue;
366 38 : m_bStripeColorA = nValue;
367 : }
368 38 : break;
369 :
370 : case PROPERTYHANDLE_STRIPE_COLOR_B:
371 : {
372 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeColorB\"?" );
373 38 : sal_Int32 nValue = 0;
374 38 : seqValues[nProperty] >>= nValue;
375 38 : m_bStripeColorB = nValue;
376 : }
377 38 : break;
378 :
379 : case PROPERTYHANDLE_STRIPE_LENGTH:
380 : {
381 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\StripeLength\"?" );
382 38 : seqValues[nProperty] >>= m_nStripeLength;
383 : }
384 38 : break;
385 :
386 : // #i73602#
387 : case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
388 : {
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 38 : seqValues[nProperty] >>= m_bOverlayBuffer_Calc;
391 : }
392 38 : break;
393 :
394 : case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
395 : {
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 38 : seqValues[nProperty] >>= m_bOverlayBuffer_Writer;
398 : }
399 38 : break;
400 :
401 : case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
402 : {
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 38 : seqValues[nProperty] >>= m_bOverlayBuffer_DrawImpress;
405 : }
406 38 : break;
407 :
408 : // #i74769#, #i75172#
409 : case PROPERTYHANDLE_PAINTBUFFER_CALC:
410 : {
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 38 : seqValues[nProperty] >>= m_bPaintBuffer_Calc;
413 : }
414 38 : break;
415 :
416 : case PROPERTYHANDLE_PAINTBUFFER_WRITER:
417 : {
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 38 : seqValues[nProperty] >>= m_bPaintBuffer_Writer;
420 : }
421 38 : break;
422 :
423 : case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
424 : {
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 38 : seqValues[nProperty] >>= m_bPaintBuffer_DrawImpress;
427 : }
428 38 : break;
429 :
430 : // #i4219#
431 : case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
432 : {
433 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperWidth\"?" );
434 38 : seqValues[nProperty] >>= m_nMaximumPaperWidth;
435 : }
436 38 : break;
437 :
438 : case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
439 : {
440 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperHeight\"?" );
441 38 : seqValues[nProperty] >>= m_nMaximumPaperHeight;
442 : }
443 38 : break;
444 :
445 : case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
446 : {
447 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperLeftMargin\"?" );
448 38 : seqValues[nProperty] >>= m_nMaximumPaperLeftMargin;
449 : }
450 38 : break;
451 :
452 : case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
453 : {
454 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperRightMargin\"?" );
455 38 : seqValues[nProperty] >>= m_nMaximumPaperRightMargin;
456 : }
457 38 : break;
458 :
459 : case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
460 : {
461 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperTopMargin\"?" );
462 38 : seqValues[nProperty] >>= m_nMaximumPaperTopMargin;
463 : }
464 38 : break;
465 :
466 : case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
467 : {
468 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\MaximumPaperBottomMargin\"?" );
469 38 : seqValues[nProperty] >>= m_nMaximumPaperBottomMargin;
470 : }
471 38 : break;
472 :
473 : // primitives
474 : case PROPERTYHANDLE_ANTIALIASING:
475 : {
476 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\AntiAliasing\"?" );
477 38 : seqValues[nProperty] >>= m_bAntiAliasing;
478 : }
479 38 : break;
480 :
481 : // primitives
482 : case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
483 : {
484 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SnapHorVerLinesToDiscrete\"?" );
485 38 : seqValues[nProperty] >>= m_bSnapHorVerLinesToDiscrete;
486 : }
487 38 : break;
488 :
489 : case PROPERTYHANDLE_SOLIDDRAGCREATE:
490 : {
491 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SolidDragCreate\"?" );
492 38 : seqValues[nProperty] >>= m_bSolidDragCreate;
493 : }
494 38 : break;
495 :
496 : case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
497 : {
498 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderDecoratedTextDirect\"?" );
499 38 : seqValues[nProperty] >>= m_bRenderDecoratedTextDirect;
500 : }
501 38 : break;
502 :
503 : case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
504 : {
505 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\RenderSimpleTextDirect\"?" );
506 38 : seqValues[nProperty] >>= m_bRenderSimpleTextDirect;
507 : }
508 38 : break;
509 :
510 : case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
511 : {
512 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\Quadratic3DRenderLimit\"?" );
513 38 : seqValues[nProperty] >>= m_nQuadratic3DRenderLimit;
514 : }
515 38 : break;
516 :
517 : case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
518 : {
519 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_LONG), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\QuadraticFormControlRenderLimit\"?" );
520 38 : seqValues[nProperty] >>= m_nQuadraticFormControlRenderLimit;
521 : }
522 38 : break;
523 :
524 : // #i97672# selection settings
525 : case PROPERTYHANDLE_TRANSPARENTSELECTION:
526 : {
527 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_BOOLEAN), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelection\"?" );
528 38 : seqValues[nProperty] >>= m_bTransparentSelection;
529 : }
530 38 : break;
531 :
532 : case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
533 : {
534 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\TransparentSelectionPercent\"?" );
535 38 : seqValues[nProperty] >>= m_nTransparentSelectionPercent;
536 : }
537 :
538 : case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
539 : {
540 : DBG_ASSERT(!(seqValues[nProperty].getValueTypeClass()!=TypeClass_SHORT), "SvtOptionsDrawinglayer_Impl::SvtOptionsDrawinglayer_Impl()\nWho has changed the value type of \"Office.Common\\Drawinglayer\\SelectionMaximumLuminancePercent\"?" );
541 76 : seqValues[nProperty] >>= m_nSelectionMaximumLuminancePercent;
542 : }
543 76 : break;
544 : }
545 38 : }
546 38 : }
547 :
548 : //*****************************************************************************************************************
549 : // destructor
550 : //*****************************************************************************************************************
551 78 : SvtOptionsDrawinglayer_Impl::~SvtOptionsDrawinglayer_Impl()
552 : {
553 26 : if( IsModified() )
554 1 : Commit();
555 52 : }
556 :
557 : //*****************************************************************************************************************
558 : // Commit
559 : //*****************************************************************************************************************
560 1 : void SvtOptionsDrawinglayer_Impl::Commit()
561 : {
562 1 : Sequence< OUString > aSeqNames( impl_GetPropertyNames() );
563 1 : Sequence< Any > aSeqValues( aSeqNames.getLength() );
564 :
565 28 : for( sal_Int32 nProperty = 0, nCount = aSeqNames.getLength(); nProperty < nCount; ++nProperty )
566 : {
567 27 : switch( nProperty )
568 : {
569 : case PROPERTYHANDLE_OVERLAYBUFFER:
570 1 : aSeqValues[nProperty] <<= m_bOverlayBuffer;
571 1 : break;
572 :
573 : case PROPERTYHANDLE_PAINTBUFFER:
574 1 : aSeqValues[nProperty] <<= m_bPaintBuffer;
575 1 : break;
576 :
577 : case PROPERTYHANDLE_STRIPE_COLOR_A:
578 1 : aSeqValues[nProperty] <<= m_bStripeColorA.GetColor();
579 1 : break;
580 :
581 : case PROPERTYHANDLE_STRIPE_COLOR_B:
582 1 : aSeqValues[nProperty] <<= m_bStripeColorB.GetColor();
583 1 : break;
584 :
585 : case PROPERTYHANDLE_STRIPE_LENGTH:
586 1 : aSeqValues[nProperty] <<= m_nStripeLength;
587 1 : break;
588 :
589 : // #i73602#
590 : case PROPERTYHANDLE_OVERLAYBUFFER_CALC:
591 1 : aSeqValues[nProperty] <<= m_bOverlayBuffer_Calc;
592 1 : break;
593 :
594 : case PROPERTYHANDLE_OVERLAYBUFFER_WRITER:
595 1 : aSeqValues[nProperty] <<= m_bOverlayBuffer_Writer;
596 1 : break;
597 :
598 : case PROPERTYHANDLE_OVERLAYBUFFER_DRAWIMPRESS:
599 1 : aSeqValues[nProperty] <<= m_bOverlayBuffer_DrawImpress;
600 1 : break;
601 :
602 : // #i74769#, #i75172#
603 : case PROPERTYHANDLE_PAINTBUFFER_CALC:
604 1 : aSeqValues[nProperty] <<= m_bPaintBuffer_Calc;
605 1 : break;
606 :
607 : case PROPERTYHANDLE_PAINTBUFFER_WRITER:
608 1 : aSeqValues[nProperty] <<= m_bPaintBuffer_Writer;
609 1 : break;
610 :
611 : case PROPERTYHANDLE_PAINTBUFFER_DRAWIMPRESS:
612 1 : aSeqValues[nProperty] <<= m_bPaintBuffer_DrawImpress;
613 1 : break;
614 :
615 : // #i4219#
616 : case PROPERTYHANDLE_MAXIMUMPAPERWIDTH:
617 1 : aSeqValues[nProperty] <<= m_nMaximumPaperWidth;
618 1 : break;
619 :
620 : case PROPERTYHANDLE_MAXIMUMPAPERHEIGHT:
621 1 : aSeqValues[nProperty] <<= m_nMaximumPaperHeight;
622 1 : break;
623 :
624 : case PROPERTYHANDLE_MAXIMUMPAPERLEFTMARGIN:
625 1 : aSeqValues[nProperty] <<= m_nMaximumPaperLeftMargin;
626 1 : break;
627 :
628 : case PROPERTYHANDLE_MAXIMUMPAPERRIGHTMARGIN:
629 1 : aSeqValues[nProperty] <<= m_nMaximumPaperRightMargin;
630 1 : break;
631 :
632 : case PROPERTYHANDLE_MAXIMUMPAPERTOPMARGIN:
633 1 : aSeqValues[nProperty] <<= m_nMaximumPaperTopMargin;
634 1 : break;
635 :
636 : case PROPERTYHANDLE_MAXIMUMPAPERBOTTOMMARGIN:
637 1 : aSeqValues[nProperty] <<= m_nMaximumPaperBottomMargin;
638 1 : break;
639 :
640 : // primitives
641 : case PROPERTYHANDLE_ANTIALIASING:
642 1 : aSeqValues[nProperty] <<= m_bAntiAliasing;
643 1 : break;
644 :
645 : case PROPERTYHANDLE_SNAPHORVERLINESTODISCRETE:
646 1 : aSeqValues[nProperty] <<= m_bSnapHorVerLinesToDiscrete;
647 1 : break;
648 :
649 : case PROPERTYHANDLE_SOLIDDRAGCREATE:
650 1 : aSeqValues[nProperty] <<= m_bSolidDragCreate;
651 1 : break;
652 :
653 : case PROPERTYHANDLE_RENDERDECORATEDTEXTDIRECT:
654 1 : aSeqValues[nProperty] <<= m_bRenderDecoratedTextDirect;
655 1 : break;
656 :
657 : case PROPERTYHANDLE_RENDERSIMPLETEXTDIRECT:
658 1 : aSeqValues[nProperty] <<= m_bRenderSimpleTextDirect;
659 1 : break;
660 :
661 : case PROPERTYHANDLE_QUADRATIC3DRENDERLIMIT:
662 1 : aSeqValues[nProperty] <<= m_nQuadratic3DRenderLimit;
663 1 : break;
664 :
665 : case PROPERTYHANDLE_QUADRATICFORMCONTROLRENDERLIMIT:
666 1 : aSeqValues[nProperty] <<= m_nQuadraticFormControlRenderLimit;
667 1 : break;
668 :
669 : // #i97672# selection settings
670 : case PROPERTYHANDLE_TRANSPARENTSELECTION:
671 1 : aSeqValues[nProperty] <<= m_bTransparentSelection;
672 1 : break;
673 :
674 : case PROPERTYHANDLE_TRANSPARENTSELECTIONPERCENT:
675 1 : aSeqValues[nProperty] <<= m_nTransparentSelectionPercent;
676 1 : break;
677 :
678 : case PROPERTYHANDLE_SELECTIONMAXIMUMLUMINANCEPERCENT:
679 1 : aSeqValues[nProperty] <<= m_nSelectionMaximumLuminancePercent;
680 1 : break;
681 : }
682 : }
683 :
684 1 : PutProperties( aSeqNames, aSeqValues );
685 1 : }
686 :
687 0 : void SvtOptionsDrawinglayer_Impl::Notify( const com::sun::star::uno::Sequence<rtl::OUString>& )
688 : {
689 0 : }
690 :
691 : //*****************************************************************************************************************
692 : // public method
693 : //*****************************************************************************************************************
694 371 : sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer() const
695 : {
696 371 : return m_bOverlayBuffer;
697 : }
698 :
699 : //*****************************************************************************************************************
700 : // public method
701 : //*****************************************************************************************************************
702 264 : sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer() const
703 : {
704 264 : return m_bPaintBuffer;
705 : }
706 :
707 : //*****************************************************************************************************************
708 : // public method
709 : //*****************************************************************************************************************
710 133 : Color SvtOptionsDrawinglayer_Impl::GetStripeColorA() const
711 : {
712 133 : return m_bStripeColorA;
713 : }
714 :
715 : //*****************************************************************************************************************
716 : // public method
717 : //*****************************************************************************************************************
718 133 : Color SvtOptionsDrawinglayer_Impl::GetStripeColorB() const
719 : {
720 133 : return m_bStripeColorB;
721 : }
722 :
723 : //*****************************************************************************************************************
724 : // public method
725 : //*****************************************************************************************************************
726 133 : sal_uInt16 SvtOptionsDrawinglayer_Impl::GetStripeLength() const
727 : {
728 133 : return m_nStripeLength;
729 : }
730 :
731 : // #i73602#
732 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Calc() const
733 : {
734 0 : return m_bOverlayBuffer_Calc;
735 : }
736 :
737 238 : sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_Writer() const
738 : {
739 238 : return m_bOverlayBuffer_Writer;
740 : }
741 :
742 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsOverlayBuffer_DrawImpress() const
743 : {
744 0 : return m_bOverlayBuffer_DrawImpress;
745 : }
746 :
747 : // #i74769#, #i75172#
748 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Calc() const
749 : {
750 0 : return m_bPaintBuffer_Calc;
751 : }
752 :
753 238 : sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_Writer() const
754 : {
755 238 : return m_bPaintBuffer_Writer;
756 : }
757 :
758 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsPaintBuffer_DrawImpress() const
759 : {
760 0 : return m_bPaintBuffer_DrawImpress;
761 : }
762 :
763 : // #i4219#
764 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperWidth() const
765 : {
766 0 : return m_nMaximumPaperWidth;
767 : }
768 :
769 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperHeight() const
770 : {
771 0 : return m_nMaximumPaperHeight;
772 : }
773 :
774 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperLeftMargin() const
775 : {
776 0 : return m_nMaximumPaperLeftMargin;
777 : }
778 :
779 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperRightMargin() const
780 : {
781 0 : return m_nMaximumPaperRightMargin;
782 : }
783 :
784 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperTopMargin() const
785 : {
786 0 : return m_nMaximumPaperTopMargin;
787 : }
788 :
789 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetMaximumPaperBottomMargin() const
790 : {
791 0 : return m_nMaximumPaperBottomMargin;
792 : }
793 :
794 : // helper
795 4073 : sal_Bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
796 : {
797 4073 : if(!m_bAllowAAChecked)
798 : {
799 9 : SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
800 9 : pThat->m_bAllowAAChecked = true;
801 :
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
808 :
809 : // check XRenderExtension
810 9 : if(m_bAllowAA && !Application::GetDefaultDevice()->supportsOperation( OutDevSupport_TransparentRect ))
811 : {
812 9 : pThat->m_bAllowAA = false;
813 : }
814 : }
815 :
816 4073 : return m_bAllowAA;
817 : }
818 :
819 : // primitives
820 4073 : sal_Bool SvtOptionsDrawinglayer_Impl::IsAntiAliasing() const
821 : {
822 4073 : return m_bAntiAliasing;
823 : }
824 :
825 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsSnapHorVerLinesToDiscrete() const
826 : {
827 0 : return m_bSnapHorVerLinesToDiscrete;
828 : }
829 :
830 640 : sal_Bool SvtOptionsDrawinglayer_Impl::IsSolidDragCreate() const
831 : {
832 640 : return m_bSolidDragCreate;
833 : }
834 :
835 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderDecoratedTextDirect() const
836 : {
837 0 : return m_bRenderDecoratedTextDirect;
838 : }
839 :
840 2 : sal_Bool SvtOptionsDrawinglayer_Impl::IsRenderSimpleTextDirect() const
841 : {
842 2 : return m_bRenderSimpleTextDirect;
843 : }
844 :
845 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadratic3DRenderLimit() const
846 : {
847 0 : return m_nQuadratic3DRenderLimit;
848 : }
849 :
850 0 : sal_uInt32 SvtOptionsDrawinglayer_Impl::GetQuadraticFormControlRenderLimit() const
851 : {
852 0 : return m_nQuadraticFormControlRenderLimit;
853 : }
854 :
855 2 : void SvtOptionsDrawinglayer_Impl::SetAntiAliasing( sal_Bool bState )
856 : {
857 2 : if(m_bAntiAliasing != bState)
858 : {
859 1 : m_bAntiAliasing = bState;
860 1 : SetModified();
861 : }
862 2 : }
863 :
864 : // #i97672# selection settings
865 0 : sal_Bool SvtOptionsDrawinglayer_Impl::IsTransparentSelection() const
866 : {
867 0 : return m_bTransparentSelection;
868 : }
869 :
870 0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelection( sal_Bool bState )
871 : {
872 0 : if(m_bTransparentSelection != bState)
873 : {
874 0 : m_bTransparentSelection = bState;
875 0 : SetModified();
876 : }
877 0 : }
878 :
879 0 : void SvtOptionsDrawinglayer_Impl::SetTransparentSelectionPercent( sal_uInt16 nPercent )
880 : {
881 0 : if(m_nTransparentSelectionPercent != nPercent)
882 : {
883 0 : m_nTransparentSelectionPercent = nPercent;
884 0 : SetModified();
885 : }
886 0 : }
887 :
888 0 : sal_uInt16 SvtOptionsDrawinglayer_Impl::GetTransparentSelectionPercent() const
889 : {
890 0 : return m_nTransparentSelectionPercent;
891 : }
892 :
893 0 : sal_uInt16 SvtOptionsDrawinglayer_Impl::GetSelectionMaximumLuminancePercent() const
894 : {
895 0 : return m_nSelectionMaximumLuminancePercent;
896 : }
897 :
898 : //*****************************************************************************************************************
899 : // private method
900 : //*****************************************************************************************************************
901 39 : Sequence< OUString > SvtOptionsDrawinglayer_Impl::impl_GetPropertyNames()
902 : {
903 : // Build list of configuration key names.
904 : const OUString pProperties[] =
905 : {
906 : PROPERTYNAME_OVERLAYBUFFER ,
907 : PROPERTYNAME_PAINTBUFFER ,
908 : PROPERTYNAME_STRIPE_COLOR_A ,
909 : PROPERTYNAME_STRIPE_COLOR_B ,
910 : PROPERTYNAME_STRIPE_LENGTH ,
911 :
912 : // #i73602#
913 : PROPERTYNAME_OVERLAYBUFFER_CALC,
914 : PROPERTYNAME_OVERLAYBUFFER_WRITER,
915 : PROPERTYNAME_OVERLAYBUFFER_DRAWIMPRESS,
916 :
917 : // #i74769#, #i75172#
918 : PROPERTYNAME_PAINTBUFFER_CALC,
919 : PROPERTYNAME_PAINTBUFFER_WRITER,
920 : PROPERTYNAME_PAINTBUFFER_DRAWIMPRESS,
921 :
922 : // #i4219#
923 : PROPERTYNAME_MAXIMUMPAPERWIDTH,
924 : PROPERTYNAME_MAXIMUMPAPERHEIGHT,
925 : PROPERTYNAME_MAXIMUMPAPERLEFTMARGIN,
926 : PROPERTYNAME_MAXIMUMPAPERRIGHTMARGIN,
927 : PROPERTYNAME_MAXIMUMPAPERTOPMARGIN,
928 : PROPERTYNAME_MAXIMUMPAPERBOTTOMMARGIN,
929 :
930 : // primitives
931 : PROPERTYNAME_ANTIALIASING,
932 : PROPERTYNAME_SNAPHORVERLINESTODISCRETE,
933 : PROPERTYNAME_SOLIDDRAGCREATE,
934 : PROPERTYNAME_RENDERDECORATEDTEXTDIRECT,
935 : PROPERTYNAME_RENDERSIMPLETEXTDIRECT,
936 : PROPERTYNAME_QUADRATIC3DRENDERLIMIT,
937 : PROPERTYNAME_QUADRATICFORMCONTROLRENDERLIMIT,
938 :
939 : // #i97672# selection settings
940 : PROPERTYNAME_TRANSPARENTSELECTION,
941 : PROPERTYNAME_TRANSPARENTSELECTIONPERCENT,
942 : PROPERTYNAME_SELECTIONMAXIMUMLUMINANCEPERCENT
943 1092 : };
944 :
945 : // Initialize return sequence with these list ...
946 39 : const Sequence< OUString > seqPropertyNames( pProperties, PROPERTYCOUNT );
947 : // ... and return it.
948 1092 : return seqPropertyNames;
949 : }
950 :
951 : //*****************************************************************************************************************
952 : // initialize static member
953 : // DON'T DO IT IN YOUR HEADER!
954 : // see definition for further informations
955 : //*****************************************************************************************************************
956 : SvtOptionsDrawinglayer_Impl* SvtOptionsDrawinglayer::m_pDataContainer = NULL;
957 : sal_Int32 SvtOptionsDrawinglayer::m_nRefCount = 0;
958 :
959 : //*****************************************************************************************************************
960 : // constructor
961 : //*****************************************************************************************************************
962 2178 : SvtOptionsDrawinglayer::SvtOptionsDrawinglayer()
963 : {
964 : // Global access, must be guarded (multithreading!).
965 2178 : MutexGuard aGuard( GetOwnStaticMutex() );
966 : // Increase our refcount ...
967 2178 : ++m_nRefCount;
968 : // ... and initialize our data container only if it not already!
969 2178 : if( m_pDataContainer == NULL )
970 : {
971 38 : m_pDataContainer = new SvtOptionsDrawinglayer_Impl();
972 2178 : }
973 2178 : }
974 :
975 : //*****************************************************************************************************************
976 : // destructor
977 : //*****************************************************************************************************************
978 1699 : SvtOptionsDrawinglayer::~SvtOptionsDrawinglayer()
979 : {
980 : // Global access, must be guarded (multithreading!)
981 1699 : MutexGuard aGuard( GetOwnStaticMutex() );
982 : // Decrease our refcount.
983 1699 : --m_nRefCount;
984 : // If last instance was deleted ...
985 : // we must destroy our static data container!
986 1699 : if( m_nRefCount <= 0 )
987 : {
988 26 : delete m_pDataContainer;
989 26 : m_pDataContainer = NULL;
990 1699 : }
991 1699 : }
992 :
993 : //*****************************************************************************************************************
994 : // public method
995 : //*****************************************************************************************************************
996 371 : sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer() const
997 : {
998 371 : MutexGuard aGuard( GetOwnStaticMutex() );
999 371 : return m_pDataContainer->IsOverlayBuffer();
1000 : }
1001 :
1002 : //*****************************************************************************************************************
1003 : // public method
1004 : //*****************************************************************************************************************
1005 264 : sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer() const
1006 : {
1007 264 : MutexGuard aGuard( GetOwnStaticMutex() );
1008 264 : return m_pDataContainer->IsPaintBuffer();
1009 : }
1010 :
1011 : //*****************************************************************************************************************
1012 : // public method
1013 : //*****************************************************************************************************************
1014 133 : Color SvtOptionsDrawinglayer::GetStripeColorA() const
1015 : {
1016 133 : MutexGuard aGuard( GetOwnStaticMutex() );
1017 133 : return m_pDataContainer->GetStripeColorA();
1018 : }
1019 :
1020 : //*****************************************************************************************************************
1021 : // public method
1022 : //*****************************************************************************************************************
1023 133 : Color SvtOptionsDrawinglayer::GetStripeColorB() const
1024 : {
1025 133 : MutexGuard aGuard( GetOwnStaticMutex() );
1026 133 : return m_pDataContainer->GetStripeColorB();
1027 : }
1028 :
1029 : //*****************************************************************************************************************
1030 : // public method
1031 : //*****************************************************************************************************************
1032 133 : sal_uInt16 SvtOptionsDrawinglayer::GetStripeLength() const
1033 : {
1034 133 : MutexGuard aGuard( GetOwnStaticMutex() );
1035 133 : return m_pDataContainer->GetStripeLength();
1036 : }
1037 :
1038 : // #i73602#
1039 0 : sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Calc() const
1040 : {
1041 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1042 0 : return m_pDataContainer->IsOverlayBuffer_Calc();
1043 : }
1044 :
1045 238 : sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_Writer() const
1046 : {
1047 238 : MutexGuard aGuard( GetOwnStaticMutex() );
1048 238 : return m_pDataContainer->IsOverlayBuffer_Writer();
1049 : }
1050 :
1051 0 : sal_Bool SvtOptionsDrawinglayer::IsOverlayBuffer_DrawImpress() const
1052 : {
1053 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1054 0 : return m_pDataContainer->IsOverlayBuffer_DrawImpress();
1055 : }
1056 :
1057 : // #i74769#, #i75172#
1058 0 : sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Calc() const
1059 : {
1060 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1061 0 : return m_pDataContainer->IsPaintBuffer_Calc();
1062 : }
1063 :
1064 238 : sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_Writer() const
1065 : {
1066 238 : MutexGuard aGuard( GetOwnStaticMutex() );
1067 238 : return m_pDataContainer->IsPaintBuffer_Writer();
1068 : }
1069 :
1070 0 : sal_Bool SvtOptionsDrawinglayer::IsPaintBuffer_DrawImpress() const
1071 : {
1072 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1073 0 : return m_pDataContainer->IsPaintBuffer_DrawImpress();
1074 : }
1075 :
1076 : // #i4219#
1077 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperWidth() const
1078 : {
1079 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1080 0 : return m_pDataContainer->GetMaximumPaperWidth();
1081 : }
1082 :
1083 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperHeight() const
1084 : {
1085 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1086 0 : return m_pDataContainer->GetMaximumPaperHeight();
1087 : }
1088 :
1089 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperLeftMargin() const
1090 : {
1091 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1092 0 : return m_pDataContainer->GetMaximumPaperLeftMargin();
1093 : }
1094 :
1095 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperRightMargin() const
1096 : {
1097 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1098 0 : return m_pDataContainer->GetMaximumPaperRightMargin();
1099 : }
1100 :
1101 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperTopMargin() const
1102 : {
1103 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1104 0 : return m_pDataContainer->GetMaximumPaperTopMargin();
1105 : }
1106 :
1107 0 : sal_uInt32 SvtOptionsDrawinglayer::GetMaximumPaperBottomMargin() const
1108 : {
1109 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1110 0 : return m_pDataContainer->GetMaximumPaperBottomMargin();
1111 : }
1112 :
1113 : // helper
1114 4073 : sal_Bool SvtOptionsDrawinglayer::IsAAPossibleOnThisSystem() const
1115 : {
1116 4073 : return m_pDataContainer->IsAAPossibleOnThisSystem();
1117 : }
1118 :
1119 : // primitives
1120 4073 : sal_Bool SvtOptionsDrawinglayer::IsAntiAliasing() const
1121 : {
1122 4073 : MutexGuard aGuard( GetOwnStaticMutex() );
1123 4073 : return m_pDataContainer->IsAntiAliasing() && IsAAPossibleOnThisSystem();
1124 : }
1125 :
1126 0 : sal_Bool SvtOptionsDrawinglayer::IsSnapHorVerLinesToDiscrete() const
1127 : {
1128 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1129 0 : return m_pDataContainer->IsAntiAliasing() && m_pDataContainer->IsSnapHorVerLinesToDiscrete();
1130 : }
1131 :
1132 640 : sal_Bool SvtOptionsDrawinglayer::IsSolidDragCreate() const
1133 : {
1134 640 : MutexGuard aGuard( GetOwnStaticMutex() );
1135 640 : return m_pDataContainer->IsSolidDragCreate();
1136 : }
1137 :
1138 0 : sal_Bool SvtOptionsDrawinglayer::IsRenderDecoratedTextDirect() const
1139 : {
1140 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1141 0 : return m_pDataContainer->IsRenderDecoratedTextDirect();
1142 : }
1143 :
1144 2 : sal_Bool SvtOptionsDrawinglayer::IsRenderSimpleTextDirect() const
1145 : {
1146 2 : MutexGuard aGuard( GetOwnStaticMutex() );
1147 2 : return m_pDataContainer->IsRenderSimpleTextDirect();
1148 : }
1149 :
1150 0 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadratic3DRenderLimit() const
1151 : {
1152 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1153 0 : return m_pDataContainer->GetQuadratic3DRenderLimit();
1154 : }
1155 :
1156 0 : sal_uInt32 SvtOptionsDrawinglayer::GetQuadraticFormControlRenderLimit() const
1157 : {
1158 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1159 0 : return m_pDataContainer->GetQuadraticFormControlRenderLimit();
1160 : }
1161 :
1162 2 : void SvtOptionsDrawinglayer::SetAntiAliasing( sal_Bool bState )
1163 : {
1164 2 : MutexGuard aGuard( GetOwnStaticMutex() );
1165 2 : m_pDataContainer->SetAntiAliasing( bState );
1166 2 : }
1167 :
1168 : // #i97672# selection settings
1169 0 : sal_Bool SvtOptionsDrawinglayer::IsTransparentSelection() const
1170 : {
1171 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1172 0 : return m_pDataContainer->IsTransparentSelection();
1173 : }
1174 :
1175 0 : void SvtOptionsDrawinglayer::SetTransparentSelection( sal_Bool bState )
1176 : {
1177 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1178 0 : m_pDataContainer->SetTransparentSelection( bState );
1179 0 : }
1180 :
1181 0 : sal_uInt16 SvtOptionsDrawinglayer::GetTransparentSelectionPercent() const
1182 : {
1183 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1184 0 : sal_uInt16 aRetval(m_pDataContainer->GetTransparentSelectionPercent());
1185 :
1186 : // crop to range [10% .. 90%]
1187 0 : if(aRetval < 10)
1188 : {
1189 0 : aRetval = 10;
1190 : }
1191 :
1192 0 : if(aRetval > 90)
1193 : {
1194 0 : aRetval = 90;
1195 : }
1196 :
1197 0 : return aRetval;
1198 : }
1199 :
1200 0 : void SvtOptionsDrawinglayer::SetTransparentSelectionPercent( sal_uInt16 nPercent )
1201 : {
1202 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1203 :
1204 : // crop to range [10% .. 90%]
1205 0 : if(nPercent < 10)
1206 : {
1207 0 : nPercent = 10;
1208 : }
1209 :
1210 0 : if(nPercent > 90)
1211 : {
1212 0 : nPercent = 90;
1213 : }
1214 :
1215 0 : m_pDataContainer->SetTransparentSelectionPercent( nPercent );
1216 0 : }
1217 :
1218 0 : sal_uInt16 SvtOptionsDrawinglayer::GetSelectionMaximumLuminancePercent() const
1219 : {
1220 0 : MutexGuard aGuard( GetOwnStaticMutex() );
1221 0 : sal_uInt16 aRetval(m_pDataContainer->GetSelectionMaximumLuminancePercent());
1222 :
1223 : // crop to range [0% .. 100%]
1224 0 : if(aRetval > 90)
1225 : {
1226 0 : aRetval = 90;
1227 : }
1228 :
1229 0 : return aRetval;
1230 : }
1231 :
1232 : namespace
1233 : {
1234 : class theOptionsDrawinglayerMutex : public rtl::Static<osl::Mutex, theOptionsDrawinglayerMutex>{};
1235 : }
1236 :
1237 : //*****************************************************************************************************************
1238 : // private method
1239 : //*****************************************************************************************************************
1240 10104 : Mutex& SvtOptionsDrawinglayer::GetOwnStaticMutex()
1241 : {
1242 10104 : return theOptionsDrawinglayerMutex::get();
1243 : }
1244 :
1245 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|