summaryrefslogtreecommitdiff
path: root/chart2/source/tools/ObjectIdentifier.cxx
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-10-15 07:55:26 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-11-19 13:47:36 +0100
commit401f01caf5b357ac6c15b37a89c0a9aaeb46f4e4 (patch)
tree587823c8639fe4c5166ccd8a70b6a5335242677f /chart2/source/tools/ObjectIdentifier.cxx
parentcf90715b35b11286d800c0e1d57ce3a62303e883 (diff)
use ChartModel instead of XModel in a few places
This allows us easier implementation of some advanced features. Mainly the 4D chartting will now be able to work without several ugly layers of UNO. Change-Id: I74d07229eaef921c508f3bab8fae6d6075ad737a
Diffstat (limited to 'chart2/source/tools/ObjectIdentifier.cxx')
-rw-r--r--chart2/source/tools/ObjectIdentifier.cxx136
1 files changed, 136 insertions, 0 deletions
diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx
index a5052c938e4f..a6fd0602ebd6 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -327,6 +327,88 @@ bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
const Reference< uno::XInterface >& xObject
+ , ChartModel& rModel)
+{
+ OUString aRet;
+
+ enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
+ OUString aObjectID;
+ OUString aParentParticle;
+ OUString aDragMethodServiceName;
+ OUString aDragParameterString;
+
+ try
+ {
+ //title
+ Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
+ if( xTitle.is() )
+ {
+ TitleHelper::eTitleType aTitleType;
+ if( TitleHelper::getTitleType( aTitleType, xTitle, rModel ) )
+ {
+ eObjectType = OBJECTTYPE_TITLE;
+ aParentParticle = lcl_getTitleParentParticle( aTitleType );
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ return aRet;
+
+ }
+
+ //axis
+ Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
+ if( xAxis.is() )
+ {
+ Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) );
+ OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) );
+ sal_Int32 nDimensionIndex=-1;
+ sal_Int32 nAxisIndex=-1;
+ AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
+ OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
+ return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
+ }
+
+ //legend
+ Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
+ if( xLegend.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, rModel ) );
+ }
+
+ //diagram
+ Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
+ if( xDiagram.is() )
+ {
+ return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, rModel ) );
+ }
+
+ //todo
+ //XDataSeries
+ //CooSys
+ //charttype
+ //datapoint?
+ //Gridproperties
+ }
+ catch(const uno::Exception& ex)
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+
+ if( eObjectType != OBJECTTYPE_UNKNOWN )
+ {
+ aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
+ eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
+ }
+ else
+ {
+ OSL_FAIL("give object could not be identifed in createClassifiedIdentifierForObject");
+ }
+
+ return aRet;
+}
+
+OUString ObjectIdentifier::createClassifiedIdentifierForObject(
+ const Reference< uno::XInterface >& xObject
, const Reference< frame::XModel >& xChartModel )
{
OUString aRet;
@@ -441,6 +523,15 @@ OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
OUString ObjectIdentifier::createParticleForDiagram(
const Reference< XDiagram >& /*xDiagram*/
+ , ChartModel& /*xChartModel*/ )
+{
+ static OUString aRet("D=0");
+ //todo: if more than one diagram is implemeted, add the correct diagram index here
+ return aRet;
+}
+
+OUString ObjectIdentifier::createParticleForDiagram(
+ const Reference< XDiagram >& /*xDiagram*/
, const Reference< frame::XModel >& /*xChartModel*/ )
{
static OUString aRet("D=0");
@@ -450,6 +541,34 @@ OUString ObjectIdentifier::createParticleForDiagram(
OUString ObjectIdentifier::createParticleForCoordinateSystem(
const Reference< XCoordinateSystem >& xCooSys
+ , ChartModel& rModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
+ if( xCooSysContainer.is() )
+ {
+ sal_Int32 nCooSysIndex = 0;
+ uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
+ for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
+ {
+ Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
+ if( xCooSys == xCurrentCooSys )
+ {
+ aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, rModel );
+ aRet.appendAscii(":CS=");
+ aRet.append( OUString::number( nCooSysIndex ) );
+ break;
+ }
+ }
+ }
+
+ return aRet.makeStringAndClear();
+}
+
+OUString ObjectIdentifier::createParticleForCoordinateSystem(
+ const Reference< XCoordinateSystem >& xCooSys
, const Reference< frame::XModel >& xChartModel )
{
OUStringBuffer aRet;
@@ -542,6 +661,23 @@ OUString ObjectIdentifier::createParticleForSeries(
OUString ObjectIdentifier::createParticleForLegend(
const Reference< XLegend >& /*xLegend*/
+ , ChartModel& rModel )
+{
+ OUStringBuffer aRet;
+
+ Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
+ //todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
+
+ aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, rModel ) );
+ aRet.appendAscii(":");
+ aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
+ aRet.appendAscii("=");
+
+ return aRet.makeStringAndClear();
+}
+
+OUString ObjectIdentifier::createParticleForLegend(
+ const Reference< XLegend >& /*xLegend*/
, const Reference< frame::XModel >& xChartModel )
{
OUStringBuffer aRet;