1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ObjectIdentifier.hxx,v $
10 * $Revision: 1.6.44.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef _CHART2_OBJECTIDENTIFIER_HXX
31 #define _CHART2_OBJECTIDENTIFIER_HXX
33 #include <com/sun/star/chart2/XChartType.hpp>
34 #include <com/sun/star/chart2/XDiagram.hpp>
35 #include <com/sun/star/chart2/XCoordinateSystem.hpp>
36 #include <com/sun/star/chart2/XDataSeries.hpp>
37 #include <com/sun/star/chart2/XChartDocument.hpp>
38 #include "TitleHelper.hxx"
39 #include "charttoolsdllapi.hxx"
41 // header for class OUString
42 #include <rtl/ustring.hxx>
43 #include <com/sun/star/frame/XModel.hpp>
44 #include <com/sun/star/beans/XPropertySet.hpp>
45 #include <com/sun/star/awt/Point.hpp>
47 //.............................................................................
50 //.............................................................................
52 //-----------------------------------------------------------------------------
60 OBJECTTYPE_LEGEND_ENTRY
,
62 OBJECTTYPE_DIAGRAM_WALL
,
63 OBJECTTYPE_DIAGRAM_FLOOR
,
65 OBJECTTYPE_AXIS_UNITLABEL
,
68 OBJECTTYPE_DATA_SERIES
,
69 OBJECTTYPE_DATA_POINT
,
70 OBJECTTYPE_DATA_LABELS
,
71 OBJECTTYPE_DATA_LABEL
,
72 OBJECTTYPE_DATA_ERRORS
,
73 OBJECTTYPE_DATA_ERRORS_X
,
74 OBJECTTYPE_DATA_ERRORS_Y
,
75 OBJECTTYPE_DATA_ERRORS_Z
,
76 OBJECTTYPE_DATA_CURVE
,//e.g. a statistical method printed as line
77 OBJECTTYPE_DATA_AVERAGE_LINE
,
78 OBJECTTYPE_DATA_CURVE_EQUATION
,
79 OBJECTTYPE_DATA_STOCK_RANGE
,
80 OBJECTTYPE_DATA_STOCK_LOSS
,
81 OBJECTTYPE_DATA_STOCK_GAIN
,
85 class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
87 //CID == ClassifiedIdentifier <--> name of shape
88 //semicolon, colon, equal sign and slash have special meanings in a CID
89 //and are therefore not allowed in its components
91 //syntax of a CID: CID:/classification/ObjectID
93 //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString"
94 // or a combination of these seperated with a colon
95 //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose
96 //where DragParameterString is any string you like to transport information to your special drag service
97 // only semicolon, colon, equal sign and slash are not allowed characters
98 // also the keywors used in the ObjectIdentifiers are not allowed
100 //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22
101 //where Particle: Type=ParticleID //e.g. Point=22
102 //where Type: getStringForType( ObjectType eType ) or other string
105 static rtl::OUString
createClassifiedIdentifierForObject(
106 const ::com::sun::star::uno::Reference
<
107 ::com::sun::star::uno::XInterface
>& xObject
108 , const ::com::sun::star::uno::Reference
<
109 ::com::sun::star::frame::XModel
>& xChartModel
);
111 static rtl::OUString
createClassifiedIdentifierForParticle(
112 const rtl::OUString
& rParticle
);
114 static rtl::OUString
createClassifiedIdentifierForParticles(
115 const rtl::OUString
& rParentParticle
116 , const rtl::OUString
& rChildParticle
117 , const rtl::OUString
& rDragMethodServiceName
= rtl::OUString()
118 , const rtl::OUString
& rDragParameterString
= rtl::OUString() );
120 static rtl::OUString
createClassifiedIdentifierForGrid(
121 const ::com::sun::star::uno::Reference
<
122 ::com::sun::star::chart2::XAxis
>& xAxis
123 , const ::com::sun::star::uno::Reference
<
124 ::com::sun::star::frame::XModel
>& xChartModel
125 , sal_Int32 nSubIndex
= -1 );//-1: main grid, 0: first subgrid etc
127 SAL_DLLPRIVATE
static rtl::OUString
createParticleForDiagram(
128 const ::com::sun::star::uno::Reference
<
129 ::com::sun::star::chart2::XDiagram
>& xDiagram
130 , const ::com::sun::star::uno::Reference
<
131 ::com::sun::star::frame::XModel
>& xChartModel
);
134 static rtl::OUString
createParticleForCoordinateSystem(
135 const ::com::sun::star::uno::Reference
<
136 ::com::sun::star::chart2::XCoordinateSystem
>& xCooSys
137 , const ::com::sun::star::uno::Reference
<
138 ::com::sun::star::frame::XModel
>& xChartModel
);
140 static rtl::OUString
createParticleForAxis(
141 sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
143 static rtl::OUString
createParticleForGrid(
144 sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
146 static rtl::OUString
createParticleForSeries( sal_Int32 nDiagramIndex
, sal_Int32 nCooSysIndex
147 , sal_Int32 nChartTypeIndex
, sal_Int32 nSeriesIndex
);
149 static rtl::OUString
createParticleForLegend(
150 const ::com::sun::star::uno::Reference
<
151 ::com::sun::star::chart2::XLegend
>& xLegend
152 , const ::com::sun::star::uno::Reference
<
153 ::com::sun::star::frame::XModel
>& xChartModel
);
155 static rtl::OUString
addChildParticle( const rtl::OUString
& rParticle
, const rtl::OUString
& rChildParticle
);
156 static rtl::OUString
createChildParticleWithIndex( ObjectType eObjectType
, sal_Int32 nIndex
);
157 static sal_Int32
getIndexFromParticleOrCID( const rtl::OUString
& rParticleOrCID
);
159 static rtl::OUString
createClassifiedIdentifier(
160 enum ObjectType eObjectType
//e.g. OBJECTTYPE_DATA_SERIES
161 , const rtl::OUString
& rParticleID
);//e.g. SeriesID
163 static rtl::OUString
createClassifiedIdentifierWithParent(
164 enum ObjectType
//e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
165 , const rtl::OUString
& rParticleID
//for points or subgrids this is an Index or otherwise an identifier from the model object
166 , const rtl::OUString
& rParentPartical
//e.g. "Series=SeriesID" or "Grid=GridId"
167 , const rtl::OUString
& rDragMethodServiceName
= rtl::OUString()
168 , const rtl::OUString
& rDragParameterString
= rtl::OUString()
171 static bool isCID( const rtl::OUString
& rName
);
172 static rtl::OUString
getDragMethodServiceName( const rtl::OUString
& rClassifiedIdentifier
);
173 static rtl::OUString
getDragParameterString( const rtl::OUString
& rCID
);
174 static bool isDragableObject( const rtl::OUString
& rClassifiedIdentifier
);
175 static bool isRotateableObject( const rtl::OUString
& rClassifiedIdentifier
);
176 static bool isMultiClickObject( const rtl::OUString
& rClassifiedIdentifier
);
177 static bool areSiblings( const rtl::OUString
& rCID1
, const rtl::OUString
& rCID2
);//identical object is no sibling
178 static bool areIdenticalObjects( const ::rtl::OUString
& rCID1
, const ::rtl::OUString
& rCID2
);
180 static rtl::OUString
getStringForType( ObjectType eObjectType
);
181 static ObjectType
getObjectType( const rtl::OUString
& rCID
);
183 static rtl::OUString
createSeriesSubObjectStub( ObjectType eSubObjectType
184 , const rtl::OUString
& rSeriesParticle
185 , const rtl::OUString
& rDragMethodServiceName
= rtl::OUString()
186 , const rtl::OUString
& rDragParameterString
= rtl::OUString() );
187 static rtl::OUString
createPointCID( const rtl::OUString
& rPointCID_Stub
, sal_Int32 nIndex
);
189 static rtl::OUString
createDataCurveCID( const rtl::OUString
& rSeriesParticle
, sal_Int32 nCurveIndex
, bool bAverageLine
);
190 static rtl::OUString
createDataCurveEquationCID( const rtl::OUString
& rSeriesParticle
, sal_Int32 nCurveIndex
);
192 SAL_DLLPRIVATE
static rtl::OUString
getObjectID( const rtl::OUString
& rCID
);
193 static rtl::OUString
getParticleID( const rtl::OUString
& rCID
);
194 static rtl::OUString
getFullParentParticle( const rtl::OUString
& rCID
);
196 //returns the series particle of a CID when the CID is a child of the series
197 static rtl::OUString
getSeriesParticleFromCID( const rtl::OUString
& rCID
);
199 //return the model object that is indicated by rObjectCID
200 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
201 getObjectPropertySet(
202 const rtl::OUString
& rObjectCID
203 , const ::com::sun::star::uno::Reference
<
204 ::com::sun::star::frame::XModel
>& xChartModel
);
205 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
206 getObjectPropertySet(
207 const rtl::OUString
& rObjectCID
208 , const ::com::sun::star::uno::Reference
<
209 ::com::sun::star::chart2::XChartDocument
>& xChartDocument
);
211 //return the axis object that belongs to rObjectCID if any
212 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>
214 const rtl::OUString
& rObjectCID
215 , const ::com::sun::star::uno::Reference
<
216 ::com::sun::star::frame::XModel
>& xChartModel
);
218 //return the series object that belongs to rObjectCID if any
219 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
>
221 const rtl::OUString
& rObjectCID
222 , const ::com::sun::star::uno::Reference
<
223 ::com::sun::star::frame::XModel
>& xChartModel
);
225 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
>
227 const rtl::OUString
& rObjectCID
228 , const ::com::sun::star::uno::Reference
<
229 ::com::sun::star::frame::XModel
>& xChartModel
);
231 static const ::rtl::OUString
& getPieSegmentDragMethodServiceName();
232 static ::rtl::OUString
createPieSegmentDragParameterString(
233 sal_Int32 nOffsetPercent
234 , const ::com::sun::star::awt::Point
& rMinimumPosition
235 , const ::com::sun::star::awt::Point
& rMaximumPosition
);
236 static bool parsePieSegmentDragParameterString( const rtl::OUString
& rDragParameterString
237 , sal_Int32
& rOffsetPercent
238 , ::com::sun::star::awt::Point
& rMinimumPosition
239 , ::com::sun::star::awt::Point
& rMaximumPosition
);
241 static TitleHelper::eTitleType
getTitleTypeForCID( const ::rtl::OUString
& rCID
);
243 static ::rtl::OUString
getMovedSeriesCID( const ::rtl::OUString
& rObjectCID
, sal_Bool bForward
);
246 //.............................................................................
248 //.............................................................................