LCOV - code coverage report
Current view: top level - chart2/source/inc - ObjectIdentifier.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 2 50.0 %
Date: 2014-11-03 Functions: 1 2 50.0 %
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             : #ifndef INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX
      20             : #define INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX
      21             : 
      22             : #include <com/sun/star/chart2/XChartType.hpp>
      23             : #include <com/sun/star/chart2/XDiagram.hpp>
      24             : #include <com/sun/star/chart2/XCoordinateSystem.hpp>
      25             : #include <com/sun/star/chart2/XDataSeries.hpp>
      26             : #include <com/sun/star/chart2/XChartDocument.hpp>
      27             : #include "TitleHelper.hxx"
      28             : #include "charttoolsdllapi.hxx"
      29             : #include "ChartModel.hxx"
      30             : 
      31             : #include <rtl/ustring.hxx>
      32             : #include <com/sun/star/frame/XModel.hpp>
      33             : #include <com/sun/star/beans/XPropertySet.hpp>
      34             : #include <com/sun/star/awt/Point.hpp>
      35             : #include <com/sun/star/drawing/XShape.hpp>
      36             : 
      37             : namespace chart
      38             : {
      39             : 
      40             : /**
      41             : */
      42             : enum ObjectType
      43             : {
      44             :     OBJECTTYPE_PAGE,
      45             :     OBJECTTYPE_TITLE,
      46             :     OBJECTTYPE_LEGEND,
      47             :     OBJECTTYPE_LEGEND_ENTRY,
      48             :     OBJECTTYPE_DIAGRAM,
      49             :     OBJECTTYPE_DIAGRAM_WALL,
      50             :     OBJECTTYPE_DIAGRAM_FLOOR,
      51             :     OBJECTTYPE_AXIS,
      52             :     OBJECTTYPE_AXIS_UNITLABEL,
      53             :     OBJECTTYPE_GRID,
      54             :     OBJECTTYPE_SUBGRID,
      55             :     OBJECTTYPE_DATA_SERIES,
      56             :     OBJECTTYPE_DATA_POINT,
      57             :     OBJECTTYPE_DATA_LABELS,
      58             :     OBJECTTYPE_DATA_LABEL,
      59             :     OBJECTTYPE_DATA_ERRORS_X,
      60             :     OBJECTTYPE_DATA_ERRORS_Y,
      61             :     OBJECTTYPE_DATA_ERRORS_Z,
      62             :     OBJECTTYPE_DATA_CURVE,//e.g. a statistical method printed as line
      63             :     OBJECTTYPE_DATA_AVERAGE_LINE,
      64             :     OBJECTTYPE_DATA_CURVE_EQUATION,
      65             :     OBJECTTYPE_DATA_STOCK_RANGE,
      66             :     OBJECTTYPE_DATA_STOCK_LOSS,
      67             :     OBJECTTYPE_DATA_STOCK_GAIN,
      68             :     OBJECTTYPE_SHAPE,
      69             :     OBJECTTYPE_UNKNOWN
      70             : };
      71             : 
      72             : class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
      73             : {
      74             :     //CID == ClassifiedIdentifier <--> name of shape
      75             :     //semicolon, colon, equal sign and slash have special meanings in a CID
      76             :     //and are therefore not allowed in its components
      77             : 
      78             :     //syntax of a CID:  CID:/classification/ObjectID
      79             : 
      80             :     //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString"
      81             :     //                      or a combination of these separated with a colon
      82             :     //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose
      83             :     //where DragParameterString is any string you like to transport information to your special drag service
      84             :     //                            only semicolon, colon, equal sign and slash are not allowed characters
      85             :     //                            also the keywors used in the ObjectIdentifiers are not allowed
      86             : 
      87             :     //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22
      88             :     //where Particle: Type=ParticleID //e.g. Point=22
      89             :     //where Type: getStringForType( ObjectType eType ) or other string
      90             : 
      91             : public:
      92             :     ObjectIdentifier();
      93             :     ObjectIdentifier( const OUString& rObjectCID );
      94             :     ObjectIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
      95             :     ObjectIdentifier( const ::com::sun::star::uno::Any& rAny );
      96             :     virtual ~ObjectIdentifier();
      97             : 
      98             :     ObjectIdentifier( const ObjectIdentifier& rOID );
      99             :     ObjectIdentifier& operator=( const ObjectIdentifier& rOID );
     100             :     bool operator==( const ObjectIdentifier& rOID ) const;
     101             :     bool operator!=( const ObjectIdentifier& rOID ) const;
     102             :     bool operator<( const ObjectIdentifier& rOID ) const;
     103             : 
     104             :     static OUString createClassifiedIdentifierForObject(
     105             :           const ::com::sun::star::uno::Reference<
     106             :                     ::com::sun::star::uno::XInterface >& xObject
     107             :         , ChartModel& rModel);
     108             : 
     109             :     static OUString createClassifiedIdentifierForObject(
     110             :           const ::com::sun::star::uno::Reference<
     111             :                     ::com::sun::star::uno::XInterface >& xObject
     112             :         , const ::com::sun::star::uno::Reference<
     113             :                     ::com::sun::star::frame::XModel >& xChartModel );
     114             : 
     115             :     static OUString createClassifiedIdentifierForParticle(
     116             :         const OUString& rParticle );
     117             : 
     118             :     static OUString createClassifiedIdentifierForParticles(
     119             :             const OUString& rParentParticle
     120             :           , const OUString& rChildParticle
     121             :           , const OUString& rDragMethodServiceName = OUString()
     122             :           , const OUString& rDragParameterString = OUString() );
     123             : 
     124             :     static OUString createClassifiedIdentifierForGrid(
     125             :           const ::com::sun::star::uno::Reference<
     126             :                     ::com::sun::star::chart2::XAxis >& xAxis
     127             :         , const ::com::sun::star::uno::Reference<
     128             :                     ::com::sun::star::frame::XModel >& xChartModel
     129             :         , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
     130             : 
     131             :     SAL_DLLPRIVATE static OUString createParticleForDiagram(
     132             :           const ::com::sun::star::uno::Reference<
     133             :                     ::com::sun::star::chart2::XDiagram >& xDiagram
     134             :         , ChartModel& rModel);
     135             : 
     136             :     SAL_DLLPRIVATE static OUString createParticleForDiagram(
     137             :           const ::com::sun::star::uno::Reference<
     138             :                     ::com::sun::star::chart2::XDiagram >& xDiagram
     139             :         , const ::com::sun::star::uno::Reference<
     140             :                     ::com::sun::star::frame::XModel >& xChartModel );
     141             : 
     142             :     static OUString createParticleForCoordinateSystem(
     143             :           const ::com::sun::star::uno::Reference<
     144             :                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
     145             :         , ChartModel& rModel );
     146             : 
     147             :     static OUString createParticleForCoordinateSystem(
     148             :           const ::com::sun::star::uno::Reference<
     149             :                     ::com::sun::star::chart2::XCoordinateSystem >& xCooSys
     150             :         , const ::com::sun::star::uno::Reference<
     151             :                     ::com::sun::star::frame::XModel >& xChartModel );
     152             : 
     153             :     static OUString createParticleForAxis(
     154             :                       sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
     155             : 
     156             :     static OUString createParticleForGrid(
     157             :                       sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
     158             : 
     159             :     static OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
     160             :             , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex );
     161             : 
     162             :     static OUString createParticleForLegend(
     163             :           const ::com::sun::star::uno::Reference<
     164             :                     ::com::sun::star::chart2::XLegend >& xLegend
     165             :         , ChartModel& rModel );
     166             : 
     167             :     static OUString createParticleForLegend(
     168             :           const ::com::sun::star::uno::Reference<
     169             :                     ::com::sun::star::chart2::XLegend >& xLegend
     170             :         , const ::com::sun::star::uno::Reference<
     171             :                     ::com::sun::star::frame::XModel >& xChartModel );
     172             : 
     173             :     static OUString addChildParticle( const OUString& rParticle, const OUString& rChildParticle );
     174             :     static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
     175             :     static sal_Int32 getIndexFromParticleOrCID( const OUString& rParticleOrCID );
     176             : 
     177             :     static OUString createClassifiedIdentifier(
     178             :         enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
     179             :         , const OUString& rParticleID );//e.g. SeriesID
     180             : 
     181             :     static OUString createClassifiedIdentifierWithParent(
     182             :         enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
     183             :         , const OUString& rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object
     184             :         , const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
     185             :         , const OUString& rDragMethodServiceName = OUString()
     186             :         , const OUString& rDragParameterString = OUString()
     187             :         );
     188             : 
     189             :     static bool isCID( const OUString& rName );
     190             :     static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier );
     191             :     static OUString getDragParameterString( const OUString& rCID );
     192             :     static bool isDragableObject( const OUString& rClassifiedIdentifier );
     193             :     bool isDragableObject();
     194             :     static bool isRotateableObject( const OUString& rClassifiedIdentifier );
     195             :     static bool isMultiClickObject( const OUString& rClassifiedIdentifier );
     196             :     static bool areSiblings( const OUString& rCID1, const OUString& rCID2 );//identical object is no sibling
     197             :     static bool areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 );
     198             : 
     199             :     static OUString getStringForType( ObjectType eObjectType );
     200             :     static ObjectType    getObjectType( const OUString& rCID );
     201             :     ObjectType getObjectType();
     202             : 
     203             :     static OUString createSeriesSubObjectStub( ObjectType eSubObjectType
     204             :                     , const OUString& rSeriesParticle
     205             :                     , const OUString& rDragMethodServiceName = OUString()
     206             :                     , const OUString& rDragParameterString = OUString() );
     207             :     static OUString createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex  );
     208             : 
     209             :     static OUString createDataCurveCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
     210             :     static OUString createDataCurveEquationCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex );
     211             : 
     212             :     SAL_DLLPRIVATE static OUString getObjectID( const OUString& rCID );
     213             :     static OUString getParticleID( const OUString& rCID );
     214             :     static OUString getFullParentParticle( const OUString& rCID );
     215             : 
     216             :     //returns the series particle of a CID when the CID is a child of the series
     217             :     static OUString getSeriesParticleFromCID( const OUString& rCID );
     218             : 
     219             :     //return the model object that is indicated by rObjectCID
     220             :     static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     221             :             getObjectPropertySet(
     222             :                   const OUString& rObjectCID
     223             :                 , const ::com::sun::star::uno::Reference<
     224             :                     ::com::sun::star::frame::XModel >& xChartModel );
     225             :     static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
     226             :             getObjectPropertySet(
     227             :                   const OUString& rObjectCID
     228             :                 , const ::com::sun::star::uno::Reference<
     229             :                     ::com::sun::star::chart2::XChartDocument >& xChartDocument );
     230             : 
     231             :     //return the axis object that belongs to rObjectCID if any
     232             :     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >
     233             :             getAxisForCID(
     234             :                   const OUString& rObjectCID
     235             :                 , const ::com::sun::star::uno::Reference<
     236             :                     ::com::sun::star::frame::XModel >& xChartModel );
     237             : 
     238             :     //return the series object that belongs to rObjectCID if any
     239             :     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >
     240             :             getDataSeriesForCID(
     241             :                   const OUString& rObjectCID
     242             :                 , const ::com::sun::star::uno::Reference<
     243             :                     ::com::sun::star::frame::XModel >& xChartModel );
     244             : 
     245             :     static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >
     246             :             getDiagramForCID(
     247             :                   const OUString& rObjectCID
     248             :                 , const ::com::sun::star::uno::Reference<
     249             :                     ::com::sun::star::frame::XModel >& xChartModel );
     250             : 
     251             :     static const OUString& getPieSegmentDragMethodServiceName();
     252             :     static OUString createPieSegmentDragParameterString(
     253             :           sal_Int32 nOffsetPercent
     254             :         , const ::com::sun::star::awt::Point& rMinimumPosition
     255             :         , const ::com::sun::star::awt::Point& rMaximumPosition );
     256             :     static bool parsePieSegmentDragParameterString( const OUString& rDragParameterString
     257             :         , sal_Int32& rOffsetPercent
     258             :         , ::com::sun::star::awt::Point& rMinimumPosition
     259             :         , ::com::sun::star::awt::Point& rMaximumPosition );
     260             : 
     261             :     static TitleHelper::eTitleType getTitleTypeForCID( const OUString& rCID );
     262             : 
     263             :     static OUString getMovedSeriesCID( const OUString& rObjectCID, bool bForward );
     264             : 
     265             :     bool isValid() const;
     266             :     bool isAutoGeneratedObject() const;
     267             :     bool isAdditionalShape() const;
     268       19381 :     OUString getObjectCID() const { return m_aObjectCID;}
     269           0 :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getAdditionalShape() const { return m_xAdditionalShape;}
     270             :     ::com::sun::star::uno::Any getAny() const;
     271             : 
     272             : private:
     273             :     // #i12587# support for shapes in chart
     274             :     // For autogenerated chart objects a CID is specified in m_aObjectCID,
     275             :     // for all other objects m_xAdditionalShape is set.
     276             :     // Note, that if m_aObjectCID is set, m_xAdditionalShape must be empty
     277             :     // and vice versa.
     278             :     OUString m_aObjectCID;
     279             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xAdditionalShape;
     280             : };
     281             : 
     282             : } //namespace chart
     283             : #endif
     284             : 
     285             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10