Kaydet (Commit) 05caae2d authored tarafından Matúš Kukan's avatar Matúš Kukan

svx: Use constructor feature for FontHeightToolBoxControl.

Change-Id: I4c4991e494f026951a4805c04018ea7b7f610cd9
üst 01739fc6
/* -*- 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: */
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <com/sun/star/awt/FontDescriptor.hpp>
#include "tbunocontroller.hxx"
#include <com/sun/star/frame/status/FontHeight.hpp> #include <com/sun/star/frame/status/FontHeight.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/vclunohelper.hxx>
#include <svtools/ctrltool.hxx> #include <svtools/ctrltool.hxx>
#include <svtools/ctrlbox.hxx> #include <svtools/ctrlbox.hxx>
#include <svtools/toolboxcontroller.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/supportsservice.hxx>
...@@ -39,10 +39,48 @@ ...@@ -39,10 +39,48 @@
using namespace ::com::sun::star; 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 class SvxFontSizeBox_Impl : public FontSizeBox
{ {
public: public:
...@@ -284,17 +322,11 @@ throw(uno::RuntimeException) ...@@ -284,17 +322,11 @@ throw(uno::RuntimeException)
OUString SAL_CALL FontHeightToolBoxControl::getImplementationName() OUString SAL_CALL FontHeightToolBoxControl::getImplementationName()
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{ {
return getImplementationName_Static(); return OUString("com.sun.star.svx.FontHeightToolBoxController");
} }
uno::Sequence< OUString > SAL_CALL FontHeightToolBoxControl::getSupportedServiceNames( ) uno::Sequence< OUString > SAL_CALL FontHeightToolBoxControl::getSupportedServiceNames( )
throw( uno::RuntimeException ) throw( uno::RuntimeException )
{
return getSupportedServiceNames_Static();
}
uno::Sequence< OUString > FontHeightToolBoxControl::getSupportedServiceNames_Static()
throw()
{ {
uno::Sequence< OUString > aSNS( 1 ); uno::Sequence< OUString > aSNS( 1 );
aSNS.getArray()[0] = "com.sun.star.frame.ToolbarController"; aSNS.getArray()[0] = "com.sun.star.frame.ToolbarController";
...@@ -404,12 +436,26 @@ void FontHeightToolBoxControl::dispatchCommand( ...@@ -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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include <svx/xtable.hxx> #include <svx/xtable.hxx>
#include "svx/unoshcol.hxx" #include "svx/unoshcol.hxx"
#include "recoveryui.hxx" #include "recoveryui.hxx"
#include "tbunocontroller.hxx"
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace ::rtl; using namespace ::rtl;
...@@ -273,13 +272,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory ( ...@@ -273,13 +272,6 @@ SAL_DLLPUBLIC_EXPORT void * SAL_CALL svx_component_getFactory (
svx::GraphicExporter_createInstance, svx::GraphicExporter_createInstance,
svx::GraphicExporter_getSupportedServiceNames() ); 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()) if( xFactory.is())
{ {
......
...@@ -59,7 +59,8 @@ ...@@ -59,7 +59,8 @@
constructor="com_sun_star_svx_FindAllToolboxController_implementation_getFactory"> constructor="com_sun_star_svx_FindAllToolboxController_implementation_getFactory">
<service name="com.sun.star.frame.ToolbarController"/> <service name="com.sun.star.frame.ToolbarController"/>
</implementation> </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"/> <service name="com.sun.star.frame.ToolbarController"/>
</implementation> </implementation>
<implementation name="com.sun.star.svx.UpSearchToolboxController" <implementation name="com.sun.star.svx.UpSearchToolboxController"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment