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: uiconfigurationmanager.cxx,v $
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/uiconfigurationmanager.hxx>
34 #include <threadhelp/resetableguard.hxx>
36 #include <uielement/rootitemcontainer.hxx>
37 #include <uielement/constitemcontainer.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/XInitialization.hpp>
53 #include <com/sun/star/lang/DisposedException.hpp>
54 #include <com/sun/star/beans/XPropertySet.hpp>
55 #include <com/sun/star/embed/ElementModes.hpp>
56 #include <com/sun/star/container/XNameAccess.hpp>
57 #include <com/sun/star/io/XStream.hpp>
58 #include <com/sun/star/embed/XTransactedObject.hpp>
60 //_________________________________________________________________________________________________________________
62 //_________________________________________________________________________________________________________________
64 #include <vcl/svapp.hxx>
65 #include <rtl/ustrbuf.hxx>
67 //_________________________________________________________________________________________________________________
69 //_________________________________________________________________________________________________________________
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_7 ( UIConfigurationManager
,
87 DIRECT_INTERFACE( css::lang::XTypeProvider
),
88 DIRECT_INTERFACE( css::lang::XServiceInfo
),
89 DIRECT_INTERFACE( css::lang::XComponent
),
90 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfiguration
),
91 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationManager
),
92 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationPersistence
),
93 DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationStorage
)
96 DEFINE_XTYPEPROVIDER_7 ( UIConfigurationManager
,
97 css::lang::XTypeProvider
,
98 css::lang::XServiceInfo
,
99 css::lang::XComponent
,
100 ::com::sun::star::ui::XUIConfiguration
,
101 ::com::sun::star::ui::XUIConfigurationManager
,
102 ::com::sun::star::ui::XUIConfigurationPersistence
,
103 ::com::sun::star::ui::XUIConfigurationStorage
106 DEFINE_XSERVICEINFO_MULTISERVICE ( UIConfigurationManager
,
107 ::cppu::OWeakObject
,
108 SERVICENAME_UICONFIGURATIONMANAGER
,
109 IMPLEMENTATIONNAME_UICONFIGURATIONMANAGER
112 DEFINE_INIT_SERVICE ( UIConfigurationManager
, {} )
114 UIConfigurationManager::UIConfigurationManager( com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
> xServiceManager
)
115 : m_pImpl( new UIConfigurationManagerImpl(xServiceManager
,static_cast< OWeakObject
* >(this),false) )
119 UIConfigurationManager::~UIConfigurationManager()
124 void SAL_CALL
UIConfigurationManager::dispose() throw (::com::sun::star::uno::RuntimeException
)
129 void SAL_CALL
UIConfigurationManager::addEventListener( const Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
132 m_pImpl
->addEventListener(xListener
);
135 void SAL_CALL
UIConfigurationManager::removeEventListener( const Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
137 m_pImpl
->removeEventListener(xListener
);
140 // XUIConfigurationManager
141 void SAL_CALL
UIConfigurationManager::addConfigurationListener( const Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
143 m_pImpl
->addConfigurationListener(xListener
);
146 void SAL_CALL
UIConfigurationManager::removeConfigurationListener( const Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
)
148 m_pImpl
->removeConfigurationListener(xListener
);
152 void SAL_CALL
UIConfigurationManager::reset() throw (::com::sun::star::uno::RuntimeException
)
157 Sequence
< Sequence
< PropertyValue
> > SAL_CALL
UIConfigurationManager::getUIElementsInfo( sal_Int16 ElementType
)
158 throw ( IllegalArgumentException
, RuntimeException
)
160 return m_pImpl
->getUIElementsInfo(ElementType
);
163 Reference
< XIndexContainer
> SAL_CALL
UIConfigurationManager::createSettings() throw (::com::sun::star::uno::RuntimeException
)
165 return m_pImpl
->createSettings();
168 sal_Bool SAL_CALL
UIConfigurationManager::hasSettings( const ::rtl::OUString
& ResourceURL
)
169 throw (::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
171 return m_pImpl
->hasSettings(ResourceURL
);
174 Reference
< XIndexAccess
> SAL_CALL
UIConfigurationManager::getSettings( const ::rtl::OUString
& ResourceURL
, sal_Bool bWriteable
)
175 throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::uno::RuntimeException
)
177 return m_pImpl
->getSettings(ResourceURL
,bWriteable
);
180 void SAL_CALL
UIConfigurationManager::replaceSettings( const ::rtl::OUString
& ResourceURL
, const Reference
< ::com::sun::star::container::XIndexAccess
>& aNewData
)
181 throw (::com::sun::star::container::NoSuchElementException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::IllegalAccessException
, ::com::sun::star::uno::RuntimeException
)
183 return m_pImpl
->replaceSettings(ResourceURL
,aNewData
);
186 void SAL_CALL
UIConfigurationManager::removeSettings( const ::rtl::OUString
& ResourceURL
)
187 throw ( NoSuchElementException
, IllegalArgumentException
, IllegalAccessException
, RuntimeException
)
189 m_pImpl
->removeSettings(ResourceURL
);
192 void SAL_CALL
UIConfigurationManager::insertSettings( const ::rtl::OUString
& NewResourceURL
, const Reference
< XIndexAccess
>& aNewData
)
193 throw ( ElementExistException
, IllegalArgumentException
, IllegalAccessException
, RuntimeException
)
195 m_pImpl
->insertSettings(NewResourceURL
,aNewData
);
198 Reference
< XInterface
> SAL_CALL
UIConfigurationManager::getImageManager() throw (::com::sun::star::uno::RuntimeException
)
200 return m_pImpl
->getImageManager();
203 Reference
< XInterface
> SAL_CALL
UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException
)
205 return m_pImpl
->getShortCutManager();
208 Reference
< XInterface
> SAL_CALL
UIConfigurationManager::getEventsManager() throw (::com::sun::star::uno::RuntimeException
)
210 return Reference
< XInterface
>();
213 // XUIConfigurationStorage
214 void SAL_CALL
UIConfigurationManager::setStorage( const Reference
< XStorage
>& Storage
) throw (::com::sun::star::uno::RuntimeException
)
216 m_pImpl
->setStorage(Storage
);
219 sal_Bool SAL_CALL
UIConfigurationManager::hasStorage() throw (::com::sun::star::uno::RuntimeException
)
221 return m_pImpl
->hasStorage();
224 // XUIConfigurationPersistence
225 void SAL_CALL
UIConfigurationManager::reload() throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
230 void SAL_CALL
UIConfigurationManager::store() throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
235 void SAL_CALL
UIConfigurationManager::storeToStorage( const Reference
< XStorage
>& Storage
) throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
)
237 m_pImpl
->storeToStorage(Storage
);
240 sal_Bool SAL_CALL
UIConfigurationManager::isModified() throw (::com::sun::star::uno::RuntimeException
)
242 return m_pImpl
->isModified();
245 sal_Bool SAL_CALL
UIConfigurationManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException
)
247 return m_pImpl
->isReadOnly();
250 } // namespace framework