summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorAlexandre Vicenzi <vicenzi.alexandre@gmail.com>2014-01-25 10:47:28 -0200
committerMarcos Souza <marcos.souza.org@gmail.com>2014-01-25 16:14:15 +0000
commit03cc76aad32b0aa40e229b14d3b2dca3ebc92dd8 (patch)
tree463b9dff46eb528b881fccddde7dd0d2be71de8b /toolkit
parent74c876e615fe575657d0a083f5a3781d4020f0c4 (diff)
fdo#54938 Convert toolkit to cppu::supportsService
Change-Id: I3a35a86d9ad9419011f0305fdc41c8484ae63a04 Reviewed-on: https://gerrit.libreoffice.org/7646 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Marcos Souza <marcos.souza.org@gmail.com> Tested-by: Marcos Souza <marcos.souza.org@gmail.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/controls/roadmapentry.cxx5
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx109
2 files changed, 5 insertions, 109 deletions
diff --git a/toolkit/source/controls/roadmapentry.cxx b/toolkit/source/controls/roadmapentry.cxx
index e636552e628c..1e01e24287d6 100644
--- a/toolkit/source/controls/roadmapentry.cxx
+++ b/toolkit/source/controls/roadmapentry.cxx
@@ -18,10 +18,9 @@
*/
#include <toolkit/controls/roadmapentry.hxx>
-
#include <rtl/ustring.hxx>
-
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <cppuhelper/supportsservice.hxx>
ORoadmapEntry::ORoadmapEntry() : ORoadmapEntry_Base( )
@@ -86,7 +85,7 @@ OUString SAL_CALL ORoadmapEntry::getImplementationName( ) throw (::com::sun::st
sal_Bool SAL_CALL ORoadmapEntry::supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
{
- return ServiceName == "com.sun.star.awt.RoadmapItem";
+ return cppu::supportsService(this, ServiceName);
}
::com::sun::star::uno::Sequence< OUString > SAL_CALL ORoadmapEntry::getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
index b9b77f0806d5..37a454178c38 100644
--- a/toolkit/source/controls/tree/treedatamodel.cxx
+++ b/toolkit/source/controls/tree/treedatamodel.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
#include <rtl/ref.hxx>
#include <toolkit/helper/mutexandbroadcasthelper.hxx>
#include <toolkit/helper/servicenames.hxx>
@@ -141,23 +142,15 @@ private:
bool mbIsInserted;
};
-///////////////////////////////////////////////////////////////////////
-// class MutableTreeDataModel
-///////////////////////////////////////////////////////////////////////
-
MutableTreeDataModel::MutableTreeDataModel()
: mbDisposed( false )
{
}
-//---------------------------------------------------------------------
-
MutableTreeDataModel::~MutableTreeDataModel()
{
}
-//---------------------------------------------------------------------
-
void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTreeNode >& xParentNode, const Reference< XTreeNode >* pNodes, sal_Int32 nNodes )
{
::cppu::OInterfaceContainerHelper* pIter = BrdcstHelper.getContainer( cppu::UnoType<XTreeDataModelListener>::get() );
@@ -182,17 +175,11 @@ void MutableTreeDataModel::broadcast( broadcast_type eType, const Reference< XTr
}
}
-//---------------------------------------------------------------------
-// XMutableTreeDataModel
-//---------------------------------------------------------------------
-
Reference< XMutableTreeNode > SAL_CALL MutableTreeDataModel::createNode( const Any& aValue, sal_Bool bChildrenOnDemand ) throw (RuntimeException)
{
return new MutableTreeNode( this, aValue, bChildrenOnDemand );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >& xNode ) throw (IllegalArgumentException, RuntimeException)
{
if( !xNode.is() )
@@ -220,34 +207,22 @@ void SAL_CALL MutableTreeDataModel::setRoot( const Reference< XMutableTreeNode >
}
}
-//---------------------------------------------------------------------
-// XTreeDataModel
-//---------------------------------------------------------------------
-
Reference< XTreeNode > SAL_CALL MutableTreeDataModel::getRoot( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return mxRootNode;
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::addTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
{
BrdcstHelper.addListener( cppu::UnoType<XTreeDataModelListener>::get(), xListener );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::removeTreeDataModelListener( const Reference< XTreeDataModelListener >& xListener ) throw (RuntimeException)
{
BrdcstHelper.removeListener( cppu::UnoType<XTreeDataModelListener>::get(), xListener );
}
-//---------------------------------------------------------------------
-// XComponent
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::dispose() throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -261,24 +236,16 @@ void SAL_CALL MutableTreeDataModel::dispose() throw (RuntimeException)
}
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
BrdcstHelper.addListener( cppu::UnoType<XEventListener>::get(), xListener );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeDataModel::removeEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException)
{
BrdcstHelper.removeListener( cppu::UnoType<XEventListener>::get(), xListener );
}
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
-
OUString SAL_CALL MutableTreeDataModel::getImplementationName( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -286,16 +253,11 @@ OUString SAL_CALL MutableTreeDataModel::getImplementationName( ) throw (Runtime
return aImplName;
}
-//---------------------------------------------------------------------
-
sal_Bool SAL_CALL MutableTreeDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException)
{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- return ServiceName.equalsAscii( szServiceName_MutableTreeDataModel );
+ return cppu::supportsService(this, ServiceName);
}
-//---------------------------------------------------------------------
-
Sequence< OUString > SAL_CALL MutableTreeDataModel::getSupportedServiceNames( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -304,10 +266,6 @@ Sequence< OUString > SAL_CALL MutableTreeDataModel::getSupportedServiceNames( )
return aSeq;
}
-///////////////////////////////////////////////////////////////////////
-// class MutabelTreeNode
-///////////////////////////////////////////////////////////////////////
-
MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const Any& rValue, sal_Bool bChildrenOnDemand )
: maDisplayValue( rValue )
, mbHasChildrenOnDemand( bChildrenOnDemand )
@@ -317,8 +275,6 @@ MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const A
{
}
-//---------------------------------------------------------------------
-
MutableTreeNode::~MutableTreeNode()
{
TreeNodeVector::iterator aIter( maChildren.begin() );
@@ -326,15 +282,11 @@ MutableTreeNode::~MutableTreeNode()
(*aIter++)->setParent(0);
}
-//---------------------------------------------------------------------
-
void MutableTreeNode::setParent( MutableTreeNode* pParent )
{
mpParent = pParent;
}
-//---------------------------------------------------------------------
-
MutableTreeNode* MutableTreeNode::getImplementation( const Reference< XTreeNode >& xNode, bool bThrows ) throw (IllegalArgumentException)
{
MutableTreeNode* pImpl = dynamic_cast< MutableTreeNode* >( xNode.get() );
@@ -344,8 +296,6 @@ MutableTreeNode* MutableTreeNode::getImplementation( const Reference< XTreeNode
return pImpl;
}
-//---------------------------------------------------------------------
-
void MutableTreeNode::broadcast_changes()
{
if( mxModel.is() )
@@ -356,8 +306,6 @@ void MutableTreeNode::broadcast_changes()
}
}
-//---------------------------------------------------------------------
-
void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, bool bNew)
{
if( mxModel.is() )
@@ -367,26 +315,18 @@ void MutableTreeNode::broadcast_changes(const Reference< XTreeNode >& xNode, boo
}
}
-//---------------------------------------------------------------------
-// XMutableTreeNode
-//---------------------------------------------------------------------
-
Any SAL_CALL MutableTreeNode::getDataValue() throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return maDataValue;
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setDataValue( const Any& _datavalue ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
maDataValue = _datavalue;
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -403,8 +343,6 @@ void SAL_CALL MutableTreeNode::appendChild( const Reference< XMutableTreeNode >&
broadcast_changes( xNode, true );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const Reference< XMutableTreeNode >& xChildNode ) throw (IllegalArgumentException, IndexOutOfBoundsException, RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -429,8 +367,6 @@ void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const
broadcast_changes( xNode, true );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -455,8 +391,6 @@ void SAL_CALL MutableTreeNode::removeChildByIndex( sal_Int32 nChildIndex ) throw
broadcast_changes( getReference( xImpl.get() ), false );
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildrenOnDemand ) throw (RuntimeException)
{
bool bChanged;
@@ -471,8 +405,6 @@ void SAL_CALL MutableTreeNode::setHasChildrenOnDemand( sal_Bool bChildrenOnDeman
broadcast_changes();
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setDisplayValue( const Any& aValue ) throw (RuntimeException)
{
{
@@ -483,8 +415,6 @@ void SAL_CALL MutableTreeNode::setDisplayValue( const Any& aValue ) throw (Runti
broadcast_changes();
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setNodeGraphicURL( const OUString& rURL ) throw (RuntimeException)
{
bool bChanged;
@@ -499,8 +429,6 @@ void SAL_CALL MutableTreeNode::setNodeGraphicURL( const OUString& rURL ) throw (
broadcast_changes();
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setExpandedGraphicURL( const OUString& rURL ) throw (RuntimeException)
{
bool bChanged;
@@ -515,8 +443,6 @@ void SAL_CALL MutableTreeNode::setExpandedGraphicURL( const OUString& rURL ) thr
broadcast_changes();
}
-//---------------------------------------------------------------------
-
void SAL_CALL MutableTreeNode::setCollapsedGraphicURL( const OUString& rURL ) throw (RuntimeException)
{
bool bChanged;
@@ -531,10 +457,6 @@ void SAL_CALL MutableTreeNode::setCollapsedGraphicURL( const OUString& rURL ) th
broadcast_changes();
}
-//---------------------------------------------------------------------
-// XTreeNode
-//---------------------------------------------------------------------
-
Reference< XTreeNode > SAL_CALL MutableTreeNode::getChildAt( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException,RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -544,24 +466,18 @@ Reference< XTreeNode > SAL_CALL MutableTreeNode::getChildAt( sal_Int32 nChildInd
return getReference( maChildren[nChildIndex].get() );
}
-//---------------------------------------------------------------------
-
sal_Int32 SAL_CALL MutableTreeNode::getChildCount( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return (sal_Int32)maChildren.size();
}
-//---------------------------------------------------------------------
-
Reference< XTreeNode > SAL_CALL MutableTreeNode::getParent( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return getReference( mpParent );
}
-//---------------------------------------------------------------------
-
sal_Int32 SAL_CALL MutableTreeNode::getIndex( const Reference< XTreeNode >& xNode ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -580,50 +496,36 @@ sal_Int32 SAL_CALL MutableTreeNode::getIndex( const Reference< XTreeNode >& xNod
return -1;
}
-//---------------------------------------------------------------------
-
sal_Bool SAL_CALL MutableTreeNode::hasChildrenOnDemand( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return mbHasChildrenOnDemand;
}
-//---------------------------------------------------------------------
-
Any SAL_CALL MutableTreeNode::getDisplayValue( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return maDisplayValue;
}
-//---------------------------------------------------------------------
-
OUString SAL_CALL MutableTreeNode::getNodeGraphicURL( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return maNodeGraphicURL;
}
-//---------------------------------------------------------------------
-
OUString SAL_CALL MutableTreeNode::getExpandedGraphicURL( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return maExpandedGraphicURL;
}
-//---------------------------------------------------------------------
-
OUString SAL_CALL MutableTreeNode::getCollapsedGraphicURL( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
return maCollapsedGraphicURL;
}
-//---------------------------------------------------------------------
-// XServiceInfo
-//---------------------------------------------------------------------
-
OUString SAL_CALL MutableTreeNode::getImplementationName( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );
@@ -631,16 +533,11 @@ OUString SAL_CALL MutableTreeNode::getImplementationName( ) throw (RuntimeExcep
return aImplName;
}
-//---------------------------------------------------------------------
-
sal_Bool SAL_CALL MutableTreeNode::supportsService( const OUString& ServiceName ) throw (RuntimeException)
{
- ::osl::Guard< ::osl::Mutex > aGuard( maMutex );
- return ServiceName == "com.sun.star.awt.tree.MutableTreeNode";
+ return cppu::supportsService(this, ServiceName);
}
-//---------------------------------------------------------------------
-
Sequence< OUString > SAL_CALL MutableTreeNode::getSupportedServiceNames( ) throw (RuntimeException)
{
::osl::Guard< ::osl::Mutex > aGuard( maMutex );