Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #include "ObjectIdentifier.hxx"
22 : : #include "macros.hxx"
23 : : #include "TitleHelper.hxx"
24 : : #include "ChartModelHelper.hxx"
25 : : #include "AxisHelper.hxx"
26 : : #include "servicenames_charttypes.hxx"
27 : : #include "DiagramHelper.hxx"
28 : : #include "AxisIndexDefines.hxx"
29 : : #include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
30 : : #include <com/sun/star/chart2/XChartDocument.hpp>
31 : : #include <com/sun/star/chart2/XChartTypeContainer.hpp>
32 : : #include <com/sun/star/chart2/XDataSeriesContainer.hpp>
33 : : #include <com/sun/star/chart2/XAxis.hpp>
34 : : #include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
35 : :
36 : : // header for define DBG_ASSERT
37 : : #include <tools/debug.hxx>
38 : : #include <comphelper/InlineContainer.hxx>
39 : :
40 : : #include <rtl/ustrbuf.hxx>
41 : :
42 : : //.............................................................................
43 : : namespace chart
44 : : {
45 : : //.............................................................................
46 : : using namespace ::com::sun::star;
47 : : using namespace ::com::sun::star::chart2;
48 : :
49 : : using rtl::OUString;
50 : : using rtl::OUStringBuffer;
51 : : using ::com::sun::star::uno::Reference;
52 : : using ::com::sun::star::uno::Any;
53 : :
54 : 16 : static OUString m_aMultiClick( C2U("MultiClick") );
55 : 16 : static OUString m_aDragMethodEquals( C2U("DragMethod=") );
56 : 16 : static OUString m_aDragParameterEquals( C2U("DragParameter=") );
57 : 16 : static OUString m_aProtocol( C2U("CID/") );
58 : 16 : static OUString m_aEmptyString;
59 : 16 : static OUString m_aPieSegmentDragMethodServiceName( C2U("PieSegmentDraging") );
60 : :
61 : : namespace
62 : : {
63 : :
64 : 48118 : OUString lcl_createClassificationStringForType( ObjectType eObjectType
65 : : , const OUString& rDragMethodServiceName
66 : : , const OUString& rDragParameterString
67 : : )
68 : : {
69 : 48118 : OUStringBuffer aRet;
70 [ + + ]: 48118 : switch( eObjectType )
71 : : {
72 : : //these object types are all selected only after their parents was selected before
73 : : case OBJECTTYPE_LEGEND_ENTRY: //parent is intended to be OBJECTTYPE_LEGEND
74 : : case OBJECTTYPE_DATA_POINT: //parent is intended to be OBJECTTYPE_DATA_SERIES
75 : : case OBJECTTYPE_DATA_LABEL: //parent is intended to be OBJECTTYPE_DATA_LABELS
76 : : case OBJECTTYPE_DATA_ERRORS_X: //parent is intended to be OBJECTTYPE_DATA_ERRORS
77 : : case OBJECTTYPE_DATA_ERRORS_Y: //parent is intended to be OBJECTTYPE_DATA_ERRORS
78 : : case OBJECTTYPE_DATA_ERRORS_Z: //parent is intended to be OBJECTTYPE_DATA_ERRORS
79 [ + - ][ + - ]: 10849 : aRet=m_aMultiClick;
80 : : default:
81 : : ;//empty string
82 : : }
83 [ + + ]: 48118 : if( !rDragMethodServiceName.isEmpty() )
84 : : {
85 [ + - ]: 152 : if( aRet.getLength() )
86 [ + - ]: 152 : aRet.appendAscii(":");
87 [ + - ]: 152 : aRet.append( m_aDragMethodEquals );
88 [ + - ]: 152 : aRet.append( rDragMethodServiceName );
89 : :
90 [ + - ]: 152 : if( !rDragParameterString.isEmpty() )
91 : : {
92 [ + - ]: 152 : if( aRet.getLength() )
93 [ + - ]: 152 : aRet.appendAscii(":");
94 [ + - ]: 152 : aRet.append( m_aDragParameterEquals );
95 [ + - ]: 152 : aRet.append( rDragParameterString );
96 : : }
97 : : }
98 [ + - ]: 48118 : return aRet.makeStringAndClear();
99 : : }
100 : :
101 : : typedef ::comphelper::MakeMap< TitleHelper::eTitleType, OUString > tTitleMap;
102 : 5339 : const tTitleMap& lcl_getTitleMap()
103 : : {
104 : : //maps the title type to the ParentParticle for that title
105 : : static tTitleMap m_aTitleMap = tTitleMap
106 : : ( TitleHelper::MAIN_TITLE, C2U("") )
107 [ + - ][ + - ]: 10 : ( TitleHelper::SUB_TITLE, C2U("D=0") )
[ + - ][ + - ]
108 [ + - ][ + - ]: 15 : ( TitleHelper::X_AXIS_TITLE, C2U("D=0:CS=0:Axis=0,0") )
109 [ + - ][ + - ]: 15 : ( TitleHelper::Y_AXIS_TITLE, C2U("D=0:CS=0:Axis=1,0") )
110 [ + - ][ + - ]: 15 : ( TitleHelper::Z_AXIS_TITLE, C2U("D=0:CS=0:Axis=2,0") )
111 [ + - ][ + - ]: 15 : ( TitleHelper::SECONDARY_X_AXIS_TITLE, C2U("D=0:CS=0:Axis=0,1") )
112 [ + + ][ + - ]: 5349 : ( TitleHelper::SECONDARY_Y_AXIS_TITLE, C2U("D=0:CS=0:Axis=1,1") )
[ + - ][ + - ]
[ + - ][ # # ]
113 : : ;
114 : 5339 : return m_aTitleMap;
115 : : }
116 : :
117 : 3129 : OUString lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType )
118 : : {
119 : 3129 : OUString aRet;
120 : :
121 [ + - ]: 3129 : const tTitleMap& rMap = lcl_getTitleMap();
122 [ + - ]: 3129 : tTitleMap::const_iterator aIt( rMap.find( aTitleType ) );
123 [ + - ]: 3129 : if( aIt != rMap.end())
124 : 3129 : aRet = (*aIt).second;
125 : :
126 : 3129 : return aRet;
127 : : }
128 : :
129 : 0 : Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel >& xChartModel )
130 : : {
131 [ # # ]: 0 : Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
132 [ # # ]: 0 : if(!xDiagram.is())
133 [ # # ]: 0 : return 0;
134 : :
135 : : //iterate through all coordinate systems
136 [ # # ]: 0 : Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
137 [ # # ]: 0 : if( !xCooSysContainer.is())
138 [ # # ]: 0 : return 0;
139 : :
140 [ # # ][ # # ]: 0 : uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
141 [ # # ]: 0 : for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
142 : : {
143 : : //iterate through all chart types in the current coordinate system
144 [ # # ][ # # ]: 0 : Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY );
145 [ # # ]: 0 : if( !xChartTypeContainer.is() )
146 : 0 : continue;
147 : :
148 [ # # ][ # # ]: 0 : uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
149 [ # # ]: 0 : for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
150 : : {
151 [ # # ]: 0 : Reference< XChartType > xChartType( aChartTypeList[nT] );
152 [ # # ]: 0 : if(!xChartType.is())
153 : 0 : continue;
154 [ # # ][ # # ]: 0 : OUString aChartType = xChartType->getChartType();
155 [ # # ][ # # ]: 0 : if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
156 : 0 : return xChartType;
157 [ # # ]: 0 : }
[ # # # ]
158 [ # # ][ # # ]: 0 : }
[ # # # ]
159 [ # # ][ # # ]: 0 : return 0;
160 : : }
161 : :
162 : 66786 : OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& rSearchString )
163 : : {
164 : 66786 : OUStringBuffer aRet;
165 : :
166 : 66786 : sal_Int32 nIndexStart = rString.lastIndexOf( rSearchString );
167 [ + + ]: 66786 : if( nIndexStart != -1 )
168 : : {
169 : 44701 : nIndexStart += rSearchString.getLength();
170 : 44701 : sal_Int32 nIndexEnd = rString.getLength();
171 : 44701 : sal_Int32 nNextColon = rString.indexOf( ':', nIndexStart );
172 [ + + ]: 44701 : if( nNextColon != -1 )
173 : 34150 : nIndexEnd = nNextColon;
174 [ + - ][ + - ]: 44701 : aRet = rString.copy(nIndexStart,nIndexEnd-nIndexStart);
175 : : }
176 : :
177 [ + - ]: 66786 : return aRet.makeStringAndClear();
178 : : }
179 : :
180 : 72453 : sal_Int32 lcl_StringToIndex( const OUString& rIndexString )
181 : : {
182 : 72453 : sal_Int32 nRet = -1;
183 [ + + ]: 72453 : if( !rIndexString.isEmpty() )
184 : : {
185 : 50368 : nRet = rIndexString.toInt32();
186 [ - + ]: 50368 : if( nRet < -1 )
187 : 0 : nRet = -1;
188 : : }
189 : 72453 : return nRet;
190 : : }
191 : :
192 : 16950 : void lcl_parseCooSysIndices( sal_Int32& rnDiagram, sal_Int32& rnCooSys, const OUString& rString )
193 : : {
194 [ + - ]: 16950 : rnDiagram = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("D=") ) );
195 [ + - ]: 16950 : rnCooSys = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("CS=") ) );
196 : 16950 : }
197 : :
198 : 5667 : void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, const OUString& rString )
199 : : {
200 [ + - ][ + - ]: 5667 : OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, C2U(":Axis=") );
201 : 5667 : sal_Int32 nCharacterIndex=0;
202 : 5667 : rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
203 : 5667 : rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
204 : 5667 : }
205 : :
206 : 0 : void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString )
207 : : {
208 : 0 : rnSubGridIndex = -1;
209 [ # # ]: 0 : rnSubGridIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U(":SubGrid=") ) );
210 : 0 : }
211 : :
212 : 9073 : void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesIndex, sal_Int32& rnPointIndex, const OUString& rString )
213 : : {
214 [ + - ]: 9073 : rnChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("CT=") ) );
215 [ + - ]: 9073 : rnSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("Series=") ) );
216 [ + - ]: 9073 : rnPointIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, C2U("Point=") ) );
217 : 9073 : }
218 : :
219 : 16950 : void lcl_getDiagramAndCooSys( const OUString& rObjectCID
220 : : , const Reference< frame::XModel >& xChartModel
221 : : , Reference< XDiagram >& xDiagram
222 : : , Reference< XCoordinateSystem >& xCooSys )
223 : : {
224 : 16950 : sal_Int32 nDiagramIndex = -1;
225 : 16950 : sal_Int32 nCooSysIndex = -1;
226 [ + - ]: 16950 : lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rObjectCID );
227 [ + - ][ + - ]: 16950 : xDiagram = ChartModelHelper::findDiagram( xChartModel );//todo use nDiagramIndex when more than one diagram is possible in future
228 [ + + ]: 16950 : if( !xDiagram.is() )
229 : 16950 : return;
230 : :
231 [ + + ]: 16880 : if( nCooSysIndex > -1 )
232 : : {
233 [ + - ]: 12379 : Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
234 [ + - ]: 12379 : if( xCooSysContainer.is() )
235 : : {
236 [ + - ][ + - ]: 12379 : uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
237 [ + - ]: 12379 : if( nCooSysIndex < aCooSysList.getLength() )
238 [ + - ][ + - ]: 12379 : xCooSys = aCooSysList[nCooSysIndex];
[ + - ]
239 : 16950 : }
240 : : }
241 : : }
242 : :
243 : : } //anonymous namespace
244 : :
245 : 26012 : ObjectIdentifier::ObjectIdentifier()
246 : : :m_aObjectCID( OUString() )
247 [ + - ]: 26012 : ,m_xAdditionalShape( 0 )
248 : : {
249 : 26012 : }
250 : :
251 : 25910 : ObjectIdentifier::ObjectIdentifier( const OUString& rObjectCID )
252 : : :m_aObjectCID( rObjectCID )
253 [ + - ]: 25910 : ,m_xAdditionalShape( 0 )
254 : : {
255 : 25910 : }
256 : :
257 : 0 : ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape )
258 : : :m_aObjectCID( OUString() )
259 : 0 : ,m_xAdditionalShape( rxShape )
260 : : {
261 : 0 : }
262 : :
263 : 7742 : ObjectIdentifier::ObjectIdentifier( const Any& rAny )
264 : : :m_aObjectCID( OUString() )
265 [ + - ]: 7742 : ,m_xAdditionalShape( 0 )
266 : : {
267 : 7742 : const uno::Type& rType = rAny.getValueType();
268 [ + + ][ + - ]: 7742 : if ( rType == ::getCppuType( static_cast< const OUString* >( 0 ) ) )
269 : : {
270 : 7674 : rAny >>= m_aObjectCID;
271 : : }
272 [ + - ][ - + ]: 68 : else if ( rType == ::getCppuType( static_cast< const Reference< drawing::XShape >* >( 0 ) ) )
273 : : {
274 [ # # ]: 0 : rAny >>= m_xAdditionalShape;
275 : : }
276 : 7742 : }
277 : :
278 : 200197 : ObjectIdentifier::~ObjectIdentifier()
279 : : {
280 [ - + ]: 200197 : }
281 : :
282 : 140533 : ObjectIdentifier::ObjectIdentifier( const ObjectIdentifier& rOID )
283 : : :m_aObjectCID( rOID.m_aObjectCID )
284 : 140533 : ,m_xAdditionalShape( rOID.m_xAdditionalShape )
285 : : {
286 : :
287 : 140533 : }
288 : :
289 : 26653 : ObjectIdentifier& ObjectIdentifier::operator=( const ObjectIdentifier& rOID )
290 : : {
291 : 26653 : m_aObjectCID = rOID.m_aObjectCID;
292 : 26653 : m_xAdditionalShape = rOID.m_xAdditionalShape;
293 : 26653 : return *this;
294 : : }
295 : :
296 : 2271 : bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const
297 : : {
298 [ + - + - ]: 4542 : if ( areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) &&
[ + - ]
299 : 2271 : ( m_xAdditionalShape == rOID.m_xAdditionalShape ) )
300 : : {
301 : 2271 : return true;
302 : : }
303 : 2271 : return false;
304 : : }
305 : :
306 : 0 : bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const
307 : : {
308 : 0 : return !operator==( rOID );
309 : : }
310 : :
311 : 47338 : bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
312 : : {
313 : 47338 : bool bReturn = false;
314 [ + - ][ + - ]: 47338 : if ( !(m_aObjectCID.isEmpty() || rOID.m_aObjectCID.isEmpty()) )
[ + - ]
315 : : {
316 : 47338 : bReturn = ( m_aObjectCID.compareTo( rOID.m_aObjectCID ) < 0 );
317 : : }
318 [ # # ]: 0 : else if ( !m_aObjectCID.isEmpty() )
319 : : {
320 : 0 : bReturn = true;
321 : : }
322 [ # # ]: 0 : else if ( !rOID.m_aObjectCID.isEmpty() )
323 : : {
324 : 0 : bReturn = false;
325 : : }
326 [ # # ][ # # ]: 0 : else if ( m_xAdditionalShape.is() && rOID.m_xAdditionalShape.is() )
[ # # ]
327 : : {
328 : 0 : bReturn = ( m_xAdditionalShape < rOID.m_xAdditionalShape );
329 : : }
330 : 47338 : return bReturn;
331 : : }
332 : :
333 : 13255 : OUString ObjectIdentifier::createClassifiedIdentifierForObject(
334 : : const Reference< uno::XInterface >& xObject
335 : : , const Reference< frame::XModel >& xChartModel )
336 : : {
337 : 13255 : OUString aRet;
338 : :
339 : 13255 : enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
340 : 13255 : OUString aObjectID;
341 : 13255 : OUString aParentParticle;
342 : 13255 : OUString aDragMethodServiceName;
343 : 13255 : OUString aDragParameterString;
344 : :
345 : :
346 : : try
347 : : {
348 : : //title
349 [ + - ]: 13255 : Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
350 [ + + ]: 13255 : if( xTitle.is() )
351 : : {
352 : : TitleHelper::eTitleType aTitleType;
353 [ + - ][ + - ]: 3129 : if( TitleHelper::getTitleType( aTitleType, xTitle, xChartModel ) )
354 : : {
355 : 3129 : eObjectType = OBJECTTYPE_TITLE;
356 [ + - ]: 3129 : aParentParticle = lcl_getTitleParentParticle( aTitleType );
357 : : aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
358 [ + - ]: 3129 : eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
359 : : }
360 : 3129 : return aRet;
361 : :
362 : : }
363 : :
364 : : //axis
365 [ + - ]: 10126 : Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
366 [ + + ]: 10126 : if( xAxis.is() )
367 : : {
368 [ + - ][ + - ]: 5667 : Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) ) );
369 [ + - ]: 5667 : rtl::OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, xChartModel ) );
370 : 5667 : sal_Int32 nDimensionIndex=-1;
371 : 5667 : sal_Int32 nAxisIndex=-1;
372 [ + - ]: 5667 : AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
373 [ + - ]: 5667 : rtl::OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
374 [ + - ]: 5667 : return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
375 : : }
376 : :
377 : : //legend
378 [ + - ]: 4459 : Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
379 [ + + ]: 4459 : if( xLegend.is() )
380 : : {
381 [ + - ][ + - ]: 2194 : return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, xChartModel ) );
382 : : }
383 : :
384 : : //diagram
385 [ + - ]: 2265 : Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
386 [ + - ]: 2265 : if( xDiagram.is() )
387 : : {
388 [ + - ][ + - ]: 2265 : return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, xChartModel ) );
389 [ + - ][ + - ]: 13255 : }
[ + - ][ - + ]
[ # # ]
390 : :
391 : : //todo
392 : : //XDataSeries
393 : : //CooSys
394 : : //charttype
395 : : //datapoint?
396 : : //Gridproperties
397 : : }
398 [ # # ]: 0 : catch(const uno::Exception& ex)
399 : : {
400 : : ASSERT_EXCEPTION( ex );
401 : : }
402 : :
403 [ # # ]: 0 : if( eObjectType != OBJECTTYPE_UNKNOWN )
404 : : {
405 : : aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
406 [ # # ]: 0 : eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
407 : : }
408 : : else
409 : : {
410 : : OSL_FAIL("give object could not be identifed in createClassifiedIdentifierForObject");
411 : : }
412 : :
413 : 13255 : return aRet;
414 : : }
415 : :
416 : 15317 : OUString ObjectIdentifier::createClassifiedIdentifierForParticle(
417 : : const OUString& rParticle )
418 : : {
419 [ + - ]: 15317 : return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() );
420 : : }
421 : :
422 : 36109 : OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
423 : : const OUString& rParentParticle
424 : : , const OUString& rChildParticle
425 : : , const OUString& rDragMethodServiceName
426 : : , const OUString& rDragParameterString )
427 : : {
428 [ + - ]: 36109 : ObjectType eObjectType( ObjectIdentifier::getObjectType( rChildParticle ) );
429 [ + + ]: 36109 : if( eObjectType == OBJECTTYPE_UNKNOWN )
430 [ + - ]: 15317 : eObjectType = ObjectIdentifier::getObjectType( rParentParticle );
431 : :
432 [ + - ]: 36109 : OUStringBuffer aRet( m_aProtocol );
433 [ + - ][ + - ]: 36109 : aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
434 [ + + ]: 36109 : if(aRet.getLength()>m_aProtocol.getLength())
435 [ + - ]: 7643 : aRet.appendAscii("/");
436 : :
437 [ + - ]: 36109 : if(!rParentParticle.isEmpty())
438 : : {
439 [ + - ]: 36109 : aRet.append(rParentParticle);
440 [ + + ]: 36109 : if( !rChildParticle.isEmpty() )
441 [ + - ]: 20792 : aRet.appendAscii(":");
442 : : }
443 [ + - ]: 36109 : aRet.append(rChildParticle);
444 : :
445 [ + - ]: 36109 : return aRet.makeStringAndClear();
446 : : }
447 : :
448 : 12064 : OUString ObjectIdentifier::createParticleForDiagram(
449 : : const Reference< XDiagram >& /*xDiagram*/
450 : : , const Reference< frame::XModel >& /*xChartModel*/ )
451 : : {
452 [ + + ][ + - ]: 12064 : static OUString aRet(C2U("D=0"));
[ + - ][ # # ]
453 : : //todo: if more than one diagram is implemeted, add the correct diagram index here
454 : 12064 : return aRet;
455 : : }
456 : :
457 : 6649 : OUString ObjectIdentifier::createParticleForCoordinateSystem(
458 : : const Reference< XCoordinateSystem >& xCooSys
459 : : , const Reference< frame::XModel >& xChartModel )
460 : : {
461 : 6649 : OUStringBuffer aRet;
462 : :
463 [ + - ]: 6649 : Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
464 [ + - ]: 6649 : Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
465 [ + - ]: 6649 : if( xCooSysContainer.is() )
466 : : {
467 : 6649 : sal_Int32 nCooSysIndex = 0;
468 [ + - ][ + - ]: 6649 : uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
469 [ + - ]: 13298 : for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
470 : : {
471 [ + - ]: 6649 : Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
472 [ + - ][ + - ]: 6649 : if( xCooSys == xCurrentCooSys )
473 : : {
474 [ + - ][ + - ]: 6649 : aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel );
[ + - ]
475 [ + - ]: 6649 : aRet.appendAscii(":CS=");
476 [ + - ]: 6649 : aRet.append( OUString::valueOf( nCooSysIndex ) );
477 : : break;
478 : : }
479 [ - + ][ + - ]: 13298 : }
480 : : }
481 : :
482 [ + - ]: 6649 : return aRet.makeStringAndClear();
483 : : }
484 : :
485 : 7605 : OUString ObjectIdentifier::createParticleForAxis(
486 : : sal_Int32 nDimensionIndex
487 : : , sal_Int32 nAxisIndex )
488 : : {
489 [ + - ][ + - ]: 7605 : OUStringBuffer aRet(C2U("Axis="));
490 : :
491 [ + - ]: 7605 : aRet.append( OUString::valueOf( nDimensionIndex ) );
492 [ + - ]: 7605 : aRet.appendAscii(",");
493 [ + - ]: 7605 : aRet.append( OUString::valueOf( nAxisIndex ) );
494 : :
495 [ + - ]: 7605 : return aRet.makeStringAndClear();
496 : : }
497 : :
498 : 1938 : OUString ObjectIdentifier::createParticleForGrid(
499 : : sal_Int32 nDimensionIndex
500 : : , sal_Int32 nAxisIndex )
501 : : {
502 [ + - ][ + - ]: 1938 : OUStringBuffer aRet(C2U("Axis="));
503 [ + - ]: 1938 : aRet.append( OUString::valueOf( nDimensionIndex ) );
504 [ + - ]: 1938 : aRet.appendAscii(",");
505 [ + - ]: 1938 : aRet.append( OUString::valueOf( nAxisIndex ) );
506 [ + - ][ + - ]: 1938 : aRet.append( C2U(":Grid=0") );
507 : :
508 [ + - ]: 1938 : return aRet.makeStringAndClear();
509 : : }
510 : :
511 : 1812 : OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
512 : : const Reference< XAxis >& xAxis
513 : : , const Reference< frame::XModel >& xChartModel
514 : : , sal_Int32 nSubGridIndex )
515 : : {
516 : : //-1: main grid, 0: first subgrid etc
517 : :
518 [ + - ]: 1812 : rtl::OUString aAxisCID( createClassifiedIdentifierForObject( xAxis, xChartModel ) );
519 : : rtl::OUString aGridCID( addChildParticle( aAxisCID
520 [ + - ][ + - ]: 1812 : , createChildParticleWithIndex( OBJECTTYPE_GRID, 0 ) ) );
521 [ - + ]: 1812 : if( nSubGridIndex >= 0 )
522 : : {
523 : : aGridCID = addChildParticle( aGridCID
524 [ # # ][ # # ]: 0 : , createChildParticleWithIndex( OBJECTTYPE_SUBGRID, 0 ) );
525 : : }
526 : 1812 : return aGridCID;
527 : : }
528 : :
529 : 9902 : OUString ObjectIdentifier::createParticleForSeries(
530 : : sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
531 : : , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex )
532 : : {
533 : 9902 : OUStringBuffer aRet;
534 : :
535 [ + - ]: 9902 : aRet.appendAscii("D=");
536 [ + - ]: 9902 : aRet.append( OUString::valueOf( nDiagramIndex ) );
537 [ + - ]: 9902 : aRet.appendAscii(":CS=");
538 [ + - ]: 9902 : aRet.append( OUString::valueOf( nCooSysIndex ) );
539 [ + - ]: 9902 : aRet.appendAscii(":CT=");
540 [ + - ]: 9902 : aRet.append( OUString::valueOf( nChartTypeIndex ) );
541 [ + - ]: 9902 : aRet.appendAscii(":");
542 [ + - ][ + - ]: 9902 : aRet.append(getStringForType( OBJECTTYPE_DATA_SERIES ));
543 [ + - ]: 9902 : aRet.appendAscii("=");
544 [ + - ]: 9902 : aRet.append( OUString::valueOf( nSeriesIndex ) );
545 : :
546 [ + - ]: 9902 : return aRet.makeStringAndClear();
547 : : }
548 : :
549 : 3150 : OUString ObjectIdentifier::createParticleForLegend(
550 : : const Reference< XLegend >& /*xLegend*/
551 : : , const Reference< frame::XModel >& xChartModel )
552 : : {
553 : 3150 : OUStringBuffer aRet;
554 : :
555 [ + - ]: 3150 : Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
556 : : //todo: if more than one diagram is implemeted, find the correct diagram wich is owner of the given legend
557 : :
558 [ + - ][ + - ]: 3150 : aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel ) );
559 [ + - ]: 3150 : aRet.appendAscii(":");
560 [ + - ][ + - ]: 3150 : aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
561 [ + - ]: 3150 : aRet.appendAscii("=");
562 : :
563 [ + - ]: 3150 : return aRet.makeStringAndClear();
564 : : }
565 : :
566 : 5466 : OUString ObjectIdentifier::createClassifiedIdentifier(
567 : : enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
568 : : , const OUString& rParticleID )//e.g. SeriesID
569 : : {
570 : : return createClassifiedIdentifierWithParent(
571 [ + - ]: 5466 : eObjectType, rParticleID, m_aEmptyString );
572 : : }
573 : :
574 : 12009 : OUString ObjectIdentifier::createClassifiedIdentifierWithParent(
575 : : enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
576 : : , const OUString& rParticleID //e.g. Point Index or SubGrid Index
577 : : , const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
578 : : , const OUString& rDragMethodServiceName
579 : : , const OUString& rDragParameterString
580 : : )
581 : : //, bool bIsMultiClickObject ) //e.g. true
582 : : {
583 : : //e.g. "MultiClick/Series=2:Point=34"
584 : :
585 [ + - ]: 12009 : OUStringBuffer aRet( m_aProtocol );
586 [ + - ][ + - ]: 12009 : aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
587 [ + + ]: 12009 : if(aRet.getLength()>m_aProtocol.getLength())
588 [ + - ]: 3206 : aRet.appendAscii("/");
589 [ + - ]: 12009 : aRet.append(rParentPartical);
590 [ + + ]: 12009 : if(!rParentPartical.isEmpty())
591 [ + - ]: 4633 : aRet.appendAscii(":");
592 : :
593 [ + - ][ + - ]: 12009 : aRet.append(getStringForType( eObjectType ));
594 [ + - ]: 12009 : aRet.appendAscii("=");
595 [ + - ]: 12009 : aRet.append(rParticleID);
596 : :
597 [ + - ]: 12009 : return aRet.makeStringAndClear();
598 : : }
599 : :
600 : 152 : const OUString& ObjectIdentifier::getPieSegmentDragMethodServiceName()
601 : : {
602 : 152 : return m_aPieSegmentDragMethodServiceName;
603 : : }
604 : :
605 : 152 : OUString ObjectIdentifier::createPieSegmentDragParameterString(
606 : : sal_Int32 nOffsetPercent
607 : : , const awt::Point& rMinimumPosition
608 : : , const awt::Point& rMaximumPosition )
609 : : {
610 [ + - ]: 152 : OUStringBuffer aRet( OUString::valueOf( nOffsetPercent ) );
611 [ + - ]: 152 : aRet.append( sal_Unicode( ',' ));
612 [ + - ]: 152 : aRet.append( OUString::valueOf( rMinimumPosition.X ) );
613 [ + - ]: 152 : aRet.append( sal_Unicode( ',' ));
614 [ + - ]: 152 : aRet.append( OUString::valueOf( rMinimumPosition.Y ) );
615 [ + - ]: 152 : aRet.append( sal_Unicode( ',' ));
616 [ + - ]: 152 : aRet.append( OUString::valueOf( rMaximumPosition.X ) );
617 [ + - ]: 152 : aRet.append( sal_Unicode( ',' ));
618 [ + - ]: 152 : aRet.append( OUString::valueOf( rMaximumPosition.Y ) );
619 [ + - ]: 152 : return aRet.makeStringAndClear();
620 : : }
621 : :
622 : 0 : bool ObjectIdentifier::parsePieSegmentDragParameterString(
623 : : const OUString& rDragParameterString
624 : : , sal_Int32& rOffsetPercent
625 : : , awt::Point& rMinimumPosition
626 : : , awt::Point& rMaximumPosition )
627 : : {
628 : 0 : sal_Int32 nCharacterIndex = 0;
629 : :
630 : 0 : OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) );
631 : 0 : rOffsetPercent = aValueString.toInt32();
632 [ # # ]: 0 : if( nCharacterIndex < 0 )
633 : 0 : return false;
634 : :
635 : 0 : aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
636 : 0 : rMinimumPosition.X = aValueString.toInt32();
637 [ # # ]: 0 : if( nCharacterIndex < 0 )
638 : 0 : return false;
639 : :
640 : 0 : aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
641 : 0 : rMinimumPosition.Y = aValueString.toInt32();
642 [ # # ]: 0 : if( nCharacterIndex < 0 )
643 : 0 : return false;
644 : :
645 : 0 : aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
646 : 0 : rMaximumPosition.X = aValueString.toInt32();
647 [ # # ]: 0 : if( nCharacterIndex < 0 )
648 : 0 : return false;
649 : :
650 : 0 : aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
651 : 0 : rMaximumPosition.Y = aValueString.toInt32();
652 [ # # ]: 0 : if( nCharacterIndex < 0 )
653 : 0 : return false;
654 : :
655 : 0 : return true;
656 : : }
657 : :
658 : 2327 : OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID )
659 : : {
660 : 2327 : OUString aRet;
661 : :
662 : 2327 : sal_Int32 nIndexStart = rCID.indexOf( m_aDragMethodEquals );
663 [ - + ]: 2327 : if( nIndexStart != -1 )
664 : : {
665 : 0 : nIndexStart = rCID.indexOf( '=', nIndexStart );
666 [ # # ]: 0 : if( nIndexStart != -1 )
667 : : {
668 : 0 : nIndexStart++;
669 : 0 : sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
670 [ # # ]: 0 : if( nNextSlash != -1 )
671 : : {
672 : 0 : sal_Int32 nIndexEnd = nNextSlash;
673 : 0 : sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
674 [ # # ]: 0 : if( nNextColon < nNextSlash )
675 : 0 : nIndexEnd = nNextColon;
676 : 0 : aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
677 : : }
678 : : }
679 : : }
680 : 2327 : return aRet;
681 : : }
682 : :
683 : 0 : OUString ObjectIdentifier::getDragParameterString( const OUString& rCID )
684 : : {
685 : 0 : OUString aRet;
686 : :
687 : 0 : sal_Int32 nIndexStart = rCID.indexOf( m_aDragParameterEquals );
688 [ # # ]: 0 : if( nIndexStart != -1 )
689 : : {
690 : 0 : nIndexStart = rCID.indexOf( '=', nIndexStart );
691 [ # # ]: 0 : if( nIndexStart != -1 )
692 : : {
693 : 0 : nIndexStart++;
694 : 0 : sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
695 [ # # ]: 0 : if( nNextSlash != -1 )
696 : : {
697 : 0 : sal_Int32 nIndexEnd = nNextSlash;
698 : 0 : sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
699 [ # # ]: 0 : if( nNextColon < nNextSlash )
700 : 0 : nIndexEnd = nNextColon;
701 : 0 : aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
702 : : }
703 : : }
704 : : }
705 : 0 : return aRet;
706 : : }
707 : :
708 : 2327 : bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
709 : : {
710 : 2327 : bool bReturn = false;
711 : 2327 : ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
712 [ - + ]: 2327 : switch( eObjectType )
713 : : {
714 : : case OBJECTTYPE_TITLE:
715 : : case OBJECTTYPE_LEGEND:
716 : : case OBJECTTYPE_DIAGRAM:
717 : : case OBJECTTYPE_DATA_CURVE_EQUATION:
718 : : //case OBJECTTYPE_DIAGRAM_WALL:
719 : 0 : bReturn = true;
720 : : break;
721 : : default:
722 [ + - ]: 2327 : OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) );
723 : 2327 : bReturn = !aDragMethodServiceName.isEmpty();
724 : 2327 : break;
725 : : }
726 : 2327 : return bReturn;
727 : : }
728 : :
729 : 2361 : bool ObjectIdentifier::isDragableObject()
730 : : {
731 : 2361 : bool bReturn = false;
732 [ + + ]: 2361 : if ( isAutoGeneratedObject() )
733 : : {
734 : 2327 : bReturn = isDragableObject( m_aObjectCID );
735 : : }
736 [ - + ]: 34 : else if ( isAdditionalShape() )
737 : : {
738 : 0 : bReturn = true;
739 : : }
740 : 2361 : return bReturn;
741 : : }
742 : :
743 : 0 : bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier )
744 : : {
745 : 0 : bool bReturn = false;
746 : 0 : ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
747 [ # # ]: 0 : switch( eObjectType )
748 : : {
749 : : case OBJECTTYPE_DIAGRAM:
750 : : //case OBJECTTYPE_DIAGRAM_WALL:
751 : 0 : bReturn = true;
752 : 0 : break;
753 : : default:
754 : 0 : bReturn = false;
755 : 0 : break;
756 : : }
757 : 0 : return bReturn;
758 : : }
759 : :
760 : 0 : bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier )
761 : : {
762 : : //the name of a shape is it's ClassifiedIdentifier
763 : :
764 : : //a MultiClickObject is an object that is selectable by more than one click only ;
765 : : //before a MultiClickObject can be selected it is necessary that a named parent group object
766 : : //was selected before;
767 : :
768 : : //!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
769 : 0 : bool bRet = false;
770 : 0 : bRet = rClassifiedIdentifier.match( m_aMultiClick, m_aProtocol.getLength() );
771 : 0 : return bRet;
772 : : }
773 : :
774 : 0 : bool ObjectIdentifier::areSiblings( const OUString& rCID1, const OUString& rCID2 )
775 : : {
776 : 0 : bool bRet=false;
777 : 0 : sal_Int32 nLastSign1 = rCID1.lastIndexOf( '=' );
778 : 0 : sal_Int32 nLastSign2 = rCID2.lastIndexOf( '=' );
779 [ # # ]: 0 : if( nLastSign1 == rCID1.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
780 : 0 : bRet=false;
781 [ # # ]: 0 : else if( nLastSign2 == rCID2.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
782 : 0 : bRet=false;
783 [ # # ]: 0 : else if( ObjectIdentifier::areIdenticalObjects( rCID1, rCID2 ) )
784 : 0 : bRet=false;
785 : : else
786 : : {
787 [ # # ]: 0 : OUString aParent1( ObjectIdentifier::getFullParentParticle( rCID1 ) );
788 [ # # ]: 0 : if( !aParent1.isEmpty() )
789 : : {
790 [ # # ]: 0 : OUString aParent2( ObjectIdentifier::getFullParentParticle( rCID2 ) );
791 : 0 : bRet=aParent1.equals(aParent2);
792 : : }
793 : : //legend entries are special:
794 [ # # ]: 0 : if(!bRet)
795 : : {
796 [ # # ][ # # ]: 0 : if( OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID1)
[ # # ][ # # ]
797 [ # # ]: 0 : && OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID2) )
798 : 0 : bRet = true;
799 : 0 : }
800 : : }
801 : 0 : return bRet;
802 : : }
803 : :
804 : 7482 : bool ObjectIdentifier::areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 )
805 : : {
806 [ + + ]: 7482 : if( rCID1.equals( rCID2 ) )
807 : 3423 : return true;
808 : : //draggable pie or donut segments need special treatment, as their CIDs do change with offset
809 : : {
810 [ - + # # ]: 4059 : if( rCID1.indexOf( m_aPieSegmentDragMethodServiceName ) < 0
[ + - ]
811 : 0 : || rCID2.indexOf( m_aPieSegmentDragMethodServiceName ) < 0 )
812 : 4059 : return false;
813 : :
814 : 0 : OUString aID1( ObjectIdentifier::getObjectID( rCID1 ) );
815 : 0 : OUString aID2( ObjectIdentifier::getObjectID( rCID2 ) );
816 [ # # ][ # # ]: 0 : if( !aID1.isEmpty() && aID1.equals( aID2 ) )
[ # # ]
817 [ # # ][ # # ]: 0 : return true;
818 : : }
819 : 7482 : return false;
820 : : }
821 : :
822 : 38265 : OUString ObjectIdentifier::getStringForType( ObjectType eObjectType )
823 : : {
824 : 38265 : OUString aRet;
825 [ + + + + : 38265 : switch( eObjectType )
+ + + - -
+ - + + +
+ - + - +
+ + - + +
- ]
826 : : {
827 : : case OBJECTTYPE_PAGE:
828 [ + - ]: 3376 : aRet=C2U("Page");
829 : 3376 : break;
830 : : case OBJECTTYPE_TITLE:
831 [ + - ]: 3129 : aRet=C2U("Title");
832 : 3129 : break;
833 : : case OBJECTTYPE_LEGEND:
834 [ + - ]: 3150 : aRet=C2U("Legend");
835 : 3150 : break;
836 : : case OBJECTTYPE_LEGEND_ENTRY:
837 [ + - ]: 3205 : aRet=C2U("LegendEntry");
838 : 3205 : break;
839 : : case OBJECTTYPE_DIAGRAM:
840 [ + - ]: 1071 : aRet=C2U("D");
841 : 1071 : break;
842 : : case OBJECTTYPE_DIAGRAM_WALL:
843 [ + - ]: 985 : aRet=C2U("DiagramWall");
844 : 985 : break;
845 : : case OBJECTTYPE_DIAGRAM_FLOOR:
846 [ + - ]: 26 : aRet=C2U("DiagramFloor");
847 : 26 : break;
848 : : case OBJECTTYPE_AXIS:
849 [ # # ]: 0 : aRet=C2U("Axis");
850 : 0 : break;
851 : : case OBJECTTYPE_AXIS_UNITLABEL:
852 [ # # ]: 0 : aRet=C2U("AxisUnitLabel");
853 : 0 : break;
854 : : case OBJECTTYPE_GRID:
855 [ + - ]: 1812 : aRet=C2U("Grid");
856 : 1812 : break;
857 : : case OBJECTTYPE_SUBGRID:
858 [ # # ]: 0 : aRet=C2U("SubGrid");
859 : 0 : break;
860 : : case OBJECTTYPE_DATA_SERIES:
861 [ + - ]: 9902 : aRet=C2U("Series");
862 : 9902 : break;
863 : : case OBJECTTYPE_DATA_POINT:
864 [ + - ]: 3393 : aRet=C2U("Point");
865 : 3393 : break;
866 : : case OBJECTTYPE_DATA_LABELS:
867 [ + - ]: 3606 : aRet=C2U("DataLabels");
868 : 3606 : break;
869 : : case OBJECTTYPE_DATA_LABEL:
870 [ + - ]: 3206 : aRet=C2U("DataLabel");
871 : 3206 : break;
872 : : case OBJECTTYPE_DATA_ERRORS_X:
873 [ # # ]: 0 : aRet=C2U("ErrorsX");
874 : 0 : break;
875 : : case OBJECTTYPE_DATA_ERRORS_Y:
876 [ + - ]: 1080 : aRet=C2U("ErrorsY");
877 : 1080 : break;
878 : : case OBJECTTYPE_DATA_ERRORS_Z:
879 [ # # ]: 0 : aRet=C2U("ErrorsZ");
880 : 0 : break;
881 : : case OBJECTTYPE_DATA_CURVE:
882 [ + - ]: 52 : aRet=C2U("Curve");
883 : 52 : break;
884 : : case OBJECTTYPE_DATA_CURVE_EQUATION:
885 [ + - ]: 108 : aRet=C2U("Equation");
886 : 108 : break;
887 : : case OBJECTTYPE_DATA_AVERAGE_LINE:
888 [ + - ]: 156 : aRet=C2U("Average");
889 : 156 : break;
890 : : case OBJECTTYPE_DATA_STOCK_RANGE:
891 [ # # ]: 0 : aRet=C2U("StockRange");
892 : 0 : break;
893 : : case OBJECTTYPE_DATA_STOCK_LOSS:
894 [ + - ]: 4 : aRet=C2U("StockLoss");
895 : 4 : break;
896 : : case OBJECTTYPE_DATA_STOCK_GAIN:
897 [ + - ]: 4 : aRet=C2U("StockGain");
898 : 4 : break;
899 : : default: //OBJECTTYPE_UNKNOWN
900 : : ;
901 : : }
902 : 38265 : return aRet;
903 : : }
904 : :
905 : 94980 : ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
906 : : {
907 : : ObjectType eRet;
908 : 94980 : sal_Int32 nLastSign = rCID.lastIndexOf( ':' );//last sign before the type string
909 [ + + ]: 94980 : if(nLastSign==-1)
910 : 57903 : nLastSign = rCID.lastIndexOf( '/' );
911 [ + + ]: 94980 : if(nLastSign==-1)
912 : : {
913 : 36828 : sal_Int32 nEndIndex = rCID.lastIndexOf( '=' );
914 [ + + ]: 36828 : if(nEndIndex==-1)
915 : 15852 : return OBJECTTYPE_UNKNOWN;
916 : 20976 : nLastSign = 0;
917 : : }
918 [ + + ]: 79128 : if( nLastSign>0 )
919 : 58152 : nLastSign++;
920 : :
921 [ + + ]: 79128 : if( rCID.match(C2U("Page"),nLastSign) )
922 : 16067 : eRet = OBJECTTYPE_PAGE;
923 [ + + ]: 63061 : else if( rCID.match(C2U("Title"),nLastSign) )
924 : 4423 : eRet = OBJECTTYPE_TITLE;
925 [ + + ]: 58638 : else if( rCID.match(C2U("LegendEntry"),nLastSign) )
926 : 3205 : eRet = OBJECTTYPE_LEGEND_ENTRY;
927 [ + + ]: 55433 : else if( rCID.match(C2U("Legend"),nLastSign) )
928 : 5344 : eRet = OBJECTTYPE_LEGEND;
929 [ + + ]: 50089 : else if( rCID.match(C2U("DiagramWall"),nLastSign) )
930 : 12 : eRet = OBJECTTYPE_DIAGRAM_WALL;
931 [ + + ]: 50077 : else if( rCID.match(C2U("DiagramFloor"),nLastSign) )
932 : 12 : eRet = OBJECTTYPE_DIAGRAM_FLOOR;
933 [ + + ]: 50065 : else if( rCID.match(C2U("D="),nLastSign) )
934 : 4530 : eRet = OBJECTTYPE_DIAGRAM;
935 [ - + ]: 45535 : else if( rCID.match(C2U("AxisUnitLabel"),nLastSign) )
936 : 0 : eRet = OBJECTTYPE_AXIS_UNITLABEL;
937 [ + + ]: 45535 : else if( rCID.match(C2U("Axis"),nLastSign) )
938 : 15315 : eRet = OBJECTTYPE_AXIS;
939 [ + + ]: 30220 : else if( rCID.match(C2U("Grid"),nLastSign) )
940 : 5562 : eRet = OBJECTTYPE_GRID;
941 [ - + ]: 24658 : else if( rCID.match(C2U("SubGrid"),nLastSign) )
942 : 0 : eRet = OBJECTTYPE_SUBGRID;
943 [ + + ]: 24658 : else if( rCID.match(C2U("Series"),nLastSign) )
944 : 16598 : eRet = OBJECTTYPE_DATA_SERIES;
945 [ + + ]: 8060 : else if( rCID.match(C2U("Point"),nLastSign) )
946 : 3358 : eRet = OBJECTTYPE_DATA_POINT;
947 [ + + ]: 4702 : else if( rCID.match(C2U("DataLabels"),nLastSign) )
948 : 3606 : eRet = OBJECTTYPE_DATA_LABELS;
949 [ - + ]: 1096 : else if( rCID.match(C2U("DataLabel"),nLastSign) )
950 : 0 : eRet = OBJECTTYPE_DATA_LABEL;
951 [ - + ]: 1096 : else if( rCID.match(C2U("ErrorsX"),nLastSign) )
952 : 0 : eRet = OBJECTTYPE_DATA_ERRORS_X;
953 [ + + ]: 1096 : else if( rCID.match(C2U("ErrorsY"),nLastSign) )
954 : 1080 : eRet = OBJECTTYPE_DATA_ERRORS_Y;
955 [ - + ]: 16 : else if( rCID.match(C2U("ErrorsZ"),nLastSign) )
956 : 0 : eRet = OBJECTTYPE_DATA_ERRORS_Z;
957 [ - + ]: 16 : else if( rCID.match(C2U("Curve"),nLastSign) )
958 : 0 : eRet = OBJECTTYPE_DATA_CURVE;
959 [ - + ]: 16 : else if( rCID.match(C2U("Equation"),nLastSign) )
960 : 0 : eRet = OBJECTTYPE_DATA_CURVE_EQUATION;
961 [ + - ]: 16 : else if( rCID.match(C2U("Average"),nLastSign) )
962 : 16 : eRet = OBJECTTYPE_DATA_AVERAGE_LINE;
963 [ # # ]: 0 : else if( rCID.match(C2U("StockRange"),nLastSign) )
964 : 0 : eRet = OBJECTTYPE_DATA_STOCK_RANGE;
965 [ # # ]: 0 : else if( rCID.match(C2U("StockLoss"),nLastSign) )
966 : 0 : eRet = OBJECTTYPE_DATA_STOCK_LOSS;
967 [ # # ]: 0 : else if( rCID.match(C2U("StockGain"),nLastSign) )
968 : 0 : eRet = OBJECTTYPE_DATA_STOCK_GAIN;
969 : : else
970 : 0 : eRet = OBJECTTYPE_UNKNOWN;
971 : :
972 : 94980 : return eRet;
973 : : }
974 : :
975 : 2271 : ObjectType ObjectIdentifier::getObjectType()
976 : : {
977 : 2271 : ObjectType eObjectType( OBJECTTYPE_UNKNOWN );
978 [ + - ]: 2271 : if ( isAutoGeneratedObject() )
979 : : {
980 : 2271 : eObjectType = getObjectType( m_aObjectCID );
981 : : }
982 [ # # ]: 0 : else if ( isAdditionalShape() )
983 : : {
984 : 0 : eObjectType = OBJECTTYPE_SHAPE;
985 : : }
986 : 2271 : return eObjectType;
987 : : }
988 : :
989 : 100 : OUString ObjectIdentifier::createDataCurveCID(
990 : : const OUString& rSeriesParticle
991 : : , sal_Int32 nCurveIndex
992 : : , bool bAverageLine )
993 : : {
994 : 100 : OUString aParticleID( OUString::valueOf( nCurveIndex ) );
995 [ + + ]: 100 : ObjectType eType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
996 [ + - ]: 100 : return createClassifiedIdentifierWithParent( eType, aParticleID, rSeriesParticle );
997 : : }
998 : :
999 : 108 : OUString ObjectIdentifier::createDataCurveEquationCID(
1000 : : const OUString& rSeriesParticle
1001 : : , sal_Int32 nCurveIndex )
1002 : : {
1003 : 108 : OUString aParticleID( OUString::valueOf( nCurveIndex ) );
1004 [ + - ]: 108 : return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION, aParticleID, rSeriesParticle );
1005 : : }
1006 : :
1007 : 1955 : OUString ObjectIdentifier::addChildParticle( const rtl::OUString& rParticle, const rtl::OUString& rChildParticle )
1008 : : {
1009 [ + - ]: 1955 : OUStringBuffer aRet(rParticle);
1010 : :
1011 [ + - ][ + - ]: 1955 : if( aRet.getLength() && !rChildParticle.isEmpty() )
[ + - ]
1012 [ + - ]: 1955 : aRet.appendAscii(":");
1013 [ + - ]: 1955 : if( !rChildParticle.isEmpty() )
1014 [ + - ]: 1955 : aRet.append(rChildParticle);
1015 : :
1016 [ + - ]: 1955 : return aRet.makeStringAndClear();
1017 : : }
1018 : :
1019 : 5160 : rtl::OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex )
1020 : : {
1021 [ + - ][ + - ]: 5160 : OUStringBuffer aRet( getStringForType( eObjectType ) );
1022 [ + - ]: 5160 : if( aRet.getLength() )
1023 : : {
1024 [ + - ]: 5160 : aRet.appendAscii("=");
1025 [ + - ]: 5160 : aRet.append(OUString::valueOf(nIndex));
1026 : : }
1027 [ + - ]: 5160 : return aRet.makeStringAndClear();
1028 : : }
1029 : :
1030 : 0 : sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const rtl::OUString& rParticleOrCID )
1031 : : {
1032 : 0 : sal_Int32 nRet = -1;
1033 : :
1034 [ # # ][ # # ]: 0 : OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, C2U("=") );
1035 : 0 : sal_Int32 nCharacterIndex=0;
1036 : 0 : nRet = lcl_StringToIndex( aIndexString.getToken( 0, ',', nCharacterIndex ) );
1037 : :
1038 : 0 : return nRet;
1039 : : }
1040 : :
1041 : 3358 : OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
1042 : : , const rtl::OUString& rSeriesParticle
1043 : : , const rtl::OUString& rDragMethodServiceName
1044 : : , const rtl::OUString& rDragParameterString )
1045 : : {
1046 [ + - ]: 3358 : OUString aChildParticle( getStringForType( eSubObjectType ) );
1047 [ + - ]: 3358 : aChildParticle+=(C2U("="));
1048 : :
1049 : : return createClassifiedIdentifierForParticles(
1050 : : rSeriesParticle, aChildParticle
1051 [ + - ]: 3358 : , rDragMethodServiceName, rDragParameterString );
1052 : : }
1053 : :
1054 : 15463 : OUString ObjectIdentifier::createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex )
1055 : : {
1056 : 15463 : OUString aRet(rPointCID_Stub);
1057 : 15463 : return aRet+=OUString::valueOf( nIndex );
1058 : : }
1059 : :
1060 : 6065 : OUString ObjectIdentifier::getParticleID( const OUString& rCID )
1061 : : {
1062 : 6065 : OUString aRet;
1063 : 6065 : sal_Int32 nLast = rCID.lastIndexOf('=');
1064 [ + - ]: 6065 : if(nLast>=0)
1065 : 6065 : aRet = rCID.copy(++nLast);
1066 : 6065 : return aRet;
1067 : : }
1068 : :
1069 : 2210 : OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID )
1070 : : {
1071 : 2210 : OUString aRet;
1072 : :
1073 : 2210 : sal_Int32 nStartPos = rCID.lastIndexOf('/');
1074 [ + - ]: 2210 : if( nStartPos>=0 )
1075 : : {
1076 : 2210 : nStartPos++;
1077 : 2210 : sal_Int32 nEndPos = rCID.lastIndexOf(':');
1078 [ + - ][ + + ]: 2210 : if( nEndPos>=0 && nStartPos < nEndPos )
1079 : : {
1080 : 852 : aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
1081 : : }
1082 : : }
1083 : :
1084 : 2210 : return aRet;
1085 : : }
1086 : :
1087 : 0 : OUString ObjectIdentifier::getObjectID( const rtl::OUString& rCID )
1088 : : {
1089 : 0 : OUString aRet;
1090 : :
1091 : 0 : sal_Int32 nStartPos = rCID.lastIndexOf('/');
1092 [ # # ]: 0 : if( nStartPos>=0 )
1093 : : {
1094 : 0 : nStartPos++;
1095 : 0 : sal_Int32 nEndPos = rCID.getLength();
1096 : 0 : aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
1097 : : }
1098 : :
1099 : 0 : return aRet;
1100 : : }
1101 : :
1102 : 0 : bool ObjectIdentifier::isCID( const OUString& rName )
1103 : : {
1104 [ # # ][ # # ]: 0 : return !rName.isEmpty() && rName.match( m_aProtocol );
1105 : : }
1106 : :
1107 : 0 : Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
1108 : : const OUString& rObjectCID,
1109 : : const Reference< chart2::XChartDocument >& xChartDocument )
1110 : : {
1111 : : return ObjectIdentifier::getObjectPropertySet(
1112 [ # # ]: 0 : rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY ));
1113 : : }
1114 : :
1115 : 6065 : Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
1116 : : const OUString& rObjectCID
1117 : : , const Reference< frame::XModel >& xChartModel )
1118 : : {
1119 : : //return the model object that is indicated by rObjectCID
1120 [ - + ]: 6065 : if(rObjectCID.isEmpty())
1121 [ # # ]: 0 : return NULL;
1122 [ - + ]: 6065 : if(!xChartModel.is())
1123 [ # # ]: 0 : return NULL;
1124 : :
1125 [ + - ]: 6065 : Reference< beans::XPropertySet > xObjectProperties = NULL;
1126 : : try
1127 : : {
1128 [ + - ]: 6065 : ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
1129 [ + - ]: 6065 : OUString aParticleID = ObjectIdentifier::getParticleID( rObjectCID );
1130 : :
1131 : 6065 : Reference< XDiagram > xDiagram;
1132 : 6065 : Reference< XCoordinateSystem > xCooSys;
1133 [ + - ]: 6065 : lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
1134 : :
1135 [ - + - - : 6065 : switch(eObjectType)
- - - + -
- - - - -
- - - - ]
1136 : : {
1137 : : case OBJECTTYPE_PAGE:
1138 : : {
1139 [ # # ]: 0 : Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
1140 [ # # ]: 0 : if( xChartDocument.is())
1141 [ # # ][ # # ]: 0 : xObjectProperties.set( xChartDocument->getPageBackground() );
[ # # ]
1142 : : }
1143 : 0 : break;
1144 : : case OBJECTTYPE_TITLE:
1145 : : {
1146 [ + - ]: 2210 : TitleHelper::eTitleType aTitleType = getTitleTypeForCID( rObjectCID );
1147 [ + - ]: 2210 : Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
1148 [ + - ]: 2210 : xObjectProperties.set( xTitle, uno::UNO_QUERY );
1149 : : }
1150 : 2210 : break;
1151 : : case OBJECTTYPE_LEGEND:
1152 : : {
1153 [ # # ]: 0 : if( xDiagram.is() )
1154 [ # # ][ # # ]: 0 : xObjectProperties.set( xDiagram->getLegend(), uno::UNO_QUERY );
[ # # ]
1155 : : }
1156 : 0 : break;
1157 : : case OBJECTTYPE_LEGEND_ENTRY:
1158 : 0 : break;
1159 : : case OBJECTTYPE_DIAGRAM:
1160 : : {
1161 [ # # ]: 0 : xObjectProperties.set( xDiagram, uno::UNO_QUERY );
1162 : : }
1163 : 0 : break;
1164 : : case OBJECTTYPE_DIAGRAM_WALL:
1165 : : {
1166 [ # # ]: 0 : if( xDiagram.is() )
1167 [ # # ][ # # ]: 0 : xObjectProperties.set( xDiagram->getWall() );
[ # # ]
1168 : : }
1169 : 0 : break;
1170 : : case OBJECTTYPE_DIAGRAM_FLOOR:
1171 : : {
1172 [ # # ]: 0 : if( xDiagram.is() )
1173 [ # # ][ # # ]: 0 : xObjectProperties.set( xDiagram->getFloor() );
[ # # ]
1174 : : }
1175 : 0 : break;
1176 : : case OBJECTTYPE_AXIS:
1177 : : {
1178 : 3855 : sal_Int32 nDimensionIndex = -1;
1179 : 3855 : sal_Int32 nAxisIndex = -1;
1180 [ + - ]: 3855 : lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
1181 : :
1182 : : Reference< chart2::XAxis > xAxis(
1183 [ + - ]: 3855 : AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
1184 [ + - ]: 3855 : if( xAxis.is() )
1185 [ + - ]: 3855 : xObjectProperties.set( xAxis, uno::UNO_QUERY );
1186 : : }
1187 : 3855 : break;
1188 : : case OBJECTTYPE_AXIS_UNITLABEL:
1189 : 0 : break;
1190 : : case OBJECTTYPE_GRID:
1191 : : case OBJECTTYPE_SUBGRID:
1192 : : {
1193 : 0 : sal_Int32 nDimensionIndex = -1;
1194 : 0 : sal_Int32 nAxisIndex = -1;
1195 [ # # ]: 0 : lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
1196 : :
1197 : 0 : sal_Int32 nSubGridIndex = -1;
1198 [ # # ]: 0 : lcl_parseGridIndices( nSubGridIndex, rObjectCID );
1199 : :
1200 [ # # ][ # # ]: 0 : xObjectProperties.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, nAxisIndex, nSubGridIndex ) );
1201 : : }
1202 : 0 : break;
1203 : : case OBJECTTYPE_DATA_LABELS:
1204 : : case OBJECTTYPE_DATA_SERIES:
1205 : : {
1206 : : Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
1207 [ # # ]: 0 : rObjectCID, xChartModel ) );
1208 [ # # ]: 0 : if( xSeries.is() )
1209 [ # # ][ # # ]: 0 : xObjectProperties = Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY );
1210 : :
1211 : 0 : break;
1212 : : }
1213 : : case OBJECTTYPE_DATA_LABEL:
1214 : : case OBJECTTYPE_DATA_POINT:
1215 : : {
1216 : : Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
1217 [ # # ]: 0 : rObjectCID, xChartModel ) );
1218 [ # # ]: 0 : if(xSeries.is())
1219 : : {
1220 : 0 : sal_Int32 nIndex = aParticleID.toInt32();
1221 [ # # ][ # # ]: 0 : xObjectProperties = xSeries->getDataPointByIndex( nIndex );
[ # # ]
1222 : : }
1223 : 0 : break;
1224 : : }
1225 : : case OBJECTTYPE_DATA_ERRORS_X:
1226 : : case OBJECTTYPE_DATA_ERRORS_Y:
1227 : : case OBJECTTYPE_DATA_ERRORS_Z:
1228 : : {
1229 : : Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
1230 [ # # ]: 0 : rObjectCID, xChartModel ) );
1231 [ # # ]: 0 : if(xSeries.is())
1232 : : {
1233 [ # # ]: 0 : Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
1234 : 0 : Reference< beans::XPropertySet > xErrorBarProp;
1235 [ # # ]: 0 : if( xSeriesProp.is() )
1236 : : {
1237 : 0 : OUString errorBar;
1238 : :
1239 [ # # ]: 0 : if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
1240 [ # # ]: 0 : errorBar = C2U("ErrorBarX");
1241 [ # # ]: 0 : else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
1242 [ # # ]: 0 : errorBar = C2U("ErrorBarY");
1243 : : else
1244 [ # # ]: 0 : errorBar = C2U("ErrorBarZ");
1245 : :
1246 [ # # ][ # # ]: 0 : xSeriesProp->getPropertyValue( errorBar ) >>= xErrorBarProp;
[ # # ]
1247 [ # # ][ # # ]: 0 : xObjectProperties = Reference< beans::XPropertySet >( xErrorBarProp, uno::UNO_QUERY );
1248 : 0 : }
1249 : : }
1250 : 0 : break;
1251 : : }
1252 : : case OBJECTTYPE_DATA_AVERAGE_LINE:
1253 : : case OBJECTTYPE_DATA_CURVE:
1254 : : case OBJECTTYPE_DATA_CURVE_EQUATION:
1255 : : {
1256 : : Reference< XRegressionCurveContainer > xRegressionContainer( ObjectIdentifier::getDataSeriesForCID(
1257 [ # # ][ # # ]: 0 : rObjectCID, xChartModel ), uno::UNO_QUERY );
1258 [ # # ]: 0 : if(xRegressionContainer.is())
1259 : : {
1260 : 0 : sal_Int32 nIndex = aParticleID.toInt32();
1261 : : uno::Sequence< Reference< XRegressionCurve > > aCurveList =
1262 [ # # ][ # # ]: 0 : xRegressionContainer->getRegressionCurves();
1263 [ # # ][ # # ]: 0 : if( nIndex >= 0 && nIndex <aCurveList.getLength() )
[ # # ]
1264 : : {
1265 [ # # ]: 0 : if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
1266 [ # # ][ # # ]: 0 : xObjectProperties.set( aCurveList[nIndex]->getEquationProperties());
[ # # ][ # # ]
1267 : : else
1268 [ # # ][ # # ]: 0 : xObjectProperties.set( aCurveList[nIndex], uno::UNO_QUERY );
1269 [ # # ]: 0 : }
1270 : : }
1271 : 0 : break;
1272 : : }
1273 : : case OBJECTTYPE_DATA_STOCK_RANGE:
1274 : 0 : break;
1275 : : case OBJECTTYPE_DATA_STOCK_LOSS:
1276 : : {
1277 [ # # ]: 0 : Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
1278 [ # # ]: 0 : Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
1279 [ # # ]: 0 : if(xChartTypeProps.is())
1280 [ # # ][ # # ]: 0 : xChartTypeProps->getPropertyValue( C2U( "BlackDay" ) ) >>= xObjectProperties;
[ # # ][ # # ]
1281 : : }
1282 : 0 : break;
1283 : : case OBJECTTYPE_DATA_STOCK_GAIN:
1284 : : {
1285 [ # # ]: 0 : Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
1286 [ # # ]: 0 : Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
1287 [ # # ]: 0 : if(xChartTypeProps.is())
1288 [ # # ][ # # ]: 0 : xChartTypeProps->getPropertyValue( C2U( "WhiteDay" ) ) >>= xObjectProperties;
[ # # ][ # # ]
1289 : : }
1290 : 0 : break;
1291 : : default: //OBJECTTYPE_UNKNOWN
1292 : 0 : break;
1293 [ # # ]: 6065 : }
1294 : : }
1295 [ # # ]: 0 : catch(const uno::Exception& ex)
1296 : : {
1297 : : ASSERT_EXCEPTION( ex );
1298 : : }
1299 : 6065 : return xObjectProperties;
1300 : : }
1301 : :
1302 : 1812 : Reference< XAxis > ObjectIdentifier::getAxisForCID(
1303 : : const OUString& rObjectCID
1304 : : , const Reference< frame::XModel >& xChartModel )
1305 : : {
1306 : 1812 : Reference< XDiagram > xDiagram;
1307 : 1812 : Reference< XCoordinateSystem > xCooSys;
1308 [ + - ]: 1812 : lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
1309 : :
1310 : 1812 : sal_Int32 nDimensionIndex = -1;
1311 : 1812 : sal_Int32 nAxisIndex = -1;
1312 [ + - ]: 1812 : lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
1313 : :
1314 [ + - ]: 1812 : return AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys );
1315 : : }
1316 : :
1317 : 9073 : Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
1318 : : const OUString& rObjectCID
1319 : : , const Reference< frame::XModel >& xChartModel )
1320 : : {
1321 [ + - ]: 9073 : Reference< XDataSeries > xSeries(NULL);
1322 : :
1323 : 9073 : Reference< XDiagram > xDiagram;
1324 : 9073 : Reference< XCoordinateSystem > xCooSys;
1325 [ + - ]: 9073 : lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
1326 : :
1327 : 9073 : sal_Int32 nChartTypeIndex = -1;
1328 : 9073 : sal_Int32 nSeriesIndex = -1;
1329 : 9073 : sal_Int32 nPointIndex = -1;
1330 [ + - ]: 9073 : lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rObjectCID );
1331 : :
1332 [ + - ][ + - ]: 9073 : Reference< XDataSeriesContainer > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ), uno::UNO_QUERY );
1333 [ + + ]: 9073 : if( xDataSeriesContainer.is() )
1334 : : {
1335 [ + - ][ + - ]: 6712 : uno::Sequence< uno::Reference< XDataSeries > > aDataSeriesSeq( xDataSeriesContainer->getDataSeries() );
1336 [ + - ][ + - ]: 6712 : if( nSeriesIndex >= 0 && nSeriesIndex < aDataSeriesSeq.getLength() )
[ + - ]
1337 [ + - ][ + - ]: 6712 : xSeries.set( aDataSeriesSeq[nSeriesIndex] );
[ + - ]
1338 : : }
1339 : :
1340 : 9073 : return xSeries;
1341 : : }
1342 : :
1343 : 0 : Reference< XDiagram > ObjectIdentifier::getDiagramForCID(
1344 : : const rtl::OUString& rObjectCID
1345 : : , const uno::Reference< frame::XModel >& xChartModel )
1346 : : {
1347 : 0 : Reference< XDiagram > xDiagram;
1348 : :
1349 : 0 : Reference< XCoordinateSystem > xCooSys;
1350 [ # # ]: 0 : lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
1351 : :
1352 : 0 : return xDiagram;
1353 : : }
1354 : :
1355 : 2210 : TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rCID )
1356 : : {
1357 : 2210 : TitleHelper::eTitleType eRet( TitleHelper::MAIN_TITLE );
1358 : :
1359 [ + - ]: 2210 : OUString aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
1360 [ + - ]: 2210 : const tTitleMap& rMap = lcl_getTitleMap();
1361 : 2210 : tTitleMap::const_iterator aIt( rMap.begin() );
1362 [ + - ]: 3062 : for( ;aIt != rMap.end(); ++aIt )
1363 : : {
1364 [ + + ]: 3062 : if( aParentParticle.equals( (*aIt).second ) )
1365 : : {
1366 : 2210 : eRet = (*aIt).first;
1367 : 2210 : break;
1368 : : }
1369 : : }
1370 : :
1371 : 2210 : return eRet;
1372 : : }
1373 : :
1374 : 0 : OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID )
1375 : : {
1376 : 0 : sal_Int32 nDiagramIndex = -1;
1377 : 0 : sal_Int32 nCooSysIndex = -1;
1378 [ # # ]: 0 : lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rCID );
1379 : :
1380 : 0 : sal_Int32 nChartTypeIndex = -1;
1381 : 0 : sal_Int32 nSeriesIndex = -1;
1382 : 0 : sal_Int32 nPointIndex = -1;
1383 [ # # ]: 0 : lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rCID );
1384 : :
1385 [ # # ]: 0 : return ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
1386 : : }
1387 : :
1388 : 0 : OUString ObjectIdentifier::getMovedSeriesCID( const ::rtl::OUString& rObjectCID, sal_Bool bForward )
1389 : : {
1390 [ # # ][ # # ]: 0 : sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CID/D=") ) );
1391 [ # # ][ # # ]: 0 : sal_Int32 nCooSysIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CS=") ) );
1392 [ # # ][ # # ]: 0 : sal_Int32 nChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("CT=") ) );
1393 [ # # ][ # # ]: 0 : sal_Int32 nSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, C2U("Series=") ) );
1394 : :
1395 [ # # ]: 0 : if( bForward )
1396 : 0 : nSeriesIndex--;
1397 : : else
1398 : 0 : nSeriesIndex++;
1399 : :
1400 [ # # ]: 0 : OUString aRet = ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
1401 [ # # ]: 0 : return ObjectIdentifier::createClassifiedIdentifierForParticle( aRet );
1402 : : }
1403 : :
1404 : 55701 : bool ObjectIdentifier::isValid() const
1405 : : {
1406 [ + + ][ - + ]: 55701 : return ( isAutoGeneratedObject() || isAdditionalShape() );
1407 : : }
1408 : :
1409 : 65770 : bool ObjectIdentifier::isAutoGeneratedObject() const
1410 : : {
1411 : 65770 : return ( !m_aObjectCID.isEmpty() );
1412 : : }
1413 : :
1414 : 2497 : bool ObjectIdentifier::isAdditionalShape() const
1415 : : {
1416 : 2497 : return m_xAdditionalShape.is();
1417 : : }
1418 : :
1419 : 36750 : OUString ObjectIdentifier::getObjectCID() const
1420 : : {
1421 : 36750 : return m_aObjectCID;
1422 : : }
1423 : :
1424 : 0 : Reference< drawing::XShape > ObjectIdentifier::getAdditionalShape() const
1425 : : {
1426 : 0 : return m_xAdditionalShape;
1427 : : }
1428 : :
1429 : 0 : Any ObjectIdentifier::getAny() const
1430 : : {
1431 : 0 : Any aAny;
1432 [ # # ][ # # ]: 0 : if ( isAutoGeneratedObject() )
1433 : : {
1434 [ # # ][ # # ]: 0 : aAny = uno::makeAny( getObjectCID() );
1435 : : }
1436 [ # # ][ # # ]: 0 : else if ( isAdditionalShape() )
1437 : : {
1438 [ # # ][ # # ]: 0 : aAny = uno::makeAny( getAdditionalShape() );
1439 : : }
1440 : 0 : return aAny;
1441 : : }
1442 : :
1443 : : //.............................................................................
1444 [ + - ][ + - ]: 48 : } //namespace chart
1445 : : //.............................................................................
1446 : :
1447 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|