diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-01-09 20:36:26 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2014-02-06 12:03:27 +0100 |
commit | 813b0f60e86de5e0ebf678691a9ff405e293bf86 (patch) | |
tree | 92c9599cc87a400527e7efb3808642a4c90498b7 /framework/inc | |
parent | 094f92bb789ecd24793c5843bfae13e79122fc5a (diff) |
fwk: Constructor feature for single-instance FooBarFactories.
Converted them as usual service implementations.
Otherwise - if static singletons are used -
it does not show menu for some reason.
Change-Id: I0673d0bfbba268728a3fa676f2af95aa6c74bbb2
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/uifactory/menubarfactory.hxx | 43 | ||||
-rw-r--r-- | framework/inc/uifactory/statusbarfactory.hxx | 51 | ||||
-rw-r--r-- | framework/inc/uifactory/toolboxfactory.hxx | 50 |
3 files changed, 26 insertions, 118 deletions
diff --git a/framework/inc/uifactory/menubarfactory.hxx b/framework/inc/uifactory/menubarfactory.hxx index ff03a96f3c17..ce9ea19f8b14 100644 --- a/framework/inc/uifactory/menubarfactory.hxx +++ b/framework/inc/uifactory/menubarfactory.hxx @@ -20,36 +20,48 @@ #ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_MENUBARFACTORY_HXX #define INCLUDED_FRAMEWORK_INC_UIFACTORY_MENUBARFACTORY_HXX -#include <stdtypes.h> -#include <threadhelp/threadhelpbase.hxx> -#include <macros/generic.hxx> -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <macros/xserviceinfo.hxx> - #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> #include <com/sun/star/frame/XModuleManager2.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <rtl/ustring.hxx> namespace framework { - class MenuBarFactory : protected 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::XUIElementFactory> +typedef ::cppu::WeakImplHelper2< + css::lang::XServiceInfo, + css::ui::XUIElementFactory> MenuBarFactory_BASE; + + class MenuBarFactory : public MenuBarFactory_BASE { public: MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); virtual ~MenuBarFactory(); - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO + virtual OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException) + { + return OUString("com.sun.star.comp.framework.MenuBarFactory"); + } + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException) + { + return cppu::supportsService(this, ServiceName); + } + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException) + { + css::uno::Sequence< OUString > aSeq(1); + aSeq[0] = OUString("com.sun.star.ui.UIElementFactory"); + return aSeq; + } // 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 ); @@ -63,10 +75,7 @@ namespace framework ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); protected: - MenuBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,bool ); - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; }; } diff --git a/framework/inc/uifactory/statusbarfactory.hxx b/framework/inc/uifactory/statusbarfactory.hxx deleted file mode 100644 index 3bbfbf456368..000000000000 --- a/framework/inc/uifactory/statusbarfactory.hxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX -#define INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX - -#include <stdtypes.h> - -#include <macros/xserviceinfo.hxx> -#include <services.h> -#include <uifactory/menubarfactory.hxx> - -#include <rtl/ustring.hxx> - -namespace framework -{ - -class StatusBarFactory : public MenuBarFactory -{ - public: - StatusBarFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); - - // 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 ); - -}; - -} - -#endif // INCLUDED_FRAMEWORK_INC_UIFACTORY_STATUSBARFACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uifactory/toolboxfactory.hxx b/framework/inc/uifactory/toolboxfactory.hxx deleted file mode 100644 index deccecb170b4..000000000000 --- a/framework/inc/uifactory/toolboxfactory.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_UIFACTORY_TOOLBOXFACTORY_HXX -#define INCLUDED_FRAMEWORK_INC_UIFACTORY_TOOLBOXFACTORY_HXX - -#include <stdtypes.h> -#include <macros/xserviceinfo.hxx> -#include <services.h> -#include <uifactory/menubarfactory.hxx> - -#include <cppuhelper/weak.hxx> -#include <rtl/ustring.hxx> - -namespace framework -{ - -class ToolBoxFactory : public MenuBarFactory -{ - public: - ToolBoxFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); - - // 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 ); -}; - -} - -#endif // SFX_TOOLBOXFACTORY_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |