LCOV - code coverage report
Current view: top level - chart2/source/tools - ObjectIdentifier.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 503 819 61.4 %
Date: 2014-04-11 Functions: 58 79 73.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10