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