summaryrefslogtreecommitdiff
path: root/chart2/source/tools/ObjectIdentifier.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/tools/ObjectIdentifier.cxx')
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx158
1 files changed, 157 insertions, 1 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index 59e608248167..0599f9317aed 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -59,6 +59,7 @@ using namespace ::com::sun::star::chart2;
using rtl::OUString;
using rtl::OUStringBuffer;
using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
static OUString m_aMultiClick( C2U("MultiClick") );
static OUString m_aDragMethodEquals( C2U("DragMethod=") );
@@ -251,6 +252,94 @@ void lcl_getDiagramAndCooSys( const OUString& rObjectCID
} //anonymous namespace
+ObjectIdentifier::ObjectIdentifier()
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( 0 )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const OUString& rObjectCID )
+ :m_aObjectCID( rObjectCID )
+ ,m_xAdditionalShape( 0 )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape )
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( rxShape )
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const Any& rAny )
+ :m_aObjectCID( OUString() )
+ ,m_xAdditionalShape( 0 )
+{
+ const uno::Type& rType = rAny.getValueType();
+ if ( rType == ::getCppuType( static_cast< const OUString* >( 0 ) ) )
+ {
+ rAny >>= m_aObjectCID;
+ }
+ else if ( rType == ::getCppuType( static_cast< const Reference< drawing::XShape >* >( 0 ) ) )
+ {
+ rAny >>= m_xAdditionalShape;
+ }
+}
+
+ObjectIdentifier::~ObjectIdentifier()
+{
+}
+
+ObjectIdentifier::ObjectIdentifier( const ObjectIdentifier& rOID )
+ :m_aObjectCID( rOID.m_aObjectCID )
+ ,m_xAdditionalShape( rOID.m_xAdditionalShape )
+{
+
+}
+
+ObjectIdentifier& ObjectIdentifier::operator=( const ObjectIdentifier& rOID )
+{
+ m_aObjectCID = rOID.m_aObjectCID;
+ m_xAdditionalShape = rOID.m_xAdditionalShape;
+ return *this;
+}
+
+bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const
+{
+ if ( areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) &&
+ ( m_xAdditionalShape == rOID.m_xAdditionalShape ) )
+ {
+ return true;
+ }
+ return false;
+}
+
+bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const
+{
+ return !operator==( rOID );
+}
+
+bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
+{
+ bool bReturn = false;
+ if ( m_aObjectCID.getLength() && rOID.m_aObjectCID.getLength() )
+ {
+ bReturn = ( m_aObjectCID.compareTo( rOID.m_aObjectCID ) < 0 );
+ }
+ else if ( m_aObjectCID.getLength() )
+ {
+ bReturn = true;
+ }
+ else if ( rOID.m_aObjectCID.getLength() )
+ {
+ bReturn = false;
+ }
+ else if ( m_xAdditionalShape.is() && rOID.m_xAdditionalShape.is() )
+ {
+ bReturn = ( m_xAdditionalShape < rOID.m_xAdditionalShape );
+ }
+ return bReturn;
+}
+
//static
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
const Reference< uno::XInterface >& xObject
@@ -665,6 +754,20 @@ bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
return false;
}
+bool ObjectIdentifier::isDragableObject()
+{
+ bool bReturn = false;
+ if ( isAutoGeneratedObject() )
+ {
+ bReturn = isDragableObject( m_aObjectCID );
+ }
+ else if ( isAdditionalShape() )
+ {
+ bReturn = true;
+ }
+ return bReturn;
+}
+
//static
bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier )
{
@@ -903,6 +1006,20 @@ ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
return eRet;
}
+ObjectType ObjectIdentifier::getObjectType()
+{
+ ObjectType eObjectType( OBJECTTYPE_UNKNOWN );
+ if ( isAutoGeneratedObject() )
+ {
+ eObjectType = getObjectType( m_aObjectCID );
+ }
+ else if ( isAdditionalShape() )
+ {
+ eObjectType = OBJECTTYPE_SHAPE;
+ }
+ return eObjectType;
+}
+
//static
OUString ObjectIdentifier::createDataCurveCID(
const OUString& rSeriesParticle
@@ -1329,7 +1446,46 @@ OUString ObjectIdentifier::getMovedSeriesCID( const ::rtl::OUString& rObjectCID,
OUString aRet = ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
return ObjectIdentifier::createClassifiedIdentifierForParticle( aRet );
}
-//static
+
+bool ObjectIdentifier::isValid() const
+{
+ return ( isAutoGeneratedObject() || isAdditionalShape() );
+}
+
+bool ObjectIdentifier::isAutoGeneratedObject() const
+{
+ return ( m_aObjectCID.getLength() > 0 );
+}
+
+bool ObjectIdentifier::isAdditionalShape() const
+{
+ return m_xAdditionalShape.is();
+}
+
+OUString ObjectIdentifier::getObjectCID() const
+{
+ return m_aObjectCID;
+}
+
+Reference< drawing::XShape > ObjectIdentifier::getAdditionalShape() const
+{
+ return m_xAdditionalShape;
+}
+
+Any ObjectIdentifier::getAny() const
+{
+ Any aAny;
+ if ( isAutoGeneratedObject() )
+ {
+ aAny = uno::makeAny( getObjectCID() );
+ }
+ else if ( isAdditionalShape() )
+ {
+ aAny = uno::makeAny( getAdditionalShape() );
+ }
+ return aAny;
+}
+
//.............................................................................
} //namespace chart
//.............................................................................