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