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