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