diff options
author | Ivo Hinkelmann <ihi@openoffice.org> | 2010-03-03 14:30:52 +0100 |
---|---|---|
committer | Ivo Hinkelmann <ihi@openoffice.org> | 2010-03-03 14:30:52 +0100 |
commit | a92bba324c4686371ca7e8d7bb94ce2df1de2cbf (patch) | |
tree | 0f738be5f86aa041cabacf21a084da0aa4c62339 /chart2/source/tools/ObjectIdentifier.cxx | |
parent | 315cc25e3f1ec5ee7c0adb5b8e51b036d54b603a (diff) | |
parent | 23be6a23f46a3df9a45b660dbfaf7eeff4e508e1 (diff) |
CWS-TOOLING: integrate CWS chartshapesooo/DEV300_m74
Diffstat (limited to 'chart2/source/tools/ObjectIdentifier.cxx')
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 158 |
1 files changed, 157 insertions, 1 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index 83401d719..b7721e14c 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 //............................................................................. |