Kaydet (Commit) 482f9792 authored tarafından Noel Grandin's avatar Noel Grandin

use SimpleReferenceObject in svtools module

to replace hand-rolled version

Change-Id: I7a1048ff1ea335c3934fe7e91a09489a4d7aeb96
üst 4861e496
......@@ -87,16 +87,9 @@ inline bool hasFloatingChild(Window *pWindow)
class AccessibleFactory :public ::toolkit::IAccessibleFactory
,public ::svt::IAccessibleFactory
{
private:
oslInterlockedCount m_refCount;
public:
AccessibleFactory();
// IReference
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
// ::toolkit::IAccessibleFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext >
createAccessibleContext( VCLXButton* _pXWindow ) SAL_OVERRIDE;
......@@ -228,7 +221,6 @@ protected:
};
AccessibleFactory::AccessibleFactory()
:m_refCount( 0 )
{
}
......@@ -236,22 +228,6 @@ AccessibleFactory::~AccessibleFactory()
{
}
oslInterlockedCount SAL_CALL AccessibleFactory::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL AccessibleFactory::release()
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, sal_Bool _bIsMenuBar )
{
OAccessibleMenuBaseComponent* pAccessible;
......
......@@ -26,6 +26,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace com { namespace sun { namespace star {
namespace accessibility {
......@@ -70,7 +71,7 @@ namespace svt
//= IAccessibleFactory
class IAccessibleFactory : public ::rtl::IReference
class IAccessibleFactory : public virtual ::salhelper::SimpleReferenceObject
{
public:
virtual IAccessibleTabListBox*
......@@ -172,7 +173,7 @@ namespace svt
) = 0;
protected:
~IAccessibleFactory() {}
virtual ~IAccessibleFactory() {}
};
......
......@@ -23,6 +23,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <boost/optional.hpp>
......@@ -40,7 +41,7 @@ namespace svt
//= IDeckLayouter
class IDeckLayouter : public ::rtl::IReference
class IDeckLayouter : public salhelper::SimpleReferenceObject
{
public:
/** re-arranges the elements of the tool deck, taking into account the
......
......@@ -21,7 +21,6 @@
#define INCLUDED_SVTOOLS_TOOLPANEL_DRAWERLAYOUTER_HXX
#include <svtools/svtdllapi.h>
#include <svtools/toolpanel/refbase.hxx>
#include <svtools/toolpanel/toolpaneldeck.hxx>
#include <svtools/toolpanel/decklayouter.hxx>
......@@ -41,8 +40,7 @@ namespace svt
/** a class which implements a tool panel selector in the form of the classical drawers
*/
class SVT_DLLPUBLIC DrawerDeckLayouter :public RefBase
,public IDeckLayouter
class SVT_DLLPUBLIC DrawerDeckLayouter :public IDeckLayouter
,public IToolPanelDeckListener
{
public:
......@@ -52,9 +50,6 @@ namespace svt
);
virtual ~DrawerDeckLayouter();
// IReference
DECLARE_IREFERENCE()
// IDeckLayouter
virtual Rectangle Layout( const Rectangle& i_rDeckPlayground ) SAL_OVERRIDE;
virtual void Destroy() SAL_OVERRIDE;
......
/* -*- 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_SVTOOLS_TOOLPANEL_REFBASE_HXX
#define INCLUDED_SVTOOLS_TOOLPANEL_REFBASE_HXX
#include <svtools/svtdllapi.h>
#include <rtl/ref.hxx>
namespace svt
{
//= RefBase
class SVT_DLLPUBLIC RefBase : public ::rtl::IReference
{
protected:
RefBase()
:m_refCount( 0 )
{
}
virtual ~RefBase()
{
}
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
private:
oslInterlockedCount m_refCount;
};
#define DECLARE_IREFERENCE() \
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE; \
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
#define IMPLEMENT_IREFERENCE( classname ) \
oslInterlockedCount classname::acquire() \
{ \
return RefBase::acquire(); \
} \
oslInterlockedCount classname::release() \
{ \
return RefBase::release(); \
}
} // namespace svt
#endif // INCLUDED_SVTOOLS_TOOLPANEL_REFBASE_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -24,7 +24,7 @@
#include <svtools/toolpanel/decklayouter.hxx>
#include <svtools/toolpanel/tabalignment.hxx>
#include <svtools/toolpanel/tabitemcontent.hxx>
#include <svtools/toolpanel/refbase.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <memory>
......@@ -44,8 +44,7 @@ namespace svt
//= TabDeckLayouter
class SVT_DLLPUBLIC TabDeckLayouter :public RefBase
,public IDeckLayouter
class SVT_DLLPUBLIC TabDeckLayouter :public IDeckLayouter
,public ::boost::noncopyable
{
public:
......@@ -83,9 +82,6 @@ namespace svt
const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
) SAL_OVERRIDE;
// IReference
DECLARE_IREFERENCE()
private:
::std::auto_ptr< TabDeckLayouter_Data > m_pData;
};
......
......@@ -21,8 +21,9 @@
#define INCLUDED_SVTOOLS_TOOLPANEL_TOOLPANEL_HXX
#include <svtools/svtdllapi.h>
#include <svtools/toolpanel/refbase.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <vcl/image.hxx>
......@@ -44,7 +45,7 @@ namespace svt
/** abstract interface for a single tool panel
*/
class SVT_DLLPUBLIC IToolPanel : public ::rtl::IReference
class SVT_DLLPUBLIC IToolPanel : public salhelper::SimpleReferenceObject
{
public:
/// retrieves the display name of the panel
......@@ -118,15 +119,11 @@ namespace svt
but still being abstract
*/
class SVT_DLLPUBLIC ToolPanelBase :public IToolPanel
,public RefBase
,public ::boost::noncopyable
{
protected:
ToolPanelBase();
virtual ~ToolPanelBase();
public:
DECLARE_IREFERENCE()
};
......
......@@ -58,7 +58,7 @@ namespace toolkit
//= IAccessibleFactory
class IAccessibleFactory : public salhelper::SimpleReferenceObject
class IAccessibleFactory : public virtual salhelper::SimpleReferenceObject
{
public:
/** creates an accessible context for a button window
......
......@@ -62,6 +62,7 @@ $(eval $(call gb_Library_use_libraries,sfx,\
i18nlangtag \
i18nutil \
sal \
salhelper \
sax \
sb \
sot \
......
......@@ -216,7 +216,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\
svtools/source/toolpanel/paneldecklisteners \
svtools/source/toolpanel/paneltabbar \
svtools/source/toolpanel/paneltabbarpeer \
svtools/source/toolpanel/refbase \
svtools/source/toolpanel/tabbargeometry \
svtools/source/toolpanel/tablayouter \
svtools/source/toolpanel/toolpanel \
......
......@@ -52,14 +52,7 @@ namespace svt
protected:
virtual ~AccessibleDummyFactory();
private:
oslInterlockedCount m_refCount;
public:
// IReference
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
// IAccessibleFactory
virtual IAccessibleTabListBox*
createAccessibleTabListBox(
......@@ -205,7 +198,6 @@ namespace svt
AccessibleDummyFactory::AccessibleDummyFactory()
: m_refCount(0)
{
}
......@@ -214,22 +206,6 @@ namespace svt
{
}
oslInterlockedCount SAL_CALL AccessibleDummyFactory::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL AccessibleDummyFactory::release()
{
if ( 0 == osl_atomic_decrement( &m_refCount ) )
{
delete this;
return 0;
}
return m_refCount;
}
}
......
......@@ -32,7 +32,7 @@ namespace svt { namespace table
{
typedef ::rtl::Reference< IMouseFunction > PMouseFunction;
typedef ::rtl::Reference< MouseFunction > PMouseFunction;
typedef ::std::vector< PMouseFunction > MouseFunctions;
struct DefaultInputHandler_Impl
{
......@@ -61,7 +61,7 @@ namespace svt { namespace table
namespace
{
bool lcl_delegateMouseEvent( DefaultInputHandler_Impl& i_impl, ITableControl& i_control, const MouseEvent& i_event,
FunctionResult ( IMouseFunction::*i_handlerMethod )( ITableControl&, const MouseEvent& ) )
FunctionResult ( MouseFunction::*i_handlerMethod )( ITableControl&, const MouseEvent& ) )
{
if ( i_impl.pActiveFunction.is() )
{
......@@ -118,19 +118,19 @@ namespace svt { namespace table
bool DefaultInputHandler::MouseMove( ITableControl& i_tableControl, const MouseEvent& i_event )
{
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseMove );
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &MouseFunction::handleMouseMove );
}
bool DefaultInputHandler::MouseButtonDown( ITableControl& i_tableControl, const MouseEvent& i_event )
{
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseDown );
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &MouseFunction::handleMouseDown );
}
bool DefaultInputHandler::MouseButtonUp( ITableControl& i_tableControl, const MouseEvent& i_event )
{
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &IMouseFunction::handleMouseUp );
return lcl_delegateMouseEvent( *m_pImpl, i_tableControl, i_event, &MouseFunction::handleMouseUp );
}
......
......@@ -30,27 +30,6 @@ namespace svt { namespace table
//= MouseFunction
oslInterlockedCount MouseFunction::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount MouseFunction::release()
{
oslInterlockedCount newCount = osl_atomic_decrement( &m_refCount );
if ( newCount == 0 )
{
delete this;
return 0;
}
return newCount;
}
//= ColumnResize
......
......@@ -23,6 +23,7 @@
#include <svtools/table/tabletypes.hxx>
#include <rtl/ref.hxx>
#include <salhelper/simplereferenceobject.hxx>
#include <boost/noncopyable.hpp>
......@@ -48,40 +49,18 @@ namespace svt { namespace table
};
//= IMouseFunction
//= MouseFunction
class IMouseFunction : public ::rtl::IReference, public ::boost::noncopyable
class MouseFunction : public ::salhelper::SimpleReferenceObject, public ::boost::noncopyable
{
public:
MouseFunction() {}
virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) = 0;
protected:
virtual ~IMouseFunction() { }
};
//= MouseFunction
class MouseFunction : public IMouseFunction
{
public:
MouseFunction()
:m_refCount( 0 )
{
}
protected:
virtual ~MouseFunction()
{
}
public:
virtual oslInterlockedCount SAL_CALL acquire() SAL_OVERRIDE;
virtual oslInterlockedCount SAL_CALL release() SAL_OVERRIDE;
private:
oslInterlockedCount m_refCount;
virtual ~MouseFunction() { }
};
......@@ -96,7 +75,7 @@ namespace svt { namespace table
}
public:
// IMouseFunction
// MouseFunction
virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
......@@ -117,7 +96,7 @@ namespace svt { namespace table
}
public:
// IMouseFunction
// MouseFunction
virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
......@@ -138,7 +117,7 @@ namespace svt { namespace table
}
public:
// IMouseFunction
// MouseFunction
virtual FunctionResult handleMouseMove( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseDown( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
virtual FunctionResult handleMouseUp( ITableControl& i_tableControl, MouseEvent const & i_event ) SAL_OVERRIDE;
......
......@@ -57,9 +57,6 @@ namespace svt
}
IMPLEMENT_IREFERENCE( DrawerDeckLayouter )
Rectangle DrawerDeckLayouter::Layout( const Rectangle& i_rDeckPlayground )
{
const size_t nPanelCount( m_rPanelDeck.GetPanelCount() );
......
......@@ -42,9 +42,6 @@ namespace svt
}
IMPLEMENT_IREFERENCE( DummyPanel )
void DummyPanel::Activate( Window& )
{
}
......
......@@ -21,7 +21,7 @@
#define INCLUDED_SVTOOLS_SOURCE_TOOLPANEL_DUMMYPANEL_HXX
#include <svtools/toolpanel/toolpanel.hxx>
#include <svtools/toolpanel/refbase.hxx>
#include <salhelper/simplereferenceobject.hxx>
namespace svt
......@@ -32,8 +32,7 @@ namespace svt
//= DummyPanel
/// is a dummy implementation of the IToolPanel interface
class DummyPanel :public RefBase
,public IToolPanel
class DummyPanel :public IToolPanel
{
public:
DummyPanel();
......@@ -52,8 +51,6 @@ namespace svt
CreatePanelAccessible(
const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& i_rParentAccessible
) SAL_OVERRIDE;
DECLARE_IREFERENCE()
};
......
/* -*- 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 .
*/
#include <svtools/toolpanel/refbase.hxx>
namespace svt
{
//= RefBase
oslInterlockedCount SAL_CALL RefBase::acquire()
{
return osl_atomic_increment( &m_refCount );
}
oslInterlockedCount SAL_CALL RefBase::release()
{
oslInterlockedCount newCount = osl_atomic_decrement( &m_refCount );
if ( 0 == newCount )
delete this;
return newCount;
}
} // namespace svt
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -92,9 +92,6 @@ namespace svt
}
IMPLEMENT_IREFERENCE( TabDeckLayouter )
TabItemContent TabDeckLayouter::GetTabItemContent() const
{
if ( lcl_checkDisposed( *m_pData ) )
......
......@@ -38,10 +38,6 @@ namespace svt
{
}
IMPLEMENT_IREFERENCE( ToolPanelBase )
} // namespace svt
......
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