diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-30 11:03:25 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@collabora.com> | 2013-12-31 13:25:49 +0100 |
commit | 05caae2d040497c68b9328da93eb4c33caee4632 (patch) | |
tree | 801c9143979f43280249728c757ebed6a98324e3 /svx | |
parent | 01739fc69fa91e58331d0edbf7282e8e25f124d1 (diff) |
svx: Use constructor feature for FontHeightToolBoxControl.
Change-Id: I4c4991e494f026951a4805c04018ea7b7f610cd9
Diffstat (limited to 'svx')
-rw-r--r-- | svx/inc/tbunocontroller.hxx | 84 | ||||
-rw-r--r-- | svx/source/tbxctrls/tbunocontroller.cxx | 78 | ||||
-rw-r--r-- | svx/source/unodraw/unoctabl.cxx | 8 | ||||
-rw-r--r-- | svx/util/svx.component | 3 |
4 files changed, 64 insertions, 109 deletions
diff --git a/svx/inc/tbunocontroller.hxx b/svx/inc/tbunocontroller.hxx deleted file mode 100644 index 82e48c5c51c7..000000000000 --- a/svx/inc/tbunocontroller.hxx +++ /dev/null @@ -1,84 +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_SVX_INC_TBUNOCONTROLLER_HXX -#define INCLUDED_SVX_INC_TBUNOCONTROLLER_HXX - -#include <svtools/toolboxcontroller.hxx> -#include <com/sun/star/awt/FontDescriptor.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> - -namespace svx -{ - -class SvxFontSizeBox_Impl; -class FontHeightToolBoxControl : public svt::ToolboxController, - public ::com::sun::star::lang::XServiceInfo -{ - public: - FontHeightToolBoxControl( - const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rServiceManager ); - ~FontHeightToolBoxControl(); - - // XInterface - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL acquire() throw (); - virtual void SAL_CALL release() throw (); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); - - static OUString getImplementationName_Static() throw() - { - return OUString("com.sun.star.svx.FontHeightToolBoxController"); - } - - static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - - // XComponent - virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); - - // XStatusListener - virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); - - // XToolbarController - virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); - - void dispatchCommand( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); - using svt::ToolboxController::dispatchCommand; - - private: - SvxFontSizeBox_Impl* m_pBox; - ::com::sun::star::awt::FontDescriptor m_aCurrentFont; -}; - -::com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL FontHeightToolBoxControl_createInstance( const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMgr ); - -} - -#endif // INCLUDED_SVX_INC_TBUNOCONTROLLER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index c34384466b6e..56dc41e031fa 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -17,18 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - -#include "tbunocontroller.hxx" - +#include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/frame/status/FontHeight.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <svtools/ctrltool.hxx> #include <svtools/ctrlbox.hxx> +#include <svtools/toolboxcontroller.hxx> #include <osl/mutex.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/supportsservice.hxx> @@ -39,10 +39,48 @@ using namespace ::com::sun::star; -namespace svx +namespace { + +class SvxFontSizeBox_Impl; +class FontHeightToolBoxControl : public svt::ToolboxController, + public lang::XServiceInfo { + public: + FontHeightToolBoxControl( + const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rServiceManager ); + ~FontHeightToolBoxControl(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XToolbarController + virtual void SAL_CALL execute( sal_Int16 KeyModifier ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + + void dispatchCommand( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArgs ); + using svt::ToolboxController::dispatchCommand; + + private: + SvxFontSizeBox_Impl* m_pBox; + ::com::sun::star::awt::FontDescriptor m_aCurrentFont; +}; -class FontHeightToolBoxControl; class SvxFontSizeBox_Impl : public FontSizeBox { public: @@ -284,18 +322,12 @@ throw(uno::RuntimeException) OUString SAL_CALL FontHeightToolBoxControl::getImplementationName() throw( uno::RuntimeException ) { - return getImplementationName_Static(); + return OUString("com.sun.star.svx.FontHeightToolBoxController"); } uno::Sequence< OUString > SAL_CALL FontHeightToolBoxControl::getSupportedServiceNames( ) throw( uno::RuntimeException ) { - return getSupportedServiceNames_Static(); -} - -uno::Sequence< OUString > FontHeightToolBoxControl::getSupportedServiceNames_Static() -throw() -{ uno::Sequence< OUString > aSNS( 1 ); aSNS.getArray()[0] = "com.sun.star.frame.ToolbarController"; return aSNS; @@ -404,12 +436,26 @@ void FontHeightToolBoxControl::dispatchCommand( } } -uno::Reference< uno::XInterface > SAL_CALL FontHeightToolBoxControl_createInstance( - const uno::Reference< lang::XMultiServiceFactory >& rSMgr ) -{ - return *new FontHeightToolBoxControl( comphelper::getComponentContext(rSMgr) ); } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_svx_FontHeightToolBoxController_implementation_getFactory( + css::uno::XComponentContext *rxContext, + uno_Sequence * arguments) +{ + assert(arguments != 0); + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new FontHeightToolBoxControl(rxContext))); + x->acquire(); + css::uno::Reference< css::lang::XInitialization > xx(x, css::uno::UNO_QUERY); + if (xx.is()) + { + css::uno::Sequence<css::uno::Any> aArgs( + reinterpret_cast<css::uno::Any *>(arguments->elements), + arguments->nElements); + xx->initialize(aArgs); + } + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 6e4575d7ad97..961b311c1b47 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -27,7 +27,6 @@ #include <svx/xtable.hxx> #include "svx/unoshcol.hxx" #include "recoveryui.hxx" -#include "tbunocontroller.hxx" using namespace ::com::sun::star; using namespace ::rtl; @@ -273,13 +272,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( svx::GraphicExporter_createInstance, svx::GraphicExporter_getSupportedServiceNames() ); } - else if ( svx::FontHeightToolBoxControl::getImplementationName_Static().equalsAscii( pImplName ) ) - { - xFactory = createSingleFactory( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ), - svx::FontHeightToolBoxControl::getImplementationName_Static(), - svx::FontHeightToolBoxControl_createInstance, - svx::FontHeightToolBoxControl::getSupportedServiceNames_Static() ); - } if( xFactory.is()) { diff --git a/svx/util/svx.component b/svx/util/svx.component index b3b4df04410f..2cc086a5f7df 100644 --- a/svx/util/svx.component +++ b/svx/util/svx.component @@ -59,7 +59,8 @@ constructor="com_sun_star_svx_FindAllToolboxController_implementation_getFactory"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> - <implementation name="com.sun.star.svx.FontHeightToolBoxController"> + <implementation name="com.sun.star.svx.FontHeightToolBoxController" + constructor="com_sun_star_svx_FontHeightToolBoxController_implementation_getFactory"> <service name="com.sun.star.frame.ToolbarController"/> </implementation> <implementation name="com.sun.star.svx.UpSearchToolboxController" |