diff options
-rw-r--r-- | framework/inc/uifactory/configurationaccessfactorymanager.hxx (renamed from framework/inc/uifactory/uielementfactorymanager.hxx) | 40 | ||||
-rw-r--r-- | framework/source/register/registerservices.cxx | 2 | ||||
-rw-r--r-- | framework/source/uifactory/uielementfactorymanager.cxx | 75 | ||||
-rw-r--r-- | framework/source/uifactory/windowcontentfactorymanager.cxx | 5 | ||||
-rw-r--r-- | framework/util/fwk.component | 3 |
5 files changed, 60 insertions, 65 deletions
diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/configurationaccessfactorymanager.hxx index 5e5f56352fad..7f73666e7f6c 100644 --- a/framework/inc/uifactory/uielementfactorymanager.hxx +++ b/framework/inc/uifactory/configurationaccessfactorymanager.hxx @@ -20,12 +20,6 @@ #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX #define INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX -/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble - with solaris headers ... -*/ -#include <vector> -#include <list> - #include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> #include <macros/xinterface.hxx> @@ -33,14 +27,11 @@ #include <macros/xserviceinfo.hxx> #include <stdtypes.h> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/ui/XUIElementFactoryManager.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> namespace framework @@ -97,35 +88,6 @@ namespace framework sal_Bool m_bConfigAccessInitialized; }; - -class UIElementFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::ui::XUIElementFactoryManager> -{ - public: - UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); - virtual ~UIElementFactoryManager(); - - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO - - // XUIElementFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Args ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - - // XUIElementFactoryRegistration - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > > SAL_CALL getRegisteredFactories( ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory > SAL_CALL getFactory( const OUString& ResourceURL, const OUString& ModuleIdentifier ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL registerFactory( const OUString& aType, const OUString& aName, const OUString& aModuleIdentifier, const OUString& aFactoryImplementationName ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deregisterFactory( const OUString& aType, const OUString& aName, const OUString& aModuleIdentifier ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); - - private: - - sal_Bool m_bConfigRead; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; - ConfigurationAccess_FactoryManager* m_pConfigAccess; -}; - } // namespace framework #endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_UIELEMENTFACTORYMANAGER_HXX diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index e16d0fdc5ad9..0168d415ebbe 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -38,7 +38,6 @@ #include <services/modulemanager.hxx> #include <jobs/jobexecutor.hxx> #include <services/layoutmanager.hxx> -#include <uifactory/uielementfactorymanager.hxx> #include <uielement/objectmenucontroller.hxx> #include <uielement/controlmenucontroller.hxx> #include <uielement/uicommanddescription.hxx> @@ -64,7 +63,6 @@ COMPONENTGETFACTORY ( fwk, IFFACTORY( ::framework::Frame ) else IFFACTORY( ::framework::JobExecutor ) else IFFACTORY( ::framework::LayoutManager ) else - IFFACTORY( ::framework::UIElementFactoryManager ) else IFFACTORY( ::framework::ObjectMenuController ) else IFFACTORY( ::framework::ControlMenuController ) else IFFACTORY( ::framework::UICommandDescription ) else diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 6d52f970690a..eff8eaf260b6 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -17,8 +17,9 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <uifactory/uielementfactorymanager.hxx> +#include <uifactory/configurationaccessfactorymanager.hxx> #include <threadhelp/resetableguard.hxx> +#include <macros/xserviceinfo.hxx> #include "services.h" #include "helper/mischelper.hxx" @@ -26,20 +27,21 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XModuleManager2.hpp> +#include <com/sun/star/ui/XUIElementFactoryManager.hpp> +#include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <cppuhelper/weak.hxx> #include <vcl/svapp.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ - using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -48,16 +50,13 @@ using namespace com::sun::star::configuration; using namespace com::sun::star::container; using namespace ::com::sun::star::ui; using namespace ::com::sun::star::frame; - -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ +using namespace framework; namespace framework { // global function needed by both implementations -OUString getHashKeyFromStrings( const OUString& aType, const OUString& aName, const OUString& aModuleName ) +static OUString getHashKeyFromStrings( const OUString& aType, const OUString& aName, const OUString& aModuleName ) { OUStringBuffer aKey( aType ); aKey.appendAscii( "^" ); @@ -68,11 +67,6 @@ OUString getHashKeyFromStrings( const OUString& aType, const OUString& aName, co } -//***************************************************************************************************************** -// Configuration access class for UIElementFactoryManager implementation -//***************************************************************************************************************** - - ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( const Reference< XComponentContext >& rxContext, const OUString& _sRoot ) : ThreadHelpBase(), m_aPropType( "Type" ), @@ -355,9 +349,37 @@ sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aE return sal_True; } -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** +} // framework + +namespace { + +class UIElementFactoryManager : private ThreadHelpBase, // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< css::lang::XServiceInfo, + css::ui::XUIElementFactoryManager> +{ +public: + UIElementFactoryManager( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~UIElementFactoryManager(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XUIElementFactory + virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL createUIElement( const OUString& ResourceURL, const css::uno::Sequence< css::beans::PropertyValue >& Args ) throw (css::container::NoSuchElementException, css::lang::IllegalArgumentException, css::uno::RuntimeException); + + // XUIElementFactoryRegistration + virtual css::uno::Sequence< css::uno::Sequence< css::beans::PropertyValue > > SAL_CALL getRegisteredFactories( ) throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::ui::XUIElementFactory > SAL_CALL getFactory( const OUString& ResourceURL, const OUString& ModuleIdentifier ) throw (css::uno::RuntimeException); + virtual void SAL_CALL registerFactory( const OUString& aType, const OUString& aName, const OUString& aModuleIdentifier, const OUString& aFactoryImplementationName ) throw (css::container::ElementExistException, css::uno::RuntimeException); + virtual void SAL_CALL deregisterFactory( const OUString& aType, const OUString& aName, const OUString& aModuleIdentifier ) throw (css::container::NoSuchElementException, css::uno::RuntimeException); + +private: + sal_Bool m_bConfigRead; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager; + ConfigurationAccess_FactoryManager* m_pConfigAccess; +}; + DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UIElementFactoryManager , ::cppu::OWeakObject , "com.sun.star.ui.UIElementFactoryManager", @@ -509,6 +531,17 @@ throw ( NoSuchElementException, RuntimeException ) // SAFE } -} // namespace framework +} + +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_framework_UIElementFactoryManager_get_implementation( + css::uno::XComponentContext * context, + uno_Sequence * arguments) +{ + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + rtl::Reference<UIElementFactoryManager> x(new UIElementFactoryManager(context)); + x->acquire(); + return static_cast<cppu::OWeakObject *>(x.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index 2cf90ec857f8..18707eda8ca0 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <uifactory/uielementfactorymanager.hxx> +#include <uifactory/configurationaccessfactorymanager.hxx> #include <threadhelp/resetableguard.hxx> #include <threadhelp/threadhelpbase.hxx> #include <helper/mischelper.hxx> @@ -28,9 +28,10 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/ModuleManager.hpp> -#include "com/sun/star/frame/XModuleManager2.hpp" +#include <com/sun/star/frame/XModuleManager2.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <cppuhelper/implbase2.hxx> #include <rtl/ref.hxx> diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 27f5534629e3..205feef33836 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -124,7 +124,8 @@ <implementation name="com.sun.star.comp.framework.UIConfigurationManager"> <service name="com.sun.star.ui.UIConfigurationManager"/> </implementation> - <implementation name="com.sun.star.comp.framework.UIElementFactoryManager"> + <implementation name="com.sun.star.comp.framework.UIElementFactoryManager" + constructor="com_sun_star_comp_framework_UIElementFactoryManager_get_implementation"> <service name="com.sun.star.ui.UIElementFactoryManager"/> </implementation> <implementation name="com.sun.star.comp.framework.URLTransformer" |