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