1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svtools.hxx"
26 
27 #include <svtools/accessibilityoptions.hxx>
28 #include "configitems/accessibilityoptions_const.hxx"
29 
30 #include <unotools/configmgr.hxx>
31 #include <tools/debug.hxx>
32 #include <com/sun/star/uno/Any.hxx>
33 #include <com/sun/star/uno/Sequence.hxx>
34 
35 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #endif
38 #ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
39 #include <com/sun/star/container/XNameAccess.hpp>
40 #endif
41 #ifndef _COMPHELPER_CONFIGURATIONHELPER_HXX_
42 #include <comphelper/configurationhelper.hxx>
43 #endif
44 #ifndef _UNOTOOLS_PROCESSFACTORY_HXX_
45 #include <unotools/processfactory.hxx>
46 #endif
47 #ifndef _SVT_LOGHELPER_HXX_
48 #include <unotools/loghelper.hxx>
49 #endif
50 
51 #include <svl/smplhint.hxx>
52 
53 #include <vcl/settings.hxx>
54 #include <vcl/svapp.hxx>
55 #include <rtl/instance.hxx>
56 
57 #include <itemholder2.hxx>
58 
59 using namespace utl;
60 using namespace rtl;
61 using namespace com::sun::star::uno;
62 namespace css = com::sun::star;
63 
64 #define HELP_TIP_TIMEOUT 0xffff     // max. timeout setting to pretend a non-timeout
65 
66 
67 // class SvtAccessibilityOptions_Impl ---------------------------------------------
68 
69 class SvtAccessibilityOptions_Impl
70 {
71 private:
72 	css::uno::Reference< css::container::XNameAccess > m_xCfg;
73 	sal_Bool										   bIsModified;
74 
75 public:
76 	SvtAccessibilityOptions_Impl();
77 	~SvtAccessibilityOptions_Impl();
78 
79 	void		SetVCLSettings();
80 	sal_Bool	GetAutoDetectSystemHC();
81 	sal_Bool	GetIsForPagePreviews() const;
82 	sal_Bool	GetIsHelpTipsDisappear() const;
83 	sal_Bool	GetIsAllowAnimatedGraphics() const;
84 	sal_Bool	GetIsAllowAnimatedText() const;
85 	sal_Bool	GetIsAutomaticFontColor() const;
86 	sal_Bool	GetIsSystemFont() const;
87 	sal_Int16	GetHelpTipSeconds() const;
88 	sal_Bool	IsSelectionInReadonly() const;
89     sal_Int16   GetColorValueSetMaximumRowCount() const;
90     sal_Int16   GetColorValueSetEntryEdgeLength() const;
91     sal_Int16   GetColorValueSetColumnCount() const;
92     sal_Int16   GetEdgeBlending() const;
93 
94 	void		SetAutoDetectSystemHC(sal_Bool bSet);
95 	void		SetIsForPagePreviews(sal_Bool bSet);
96 	void		SetIsHelpTipsDisappear(sal_Bool bSet);
97 	void		SetIsAllowAnimatedGraphics(sal_Bool bSet);
98 	void		SetIsAllowAnimatedText(sal_Bool bSet);
99 	void		SetIsAutomaticFontColor(sal_Bool bSet);
100 	void		SetIsSystemFont(sal_Bool bSet);
101 	void		SetHelpTipSeconds(sal_Int16 nSet);
102 	void		SetSelectionInReadonly(sal_Bool bSet);
103     void        SetColorValueSetMaximumRowCount(sal_Int16 nSet);
104     void        SetColorValueSetEntryEdgeLength(sal_Int16 nSet);
105     void        SetColorValueSetColumnCount(sal_Int16 nSet);
106     void        SetEdgeBlending(sal_Int16 nSet);
107 
108 	sal_Bool	IsModified() const { return bIsModified; };
109 };
110 
111 // initialization of static members --------------------------------------
112 
113 SvtAccessibilityOptions_Impl* volatile 	SvtAccessibilityOptions::sm_pSingleImplConfig =NULL;
114 sal_Int32					  volatile 	SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
115 
116 namespace
117 {
118 	struct SingletonMutex
119 		: public rtl::Static< ::osl::Mutex, SingletonMutex > {};
120 }
121 
122 // -----------------------------------------------------------------------
123 // class SvtAccessibilityOptions_Impl ---------------------------------------------
124 
125 SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl()
126 {
127 	try
128 	{
129 		m_xCfg = css::uno::Reference< css::container::XNameAccess >(
130 			::comphelper::ConfigurationHelper::openConfig(
131 			utl::getProcessServiceFactory(),
132 			s_sAccessibility,
133 			::comphelper::ConfigurationHelper::E_STANDARD),
134 			css::uno::UNO_QUERY);
135 
136 		bIsModified = sal_False;
137 	}
138 	catch(const css::uno::Exception& ex)
139 	{
140 		m_xCfg.clear();
141 		LogHelper::logIt(ex);
142 	}
143 }
144 
145 SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl()
146 {
147 }
148 
149 // -----------------------------------------------------------------------
150 sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC()
151 {
152 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
153 	sal_Bool										bRet = sal_True;
154 
155 	try
156 	{
157 		if(xNode.is())
158 			xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet;
159 	}
160 	catch(const css::uno::Exception& ex)
161 	{
162 		LogHelper::logIt(ex);
163 	}
164 
165 	return bRet;
166 }
167 
168 sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const
169 {
170 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
171 	sal_Bool										bRet = sal_True;
172 
173 	try
174 	{
175 		if(xNode.is())
176 			xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet;
177 	}
178 	catch(const css::uno::Exception& ex)
179 	{
180 		LogHelper::logIt(ex);
181 	}
182 	return bRet;
183 }
184 
185 sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
186 {
187 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
188 	sal_Bool										bRet = sal_True;
189 
190 	try
191 	{
192 		if(xNode.is())
193 			xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet;
194 	}
195 	catch(const css::uno::Exception& ex)
196 	{
197 		LogHelper::logIt(ex);
198 	}
199 
200 	return bRet;
201 }
202 
203 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
204 {
205 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
206 	sal_Bool										bRet = sal_True;
207 
208 	try
209 	{
210 		if(xNode.is())
211 			xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet;
212 	}
213 	catch(const css::uno::Exception& ex)
214 	{
215 		LogHelper::logIt(ex);
216 	}
217 
218 	return bRet;
219 }
220 
221 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const
222 {
223 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
224 	sal_Bool										bRet = sal_True;
225 
226 	try
227 	{
228 		if(xNode.is())
229 			xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet;
230 	}
231 	catch(const css::uno::Exception& ex)
232 	{
233 		LogHelper::logIt(ex);
234 	}
235 
236 	return bRet;
237 }
238 
239 sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const
240 {
241 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
242 	sal_Bool										bRet = sal_False;
243 
244 	try
245 	{
246 		if(xNode.is())
247 			xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet;
248 	}
249 	catch(const css::uno::Exception& ex)
250 	{
251 		LogHelper::logIt(ex);
252 	}
253 
254 	return bRet;
255 }
256 
257 sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const
258 {
259 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
260 	sal_Bool										bRet = sal_True;
261 
262 	try
263 	{
264 		if(xNode.is())
265 			xNode->getPropertyValue(s_sIsSystemFont) >>= bRet;
266 	}
267 	catch(const css::uno::Exception& ex)
268 	{
269 		LogHelper::logIt(ex);
270 	}
271 
272 	return bRet;
273 }
274 
275 sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const
276 {
277 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
278 	sal_Int16										nRet = 4;
279 
280 	try
281 	{
282 		if(xNode.is())
283 			xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet;
284 	}
285 	catch(const css::uno::Exception& ex)
286 	{
287 		LogHelper::logIt(ex);
288 	}
289 
290 	return nRet;
291 }
292 
293 sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
294 {
295 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
296 	sal_Bool										bRet = sal_False;
297 
298 	try
299 	{
300 		if(xNode.is())
301 			xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet;
302 	}
303 	catch(const css::uno::Exception& ex)
304 	{
305 		LogHelper::logIt(ex);
306 	}
307 
308 	return bRet;
309 }
310 
311 sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetMaximumRowCount() const
312 {
313     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
314     sal_Int16 nRet = 40;
315 
316     try
317     {
318         if(xNode.is())
319             xNode->getPropertyValue(s_sColorValueSetMaximumRowCount) >>= nRet;
320     }
321     catch(const css::uno::Exception& ex)
322     {
323         LogHelper::logIt(ex);
324     }
325 
326     return nRet;
327 }
328 
329 sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetEntryEdgeLength() const
330 {
331     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
332     sal_Int16 nRet = 14;
333 
334     try
335     {
336         if(xNode.is())
337             xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength) >>= nRet;
338     }
339     catch(const css::uno::Exception& ex)
340     {
341         LogHelper::logIt(ex);
342     }
343 
344     return nRet;
345 }
346 
347 sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
348 {
349     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
350     sal_Int16 nRet = 12;
351 
352     try
353     {
354         if(xNode.is())
355             xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet;
356     }
357     catch(const css::uno::Exception& ex)
358     {
359         LogHelper::logIt(ex);
360     }
361 
362     return nRet;
363 }
364 
365 sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const
366 {
367     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
368     sal_Int16 nRet = 35;
369 
370     try
371     {
372         if(xNode.is())
373             xNode->getPropertyValue(s_sEdgeBlending) >>= nRet;
374     }
375     catch(const css::uno::Exception& ex)
376     {
377         LogHelper::logIt(ex);
378     }
379 
380     return nRet;
381 }
382 
383 void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet)
384 {
385 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
386 
387 	try
388 	{
389 		if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet)
390 		{
391 			xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet));
392 			::comphelper::ConfigurationHelper::flush(m_xCfg);
393 
394 			bIsModified = sal_True;
395 		}
396 	}
397 	catch(const css::uno::Exception& ex)
398 	{
399 		LogHelper::logIt(ex);
400 	}
401 }
402 
403 void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet)
404 {
405 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
406 
407 	try
408 	{
409 		if(xNode.is() && xNode->getPropertyValue(s_sIsForPagePreviews)!=bSet)
410 		{
411 			xNode->setPropertyValue(s_sIsForPagePreviews, css::uno::makeAny(bSet));
412 			::comphelper::ConfigurationHelper::flush(m_xCfg);
413 
414 			bIsModified = sal_True;
415 		}
416 	}
417 	catch(const css::uno::Exception& ex)
418 	{
419 		LogHelper::logIt(ex);
420 	}
421 }
422 
423 void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet)
424 {
425 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
426 
427 	try
428 	{
429 		if(xNode.is() && xNode->getPropertyValue(s_sIsHelpTipsDisappear)!=bSet)
430 		{
431 			xNode->setPropertyValue(s_sIsHelpTipsDisappear, css::uno::makeAny(bSet));
432 			::comphelper::ConfigurationHelper::flush(m_xCfg);
433 
434 			bIsModified = sal_True;
435 		}
436 	}
437 	catch(const css::uno::Exception& ex)
438 	{
439 		LogHelper::logIt(ex);
440 	}
441 }
442 
443 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet)
444 {
445 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
446 
447 	try
448 	{
449 		if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedGraphics)!=bSet)
450 		{
451 			xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, css::uno::makeAny(bSet));
452 			::comphelper::ConfigurationHelper::flush(m_xCfg);
453 
454 			bIsModified = sal_True;
455 		}
456 	}
457 	catch(const css::uno::Exception& ex)
458 	{
459 		LogHelper::logIt(ex);
460 	}
461 }
462 
463 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet)
464 {
465 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
466 
467 	try
468 	{
469 		if(xNode.is() && xNode->getPropertyValue(s_sIsAllowAnimatedText)!=bSet)
470 		{
471 			xNode->setPropertyValue(s_sIsAllowAnimatedText, css::uno::makeAny(bSet));
472 			::comphelper::ConfigurationHelper::flush(m_xCfg);
473 
474 			bIsModified = sal_True;
475 		}
476 	}
477 	catch(const css::uno::Exception& ex)
478 	{
479 		LogHelper::logIt(ex);
480 	}
481 }
482 
483 void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet)
484 {
485 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
486 
487 	try
488 	{
489 		if(xNode.is() && xNode->getPropertyValue(s_sIsAutomaticFontColor)!=bSet)
490 		{
491 			xNode->setPropertyValue(s_sIsAutomaticFontColor, css::uno::makeAny(bSet));
492 			::comphelper::ConfigurationHelper::flush(m_xCfg);
493 
494 			bIsModified = sal_True;
495 		}
496 	}
497 	catch(const css::uno::Exception& ex)
498 	{
499 		LogHelper::logIt(ex);
500 	}
501 }
502 
503 void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet)
504 {
505 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
506 
507 	try
508 	{
509 		if(xNode.is() && xNode->getPropertyValue(s_sIsSystemFont)!=bSet)
510 		{
511 			xNode->setPropertyValue(s_sIsSystemFont, css::uno::makeAny(bSet));
512 			::comphelper::ConfigurationHelper::flush(m_xCfg);
513 
514 			bIsModified = sal_True;
515 		}
516 	}
517 	catch(const css::uno::Exception& ex)
518 	{
519 		LogHelper::logIt(ex);
520 	}
521 }
522 
523 void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet)
524 {
525 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
526 
527 	try
528 	{
529 		if(xNode.is() && xNode->getPropertyValue(s_sHelpTipSeconds)!=nSet)
530 		{
531 			xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet));
532 			::comphelper::ConfigurationHelper::flush(m_xCfg);
533 
534 			bIsModified = sal_True;
535 		}
536 	}
537 	catch(const css::uno::Exception& ex)
538 	{
539 		LogHelper::logIt(ex);
540 	}
541 }
542 
543 void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet)
544 {
545 	css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
546 
547 	try
548 	{
549 		if(xNode.is() && xNode->getPropertyValue(s_sIsSelectionInReadonly)!=bSet)
550 		{
551 			xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet));
552 			::comphelper::ConfigurationHelper::flush(m_xCfg);
553 
554 			bIsModified = sal_True;
555 		}
556 	}
557 	catch(const css::uno::Exception& ex)
558 	{
559 		LogHelper::logIt(ex);
560 	}
561 }
562 
563 void SvtAccessibilityOptions_Impl::SetVCLSettings()
564 {
565 	AllSettings aAllSettings = Application::GetSettings();
566 	HelpSettings aHelpSettings = aAllSettings.GetHelpSettings();
567 	aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
568 	aAllSettings.SetHelpSettings(aHelpSettings);
569 	if(aAllSettings.GetStyleSettings().GetUseSystemUIFonts() != GetIsSystemFont() )
570 	{
571 		StyleSettings aStyleSettings = aAllSettings.GetStyleSettings();
572 		aStyleSettings.SetUseSystemUIFonts( GetIsSystemFont()  );
573 		aAllSettings.SetStyleSettings(aStyleSettings);
574 		Application::MergeSystemSettings( aAllSettings );
575 	}
576 
577 	Application::SetSettings(aAllSettings);
578 }
579 
580 void SvtAccessibilityOptions_Impl::SetColorValueSetMaximumRowCount(sal_Int16 nSet)
581 {
582     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
583 
584     try
585     {
586         if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetMaximumRowCount)!=nSet)
587         {
588             xNode->setPropertyValue(s_sColorValueSetMaximumRowCount, css::uno::makeAny(nSet));
589             ::comphelper::ConfigurationHelper::flush(m_xCfg);
590 
591             bIsModified = sal_True;
592         }
593     }
594     catch(const css::uno::Exception& ex)
595     {
596         LogHelper::logIt(ex);
597     }
598 }
599 
600 void SvtAccessibilityOptions_Impl::SetColorValueSetEntryEdgeLength(sal_Int16 nSet)
601 {
602     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
603 
604     try
605     {
606         if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetEntryEdgeLength)!=nSet)
607         {
608             xNode->setPropertyValue(s_sColorValueSetEntryEdgeLength, css::uno::makeAny(nSet));
609             ::comphelper::ConfigurationHelper::flush(m_xCfg);
610 
611             bIsModified = sal_True;
612         }
613     }
614     catch(const css::uno::Exception& ex)
615     {
616         LogHelper::logIt(ex);
617     }
618 }
619 
620 void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet)
621 {
622     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
623 
624     try
625     {
626         if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet)
627         {
628             xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet));
629             ::comphelper::ConfigurationHelper::flush(m_xCfg);
630 
631             bIsModified = sal_True;
632         }
633     }
634     catch(const css::uno::Exception& ex)
635     {
636         LogHelper::logIt(ex);
637     }
638 }
639 
640 void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet)
641 {
642     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
643 
644     try
645     {
646         if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet)
647         {
648             xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet));
649             ::comphelper::ConfigurationHelper::flush(m_xCfg);
650 
651             bIsModified = sal_True;
652         }
653     }
654     catch(const css::uno::Exception& ex)
655     {
656         LogHelper::logIt(ex);
657     }
658 }
659 
660 // -----------------------------------------------------------------------
661 // class SvtAccessibilityOptions --------------------------------------------------
662 
663 SvtAccessibilityOptions::SvtAccessibilityOptions()
664 {
665 	{
666 		::osl::MutexGuard aGuard( SingletonMutex::get() );
667 		if(!sm_pSingleImplConfig)
668 		{
669 			sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl;
670 			ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS);
671 		}
672 		++sm_nAccessibilityRefCount;
673 	}
674 	//StartListening( *sm_pSingleImplConfig, sal_True );
675 }
676 
677 // -----------------------------------------------------------------------
678 
679 SvtAccessibilityOptions::~SvtAccessibilityOptions()
680 {
681 	//EndListening( *sm_pSingleImplConfig, sal_True );
682 	::osl::MutexGuard aGuard( SingletonMutex::get() );
683 	if( !--sm_nAccessibilityRefCount )
684 	{
685 		//if( sm_pSingleImplConfig->IsModified() )
686 		//	sm_pSingleImplConfig->Commit();
687 		DELETEZ( sm_pSingleImplConfig );
688 	}
689 }
690 
691 // -----------------------------------------------------------------------
692 
693 void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
694 {
695 	NotifyListeners(0);
696 	if ( rHint.IsA(TYPE(SfxSimpleHint)) )
697 	{
698 		if ( ((SfxSimpleHint&)rHint).GetId()  == SFX_HINT_ACCESSIBILITY_CHANGED )
699 			SetVCLSettings();
700 	}
701 }
702 
703 // -----------------------------------------------------------------------
704 
705 sal_Bool SvtAccessibilityOptions::IsModified() const
706 {
707 	return sm_pSingleImplConfig->IsModified();
708 }
709 void SvtAccessibilityOptions::Commit()
710 {
711 	//sm_pSingleImplConfig->Commit();
712 }
713 
714 // -----------------------------------------------------------------------
715 
716 sal_Bool SvtAccessibilityOptions::GetIsForDrawings() const
717 {
718 	DBG_ERROR( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" );
719     return sal_False;
720 }
721 sal_Bool SvtAccessibilityOptions::GetIsForBorders() const
722 {
723 	DBG_ERROR( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" );
724     return sal_False;
725 }
726 sal_Bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const
727 {
728 	return sm_pSingleImplConfig->GetAutoDetectSystemHC();
729 }
730 sal_Bool SvtAccessibilityOptions::GetIsForPagePreviews() const
731 {
732 	return sm_pSingleImplConfig->GetIsForPagePreviews();
733 }
734 sal_Bool SvtAccessibilityOptions::GetIsHelpTipsDisappear() const
735 {
736 	return sm_pSingleImplConfig->GetIsHelpTipsDisappear();
737 }
738 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const
739 {
740 	return sm_pSingleImplConfig->GetIsAllowAnimatedGraphics();
741 }
742 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedText() const
743 {
744 	return sm_pSingleImplConfig->GetIsAllowAnimatedText();
745 }
746 sal_Bool SvtAccessibilityOptions::GetIsAutomaticFontColor() const
747 {
748 	return sm_pSingleImplConfig->GetIsAutomaticFontColor();
749 }
750 sal_Bool SvtAccessibilityOptions::GetIsSystemFont() const
751 {
752 	return sm_pSingleImplConfig->GetIsSystemFont();
753 }
754 sal_Int16 SvtAccessibilityOptions::GetHelpTipSeconds() const
755 {
756 	return sm_pSingleImplConfig->GetHelpTipSeconds();
757 }
758 sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const
759 {
760 	return sm_pSingleImplConfig->IsSelectionInReadonly();
761 }
762 
763 sal_Int16 SvtAccessibilityOptions::GetColorValueSetMaximumRowCount() const
764 {
765     return sm_pSingleImplConfig->GetColorValueSetMaximumRowCount();
766 }
767 
768 sal_Int16 SvtAccessibilityOptions::GetColorValueSetEntryEdgeLength() const
769 {
770     return sm_pSingleImplConfig->GetColorValueSetEntryEdgeLength();
771 }
772 
773 sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const
774 {
775     return sm_pSingleImplConfig->GetColorValueSetColumnCount();
776 }
777 
778 sal_Int16 SvtAccessibilityOptions::GetEdgeBlending() const
779 {
780     return sm_pSingleImplConfig->GetEdgeBlending();
781 }
782 
783 // -----------------------------------------------------------------------
784 void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet)
785 {
786 	sm_pSingleImplConfig->SetAutoDetectSystemHC(bSet);
787 }
788 void SvtAccessibilityOptions::SetIsForPagePreviews(sal_Bool bSet)
789 {
790 	sm_pSingleImplConfig->SetIsForPagePreviews(bSet);
791 }
792 void SvtAccessibilityOptions::SetIsHelpTipsDisappear(sal_Bool bSet)
793 {
794 	sm_pSingleImplConfig->SetIsHelpTipsDisappear(bSet);
795 }
796 void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(sal_Bool bSet)
797 {
798 	sm_pSingleImplConfig->SetIsAllowAnimatedGraphics(bSet);
799 }
800 void SvtAccessibilityOptions::SetIsAllowAnimatedText(sal_Bool bSet)
801 {
802 	sm_pSingleImplConfig->SetIsAllowAnimatedText(bSet);
803 }
804 void SvtAccessibilityOptions::SetIsAutomaticFontColor(sal_Bool bSet)
805 {
806 	sm_pSingleImplConfig->SetIsAutomaticFontColor(bSet);
807 }
808 void SvtAccessibilityOptions::SetIsSystemFont(sal_Bool bSet)
809 {
810 	sm_pSingleImplConfig->SetIsSystemFont(bSet);
811 }
812 void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet)
813 {
814 	sm_pSingleImplConfig->SetHelpTipSeconds(nSet);
815 }
816 void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet)
817 {
818 	sm_pSingleImplConfig->SetSelectionInReadonly(bSet);
819 }
820 void SvtAccessibilityOptions::SetVCLSettings()
821 {
822 	sm_pSingleImplConfig->SetVCLSettings();
823 }
824 void SvtAccessibilityOptions::SetColorValueSetMaximumRowCount(sal_Int16 nSet)
825 {
826     sm_pSingleImplConfig->SetColorValueSetMaximumRowCount(nSet);
827 }
828 void SvtAccessibilityOptions::SetColorValueSetEntryEdgeLength(sal_Int16 nSet)
829 {
830     sm_pSingleImplConfig->SetColorValueSetEntryEdgeLength(nSet);
831 }
832 void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet)
833 {
834     sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet);
835 }
836 void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet)
837 {
838     sm_pSingleImplConfig->SetEdgeBlending(nSet);
839 }
840 // -----------------------------------------------------------------------
841