1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: globalacceleratorconfiguration.cxx,v $
10 * $Revision: 1.5.244.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_framework.hxx"
33 #include <accelerators/globalacceleratorconfiguration.hxx>
35 //_______________________________________________
37 #include <threadhelp/readguard.hxx>
38 #include <threadhelp/writeguard.hxx>
40 #include <acceleratorconst.h>
43 //_______________________________________________
45 #include <com/sun/star/beans/XPropertySet.hpp>
46 #include <com/sun/star/embed/ElementModes.hpp>
47 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
48 #include <com/sun/star/container/XNameAccess.hpp>
49 #include <com/sun/star/util/XChangesNotifier.hpp>
51 //_______________________________________________
53 #include <vcl/svapp.hxx>
54 #include <comphelper/locale.hxx>
55 #include <comphelper/configurationhelper.hxx>
57 //_______________________________________________
63 //-----------------------------------------------
64 // XInterface, XTypeProvider, XServiceInfo
65 DEFINE_XINTERFACE_2(GlobalAcceleratorConfiguration
,
66 XCUBasedAcceleratorConfiguration
,
67 DIRECT_INTERFACE(css::lang::XServiceInfo
),
68 DIRECT_INTERFACE(css::lang::XInitialization
))
69 DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS(GlobalAcceleratorConfiguration
,
70 XCUBasedAcceleratorConfiguration
,
71 css::lang::XServiceInfo
,
72 css::lang::XInitialization
)
74 DEFINE_XSERVICEINFO_MULTISERVICE(GlobalAcceleratorConfiguration
,
76 SERVICENAME_GLOBALACCELERATORCONFIGURATION
,
77 IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION
)
79 DEFINE_INIT_SERVICE(GlobalAcceleratorConfiguration
,
82 I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance()
83 to create a new instance of this class by our own supported service factory.
84 see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations!
90 //-----------------------------------------------
91 GlobalAcceleratorConfiguration::GlobalAcceleratorConfiguration(const css::uno::Reference
< css::lang::XMultiServiceFactory
> xSMGR
)
92 : XCUBasedAcceleratorConfiguration(xSMGR
)
96 //-----------------------------------------------
97 GlobalAcceleratorConfiguration::~GlobalAcceleratorConfiguration()
101 void SAL_CALL
GlobalAcceleratorConfiguration::initialize(const css::uno::Sequence
< css::uno::Any
>& /*lArguments*/)
102 throw(css::uno::Exception
,
103 css::uno::RuntimeException
)
107 //-----------------------------------------------
108 void GlobalAcceleratorConfiguration::impl_ts_fillCache()
110 // get current office locale ... but dont cache it.
111 // Otherwise we must be listener on the configuration layer
112 // which seems to superflous for this small implementation .-)
113 ::comphelper::Locale aLocale
= ::comphelper::Locale(m_sLocale
);
115 // May be there exists no accelerator config? Handle it gracefully :-)
118 m_sGlobalOrModules
= CFG_ENTRY_GLOBAL
;
119 XCUBasedAcceleratorConfiguration::reload();
121 css::uno::Reference
< css::util::XChangesNotifier
> xBroadcaster(m_xCfg
, css::uno::UNO_QUERY_THROW
);
122 xBroadcaster
->addChangesListener(static_cast< css::util::XChangesListener
* >(this));
124 catch(const css::uno::RuntimeException
& exRun
)
126 catch(const css::uno::Exception
&)
130 } // namespace framework