Kaydet (Commit) 307684b2 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Clean-up svt::ToolboxController inheritance

...and fix its XTypeProvider::getTypes

Change-Id: Ic36b17b14da21a29ca5530dd5e2ad03ee3da0782
üst 435a5e70
......@@ -30,7 +30,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/util/XUpdatable.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/proparrhlp.hxx>
......@@ -46,15 +46,17 @@ class ToolBox;
namespace svt
{
class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusListener,
public ::com::sun::star::frame::XToolbarController,
public ::com::sun::star::lang::XInitialization,
public ::com::sun::star::util::XUpdatable,
public ::com::sun::star::lang::XComponent,
typedef cppu::WeakImplHelper5<
css::frame::XStatusListener, css::frame::XToolbarController,
css::lang::XInitialization, css::util::XUpdatable,
css::lang::XComponent >
ToolboxController_Base;
class SVT_DLLPUBLIC ToolboxController :
public ToolboxController_Base,
public ::comphelper::OMutexAndBroadcastHelper,
public ::comphelper::OPropertyContainer,
public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >,
public ::cppu::OWeakObject
public ::comphelper::OPropertyArrayUsageHelper< ToolboxController >
{
private:
sal_Bool m_bSupportVisible;
......@@ -76,6 +78,8 @@ class SVT_DLLPUBLIC ToolboxController : public ::com::sun::star::frame::XStatusL
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 ();
virtual css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
throw (css::uno::RuntimeException);
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
......
......@@ -54,7 +54,6 @@ ToolboxController::ToolboxController(
const Reference< XFrame >& xFrame,
const OUString& aCommandURL ) :
OPropertyContainer(GetBroadcastHelper())
, OWeakObject()
, m_bSupportVisible(sal_False)
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
......@@ -81,7 +80,6 @@ ToolboxController::ToolboxController(
ToolboxController::ToolboxController() :
OPropertyContainer(GetBroadcastHelper())
, OWeakObject()
, m_bSupportVisible(sal_False)
, m_bInitialized( sal_False )
, m_bDisposed( sal_False )
......@@ -137,34 +135,31 @@ Reference< XLayoutManager > ToolboxController::getLayoutManager() const
Any SAL_CALL ToolboxController::queryInterface( const Type& rType )
throw ( RuntimeException )
{
Any a = ::cppu::queryInterface(
rType ,
static_cast< XToolbarController* >( this ),
static_cast< XStatusListener* >( this ),
static_cast< XEventListener* >( this ),
static_cast< XInitialization* >( this ),
static_cast< XComponent* >( this ),
static_cast< XUpdatable* >( this ));
if ( !a.hasValue())
{
a = ::cppu::queryInterface(rType
,static_cast<XPropertySet*>(this)
,static_cast<XMultiPropertySet*>(this)
,static_cast<XFastPropertySet*>(this));
if (!a.hasValue())
return OWeakObject::queryInterface( rType );
}
return a;
css::uno::Any a(ToolboxController_Base::queryInterface(rType));
return a.hasValue() ? a : OPropertyContainer::queryInterface(rType);
}
void SAL_CALL ToolboxController::acquire() throw ()
{
OWeakObject::acquire();
ToolboxController_Base::acquire();
}
void SAL_CALL ToolboxController::release() throw ()
{
OWeakObject::release();
ToolboxController_Base::release();
}
css::uno::Sequence<css::uno::Type> ToolboxController::getTypes()
throw (css::uno::RuntimeException)
{
css::uno::Sequence<css::uno::Type> s1(ToolboxController_Base::getTypes());
css::uno::Sequence<css::uno::Type> s2(OPropertyContainer::getTypes());
sal_Int32 n = s1.getLength();
s1.realloc(n + s2.getLength());
for (sal_Int32 i = 0; i != s2.getLength(); ++i) {
s1[n + i] = s2[i];
}
return s1;
}
void SAL_CALL ToolboxController::initialize( const Sequence< Any >& aArguments )
......
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