23#include <com/sun/star/configuration/theDefaultProvider.hpp>
24#include <com/sun/star/container/XNameAccess.hpp>
25#include <com/sun/star/lang/XComponent.hpp>
26#include <com/sun/star/lang/XEventListener.hpp>
47class GlobalSettings_Access :
public ::cppu::WeakImplHelper<
48 css::lang::XComponent,
49 css::lang::XEventListener>
52 explicit GlobalSettings_Access( css::uno::Reference< css::uno::XComponentContext > xContext );
55 virtual void SAL_CALL
dispose()
override;
56 virtual void SAL_CALL addEventListener(
const css::uno::Reference< css::lang::XEventListener >& xListener )
override;
57 virtual void SAL_CALL removeEventListener(
const css::uno::Reference< css::lang::XEventListener >& aListener )
override;
60 virtual void SAL_CALL disposing(
const css::lang::EventObject& Source )
override;
63 bool HasToolbarStatesInfo();
67 void impl_initConfigAccess();
77 css::uno::Reference< css::uno::XComponentContext>
m_xContext;
82GlobalSettings_Access::GlobalSettings_Access( css::uno::Reference< css::uno::XComponentContext > xContext ) :
94void SAL_CALL GlobalSettings_Access::dispose()
101void SAL_CALL GlobalSettings_Access::addEventListener(
const css::uno::Reference< css::lang::XEventListener >& )
105void SAL_CALL GlobalSettings_Access::removeEventListener(
const css::uno::Reference< css::lang::XEventListener >& )
110void SAL_CALL GlobalSettings_Access::disposing(
const css::lang::EventObject& )
117bool GlobalSettings_Access::HasToolbarStatesInfo()
127 impl_initConfigAccess();
140 catch (
const css::container::NoSuchElementException& )
143 catch (
const css::uno::Exception& )
151bool GlobalSettings_Access::GetToolbarStateInfo( GlobalSettings::StateInfo eStateInfo, css::uno::Any& aValue )
161 impl_initConfigAccess();
170 css::uno::Reference< css::container::XNameAccess > xNameAccess;
171 if ( a >>= xNameAccess )
173 if ( eStateInfo == GlobalSettings::STATEINFO_LOCKED )
175 else if ( eStateInfo == GlobalSettings::STATEINFO_DOCKED )
182 catch (
const css::container::NoSuchElementException& )
185 catch (
const css::uno::Exception& )
192void GlobalSettings_Access::impl_initConfigAccess()
198 css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider =
199 css::configuration::theDefaultProvider::get(
m_xContext );
203 {
"nodepath",
uno::Any(OUString(
"/org.openoffice.Office.UI.GlobalSettings/Toolbars"))}
206 SERVICENAME_CFGREADACCESS, aArgs ),
207 css::uno::UNO_QUERY );
209 css::uno::Reference< css::lang::XComponent >(
210 xConfigProvider, css::uno::UNO_QUERY_THROW )->addEventListener(
211 css::uno::Reference< css::lang::XEventListener >(
this));
214 catch (
const css::lang::WrappedTargetException& )
217 catch (
const css::uno::Exception& )
224static GlobalSettings_Access*
GetGlobalSettings(
const css::uno::Reference< css::uno::XComponentContext >& rxContext )
227 return pStaticSettings.get();
230GlobalSettings::GlobalSettings( css::uno::Reference< css::uno::XComponentContext > xContext ) :
245 return pSettings->HasToolbarStatesInfo();
255 return pSettings->GetToolbarStateInfo( eStateInfo, aValue );
bool GetToolbarStateInfo(StateInfo eStateInfo, css::uno::Any &aValue)
css::uno::Reference< css::uno::XComponentContext > m_xContext
bool HasToolbarStatesInfo() const
css::uno::Reference< css::container::XNameAccess > m_xConfigAccess
OUString m_aNodeRefStates
css::uno::Reference< css::uno::XComponentContext > m_xContext
OUString m_aPropStatesEnabled
css::uno::Sequence< css::uno::Any > InitAnyPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
static GlobalSettings_Access * GetGlobalSettings(const css::uno::Reference< css::uno::XComponentContext > &rxContext)