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: moduleuiconfigurationmanager.cxx,v $
10 * $Revision: 1.19.208.2 $
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 <uiconfiguration/moduleuiconfigurationmanager.hxx>
34 #include <threadhelp/resetableguard.hxx>
36 #include <uielement/constitemcontainer.hxx>
37 #include <uielement/rootitemcontainer.hxx>
38 #include <uielement/uielementtypenames.hxx>
39 #include <xml/menuconfiguration.hxx>
40 #include <xml/toolboxconfiguration.hxx>
41 #include <uiconfigurationmanagerimpl.hxx>
43 #ifndef __FRAMEWORK_XML_STATUSBARCONFIGURATION_HXX_
44 #include <xml/statusbarconfiguration.hxx>
47 //_________________________________________________________________________________________________________________
49 //_________________________________________________________________________________________________________________
50 #include <com/sun/star/ui/UIElementType.hpp>
51 #include <com/sun/star/ui/ConfigurationEvent.hpp>
52 #include <com/sun/star/lang/DisposedException.hpp>
53 #include <com/sun/star/beans/XPropertySet.hpp>
54 #include <com/sun/star/embed/ElementModes.hpp>
55 #include <com/sun/star/container/XNameAccess.hpp>
56 #include <com/sun/star/io/XStream.hpp>
58 //_________________________________________________________________________________________________________________
60 //_________________________________________________________________________________________________________________
62 #include <vcl/svapp.hxx>
63 #include <rtl/ustrbuf.hxx>
64 #include <comphelper/sequenceashashmap.hxx>
66 //_________________________________________________________________________________________________________________
68 //_________________________________________________________________________________________________________________
71 using namespace com::sun::star::uno
;
72 using namespace com::sun::star::io
;
73 using namespace com::sun::star::embed
;
74 using namespace com::sun::star::lang
;
75 using namespace com::sun::star::container
;
76 using namespace com::sun::star::beans
;
77 using namespace ::com::sun::star::ui
;
82 //*****************************************************************************************************************
83 // XInterface, XTypeProvider, XServiceInfo
84 //*****************************************************************************************************************
85 DEFINE_XINTERFACE_8 ( ModuleUIConfigurationManager
,
87 DIRECT_INTERFACE( css::lang::XTypeProvider
),
88 DIRECT_INTERFACE( css::lang::XServiceInfo
),
89 DIRECT_INTERFACE( css::lang::XComponent
),
90 DIRECT_INTERFACE( css::lang::XInitialization
),
91 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration
),
92 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationManager
),
93 DIRECT_INTERFACE( ::com::sun::star::ui::XModuleUIConfigurationManager
),
94 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence
)
97 DEFINE_XTYPEPROVIDER_8 ( ModuleUIConfigurationManager
,
98 css::lang::XTypeProvider
,
99 css::lang::XServiceInfo
,
100 css::lang::XComponent
,
101 css::lang::XInitialization
,
102 ::com::sun::star::ui::XUIConfiguration
,
103 ::com::sun::star::ui::XUIConfigurationManager
,
104 ::com::sun::star::ui::XModuleUIConfigurationManager
,
105 ::com::sun::star::ui::XUIConfigurationPersistence
108 DEFINE_XSERVICEINFO_MULTISERVICE ( ModuleUIConfigurationManager
,
109 ::cppu::OWeakObject
,
110 SERVICENAME_MODULEUICONFIGURATIONMANAGER
,
111 IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGER
114 DEFINE_INIT_SERVICE ( ModuleUIConfigurationManager
, {} )
117 ModuleUIConfigurationManager::ModuleUIConfigurationManager( com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> xServiceManager
)
118 : m_pImpl( new UIConfigurationManagerImpl(xServiceManager
,static_cast< OWeakObject
* >(this),true) )
120 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::ModuleUIConfigurationManager" );
123 ModuleUIConfigurationManager::~ModuleUIConfigurationManager()
128 void SAL_CALL
ModuleUIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException
)
130 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::dispose" );
134 void SAL_CALL
ModuleUIConfigurationManager::addEventListener( const Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
136 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addEventListener" );
137 m_pImpl
->addEventListener(xListener
);
140 void SAL_CALL
ModuleUIConfigurationManager::removeEventListener( const Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
142 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeEventListener" );
143 m_pImpl
->removeEventListener(xListener
);
147 void SAL_CALL
ModuleUIConfigurationManager::initialize( const Sequence
< Any
>& aArguments
) throw ( Exception
, RuntimeException
)
149 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::initialize" );
150 m_pImpl
->initialize(aArguments
);
154 void SAL_CALL
ModuleUIConfigurationManager::addConfigurationListener( const Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
156 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::addConfigurationListener" );
157 m_pImpl
->addConfigurationListener(xListener
);
160 void SAL_CALL
ModuleUIConfigurationManager::removeConfigurationListener( const Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
162 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeConfigurationListener" );
163 m_pImpl
->removeConfigurationListener(xListener
);
167 // XUIConfigurationManager
168 void SAL_CALL
ModuleUIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException
)
170 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reset" );
174 Sequence
< Sequence
< PropertyValue
> > SAL_CALL
ModuleUIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType
)
175 throw ( IllegalArgumentException
, RuntimeException
)
177 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getUIElementsInfo" );
178 return m_pImpl
->getUIElementsInfo(ElementType
);
181 Reference
< XIndexContainer
> SAL_CALL
ModuleUIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException
)
183 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::createSettings" );
185 // Creates an empty item container which can be filled from outside
186 return m_pImpl
->createSettings();
189 sal_Bool SAL_CALL
ModuleUIConfigurationManager::hasSettings( const ::rtl::OUString
& ResourceURL
)
190 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
192 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::hasSettings" );
193 return m_pImpl
->hasSettings(ResourceURL
);
196 Reference
< XIndexAccess
> SAL_CALL
ModuleUIConfigurationManager::getSettings( const ::rtl::OUString
& ResourceURL
, sal_Bool bWriteable
)
197 throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
199 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getSettings" );
200 return m_pImpl
->getSettings(ResourceURL
,bWriteable
);
203 void SAL_CALL
ModuleUIConfigurationManager::replaceSettings( const ::rtl::OUString
& ResourceURL
, const Reference
< ::com::sun::star::container::XIndexAccess
>& aNewData
)
204 throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IllegalAccessException
, ::com::sun::star::uno::RuntimeException
)
206 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::replaceSettings" );
207 return m_pImpl
->replaceSettings(ResourceURL
,aNewData
);
210 void SAL_CALL
ModuleUIConfigurationManager::removeSettings( const ::rtl::OUString
& ResourceURL
)
211 throw ( NoSuchElementException
, IllegalArgumentException
, IllegalAccessException
, RuntimeException
)
213 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::removeSettings" );
214 m_pImpl
->removeSettings(ResourceURL
);
217 void SAL_CALL
ModuleUIConfigurationManager::insertSettings( const ::rtl::OUString
& NewResourceURL
, const Reference
< XIndexAccess
>& aNewData
)
218 throw ( ElementExistException
, IllegalArgumentException
, IllegalAccessException
, RuntimeException
)
220 m_pImpl
->insertSettings(NewResourceURL
,aNewData
);
223 Reference
< XInterface
> SAL_CALL
ModuleUIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException
)
225 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getImageManager" );
226 return m_pImpl
->getImageManager();
229 Reference
< XInterface
> SAL_CALL
ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException
)
231 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getShortCutManager" );
232 return m_pImpl
->getShortCutManager();
235 Reference
< XInterface
> SAL_CALL
ModuleUIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException
)
237 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getEventsManager" );
238 return Reference
< XInterface
>();
241 // XModuleUIConfigurationManager
242 sal_Bool SAL_CALL
ModuleUIConfigurationManager::isDefaultSettings( const ::rtl::OUString
& ResourceURL
)
243 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
245 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isDefaultSettings" );
246 return m_pImpl
->isDefaultSettings(ResourceURL
);
249 Reference
< XIndexAccess
> SAL_CALL
ModuleUIConfigurationManager::getDefaultSettings( const ::rtl::OUString
& ResourceURL
)
250 throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
252 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::getDefaultSettings" );
253 return m_pImpl
->getDefaultSettings(ResourceURL
);
256 // XUIConfigurationPersistence
257 void SAL_CALL
ModuleUIConfigurationManager::reload() throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
259 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::reload" );
263 void SAL_CALL
ModuleUIConfigurationManager::store() throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
265 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::store" );
269 void SAL_CALL
ModuleUIConfigurationManager::storeToStorage( const Reference
< XStorage
>& Storage
) throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
271 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::storeToStorage" );
272 m_pImpl
->storeToStorage(Storage
);
275 sal_Bool SAL_CALL
ModuleUIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException
)
277 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isModified" );
278 return m_pImpl
->isModified();
281 sal_Bool SAL_CALL
ModuleUIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException
)
283 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger
, "framework", "Ocke.Janssen@sun.com", "ModuleUIConfigurationManager::isReadOnly" );
284 return m_pImpl
->isReadOnly();
287 } // namespace framework