1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <svtools/accessibilityoptions.hxx>
23 #include <unotools/configmgr.hxx>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/container/XNameAccess.hpp>
29 #include <comphelper/configurationhelper.hxx>
30 #include <comphelper/processfactory.hxx>
32 #include <svl/smplhint.hxx>
34 #include <vcl/settings.hxx>
35 #include <vcl/svapp.hxx>
36 #include <rtl/instance.hxx>
38 #include <itemholder2.hxx>
41 using namespace com::sun::star::uno
;
43 #define HELP_TIP_TIMEOUT 0xffff // max. timeout setting to pretend a non-timeout
47 const char s_sAccessibility
[] = "org.openoffice.Office.Common/Accessibility";
48 const char s_sAutoDetectSystemHC
[] = "AutoDetectSystemHC";
49 const char s_sIsForPagePreviews
[] = "IsForPagePreviews";
50 const char s_sIsHelpTipsDisappear
[] = "IsHelpTipsDisappear";
51 const char s_sHelpTipSeconds
[] = "HelpTipSeconds";
52 const char s_sIsAllowAnimatedGraphics
[] = "IsAllowAnimatedGraphics";
53 const char s_sIsAllowAnimatedText
[] = "IsAllowAnimatedText";
54 const char s_sIsAutomaticFontColor
[] = "IsAutomaticFontColor";
55 const char s_sIsSystemFont
[] = "IsSystemFont";
56 const char s_sIsSelectionInReadonly
[] = "IsSelectionInReadonly";
57 const char s_sColorValueSetColumnCount
[] = "ColorValueSetColumnCount";
58 const char s_sEdgeBlending
[] = "EdgeBlending";
59 const char s_sListBoxMaximumLineCount
[] = "ListBoxMaximumLineCount";
60 const char s_sPreviewUsesCheckeredBackground
[] = "PreviewUsesCheckeredBackground";
63 // class SvtAccessibilityOptions_Impl ---------------------------------------------
65 class SvtAccessibilityOptions_Impl
68 css::uno::Reference
< css::container::XNameAccess
> m_xCfg
;
72 SvtAccessibilityOptions_Impl();
73 ~SvtAccessibilityOptions_Impl();
75 void SetVCLSettings();
76 sal_Bool
GetAutoDetectSystemHC();
77 sal_Bool
GetIsForPagePreviews() const;
78 sal_Bool
GetIsHelpTipsDisappear() const;
79 sal_Bool
GetIsAllowAnimatedGraphics() const;
80 sal_Bool
GetIsAllowAnimatedText() const;
81 sal_Bool
GetIsAutomaticFontColor() const;
82 sal_Bool
GetIsSystemFont() const;
83 sal_Int16
GetHelpTipSeconds() const;
84 sal_Bool
IsSelectionInReadonly() const;
85 sal_Int16
GetEdgeBlending() const;
86 sal_Int16
GetListBoxMaximumLineCount() const;
87 sal_Int16
GetColorValueSetColumnCount() const;
88 sal_Bool
GetPreviewUsesCheckeredBackground() const;
90 void SetAutoDetectSystemHC(sal_Bool bSet
);
91 void SetIsForPagePreviews(sal_Bool bSet
);
92 void SetIsHelpTipsDisappear(sal_Bool bSet
);
93 void SetIsAllowAnimatedGraphics(sal_Bool bSet
);
94 void SetIsAllowAnimatedText(sal_Bool bSet
);
95 void SetIsAutomaticFontColor(sal_Bool bSet
);
96 void SetIsSystemFont(sal_Bool bSet
);
97 void SetHelpTipSeconds(sal_Int16 nSet
);
98 void SetSelectionInReadonly(sal_Bool bSet
);
99 void SetEdgeBlending(sal_Int16 nSet
);
100 void SetListBoxMaximumLineCount(sal_Int16 nSet
);
101 void SetColorValueSetColumnCount(sal_Int16 nSet
);
102 void SetPreviewUsesCheckeredBackground(sal_Bool bSet
);
104 sal_Bool
IsModified() const { return bIsModified
; };
107 // initialization of static members --------------------------------------
109 SvtAccessibilityOptions_Impl
* SvtAccessibilityOptions::sm_pSingleImplConfig
=NULL
;
110 sal_Int32
SvtAccessibilityOptions::sm_nAccessibilityRefCount(0);
114 struct SingletonMutex
115 : public rtl::Static
< ::osl::Mutex
, SingletonMutex
> {};
118 // -----------------------------------------------------------------------
119 // class SvtAccessibilityOptions_Impl ---------------------------------------------
121 SvtAccessibilityOptions_Impl::SvtAccessibilityOptions_Impl()
125 m_xCfg
= css::uno::Reference
< css::container::XNameAccess
>(
126 ::comphelper::ConfigurationHelper::openConfig(
127 comphelper::getProcessComponentContext(),
129 ::comphelper::ConfigurationHelper::E_STANDARD
),
130 css::uno::UNO_QUERY
);
132 bIsModified
= sal_False
;
134 catch(const css::uno::Exception
& ex
)
137 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
141 SvtAccessibilityOptions_Impl::~SvtAccessibilityOptions_Impl()
145 // -----------------------------------------------------------------------
146 sal_Bool
SvtAccessibilityOptions_Impl::GetAutoDetectSystemHC()
148 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
149 sal_Bool bRet
= sal_True
;
154 xNode
->getPropertyValue(s_sAutoDetectSystemHC
) >>= bRet
;
156 catch(const css::uno::Exception
& ex
)
158 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
164 sal_Bool
SvtAccessibilityOptions_Impl::GetIsForPagePreviews() const
166 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
167 sal_Bool bRet
= sal_True
;
172 xNode
->getPropertyValue(s_sIsForPagePreviews
) >>= bRet
;
174 catch(const css::uno::Exception
& ex
)
176 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
181 sal_Bool
SvtAccessibilityOptions_Impl::GetIsHelpTipsDisappear() const
183 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
184 sal_Bool bRet
= sal_True
;
189 xNode
->getPropertyValue(s_sIsHelpTipsDisappear
) >>= bRet
;
191 catch(const css::uno::Exception
& ex
)
193 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
199 sal_Bool
SvtAccessibilityOptions_Impl::GetIsAllowAnimatedGraphics() const
201 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
202 sal_Bool bRet
= sal_True
;
207 xNode
->getPropertyValue(s_sIsAllowAnimatedGraphics
) >>= bRet
;
209 catch(const css::uno::Exception
& ex
)
211 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
217 sal_Bool
SvtAccessibilityOptions_Impl::GetIsAllowAnimatedText() const
219 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
220 sal_Bool bRet
= sal_True
;
225 xNode
->getPropertyValue(s_sIsAllowAnimatedText
) >>= bRet
;
227 catch(const css::uno::Exception
& ex
)
229 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
235 sal_Bool
SvtAccessibilityOptions_Impl::GetIsAutomaticFontColor() const
237 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
238 sal_Bool bRet
= sal_False
;
243 xNode
->getPropertyValue(s_sIsAutomaticFontColor
) >>= bRet
;
245 catch(const css::uno::Exception
& ex
)
247 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
253 sal_Bool
SvtAccessibilityOptions_Impl::GetIsSystemFont() const
255 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
256 sal_Bool bRet
= sal_True
;
261 xNode
->getPropertyValue(s_sIsSystemFont
) >>= bRet
;
263 catch(const css::uno::Exception
& ex
)
265 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
271 sal_Int16
SvtAccessibilityOptions_Impl::GetHelpTipSeconds() const
273 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
279 xNode
->getPropertyValue(s_sHelpTipSeconds
) >>= nRet
;
281 catch(const css::uno::Exception
& ex
)
283 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
289 sal_Bool
SvtAccessibilityOptions_Impl::IsSelectionInReadonly() const
291 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
292 sal_Bool bRet
= sal_False
;
297 xNode
->getPropertyValue(s_sIsSelectionInReadonly
) >>= bRet
;
299 catch(const css::uno::Exception
& ex
)
301 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
307 sal_Int16
SvtAccessibilityOptions_Impl::GetEdgeBlending() const
309 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
315 xNode
->getPropertyValue(s_sEdgeBlending
) >>= nRet
;
317 catch(const css::uno::Exception
& ex
)
319 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
325 sal_Int16
SvtAccessibilityOptions_Impl::GetListBoxMaximumLineCount() const
327 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
333 xNode
->getPropertyValue(s_sListBoxMaximumLineCount
) >>= nRet
;
335 catch(const css::uno::Exception
& ex
)
337 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
343 sal_Int16
SvtAccessibilityOptions_Impl::GetColorValueSetColumnCount() const
345 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
351 xNode
->getPropertyValue(s_sColorValueSetColumnCount
) >>= nRet
;
353 catch(const css::uno::Exception
& ex
)
355 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
361 sal_Bool
SvtAccessibilityOptions_Impl::GetPreviewUsesCheckeredBackground() const
363 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
364 sal_Bool bRet
= sal_False
;
369 xNode
->getPropertyValue(s_sPreviewUsesCheckeredBackground
) >>= bRet
;
371 catch(const css::uno::Exception
& ex
)
373 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
379 void SvtAccessibilityOptions_Impl::SetAutoDetectSystemHC(sal_Bool bSet
)
381 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
385 if(xNode
.is() && xNode
->getPropertyValue(s_sAutoDetectSystemHC
)!=bSet
)
387 xNode
->setPropertyValue(s_sAutoDetectSystemHC
, css::uno::makeAny(bSet
));
388 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
390 bIsModified
= sal_True
;
393 catch(const css::uno::Exception
& ex
)
395 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
399 void SvtAccessibilityOptions_Impl::SetIsForPagePreviews(sal_Bool bSet
)
401 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
405 if(xNode
.is() && xNode
->getPropertyValue(s_sIsForPagePreviews
)!=bSet
)
407 xNode
->setPropertyValue(s_sIsForPagePreviews
, css::uno::makeAny(bSet
));
408 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
410 bIsModified
= sal_True
;
413 catch(const css::uno::Exception
& ex
)
415 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
419 void SvtAccessibilityOptions_Impl::SetIsHelpTipsDisappear(sal_Bool bSet
)
421 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
425 if(xNode
.is() && xNode
->getPropertyValue(s_sIsHelpTipsDisappear
)!=bSet
)
427 xNode
->setPropertyValue(s_sIsHelpTipsDisappear
, css::uno::makeAny(bSet
));
428 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
430 bIsModified
= sal_True
;
433 catch(const css::uno::Exception
& ex
)
435 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
439 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedGraphics(sal_Bool bSet
)
441 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
445 if(xNode
.is() && xNode
->getPropertyValue(s_sIsAllowAnimatedGraphics
)!=bSet
)
447 xNode
->setPropertyValue(s_sIsAllowAnimatedGraphics
, css::uno::makeAny(bSet
));
448 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
450 bIsModified
= sal_True
;
453 catch(const css::uno::Exception
& ex
)
455 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
459 void SvtAccessibilityOptions_Impl::SetIsAllowAnimatedText(sal_Bool bSet
)
461 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
465 if(xNode
.is() && xNode
->getPropertyValue(s_sIsAllowAnimatedText
)!=bSet
)
467 xNode
->setPropertyValue(s_sIsAllowAnimatedText
, css::uno::makeAny(bSet
));
468 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
470 bIsModified
= sal_True
;
473 catch(const css::uno::Exception
& ex
)
475 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
479 void SvtAccessibilityOptions_Impl::SetIsAutomaticFontColor(sal_Bool bSet
)
481 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
485 if(xNode
.is() && xNode
->getPropertyValue(s_sIsAutomaticFontColor
)!=bSet
)
487 xNode
->setPropertyValue(s_sIsAutomaticFontColor
, css::uno::makeAny(bSet
));
488 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
490 bIsModified
= sal_True
;
493 catch(const css::uno::Exception
& ex
)
495 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
499 void SvtAccessibilityOptions_Impl::SetIsSystemFont(sal_Bool bSet
)
501 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
505 if(xNode
.is() && xNode
->getPropertyValue(s_sIsSystemFont
)!=bSet
)
507 xNode
->setPropertyValue(s_sIsSystemFont
, css::uno::makeAny(bSet
));
508 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
510 bIsModified
= sal_True
;
513 catch(const css::uno::Exception
& ex
)
515 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
519 void SvtAccessibilityOptions_Impl::SetHelpTipSeconds(sal_Int16 nSet
)
521 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
525 if(xNode
.is() && xNode
->getPropertyValue(s_sHelpTipSeconds
)!=nSet
)
527 xNode
->setPropertyValue(s_sHelpTipSeconds
, css::uno::makeAny(nSet
));
528 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
530 bIsModified
= sal_True
;
533 catch(const css::uno::Exception
& ex
)
535 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
539 void SvtAccessibilityOptions_Impl::SetSelectionInReadonly(sal_Bool bSet
)
541 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
545 if(xNode
.is() && xNode
->getPropertyValue(s_sIsSelectionInReadonly
)!=bSet
)
547 xNode
->setPropertyValue(s_sIsSelectionInReadonly
, css::uno::makeAny(bSet
));
548 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
550 bIsModified
= sal_True
;
553 catch(const css::uno::Exception
& ex
)
555 SAL_WARN("svtools.config", "Caught unexpected: " << ex
.Message
);
559 void SvtAccessibilityOptions_Impl::SetVCLSettings()
561 AllSettings
aAllSettings(Application::GetSettings());
562 StyleSettings
aStyleSettings(aAllSettings
.GetStyleSettings());
563 HelpSettings
aHelpSettings(aAllSettings
.GetHelpSettings());
564 bool StyleSettingsChanged(false);
566 aHelpSettings
.SetTipTimeout( GetIsHelpTipsDisappear() ? GetHelpTipSeconds() * 1000 : HELP_TIP_TIMEOUT
);
567 aAllSettings
.SetHelpSettings(aHelpSettings
);
569 if(aStyleSettings
.GetUseSystemUIFonts() != GetIsSystemFont())
571 aStyleSettings
.SetUseSystemUIFonts(GetIsSystemFont());
572 StyleSettingsChanged
= true;
575 const sal_Int16
nEdgeBlendingCountA(GetEdgeBlending());
576 OSL_ENSURE(nEdgeBlendingCountA
>= 0, "OOps, negative values for EdgeBlending are not allowed (!)");
577 const sal_uInt16
nEdgeBlendingCountB(static_cast< sal_uInt16
>(nEdgeBlendingCountA
>= 0 ? nEdgeBlendingCountA
: 0));
579 if(aStyleSettings
.GetEdgeBlending() != nEdgeBlendingCountB
)
581 aStyleSettings
.SetEdgeBlending(nEdgeBlendingCountB
);
582 StyleSettingsChanged
= true;
585 const sal_Int16
nMaxLineCountA(GetListBoxMaximumLineCount());
586 OSL_ENSURE(nMaxLineCountA
>= 0, "OOps, negative values for ListBoxMaximumLineCount are not allowed (!)");
587 const sal_uInt16
nMaxLineCountB(static_cast< sal_uInt16
>(nMaxLineCountA
>= 0 ? nMaxLineCountA
: 0));
589 if(aStyleSettings
.GetListBoxMaximumLineCount() != nMaxLineCountB
)
591 aStyleSettings
.SetListBoxMaximumLineCount(nMaxLineCountB
);
592 StyleSettingsChanged
= true;
595 const sal_Int16
nMaxColumnCountA(GetColorValueSetColumnCount());
596 OSL_ENSURE(nMaxColumnCountA
>= 0, "OOps, negative values for ColorValueSetColumnCount are not allowed (!)");
597 const sal_uInt16
nMaxColumnCountB(static_cast< sal_uInt16
>(nMaxColumnCountA
>= 0 ? nMaxColumnCountA
: 0));
599 if(aStyleSettings
.GetColorValueSetColumnCount() != nMaxColumnCountB
)
601 aStyleSettings
.SetColorValueSetColumnCount(nMaxColumnCountB
);
602 StyleSettingsChanged
= true;
605 const bool bPreviewUsesCheckeredBackground(GetPreviewUsesCheckeredBackground());
607 if(aStyleSettings
.GetPreviewUsesCheckeredBackground() != bPreviewUsesCheckeredBackground
)
609 aStyleSettings
.SetPreviewUsesCheckeredBackground(bPreviewUsesCheckeredBackground
);
610 StyleSettingsChanged
= true;
613 if(StyleSettingsChanged
)
615 aAllSettings
.SetStyleSettings(aStyleSettings
);
616 Application::MergeSystemSettings(aAllSettings
);
619 Application::SetSettings(aAllSettings
);
622 void SvtAccessibilityOptions_Impl::SetEdgeBlending(sal_Int16 nSet
)
624 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
628 if(xNode
.is() && xNode
->getPropertyValue(s_sEdgeBlending
)!=nSet
)
630 xNode
->setPropertyValue(s_sEdgeBlending
, css::uno::makeAny(nSet
));
631 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
633 bIsModified
= sal_True
;
636 catch(const css::uno::Exception
& ex
)
638 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
642 void SvtAccessibilityOptions_Impl::SetListBoxMaximumLineCount(sal_Int16 nSet
)
644 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
648 if(xNode
.is() && xNode
->getPropertyValue(s_sListBoxMaximumLineCount
)!=nSet
)
650 xNode
->setPropertyValue(s_sListBoxMaximumLineCount
, css::uno::makeAny(nSet
));
651 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
653 bIsModified
= sal_True
;
656 catch(const css::uno::Exception
& ex
)
658 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
662 void SvtAccessibilityOptions_Impl::SetColorValueSetColumnCount(sal_Int16 nSet
)
664 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
668 if(xNode
.is() && xNode
->getPropertyValue(s_sColorValueSetColumnCount
)!=nSet
)
670 xNode
->setPropertyValue(s_sColorValueSetColumnCount
, css::uno::makeAny(nSet
));
671 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
673 bIsModified
= sal_True
;
676 catch(const css::uno::Exception
& ex
)
678 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
682 void SvtAccessibilityOptions_Impl::SetPreviewUsesCheckeredBackground(sal_Bool bSet
)
684 css::uno::Reference
< css::beans::XPropertySet
> xNode(m_xCfg
, css::uno::UNO_QUERY
);
688 if(xNode
.is() && xNode
->getPropertyValue(s_sPreviewUsesCheckeredBackground
)!=bSet
)
690 xNode
->setPropertyValue(s_sPreviewUsesCheckeredBackground
, css::uno::makeAny(bSet
));
691 ::comphelper::ConfigurationHelper::flush(m_xCfg
);
693 bIsModified
= sal_True
;
696 catch(const css::uno::Exception
& ex
)
698 SAL_WARN("svtools", "Caught unexpected: " << ex
.Message
);
702 // -----------------------------------------------------------------------
703 // class SvtAccessibilityOptions --------------------------------------------------
705 SvtAccessibilityOptions::SvtAccessibilityOptions()
708 ::osl::MutexGuard
aGuard( SingletonMutex::get() );
709 if(!sm_pSingleImplConfig
)
711 sm_pSingleImplConfig
= new SvtAccessibilityOptions_Impl
;
712 svtools::ItemHolder2::holdConfigItem(E_ACCESSIBILITYOPTIONS
);
714 ++sm_nAccessibilityRefCount
;
716 //StartListening( *sm_pSingleImplConfig, sal_True );
719 // -----------------------------------------------------------------------
721 SvtAccessibilityOptions::~SvtAccessibilityOptions()
723 //EndListening( *sm_pSingleImplConfig, sal_True );
724 ::osl::MutexGuard
aGuard( SingletonMutex::get() );
725 if( !--sm_nAccessibilityRefCount
)
727 //if( sm_pSingleImplConfig->IsModified() )
728 // sm_pSingleImplConfig->Commit();
729 DELETEZ( sm_pSingleImplConfig
);
733 // -----------------------------------------------------------------------
735 void SvtAccessibilityOptions::Notify( SfxBroadcaster
&, const SfxHint
& rHint
)
738 if ( rHint
.IsA(TYPE(SfxSimpleHint
)) )
740 if ( ((SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_ACCESSIBILITY_CHANGED
)
745 // -----------------------------------------------------------------------
747 sal_Bool
SvtAccessibilityOptions::IsModified() const
749 return sm_pSingleImplConfig
->IsModified();
751 void SvtAccessibilityOptions::Commit()
753 //sm_pSingleImplConfig->Commit();
756 // -----------------------------------------------------------------------
758 sal_Bool
SvtAccessibilityOptions::GetAutoDetectSystemHC() const
760 return sm_pSingleImplConfig
->GetAutoDetectSystemHC();
762 sal_Bool
SvtAccessibilityOptions::GetIsForPagePreviews() const
764 return sm_pSingleImplConfig
->GetIsForPagePreviews();
766 sal_Bool
SvtAccessibilityOptions::GetIsHelpTipsDisappear() const
768 return sm_pSingleImplConfig
->GetIsHelpTipsDisappear();
770 sal_Bool
SvtAccessibilityOptions::GetIsAllowAnimatedGraphics() const
772 return sm_pSingleImplConfig
->GetIsAllowAnimatedGraphics();
774 sal_Bool
SvtAccessibilityOptions::GetIsAllowAnimatedText() const
776 return sm_pSingleImplConfig
->GetIsAllowAnimatedText();
778 sal_Bool
SvtAccessibilityOptions::GetIsAutomaticFontColor() const
780 return sm_pSingleImplConfig
->GetIsAutomaticFontColor();
782 sal_Bool
SvtAccessibilityOptions::GetIsSystemFont() const
784 return sm_pSingleImplConfig
->GetIsSystemFont();
786 sal_Int16
SvtAccessibilityOptions::GetHelpTipSeconds() const
788 return sm_pSingleImplConfig
->GetHelpTipSeconds();
790 sal_Bool
SvtAccessibilityOptions::IsSelectionInReadonly() const
792 return sm_pSingleImplConfig
->IsSelectionInReadonly();
794 sal_Int16
SvtAccessibilityOptions::GetEdgeBlending() const
796 return sm_pSingleImplConfig
->GetEdgeBlending();
798 sal_Int16
SvtAccessibilityOptions::GetListBoxMaximumLineCount() const
800 return sm_pSingleImplConfig
->GetListBoxMaximumLineCount();
802 sal_Int16
SvtAccessibilityOptions::GetColorValueSetColumnCount() const
804 return sm_pSingleImplConfig
->GetColorValueSetColumnCount();
806 sal_Bool
SvtAccessibilityOptions::GetPreviewUsesCheckeredBackground() const
808 return sm_pSingleImplConfig
->GetPreviewUsesCheckeredBackground();
811 // -----------------------------------------------------------------------
812 void SvtAccessibilityOptions::SetAutoDetectSystemHC(sal_Bool bSet
)
814 sm_pSingleImplConfig
->SetAutoDetectSystemHC(bSet
);
816 void SvtAccessibilityOptions::SetIsForPagePreviews(sal_Bool bSet
)
818 sm_pSingleImplConfig
->SetIsForPagePreviews(bSet
);
820 void SvtAccessibilityOptions::SetIsHelpTipsDisappear(sal_Bool bSet
)
822 sm_pSingleImplConfig
->SetIsHelpTipsDisappear(bSet
);
824 void SvtAccessibilityOptions::SetIsAllowAnimatedGraphics(sal_Bool bSet
)
826 sm_pSingleImplConfig
->SetIsAllowAnimatedGraphics(bSet
);
828 void SvtAccessibilityOptions::SetIsAllowAnimatedText(sal_Bool bSet
)
830 sm_pSingleImplConfig
->SetIsAllowAnimatedText(bSet
);
832 void SvtAccessibilityOptions::SetIsAutomaticFontColor(sal_Bool bSet
)
834 sm_pSingleImplConfig
->SetIsAutomaticFontColor(bSet
);
836 void SvtAccessibilityOptions::SetIsSystemFont(sal_Bool bSet
)
838 sm_pSingleImplConfig
->SetIsSystemFont(bSet
);
840 void SvtAccessibilityOptions::SetHelpTipSeconds(sal_Int16 nSet
)
842 sm_pSingleImplConfig
->SetHelpTipSeconds(nSet
);
844 void SvtAccessibilityOptions::SetSelectionInReadonly(sal_Bool bSet
)
846 sm_pSingleImplConfig
->SetSelectionInReadonly(bSet
);
848 void SvtAccessibilityOptions::SetVCLSettings()
850 sm_pSingleImplConfig
->SetVCLSettings();
852 void SvtAccessibilityOptions::SetEdgeBlending(sal_Int16 nSet
)
854 sm_pSingleImplConfig
->SetEdgeBlending(nSet
);
856 void SvtAccessibilityOptions::SetListBoxMaximumLineCount(sal_Int16 nSet
)
858 sm_pSingleImplConfig
->SetListBoxMaximumLineCount(nSet
);
860 void SvtAccessibilityOptions::SetColorValueSetColumnCount(sal_Int16 nSet
)
862 sm_pSingleImplConfig
->SetColorValueSetColumnCount(nSet
);
864 void SvtAccessibilityOptions::SetPreviewUsesCheckeredBackground(sal_Bool bSet
)
866 sm_pSingleImplConfig
->SetPreviewUsesCheckeredBackground(bSet
);
869 // -----------------------------------------------------------------------
871 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */