xref: /AOO41X/main/svtools/source/config/accessibilityoptions.cxx (revision 97a5809e6e63979b09c46e1e26f29916a6bbbca4)
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   GetEdgeBlending() const;
90     sal_Int16   GetListBoxMaximumLineCount() const;
91     sal_Int16   GetColorValueSetColumnCount() const;
92 
93     void        SetAutoDetectSystemHC(sal_Bool bSet);
94     void        SetIsForPagePreviews(sal_Bool bSet);
95     void        SetIsHelpTipsDisappear(sal_Bool bSet);
96     void        SetIsAllowAnimatedGraphics(sal_Bool bSet);
97     void        SetIsAllowAnimatedText(sal_Bool bSet);
98     void        SetIsAutomaticFontColor(sal_Bool bSet);
99     void        SetIsSystemFont(sal_Bool bSet);
100     void        SetHelpTipSeconds(sal_Int16 nSet);
101     void        SetSelectionInReadonly(sal_Bool bSet);
102     void        SetEdgeBlending(sal_Int16 nSet);
103     void        SetListBoxMaximumLineCount(sal_Int16 nSet);
104     void        SetColorValueSetColumnCount(sal_Int16 nSet);
105 
106     sal_Bool    IsModified() const { return bIsModified; };
107 };
108 
109 // initialization of static members --------------------------------------
110 
111 SvtAccessibilityOptions_Impl* volatile  SvtAccessibilityOptions::sm_pSingleImplConfig =NULL;
112 sal_Int32                     volatile  SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
113 
114 namespace
115 {
116     struct SingletonMutex
117         : public rtl::Static< ::osl::Mutex, SingletonMutex > {};
118 }
119 
120 // -----------------------------------------------------------------------
121 // class SvtAccessibilityOptions_Impl ---------------------------------------------
122 
123 SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl()
124 {
125     try
126     {
127         m_xCfg = css::uno::Reference< css::container::XNameAccess >(
128             ::comphelper::ConfigurationHelper::openConfig(
129             utl::getProcessServiceFactory(),
130             s_sAccessibility,
131             ::comphelper::ConfigurationHelper::E_STANDARD),
132             css::uno::UNO_QUERY);
133 
134         bIsModified = sal_False;
135     }
136     catch(const css::uno::Exception& ex)
137     {
138         m_xCfg.clear();
139         LogHelper::logIt(ex);
140     }
141 }
142 
143 SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl()
144 {
145 }
146 
147 // -----------------------------------------------------------------------
148 sal_Bool SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC()
149 {
150     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
151     sal_Bool                                        bRet = sal_True;
152 
153     try
154     {
155         if(xNode.is())
156             xNode->getPropertyValue(s_sAutoDetectSystemHC) >>= bRet;
157     }
158     catch(const css::uno::Exception& ex)
159     {
160         LogHelper::logIt(ex);
161     }
162 
163     return bRet;
164 }
165 
166 sal_Bool SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const
167 {
168     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
169     sal_Bool                                        bRet = sal_True;
170 
171     try
172     {
173         if(xNode.is())
174             xNode->getPropertyValue(s_sIsForPagePreviews) >>= bRet;
175     }
176     catch(const css::uno::Exception& ex)
177     {
178         LogHelper::logIt(ex);
179     }
180     return bRet;
181 }
182 
183 sal_Bool SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
184 {
185     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
186     sal_Bool                                        bRet = sal_True;
187 
188     try
189     {
190         if(xNode.is())
191             xNode->getPropertyValue(s_sIsHelpTipsDisappear) >>= bRet;
192     }
193     catch(const css::uno::Exception& ex)
194     {
195         LogHelper::logIt(ex);
196     }
197 
198     return bRet;
199 }
200 
201 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
202 {
203     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
204     sal_Bool                                        bRet = sal_True;
205 
206     try
207     {
208         if(xNode.is())
209             xNode->getPropertyValue(s_sIsAllowAnimatedGraphics) >>= bRet;
210     }
211     catch(const css::uno::Exception& ex)
212     {
213         LogHelper::logIt(ex);
214     }
215 
216     return bRet;
217 }
218 
219 sal_Bool SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const
220 {
221     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
222     sal_Bool                                        bRet = sal_True;
223 
224     try
225     {
226         if(xNode.is())
227             xNode->getPropertyValue(s_sIsAllowAnimatedText) >>= bRet;
228     }
229     catch(const css::uno::Exception& ex)
230     {
231         LogHelper::logIt(ex);
232     }
233 
234     return bRet;
235 }
236 
237 sal_Bool SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const
238 {
239     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
240     sal_Bool                                        bRet = sal_False;
241 
242     try
243     {
244         if(xNode.is())
245             xNode->getPropertyValue(s_sIsAutomaticFontColor) >>= bRet;
246     }
247     catch(const css::uno::Exception& ex)
248     {
249         LogHelper::logIt(ex);
250     }
251 
252     return bRet;
253 }
254 
255 sal_Bool SvtAccessibilityOptions_Impl::GetIsSystemFont() const
256 {
257     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
258     sal_Bool                                        bRet = sal_True;
259 
260     try
261     {
262         if(xNode.is())
263             xNode->getPropertyValue(s_sIsSystemFont) >>= bRet;
264     }
265     catch(const css::uno::Exception& ex)
266     {
267         LogHelper::logIt(ex);
268     }
269 
270     return bRet;
271 }
272 
273 sal_Int16 SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const
274 {
275     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
276     sal_Int16                                       nRet = 4;
277 
278     try
279     {
280         if(xNode.is())
281             xNode->getPropertyValue(s_sHelpTipSeconds) >>= nRet;
282     }
283     catch(const css::uno::Exception& ex)
284     {
285         LogHelper::logIt(ex);
286     }
287 
288     return nRet;
289 }
290 
291 sal_Bool SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
292 {
293     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
294     sal_Bool                                        bRet = sal_False;
295 
296     try
297     {
298         if(xNode.is())
299             xNode->getPropertyValue(s_sIsSelectionInReadonly) >>= bRet;
300     }
301     catch(const css::uno::Exception& ex)
302     {
303         LogHelper::logIt(ex);
304     }
305 
306     return bRet;
307 }
308 
309 sal_Int16 SvtAccessibilityOptions_Impl::GetEdgeBlending() const
310 {
311     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
312     sal_Int16 nRet = 35;
313 
314     try
315     {
316         if(xNode.is())
317             xNode->getPropertyValue(s_sEdgeBlending) >>= nRet;
318     }
319     catch(const css::uno::Exception& ex)
320     {
321         LogHelper::logIt(ex);
322     }
323 
324     return nRet;
325 }
326 
327 sal_Int16 SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const
328 {
329     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
330     sal_Int16 nRet = 25;
331 
332     try
333     {
334         if(xNode.is())
335             xNode->getPropertyValue(s_sListBoxMaximumLineCount) >>= nRet;
336     }
337     catch(const css::uno::Exception& ex)
338     {
339         LogHelper::logIt(ex);
340     }
341 
342     return nRet;
343 }
344 
345 sal_Int16 SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
346 {
347     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
348     sal_Int16 nRet = 12;
349 
350     try
351     {
352         if(xNode.is())
353             xNode->getPropertyValue(s_sColorValueSetColumnCount) >>= nRet;
354     }
355     catch(const css::uno::Exception& ex)
356     {
357         LogHelper::logIt(ex);
358     }
359 
360     return nRet;
361 }
362 
363 void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet)
364 {
365     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
366 
367     try
368     {
369         if(xNode.is() && xNode->getPropertyValue(s_sAutoDetectSystemHC)!=bSet)
370         {
371             xNode->setPropertyValue(s_sAutoDetectSystemHC, css::uno::makeAny(bSet));
372             ::comphelper::ConfigurationHelper::flush(m_xCfg);
373 
374             bIsModified = sal_True;
375         }
376     }
377     catch(const css::uno::Exception& ex)
378     {
379         LogHelper::logIt(ex);
380     }
381 }
382 
383 void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(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_sIsForPagePreviews)!=bSet)
390         {
391             xNode->setPropertyValue(s_sIsForPagePreviews, 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::SetIsHelpTipsDisappear(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_sIsHelpTipsDisappear)!=bSet)
410         {
411             xNode->setPropertyValue(s_sIsHelpTipsDisappear, 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::SetIsAllowAnimatedGraphics(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_sIsAllowAnimatedGraphics)!=bSet)
430         {
431             xNode->setPropertyValue(s_sIsAllowAnimatedGraphics, 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::SetIsAllowAnimatedText(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_sIsAllowAnimatedText)!=bSet)
450         {
451             xNode->setPropertyValue(s_sIsAllowAnimatedText, 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::SetIsAutomaticFontColor(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_sIsAutomaticFontColor)!=bSet)
470         {
471             xNode->setPropertyValue(s_sIsAutomaticFontColor, 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::SetIsSystemFont(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_sIsSystemFont)!=bSet)
490         {
491             xNode->setPropertyValue(s_sIsSystemFont, 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::SetHelpTipSeconds(sal_Int16 nSet)
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_sHelpTipSeconds)!=nSet)
510         {
511             xNode->setPropertyValue(s_sHelpTipSeconds, css::uno::makeAny(nSet));
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::SetSelectionInReadonly(sal_Bool bSet)
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_sIsSelectionInReadonly)!=bSet)
530         {
531             xNode->setPropertyValue(s_sIsSelectionInReadonly, css::uno::makeAny(bSet));
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::SetVCLSettings()
544 {
545     AllSettings aAllSettings(Application::GetSettings());
546     StyleSettings aStyleSettings(aAllSettings.GetStyleSettings());
547     HelpSettings aHelpSettings(aAllSettings.GetHelpSettings());
548     bool StyleSettingsChanged(false);
549 
550     aHelpSettings.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT);
551     aAllSettings.SetHelpSettings(aHelpSettings);
552 
553     if(aStyleSettings.GetUseSystemUIFonts() != GetIsSystemFont())
554     {
555         aStyleSettings.SetUseSystemUIFonts(GetIsSystemFont());
556         StyleSettingsChanged = true;
557     }
558 
559     const sal_Int16 nEdgeBlendingCountA(GetEdgeBlending());
560     OSL_ENSURE(nEdgeBlendingCountA >= 0, "OOps, negative values for EdgeBlending are not allowed (!)");
561     const sal_uInt16 nEdgeBlendingCountB(static_cast< sal_uInt16 >(nEdgeBlendingCountA >= 0 ? nEdgeBlendingCountA : 0));
562 
563     if(aStyleSettings.GetEdgeBlending() != nEdgeBlendingCountB)
564     {
565         aStyleSettings.SetEdgeBlending(nEdgeBlendingCountB);
566         StyleSettingsChanged = true;
567     }
568 
569     const sal_Int16 nMaxLineCountA(GetListBoxMaximumLineCount());
570     OSL_ENSURE(nMaxLineCountA >= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)");
571     const sal_uInt16 nMaxLineCountB(static_cast< sal_uInt16 >(nMaxLineCountA >= 0 ? nMaxLineCountA : 0));
572 
573     if(aStyleSettings.GetListBoxMaximumLineCount() != nMaxLineCountB)
574     {
575         aStyleSettings.SetListBoxMaximumLineCount(nMaxLineCountB);
576         StyleSettingsChanged = true;
577     }
578 
579     const sal_Int16 nMaxColumnCountA(GetColorValueSetColumnCount());
580     OSL_ENSURE(nMaxColumnCountA >= 0, "OOps, negative values for ColorValueSetColumnCount are not allowed (!)");
581     const sal_uInt16 nMaxColumnCountB(static_cast< sal_uInt16 >(nMaxColumnCountA >= 0 ? nMaxColumnCountA : 0));
582 
583     if(aStyleSettings.GetColorValueSetColumnCount() != nMaxColumnCountB)
584     {
585         aStyleSettings.SetColorValueSetColumnCount(nMaxColumnCountB);
586         StyleSettingsChanged = true;
587     }
588 
589     if(StyleSettingsChanged)
590     {
591         aAllSettings.SetStyleSettings(aStyleSettings);
592         Application::MergeSystemSettings(aAllSettings);
593     }
594 
595     Application::SetSettings(aAllSettings);
596 }
597 
598 void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet)
599 {
600     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
601 
602     try
603     {
604         if(xNode.is() && xNode->getPropertyValue(s_sEdgeBlending)!=nSet)
605         {
606             xNode->setPropertyValue(s_sEdgeBlending, css::uno::makeAny(nSet));
607             ::comphelper::ConfigurationHelper::flush(m_xCfg);
608 
609             bIsModified = sal_True;
610         }
611     }
612     catch(const css::uno::Exception& ex)
613     {
614         LogHelper::logIt(ex);
615     }
616 }
617 
618 void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(sal_Int16 nSet)
619 {
620     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
621 
622     try
623     {
624         if(xNode.is() && xNode->getPropertyValue(s_sListBoxMaximumLineCount)!=nSet)
625         {
626             xNode->setPropertyValue(s_sListBoxMaximumLineCount, css::uno::makeAny(nSet));
627             ::comphelper::ConfigurationHelper::flush(m_xCfg);
628 
629             bIsModified = sal_True;
630         }
631     }
632     catch(const css::uno::Exception& ex)
633     {
634         LogHelper::logIt(ex);
635     }
636 }
637 
638 void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet)
639 {
640     css::uno::Reference< css::beans::XPropertySet > xNode(m_xCfg, css::uno::UNO_QUERY);
641 
642     try
643     {
644         if(xNode.is() && xNode->getPropertyValue(s_sColorValueSetColumnCount)!=nSet)
645         {
646             xNode->setPropertyValue(s_sColorValueSetColumnCount, css::uno::makeAny(nSet));
647             ::comphelper::ConfigurationHelper::flush(m_xCfg);
648 
649             bIsModified = sal_True;
650         }
651     }
652     catch(const css::uno::Exception& ex)
653     {
654         LogHelper::logIt(ex);
655     }
656 }
657 
658 // -----------------------------------------------------------------------
659 // class SvtAccessibilityOptions --------------------------------------------------
660 
661 SvtAccessibilityOptions::SvtAccessibilityOptions()
662 {
663     {
664         ::osl::MutexGuard aGuard( SingletonMutex::get() );
665         if(!sm_pSingleImplConfig)
666         {
667             sm_pSingleImplConfig = new SvtAccessibilityOptions_Impl;
668             ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS);
669         }
670         ++sm_nAccessibilityRefCount;
671     }
672     //StartListening( *sm_pSingleImplConfig, sal_True );
673 }
674 
675 // -----------------------------------------------------------------------
676 
677 SvtAccessibilityOptions::~SvtAccessibilityOptions()
678 {
679     //EndListening( *sm_pSingleImplConfig, sal_True );
680     ::osl::MutexGuard aGuard( SingletonMutex::get() );
681     if( !--sm_nAccessibilityRefCount )
682     {
683         //if( sm_pSingleImplConfig->IsModified() )
684         //  sm_pSingleImplConfig->Commit();
685         DELETEZ( sm_pSingleImplConfig );
686     }
687 }
688 
689 // -----------------------------------------------------------------------
690 
691 void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
692 {
693     NotifyListeners(0);
694     if ( rHint.IsA(TYPE(SfxSimpleHint)) )
695     {
696         if ( ((SfxSimpleHint&)rHint).GetId()  == SFX_HINT_ACCESSIBILITY_CHANGED )
697             SetVCLSettings();
698     }
699 }
700 
701 // -----------------------------------------------------------------------
702 
703 sal_Bool SvtAccessibilityOptions::IsModified() const
704 {
705     return sm_pSingleImplConfig->IsModified();
706 }
707 void SvtAccessibilityOptions::Commit()
708 {
709     //sm_pSingleImplConfig->Commit();
710 }
711 
712 // -----------------------------------------------------------------------
713 
714 sal_Bool SvtAccessibilityOptions::GetIsForDrawings() const
715 {
716     DBG_ERROR( "SvtAccessibilityOptions::GetIsForDrawings: is obsolete!" );
717     return sal_False;
718 }
719 sal_Bool SvtAccessibilityOptions::GetIsForBorders() const
720 {
721     DBG_ERROR( "SvtAccessibilityOptions::GetIsForBorders: is obsolete!" );
722     return sal_False;
723 }
724 sal_Bool SvtAccessibilityOptions::GetAutoDetectSystemHC() const
725 {
726     return sm_pSingleImplConfig->GetAutoDetectSystemHC();
727 }
728 sal_Bool SvtAccessibilityOptions::GetIsForPagePreviews() const
729 {
730     return sm_pSingleImplConfig->GetIsForPagePreviews();
731 }
732 sal_Bool SvtAccessibilityOptions::GetIsHelpTipsDisappear() const
733 {
734     return sm_pSingleImplConfig->GetIsHelpTipsDisappear();
735 }
736 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const
737 {
738     return sm_pSingleImplConfig->GetIsAllowAnimatedGraphics();
739 }
740 sal_Bool SvtAccessibilityOptions::GetIsAllowAnimatedText() const
741 {
742     return sm_pSingleImplConfig->GetIsAllowAnimatedText();
743 }
744 sal_Bool SvtAccessibilityOptions::GetIsAutomaticFontColor() const
745 {
746     return sm_pSingleImplConfig->GetIsAutomaticFontColor();
747 }
748 sal_Bool SvtAccessibilityOptions::GetIsSystemFont() const
749 {
750     return sm_pSingleImplConfig->GetIsSystemFont();
751 }
752 sal_Int16 SvtAccessibilityOptions::GetHelpTipSeconds() const
753 {
754     return sm_pSingleImplConfig->GetHelpTipSeconds();
755 }
756 sal_Bool SvtAccessibilityOptions::IsSelectionInReadonly() const
757 {
758     return sm_pSingleImplConfig->IsSelectionInReadonly();
759 }
760 sal_Int16 SvtAccessibilityOptions::GetEdgeBlending() const
761 {
762     return sm_pSingleImplConfig->GetEdgeBlending();
763 }
764 sal_Int16 SvtAccessibilityOptions::GetListBoxMaximumLineCount() const
765 {
766     return sm_pSingleImplConfig->GetListBoxMaximumLineCount();
767 }
768 sal_Int16 SvtAccessibilityOptions::GetColorValueSetColumnCount() const
769 {
770     return sm_pSingleImplConfig->GetColorValueSetColumnCount();
771 }
772 
773 // -----------------------------------------------------------------------
774 void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet)
775 {
776     sm_pSingleImplConfig->SetAutoDetectSystemHC(bSet);
777 }
778 void SvtAccessibilityOptions::SetIsForPagePreviews(sal_Bool bSet)
779 {
780     sm_pSingleImplConfig->SetIsForPagePreviews(bSet);
781 }
782 void SvtAccessibilityOptions::SetIsHelpTipsDisappear(sal_Bool bSet)
783 {
784     sm_pSingleImplConfig->SetIsHelpTipsDisappear(bSet);
785 }
786 void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(sal_Bool bSet)
787 {
788     sm_pSingleImplConfig->SetIsAllowAnimatedGraphics(bSet);
789 }
790 void SvtAccessibilityOptions::SetIsAllowAnimatedText(sal_Bool bSet)
791 {
792     sm_pSingleImplConfig->SetIsAllowAnimatedText(bSet);
793 }
794 void SvtAccessibilityOptions::SetIsAutomaticFontColor(sal_Bool bSet)
795 {
796     sm_pSingleImplConfig->SetIsAutomaticFontColor(bSet);
797 }
798 void SvtAccessibilityOptions::SetIsSystemFont(sal_Bool bSet)
799 {
800     sm_pSingleImplConfig->SetIsSystemFont(bSet);
801 }
802 void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet)
803 {
804     sm_pSingleImplConfig->SetHelpTipSeconds(nSet);
805 }
806 void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet)
807 {
808     sm_pSingleImplConfig->SetSelectionInReadonly(bSet);
809 }
810 void SvtAccessibilityOptions::SetVCLSettings()
811 {
812     sm_pSingleImplConfig->SetVCLSettings();
813 }
814 void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet)
815 {
816     sm_pSingleImplConfig->SetEdgeBlending(nSet);
817 }
818 void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet)
819 {
820     sm_pSingleImplConfig->SetListBoxMaximumLineCount(nSet);
821 }
822 void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet)
823 {
824     sm_pSingleImplConfig->SetColorValueSetColumnCount(nSet);
825 }
826 
827 // -----------------------------------------------------------------------
828