1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ObjectIdentifier.cxx,v $
10 * $Revision: 1.8.24.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_chart2.hxx"
34 #include "ObjectIdentifier.hxx"
36 #include "TitleHelper.hxx"
37 #include "ChartModelHelper.hxx"
38 #include "AxisHelper.hxx"
39 #include "servicenames_charttypes.hxx"
40 #include "DiagramHelper.hxx"
41 #include "AxisIndexDefines.hxx"
42 #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
43 #include <com/sun/star/chart2/XChartDocument.hpp>
44 #include <com/sun/star/chart2/XChartTypeContainer.hpp>
45 #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
46 #include <com/sun/star/chart2/XAxis.hpp>
47 #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
49 // header for define DBG_ASSERT
50 #include <tools/debug.hxx>
51 #include <comphelper/InlineContainer.hxx>
53 #include <rtl/ustrbuf.hxx>
55 //.............................................................................
58 //.............................................................................
59 using namespace ::com::sun::star
;
60 using namespace ::com::sun::star::chart2
;
63 using rtl::OUStringBuffer
;
64 using ::com::sun::star::uno::Reference
;
66 static OUString
m_aMultiClick( C2U("MultiClick") );
67 static OUString
m_aDragMethodEquals( C2U("DragMethod=") );
68 static OUString
m_aDragParameterEquals( C2U("DragParameter=") );
69 static OUString
m_aProtocol( C2U("CID/") );
70 static OUString m_aEmptyString
;
71 static OUString
m_aPieSegmentDragMethodServiceName( C2U("PieSegmentDraging") );
76 OUString
lcl_createClassificationStringForType( ObjectType eObjectType
77 , const OUString
& rDragMethodServiceName
78 , const OUString
& rDragParameterString
84 //these object types are all selected only after their parents was selected before
85 case OBJECTTYPE_LEGEND_ENTRY
: //parent is intended to be OBJECTTYPE_LEGEND
86 case OBJECTTYPE_DATA_POINT
: //parent is intended to be OBJECTTYPE_DATA_SERIES
87 case OBJECTTYPE_DATA_LABEL
: //parent is intended to be OBJECTTYPE_DATA_LABELS
88 case OBJECTTYPE_DATA_ERRORS_X
: //parent is intended to be OBJECTTYPE_DATA_ERRORS
89 case OBJECTTYPE_DATA_ERRORS_Y
: //parent is intended to be OBJECTTYPE_DATA_ERRORS
90 case OBJECTTYPE_DATA_ERRORS_Z
: //parent is intended to be OBJECTTYPE_DATA_ERRORS
95 if( rDragMethodServiceName
.getLength() )
97 if( aRet
.getLength() )
98 aRet
.appendAscii(":");
99 aRet
.append( m_aDragMethodEquals
);
100 aRet
.append( rDragMethodServiceName
);
102 if( rDragParameterString
.getLength() )
104 if( aRet
.getLength() )
105 aRet
.appendAscii(":");
106 aRet
.append( m_aDragParameterEquals
);
107 aRet
.append( rDragParameterString
);
110 return aRet
.makeStringAndClear();
113 typedef ::comphelper::MakeMap
< TitleHelper::eTitleType
, OUString
> tTitleMap
;
114 const tTitleMap
& lcl_getTitleMap()
116 //maps the title type to the ParentParticle for that title
117 static tTitleMap m_aTitleMap
= tTitleMap
118 ( TitleHelper::MAIN_TITLE
, C2U("") )
119 ( TitleHelper::SUB_TITLE
, C2U("D=0") )
120 ( TitleHelper::X_AXIS_TITLE
, C2U("D=0:CS=0:Axis=0,0") )
121 ( TitleHelper::Y_AXIS_TITLE
, C2U("D=0:CS=0:Axis=1,0") )
122 ( TitleHelper::Z_AXIS_TITLE
, C2U("D=0:CS=0:Axis=2,0") )
123 ( TitleHelper::SECONDARY_X_AXIS_TITLE
, C2U("D=0:CS=0:Axis=0,1") )
124 ( TitleHelper::SECONDARY_Y_AXIS_TITLE
, C2U("D=0:CS=0:Axis=1,1") )
129 OUString
lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType
)
133 const tTitleMap
& rMap
= lcl_getTitleMap();
134 tTitleMap::const_iterator
aIt( rMap
.find( aTitleType
) );
135 if( aIt
!= rMap
.end())
136 aRet
= (*aIt
).second
;
141 Reference
<XChartType
> lcl_getFirstStockChartType( const Reference
< frame::XModel
>& xChartModel
)
143 Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
147 //iterate through all coordinate systems
148 Reference
< XCoordinateSystemContainer
> xCooSysContainer( xDiagram
, uno::UNO_QUERY
);
149 if( !xCooSysContainer
.is())
152 uno::Sequence
< Reference
< XCoordinateSystem
> > aCooSysList( xCooSysContainer
->getCoordinateSystems() );
153 for( sal_Int32 nCS
= 0; nCS
< aCooSysList
.getLength(); ++nCS
)
155 //iterate through all chart types in the current coordinate system
156 Reference
< XChartTypeContainer
> xChartTypeContainer( aCooSysList
[nCS
], uno::UNO_QUERY
);
157 if( !xChartTypeContainer
.is() )
160 uno::Sequence
< Reference
< XChartType
> > aChartTypeList( xChartTypeContainer
->getChartTypes() );
161 for( sal_Int32 nT
= 0; nT
< aChartTypeList
.getLength(); ++nT
)
163 Reference
< XChartType
> xChartType( aChartTypeList
[nT
] );
166 OUString aChartType
= xChartType
->getChartType();
167 if( aChartType
.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK
) )
174 OUString
lcl_getIndexStringAfterString( const OUString
& rString
, const OUString
& rSearchString
)
178 sal_Int32 nIndexStart
= rString
.lastIndexOf( rSearchString
);
179 if( nIndexStart
!= -1 )
181 nIndexStart
+= rSearchString
.getLength();
182 sal_Int32 nIndexEnd
= rString
.getLength();
183 sal_Int32 nNextColon
= rString
.indexOf( ':', nIndexStart
);
184 if( nNextColon
!= -1 )
185 nIndexEnd
= nNextColon
;
186 aRet
= rString
.copy(nIndexStart
,nIndexEnd
-nIndexStart
);
189 return aRet
.makeStringAndClear();
192 sal_Int32
lcl_StringToIndex( const OUString
& rIndexString
)
195 if( rIndexString
.getLength() )
197 nRet
= rIndexString
.toInt32();
204 void lcl_parseCooSysIndices( sal_Int32
& rnDiagram
, sal_Int32
& rnCooSys
, const OUString
& rString
)
206 rnDiagram
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U("D=") ) );
207 rnCooSys
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U("CS=") ) );
210 void lcl_parseAxisIndices( sal_Int32
& rnDimensionIndex
, sal_Int32
& rnAxisIndex
, const OUString
& rString
)
212 OUString aAxisIndexString
= lcl_getIndexStringAfterString( rString
, C2U(":Axis=") );
213 sal_Int32 nCharacterIndex
=0;
214 rnDimensionIndex
= lcl_StringToIndex( aAxisIndexString
.getToken( 0, ',', nCharacterIndex
) );
215 rnAxisIndex
= lcl_StringToIndex( aAxisIndexString
.getToken( 0, ',', nCharacterIndex
) );
218 void lcl_parseGridIndices( sal_Int32
& rnSubGridIndex
, const OUString
& rString
)
221 rnSubGridIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U(":SubGrid=") ) );
224 void lcl_parseSeriesIndices( sal_Int32
& rnChartTypeIndex
, sal_Int32
& rnSeriesIndex
, sal_Int32
& rnPointIndex
, const OUString
& rString
)
226 rnChartTypeIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U("CT=") ) );
227 rnSeriesIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U("Series=") ) );
228 rnPointIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rString
, C2U("Point=") ) );
231 void lcl_getDiagramAndCooSys( const OUString
& rObjectCID
232 , const Reference
< frame::XModel
>& xChartModel
233 , Reference
< XDiagram
>& xDiagram
234 , Reference
< XCoordinateSystem
>& xCooSys
)
236 sal_Int32 nDiagramIndex
= -1;
237 sal_Int32 nCooSysIndex
= -1;
238 lcl_parseCooSysIndices( nDiagramIndex
, nCooSysIndex
, rObjectCID
);
239 xDiagram
= ChartModelHelper::findDiagram( xChartModel
);//todo use nDiagramIndex when more than one diagram is possible in future
243 if( nCooSysIndex
> -1 )
245 Reference
< XCoordinateSystemContainer
> xCooSysContainer( xDiagram
, uno::UNO_QUERY
);
246 if( xCooSysContainer
.is() )
248 uno::Sequence
< Reference
< XCoordinateSystem
> > aCooSysList( xCooSysContainer
->getCoordinateSystems() );
249 if( nCooSysIndex
< aCooSysList
.getLength() )
250 xCooSys
= aCooSysList
[nCooSysIndex
];
255 } //anonymous namespace
258 OUString
ObjectIdentifier::createClassifiedIdentifierForObject(
259 const Reference
< uno::XInterface
>& xObject
260 , const Reference
< frame::XModel
>& xChartModel
)
264 enum ObjectType eObjectType
= OBJECTTYPE_UNKNOWN
;
266 OUString aParentParticle
;
267 OUString aDragMethodServiceName
;
268 OUString aDragParameterString
;
274 Reference
< XTitle
> xTitle( xObject
, uno::UNO_QUERY
);
277 TitleHelper::eTitleType aTitleType
;
278 if( TitleHelper::getTitleType( aTitleType
, xTitle
, xChartModel
) )
280 eObjectType
= OBJECTTYPE_TITLE
;
281 aParentParticle
= lcl_getTitleParentParticle( aTitleType
);
282 aRet
= ObjectIdentifier::createClassifiedIdentifierWithParent(
283 eObjectType
, aObjectID
, aParentParticle
, aDragMethodServiceName
, aDragParameterString
);
290 Reference
< XAxis
> xAxis( xObject
, uno::UNO_QUERY
);
293 Reference
< XCoordinateSystem
> xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis
, ChartModelHelper::findDiagram( xChartModel
) ) );
294 rtl::OUString
aCooSysParticle( createParticleForCoordinateSystem( xCooSys
, xChartModel
) );
295 sal_Int32 nDimensionIndex
=-1;
296 sal_Int32 nAxisIndex
=-1;
297 AxisHelper::getIndicesForAxis( xAxis
, xCooSys
, nDimensionIndex
, nAxisIndex
);
298 rtl::OUString
aAxisParticle( createParticleForAxis( nDimensionIndex
, nAxisIndex
) );
299 return createClassifiedIdentifierForParticles( aCooSysParticle
, aAxisParticle
);
303 Reference
< XLegend
> xLegend( xObject
, uno::UNO_QUERY
);
306 return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend
, xChartModel
) );
310 Reference
< XDiagram
> xDiagram( xObject
, uno::UNO_QUERY
);
313 return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram
, xChartModel
) );
323 catch( uno::Exception
& ex
)
325 ASSERT_EXCEPTION( ex
);
328 if( eObjectType
!= OBJECTTYPE_UNKNOWN
)
330 aRet
= ObjectIdentifier::createClassifiedIdentifierWithParent(
331 eObjectType
, aObjectID
, aParentParticle
, aDragMethodServiceName
, aDragParameterString
);
335 DBG_ASSERT(false,"give object could not be identifed in createClassifiedIdentifierForObject");
342 OUString
ObjectIdentifier::createClassifiedIdentifierForParticle(
343 const OUString
& rParticle
)
345 return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle
, OUString() );
349 OUString
ObjectIdentifier::createClassifiedIdentifierForParticles(
350 const OUString
& rParentParticle
351 , const OUString
& rChildParticle
352 , const OUString
& rDragMethodServiceName
353 , const OUString
& rDragParameterString
)
355 ObjectType
eObjectType( ObjectIdentifier::getObjectType( rChildParticle
) );
356 if( eObjectType
== OBJECTTYPE_UNKNOWN
)
357 eObjectType
= ObjectIdentifier::getObjectType( rParentParticle
);
359 OUStringBuffer
aRet( m_aProtocol
);
360 aRet
.append( lcl_createClassificationStringForType( eObjectType
, rDragMethodServiceName
, rDragParameterString
));
361 if(aRet
.getLength()>m_aProtocol
.getLength())
362 aRet
.appendAscii("/");
364 if(rParentParticle
.getLength())
366 aRet
.append(rParentParticle
);
367 if( rChildParticle
.getLength() )
368 aRet
.appendAscii(":");
370 aRet
.append(rChildParticle
);
372 return aRet
.makeStringAndClear();
376 OUString
ObjectIdentifier::createParticleForDiagram(
377 const Reference
< XDiagram
>& /*xDiagram*/
378 , const Reference
< frame::XModel
>& /*xChartModel*/ )
380 static OUString
aRet(C2U("D=0"));
381 //todo: if more than one diagram is implemeted, add the correct diagram index here
386 OUString
ObjectIdentifier::createParticleForCoordinateSystem(
387 const Reference
< XCoordinateSystem
>& xCooSys
388 , const Reference
< frame::XModel
>& xChartModel
)
392 Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
393 Reference
< XCoordinateSystemContainer
> xCooSysContainer( xDiagram
, uno::UNO_QUERY
);
394 if( xCooSysContainer
.is() )
396 sal_Int32 nCooSysIndex
= 0;
397 uno::Sequence
< Reference
< XCoordinateSystem
> > aCooSysList( xCooSysContainer
->getCoordinateSystems() );
398 for( ; nCooSysIndex
< aCooSysList
.getLength(); ++nCooSysIndex
)
400 Reference
< XCoordinateSystem
> xCurrentCooSys( aCooSysList
[nCooSysIndex
] );
401 if( xCooSys
== xCurrentCooSys
)
403 aRet
= ObjectIdentifier::createParticleForDiagram( xDiagram
, xChartModel
);
404 aRet
.appendAscii(":CS=");
405 aRet
.append( OUString::valueOf( nCooSysIndex
) );
411 return aRet
.makeStringAndClear();
415 OUString
ObjectIdentifier::createParticleForAxis(
416 sal_Int32 nDimensionIndex
417 , sal_Int32 nAxisIndex
)
419 OUStringBuffer
aRet(C2U("Axis="));
421 aRet
.append( OUString::valueOf( nDimensionIndex
) );
422 aRet
.appendAscii(",");
423 aRet
.append( OUString::valueOf( nAxisIndex
) );
425 return aRet
.makeStringAndClear();
429 OUString
ObjectIdentifier::createParticleForGrid(
430 sal_Int32 nDimensionIndex
431 , sal_Int32 nAxisIndex
)
433 OUStringBuffer
aRet(C2U("Axis="));
434 aRet
.append( OUString::valueOf( nDimensionIndex
) );
435 aRet
.appendAscii(",");
436 aRet
.append( OUString::valueOf( nAxisIndex
) );
437 aRet
.append( C2U(":Grid=0") );
439 return aRet
.makeStringAndClear();
443 OUString
ObjectIdentifier::createClassifiedIdentifierForGrid(
444 const Reference
< XAxis
>& xAxis
445 , const Reference
< frame::XModel
>& xChartModel
446 , sal_Int32 nSubGridIndex
)
448 //-1: main grid, 0: first subgrid etc
450 rtl::OUString
aAxisCID( createClassifiedIdentifierForObject( xAxis
, xChartModel
) );
451 rtl::OUString
aGridCID( addChildParticle( aAxisCID
452 , createChildParticleWithIndex( OBJECTTYPE_GRID
, 0 ) ) );
453 if( nSubGridIndex
>= 0 )
455 aGridCID
= addChildParticle( aGridCID
456 , createChildParticleWithIndex( OBJECTTYPE_SUBGRID
, 0 ) );
462 OUString
ObjectIdentifier::createParticleForSeries(
463 sal_Int32 nDiagramIndex
, sal_Int32 nCooSysIndex
464 , sal_Int32 nChartTypeIndex
, sal_Int32 nSeriesIndex
)
468 aRet
.appendAscii("D=");
469 aRet
.append( OUString::valueOf( nDiagramIndex
) );
470 aRet
.appendAscii(":CS=");
471 aRet
.append( OUString::valueOf( nCooSysIndex
) );
472 aRet
.appendAscii(":CT=");
473 aRet
.append( OUString::valueOf( nChartTypeIndex
) );
474 aRet
.appendAscii(":");
475 aRet
.append(getStringForType( OBJECTTYPE_DATA_SERIES
));
476 aRet
.appendAscii("=");
477 aRet
.append( OUString::valueOf( nSeriesIndex
) );
479 return aRet
.makeStringAndClear();
483 OUString
ObjectIdentifier::createParticleForLegend(
484 const Reference
< XLegend
>& /*xLegend*/
485 , const Reference
< frame::XModel
>& xChartModel
)
489 Reference
< XDiagram
> xDiagram( ChartModelHelper::findDiagram( xChartModel
) );
490 //todo: if more than one diagram is implemeted, find the correct diagram wich is owner of the given legend
492 aRet
.append( ObjectIdentifier::createParticleForDiagram( xDiagram
, xChartModel
) );
493 aRet
.appendAscii(":");
494 aRet
.append(getStringForType( OBJECTTYPE_LEGEND
));
495 aRet
.appendAscii("=");
497 return aRet
.makeStringAndClear();
501 OUString
ObjectIdentifier::createClassifiedIdentifier(
502 enum ObjectType eObjectType
//e.g. OBJECTTYPE_DATA_SERIES
503 , const OUString
& rParticleID
)//e.g. SeriesID
505 return createClassifiedIdentifierWithParent(
506 eObjectType
, rParticleID
, m_aEmptyString
);
510 OUString
ObjectIdentifier::createClassifiedIdentifierWithParent(
511 enum ObjectType eObjectType
//e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
512 , const OUString
& rParticleID
//e.g. Point Index or SubGrid Index
513 , const OUString
& rParentPartical
//e.g. "Series=SeriesID" or "Grid=GridId"
514 , const OUString
& rDragMethodServiceName
515 , const OUString
& rDragParameterString
517 //, bool bIsMultiClickObject ) //e.g. true
519 //e.g. "MultiClick/Series=2:Point=34"
521 OUStringBuffer
aRet( m_aProtocol
);
522 aRet
.append( lcl_createClassificationStringForType( eObjectType
, rDragMethodServiceName
, rDragParameterString
));
523 if(aRet
.getLength()>m_aProtocol
.getLength())
524 aRet
.appendAscii("/");
525 aRet
.append(rParentPartical
);
526 if(rParentPartical
.getLength())
527 aRet
.appendAscii(":");
529 aRet
.append(getStringForType( eObjectType
));
530 aRet
.appendAscii("=");
531 aRet
.append(rParticleID
);
533 return aRet
.makeStringAndClear();
537 const OUString
& ObjectIdentifier::getPieSegmentDragMethodServiceName()
539 return m_aPieSegmentDragMethodServiceName
;
543 OUString
ObjectIdentifier::createPieSegmentDragParameterString(
544 sal_Int32 nOffsetPercent
545 , const awt::Point
& rMinimumPosition
546 , const awt::Point
& rMaximumPosition
)
548 OUStringBuffer
aRet( OUString::valueOf( nOffsetPercent
) );
549 aRet
.append( sal_Unicode( ',' ));
550 aRet
.append( OUString::valueOf( rMinimumPosition
.X
) );
551 aRet
.append( sal_Unicode( ',' ));
552 aRet
.append( OUString::valueOf( rMinimumPosition
.Y
) );
553 aRet
.append( sal_Unicode( ',' ));
554 aRet
.append( OUString::valueOf( rMaximumPosition
.X
) );
555 aRet
.append( sal_Unicode( ',' ));
556 aRet
.append( OUString::valueOf( rMaximumPosition
.Y
) );
557 return aRet
.makeStringAndClear();
561 bool ObjectIdentifier::parsePieSegmentDragParameterString(
562 const OUString
& rDragParameterString
563 , sal_Int32
& rOffsetPercent
564 , awt::Point
& rMinimumPosition
565 , awt::Point
& rMaximumPosition
)
568 sal_Int32 nCharacterIndex
= 0;
570 OUString
aValueString( rDragParameterString
.getToken( 0, ',', nCharacterIndex
) );
571 rOffsetPercent
= aValueString
.toInt32();
572 if( nCharacterIndex
< 0 )
575 aValueString
= rDragParameterString
.getToken( 0, ',', nCharacterIndex
);
576 rMinimumPosition
.X
= aValueString
.toInt32();
577 if( nCharacterIndex
< 0 )
580 aValueString
= rDragParameterString
.getToken( 0, ',', nCharacterIndex
);
581 rMinimumPosition
.Y
= aValueString
.toInt32();
582 if( nCharacterIndex
< 0 )
585 aValueString
= rDragParameterString
.getToken( 0, ',', nCharacterIndex
);
586 rMaximumPosition
.X
= aValueString
.toInt32();
587 if( nCharacterIndex
< 0 )
590 aValueString
= rDragParameterString
.getToken( 0, ',', nCharacterIndex
);
591 rMaximumPosition
.Y
= aValueString
.toInt32();
592 if( nCharacterIndex
< 0 )
599 OUString
ObjectIdentifier::getDragMethodServiceName( const OUString
& rCID
)
603 sal_Int32 nIndexStart
= rCID
.indexOf( m_aDragMethodEquals
);
604 if( nIndexStart
!= -1 )
606 nIndexStart
= rCID
.indexOf( '=', nIndexStart
);
607 if( nIndexStart
!= -1 )
610 sal_Int32 nNextSlash
= rCID
.indexOf( '/', nIndexStart
);
611 if( nNextSlash
!= -1 )
613 sal_Int32 nIndexEnd
= nNextSlash
;
614 sal_Int32 nNextColon
= rCID
.indexOf( ':', nIndexStart
);
615 if( nNextColon
< nNextSlash
)
616 nIndexEnd
= nNextColon
;
617 aRet
= rCID
.copy(nIndexStart
,nIndexEnd
-nIndexStart
);
625 OUString
ObjectIdentifier::getDragParameterString( const OUString
& rCID
)
629 sal_Int32 nIndexStart
= rCID
.indexOf( m_aDragParameterEquals
);
630 if( nIndexStart
!= -1 )
632 nIndexStart
= rCID
.indexOf( '=', nIndexStart
);
633 if( nIndexStart
!= -1 )
636 sal_Int32 nNextSlash
= rCID
.indexOf( '/', nIndexStart
);
637 if( nNextSlash
!= -1 )
639 sal_Int32 nIndexEnd
= nNextSlash
;
640 sal_Int32 nNextColon
= rCID
.indexOf( ':', nIndexStart
);
641 if( nNextColon
< nNextSlash
)
642 nIndexEnd
= nNextColon
;
643 aRet
= rCID
.copy(nIndexStart
,nIndexEnd
-nIndexStart
);
651 bool ObjectIdentifier::isDragableObject( const OUString
& rClassifiedIdentifier
)
653 ObjectType eObjectType
= ObjectIdentifier::getObjectType( rClassifiedIdentifier
);
654 switch( eObjectType
)
656 case OBJECTTYPE_TITLE
:
657 case OBJECTTYPE_LEGEND
:
658 case OBJECTTYPE_DIAGRAM
:
659 case OBJECTTYPE_DATA_CURVE_EQUATION
:
660 //case OBJECTTYPE_DIAGRAM_WALL:
663 OUString
aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier
) );
664 if( aDragMethodServiceName
.getLength() )
672 bool ObjectIdentifier::isRotateableObject( const OUString
& rClassifiedIdentifier
)
674 ObjectType eObjectType
= ObjectIdentifier::getObjectType( rClassifiedIdentifier
);
675 switch( eObjectType
)
677 case OBJECTTYPE_DIAGRAM
:
678 //case OBJECTTYPE_DIAGRAM_WALL:
687 bool ObjectIdentifier::isMultiClickObject( const OUString
& rClassifiedIdentifier
)
689 //the name of a shape is it's ClassifiedIdentifier
691 //a MultiClickObject is an object that is selectable by more than one click only ;
692 //before a MultiClickObject can be selected it is necessary that a named parent group object
693 //was selected before;
695 //!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
697 bRet
= rClassifiedIdentifier
.match( m_aMultiClick
, m_aProtocol
.getLength() );
701 bool ObjectIdentifier::areSiblings( const OUString
& rCID1
, const OUString
& rCID2
)
704 sal_Int32 nLastSign1
= rCID1
.lastIndexOf( '=' );
705 sal_Int32 nLastSign2
= rCID2
.lastIndexOf( '=' );
706 if( nLastSign1
== rCID1
.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
708 else if( nLastSign2
== rCID2
.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
710 else if( ObjectIdentifier::areIdenticalObjects( rCID1
, rCID2
) )
714 OUString
aParent1( ObjectIdentifier::getFullParentParticle( rCID1
) );
715 if( aParent1
.getLength() )
717 OUString
aParent2( ObjectIdentifier::getFullParentParticle( rCID2
) );
718 bRet
=aParent1
.equals(aParent2
);
720 //legend entries are special:
723 if( OBJECTTYPE_LEGEND_ENTRY
== getObjectType(rCID1
)
724 && OBJECTTYPE_LEGEND_ENTRY
== getObjectType(rCID2
) )
731 bool ObjectIdentifier::areIdenticalObjects( const OUString
& rCID1
, const OUString
& rCID2
)
733 if( rCID1
.equals( rCID2
) )
735 //draggable pie or donut segments need special treatment, as their CIDs do change with offset
737 if( rCID1
.indexOf( m_aPieSegmentDragMethodServiceName
) < 0
738 || rCID2
.indexOf( m_aPieSegmentDragMethodServiceName
) < 0 )
741 OUString
aID1( ObjectIdentifier::getObjectID( rCID1
) );
742 OUString
aID2( ObjectIdentifier::getObjectID( rCID2
) );
743 if( aID1
.getLength() && aID1
.equals( aID2
) )
750 OUString
ObjectIdentifier::getStringForType( ObjectType eObjectType
)
753 switch( eObjectType
)
755 case OBJECTTYPE_PAGE
:
758 case OBJECTTYPE_TITLE
:
761 case OBJECTTYPE_LEGEND
:
764 case OBJECTTYPE_LEGEND_ENTRY
:
765 aRet
=C2U("LegendEntry");
767 case OBJECTTYPE_DIAGRAM
:
770 case OBJECTTYPE_DIAGRAM_WALL
:
771 aRet
=C2U("DiagramWall");
773 case OBJECTTYPE_DIAGRAM_FLOOR
:
774 aRet
=C2U("DiagramFloor");
776 case OBJECTTYPE_AXIS
:
779 case OBJECTTYPE_AXIS_UNITLABEL
:
780 aRet
=C2U("AxisUnitLabel");
782 case OBJECTTYPE_GRID
:
785 case OBJECTTYPE_SUBGRID
:
788 case OBJECTTYPE_DATA_SERIES
:
791 case OBJECTTYPE_DATA_POINT
:
794 case OBJECTTYPE_DATA_LABELS
:
795 aRet
=C2U("DataLabels");
797 case OBJECTTYPE_DATA_LABEL
:
798 aRet
=C2U("DataLabel");
800 case OBJECTTYPE_DATA_ERRORS
:
803 case OBJECTTYPE_DATA_ERRORS_X
:
806 case OBJECTTYPE_DATA_ERRORS_Y
:
809 case OBJECTTYPE_DATA_ERRORS_Z
:
812 case OBJECTTYPE_DATA_CURVE
:
815 case OBJECTTYPE_DATA_CURVE_EQUATION
:
816 aRet
=C2U("Equation");
818 case OBJECTTYPE_DATA_AVERAGE_LINE
:
821 case OBJECTTYPE_DATA_STOCK_RANGE
:
822 aRet
=C2U("StockRange");
824 case OBJECTTYPE_DATA_STOCK_LOSS
:
825 aRet
=C2U("StockLoss");
827 case OBJECTTYPE_DATA_STOCK_GAIN
:
828 aRet
=C2U("StockGain");
830 default: //OBJECTTYPE_UNKNOWN
837 ObjectType
ObjectIdentifier::getObjectType( const OUString
& rCID
)
840 sal_Int32 nLastSign
= rCID
.lastIndexOf( ':' );//last sign before the type string
842 nLastSign
= rCID
.lastIndexOf( '/' );
845 sal_Int32 nEndIndex
= rCID
.lastIndexOf( '=' );
847 return OBJECTTYPE_UNKNOWN
;
853 if( rCID
.match(C2U("Page"),nLastSign
) )
854 eRet
= OBJECTTYPE_PAGE
;
855 else if( rCID
.match(C2U("Title"),nLastSign
) )
856 eRet
= OBJECTTYPE_TITLE
;
857 else if( rCID
.match(C2U("LegendEntry"),nLastSign
) )
858 eRet
= OBJECTTYPE_LEGEND_ENTRY
;
859 else if( rCID
.match(C2U("Legend"),nLastSign
) )
860 eRet
= OBJECTTYPE_LEGEND
;
861 else if( rCID
.match(C2U("DiagramWall"),nLastSign
) )
862 eRet
= OBJECTTYPE_DIAGRAM_WALL
;
863 else if( rCID
.match(C2U("DiagramFloor"),nLastSign
) )
864 eRet
= OBJECTTYPE_DIAGRAM_FLOOR
;
865 else if( rCID
.match(C2U("D="),nLastSign
) )
866 eRet
= OBJECTTYPE_DIAGRAM
;
867 else if( rCID
.match(C2U("AxisUnitLabel"),nLastSign
) )
868 eRet
= OBJECTTYPE_AXIS_UNITLABEL
;
869 else if( rCID
.match(C2U("Axis"),nLastSign
) )
870 eRet
= OBJECTTYPE_AXIS
;
871 else if( rCID
.match(C2U("Grid"),nLastSign
) )
872 eRet
= OBJECTTYPE_GRID
;
873 else if( rCID
.match(C2U("SubGrid"),nLastSign
) )
874 eRet
= OBJECTTYPE_SUBGRID
;
875 else if( rCID
.match(C2U("Series"),nLastSign
) )
876 eRet
= OBJECTTYPE_DATA_SERIES
;
877 else if( rCID
.match(C2U("Point"),nLastSign
) )
878 eRet
= OBJECTTYPE_DATA_POINT
;
879 else if( rCID
.match(C2U("DataLabels"),nLastSign
) )
880 eRet
= OBJECTTYPE_DATA_LABELS
;
881 else if( rCID
.match(C2U("DataLabel"),nLastSign
) )
882 eRet
= OBJECTTYPE_DATA_LABEL
;
883 else if( rCID
.match(C2U("ErrorsX"),nLastSign
) )
884 eRet
= OBJECTTYPE_DATA_ERRORS_X
;
885 else if( rCID
.match(C2U("ErrorsY"),nLastSign
) )
886 eRet
= OBJECTTYPE_DATA_ERRORS_Y
;
887 else if( rCID
.match(C2U("ErrorsZ"),nLastSign
) )
888 eRet
= OBJECTTYPE_DATA_ERRORS_Z
;
889 else if( rCID
.match(C2U("Errors"),nLastSign
) )
890 eRet
= OBJECTTYPE_DATA_ERRORS
;
891 else if( rCID
.match(C2U("Curve"),nLastSign
) )
892 eRet
= OBJECTTYPE_DATA_CURVE
;
893 else if( rCID
.match(C2U("Equation"),nLastSign
) )
894 eRet
= OBJECTTYPE_DATA_CURVE_EQUATION
;
895 else if( rCID
.match(C2U("Average"),nLastSign
) )
896 eRet
= OBJECTTYPE_DATA_AVERAGE_LINE
;
897 else if( rCID
.match(C2U("StockRange"),nLastSign
) )
898 eRet
= OBJECTTYPE_DATA_STOCK_RANGE
;
899 else if( rCID
.match(C2U("StockLoss"),nLastSign
) )
900 eRet
= OBJECTTYPE_DATA_STOCK_LOSS
;
901 else if( rCID
.match(C2U("StockGain"),nLastSign
) )
902 eRet
= OBJECTTYPE_DATA_STOCK_GAIN
;
904 eRet
= OBJECTTYPE_UNKNOWN
;
910 OUString
ObjectIdentifier::createDataCurveCID(
911 const OUString
& rSeriesParticle
912 , sal_Int32 nCurveIndex
913 , bool bAverageLine
)
915 OUString
aParticleID( OUString::valueOf( nCurveIndex
) );
916 ObjectType eType
= bAverageLine
? OBJECTTYPE_DATA_AVERAGE_LINE
: OBJECTTYPE_DATA_CURVE
;
917 return createClassifiedIdentifierWithParent( eType
, aParticleID
, rSeriesParticle
);
921 OUString
ObjectIdentifier::createDataCurveEquationCID(
922 const OUString
& rSeriesParticle
923 , sal_Int32 nCurveIndex
)
925 OUString
aParticleID( OUString::valueOf( nCurveIndex
) );
926 return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION
, aParticleID
, rSeriesParticle
);
930 OUString
ObjectIdentifier::addChildParticle( const rtl::OUString
& rParticle
, const rtl::OUString
& rChildParticle
)
932 OUStringBuffer
aRet(rParticle
);
934 if( aRet
.getLength() && rChildParticle
.getLength() )
935 aRet
.appendAscii(":");
936 if( rChildParticle
.getLength() )
937 aRet
.append(rChildParticle
);
939 return aRet
.makeStringAndClear();
943 rtl::OUString
ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType
, sal_Int32 nIndex
)
945 OUStringBuffer
aRet( getStringForType( eObjectType
) );
946 if( aRet
.getLength() )
948 aRet
.appendAscii("=");
949 aRet
.append(OUString::valueOf(nIndex
));
951 return aRet
.makeStringAndClear();
955 sal_Int32
ObjectIdentifier::getIndexFromParticleOrCID( const rtl::OUString
& rParticleOrCID
)
959 OUString aIndexString
= lcl_getIndexStringAfterString( rParticleOrCID
, C2U("=") );
960 sal_Int32 nCharacterIndex
=0;
961 nRet
= lcl_StringToIndex( aIndexString
.getToken( 0, ',', nCharacterIndex
) );
967 OUString
ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
968 , const rtl::OUString
& rSeriesParticle
969 , const rtl::OUString
& rDragMethodServiceName
970 , const rtl::OUString
& rDragParameterString
)
972 OUString
aChildParticle( getStringForType( eSubObjectType
) );
973 aChildParticle
+=(C2U("="));
975 return createClassifiedIdentifierForParticles(
976 rSeriesParticle
, aChildParticle
977 , rDragMethodServiceName
, rDragParameterString
);
981 OUString
ObjectIdentifier::createPointCID( const OUString
& rPointCID_Stub
, sal_Int32 nIndex
)
983 OUString
aRet(rPointCID_Stub
);
984 return aRet
+=OUString::valueOf( nIndex
);
988 OUString
ObjectIdentifier::getParticleID( const OUString
& rCID
)
991 sal_Int32 nLast
= rCID
.lastIndexOf('=');
993 aRet
= rCID
.copy(++nLast
);
998 OUString
ObjectIdentifier::getFullParentParticle( const OUString
& rCID
)
1002 sal_Int32 nStartPos
= rCID
.lastIndexOf('/');
1006 sal_Int32 nEndPos
= rCID
.lastIndexOf(':');
1007 if( nEndPos
>=0 && nStartPos
< nEndPos
)
1009 aRet
= rCID
.copy(nStartPos
,nEndPos
-nStartPos
);
1017 OUString
ObjectIdentifier::getObjectID( const rtl::OUString
& rCID
)
1021 sal_Int32 nStartPos
= rCID
.lastIndexOf('/');
1025 sal_Int32 nEndPos
= rCID
.getLength();
1026 aRet
= rCID
.copy(nStartPos
,nEndPos
-nStartPos
);
1033 bool ObjectIdentifier::isCID( const OUString
& rName
)
1035 return rName
.getLength() && rName
.match( m_aProtocol
);
1038 Reference
< beans::XPropertySet
> ObjectIdentifier::getObjectPropertySet(
1039 const OUString
& rObjectCID
,
1040 const Reference
< chart2::XChartDocument
>& xChartDocument
)
1042 return ObjectIdentifier::getObjectPropertySet(
1043 rObjectCID
, Reference
< frame::XModel
>( xChartDocument
, uno::UNO_QUERY
));
1047 Reference
< beans::XPropertySet
> ObjectIdentifier::getObjectPropertySet(
1048 const OUString
& rObjectCID
1049 , const Reference
< frame::XModel
>& xChartModel
)
1051 //return the model object that is indicated by rObjectCID
1052 if(!rObjectCID
.getLength())
1054 if(!xChartModel
.is())
1057 Reference
< beans::XPropertySet
> xObjectProperties
= NULL
;
1060 ObjectType eObjectType
= ObjectIdentifier::getObjectType( rObjectCID
);
1061 OUString aParticleID
= ObjectIdentifier::getParticleID( rObjectCID
);
1063 Reference
< XDiagram
> xDiagram
;
1064 Reference
< XCoordinateSystem
> xCooSys
;
1065 lcl_getDiagramAndCooSys( rObjectCID
, xChartModel
, xDiagram
, xCooSys
);
1069 case OBJECTTYPE_PAGE
:
1071 Reference
< XChartDocument
> xChartDocument( xChartModel
, uno::UNO_QUERY
);
1072 if( xChartDocument
.is())
1073 xObjectProperties
.set( xChartDocument
->getPageBackground() );
1076 case OBJECTTYPE_TITLE
:
1078 TitleHelper::eTitleType aTitleType
= getTitleTypeForCID( rObjectCID
);
1079 Reference
< XTitle
> xTitle( TitleHelper::getTitle( aTitleType
, xChartModel
) );
1080 xObjectProperties
.set( xTitle
, uno::UNO_QUERY
);
1083 case OBJECTTYPE_LEGEND
:
1086 xObjectProperties
.set( xDiagram
->getLegend(), uno::UNO_QUERY
);
1089 case OBJECTTYPE_LEGEND_ENTRY
:
1091 case OBJECTTYPE_DIAGRAM
:
1093 xObjectProperties
.set( xDiagram
, uno::UNO_QUERY
);
1096 case OBJECTTYPE_DIAGRAM_WALL
:
1099 xObjectProperties
.set( xDiagram
->getWall() );
1102 case OBJECTTYPE_DIAGRAM_FLOOR
:
1105 xObjectProperties
.set( xDiagram
->getFloor() );
1108 case OBJECTTYPE_AXIS
:
1110 sal_Int32 nDimensionIndex
= -1;
1111 sal_Int32 nAxisIndex
= -1;
1112 lcl_parseAxisIndices( nDimensionIndex
, nAxisIndex
, rObjectCID
);
1114 Reference
< chart2::XAxis
> xAxis(
1115 AxisHelper::getAxis( nDimensionIndex
, nAxisIndex
, xCooSys
) );
1117 xObjectProperties
.set( xAxis
, uno::UNO_QUERY
);
1120 case OBJECTTYPE_AXIS_UNITLABEL
:
1122 case OBJECTTYPE_GRID
:
1123 case OBJECTTYPE_SUBGRID
:
1125 sal_Int32 nDimensionIndex
= -1;
1126 sal_Int32 nAxisIndex
= -1;
1127 lcl_parseAxisIndices( nDimensionIndex
, nAxisIndex
, rObjectCID
);
1129 sal_Int32 nSubGridIndex
= -1;
1130 lcl_parseGridIndices( nSubGridIndex
, rObjectCID
);
1132 xObjectProperties
.set( AxisHelper::getGridProperties( xCooSys
, nDimensionIndex
, nAxisIndex
, nSubGridIndex
) );
1135 case OBJECTTYPE_DATA_LABELS
:
1136 case OBJECTTYPE_DATA_SERIES
:
1138 Reference
< XDataSeries
> xSeries( ObjectIdentifier::getDataSeriesForCID(
1139 rObjectCID
, xChartModel
) );
1141 xObjectProperties
= Reference
< beans::XPropertySet
>( xSeries
, uno::UNO_QUERY
);
1145 case OBJECTTYPE_DATA_LABEL
:
1146 case OBJECTTYPE_DATA_POINT
:
1148 Reference
< XDataSeries
> xSeries( ObjectIdentifier::getDataSeriesForCID(
1149 rObjectCID
, xChartModel
) );
1152 sal_Int32 nIndex
= aParticleID
.toInt32();
1153 xObjectProperties
= xSeries
->getDataPointByIndex( nIndex
);
1157 case OBJECTTYPE_DATA_ERRORS
:
1159 Reference
< XDataSeries
> xSeries( ObjectIdentifier::getDataSeriesForCID(
1160 rObjectCID
, xChartModel
) );
1163 Reference
< beans::XPropertySet
> xSeriesProp( xSeries
, uno::UNO_QUERY
);
1164 Reference
< beans::XPropertySet
> xErrorBarProp
;
1165 if( xSeriesProp
.is() )
1167 xSeriesProp
->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProp
;
1168 xObjectProperties
= Reference
< beans::XPropertySet
>( xErrorBarProp
, uno::UNO_QUERY
);
1173 case OBJECTTYPE_DATA_ERRORS_X
:
1175 case OBJECTTYPE_DATA_ERRORS_Y
:
1177 case OBJECTTYPE_DATA_ERRORS_Z
:
1179 case OBJECTTYPE_DATA_AVERAGE_LINE
:
1180 case OBJECTTYPE_DATA_CURVE
:
1181 case OBJECTTYPE_DATA_CURVE_EQUATION
:
1183 Reference
< XRegressionCurveContainer
> xRegressionContainer( ObjectIdentifier::getDataSeriesForCID(
1184 rObjectCID
, xChartModel
), uno::UNO_QUERY
);
1185 if(xRegressionContainer
.is())
1187 sal_Int32 nIndex
= aParticleID
.toInt32();
1188 uno::Sequence
< Reference
< XRegressionCurve
> > aCurveList
=
1189 xRegressionContainer
->getRegressionCurves();
1190 if( nIndex
>= 0 && nIndex
<aCurveList
.getLength() )
1192 if( eObjectType
== OBJECTTYPE_DATA_CURVE_EQUATION
)
1193 xObjectProperties
.set( aCurveList
[nIndex
]->getEquationProperties());
1195 xObjectProperties
.set( aCurveList
[nIndex
], uno::UNO_QUERY
);
1200 case OBJECTTYPE_DATA_STOCK_RANGE
:
1202 case OBJECTTYPE_DATA_STOCK_LOSS
:
1204 Reference
<XChartType
> xChartType( lcl_getFirstStockChartType( xChartModel
) );
1205 Reference
< beans::XPropertySet
> xChartTypeProps( xChartType
, uno::UNO_QUERY
);
1206 if(xChartTypeProps
.is())
1207 xChartTypeProps
->getPropertyValue( C2U( "BlackDay" ) ) >>= xObjectProperties
;
1210 case OBJECTTYPE_DATA_STOCK_GAIN
:
1212 Reference
<XChartType
> xChartType( lcl_getFirstStockChartType( xChartModel
) );
1213 Reference
< beans::XPropertySet
> xChartTypeProps( xChartType
, uno::UNO_QUERY
);
1214 if(xChartTypeProps
.is())
1215 xChartTypeProps
->getPropertyValue( C2U( "WhiteDay" ) ) >>= xObjectProperties
;
1218 default: //OBJECTTYPE_UNKNOWN
1222 catch( uno::Exception
& ex
)
1224 ASSERT_EXCEPTION( ex
);
1226 return xObjectProperties
;
1230 Reference
< XAxis
> ObjectIdentifier::getAxisForCID(
1231 const OUString
& rObjectCID
1232 , const Reference
< frame::XModel
>& xChartModel
)
1234 Reference
< XDiagram
> xDiagram
;
1235 Reference
< XCoordinateSystem
> xCooSys
;
1236 lcl_getDiagramAndCooSys( rObjectCID
, xChartModel
, xDiagram
, xCooSys
);
1238 sal_Int32 nDimensionIndex
= -1;
1239 sal_Int32 nAxisIndex
= -1;
1240 lcl_parseAxisIndices( nDimensionIndex
, nAxisIndex
, rObjectCID
);
1242 return AxisHelper::getAxis( nDimensionIndex
, nAxisIndex
, xCooSys
);
1246 Reference
< XDataSeries
> ObjectIdentifier::getDataSeriesForCID(
1247 const OUString
& rObjectCID
1248 , const Reference
< frame::XModel
>& xChartModel
)
1250 Reference
< XDataSeries
> xSeries(NULL
);
1252 Reference
< XDiagram
> xDiagram
;
1253 Reference
< XCoordinateSystem
> xCooSys
;
1254 lcl_getDiagramAndCooSys( rObjectCID
, xChartModel
, xDiagram
, xCooSys
);
1256 sal_Int32 nChartTypeIndex
= -1;
1257 sal_Int32 nSeriesIndex
= -1;
1258 sal_Int32 nPointIndex
= -1;
1259 lcl_parseSeriesIndices( nChartTypeIndex
, nSeriesIndex
, nPointIndex
, rObjectCID
);
1261 Reference
< XDataSeriesContainer
> xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram
, nChartTypeIndex
), uno::UNO_QUERY
);
1262 if( xDataSeriesContainer
.is() )
1264 uno::Sequence
< uno::Reference
< XDataSeries
> > aDataSeriesSeq( xDataSeriesContainer
->getDataSeries() );
1265 if( nSeriesIndex
>= 0 && nSeriesIndex
< aDataSeriesSeq
.getLength() )
1266 xSeries
.set( aDataSeriesSeq
[nSeriesIndex
] );
1273 Reference
< XDiagram
> ObjectIdentifier::getDiagramForCID(
1274 const rtl::OUString
& rObjectCID
1275 , const uno::Reference
< frame::XModel
>& xChartModel
)
1277 Reference
< XDiagram
> xDiagram
;
1279 Reference
< XCoordinateSystem
> xCooSys
;
1280 lcl_getDiagramAndCooSys( rObjectCID
, xChartModel
, xDiagram
, xCooSys
);
1285 TitleHelper::eTitleType
ObjectIdentifier::getTitleTypeForCID( const OUString
& rCID
)
1287 TitleHelper::eTitleType
eRet( TitleHelper::MAIN_TITLE
);
1289 OUString aParentParticle
= ObjectIdentifier::getFullParentParticle( rCID
);
1290 const tTitleMap
& rMap
= lcl_getTitleMap();
1291 tTitleMap::const_iterator
aIt( rMap
.begin() );
1292 for( ;aIt
!= rMap
.end(); ++aIt
)
1294 if( aParentParticle
.equals( (*aIt
).second
) )
1296 eRet
= (*aIt
).first
;
1305 OUString
ObjectIdentifier::getSeriesParticleFromCID( const OUString
& rCID
)
1307 sal_Int32 nDiagramIndex
= -1;
1308 sal_Int32 nCooSysIndex
= -1;
1309 lcl_parseCooSysIndices( nDiagramIndex
, nCooSysIndex
, rCID
);
1311 sal_Int32 nChartTypeIndex
= -1;
1312 sal_Int32 nSeriesIndex
= -1;
1313 sal_Int32 nPointIndex
= -1;
1314 lcl_parseSeriesIndices( nChartTypeIndex
, nSeriesIndex
, nPointIndex
, rCID
);
1316 return ObjectIdentifier::createParticleForSeries( nDiagramIndex
, nCooSysIndex
, nChartTypeIndex
, nSeriesIndex
);
1320 OUString
ObjectIdentifier::getMovedSeriesCID( const ::rtl::OUString
& rObjectCID
, sal_Bool bForward
)
1322 sal_Int32 nDiagramIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID
, C2U("CID/D=") ) );
1323 sal_Int32 nCooSysIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID
, C2U("CS=") ) );
1324 sal_Int32 nChartTypeIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID
, C2U("CT=") ) );
1325 sal_Int32 nSeriesIndex
= lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID
, C2U("Series=") ) );
1332 OUString aRet
= ObjectIdentifier::createParticleForSeries( nDiagramIndex
, nCooSysIndex
, nChartTypeIndex
, nSeriesIndex
);
1333 return ObjectIdentifier::createClassifiedIdentifierForParticle( aRet
);
1336 //.............................................................................
1338 //.............................................................................