1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef _CHART2_OBJECTIDENTIFIER_HXX
20 #define _CHART2_OBJECTIDENTIFIER_HXX
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"
30 // header for class OUString
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>
37 //.............................................................................
40 //.............................................................................
42 //-----------------------------------------------------------------------------
50 OBJECTTYPE_LEGEND_ENTRY
,
52 OBJECTTYPE_DIAGRAM_WALL
,
53 OBJECTTYPE_DIAGRAM_FLOOR
,
55 OBJECTTYPE_AXIS_UNITLABEL
,
58 OBJECTTYPE_DATA_SERIES
,
59 OBJECTTYPE_DATA_POINT
,
60 OBJECTTYPE_DATA_LABELS
,
61 OBJECTTYPE_DATA_LABEL
,
62 OBJECTTYPE_DATA_ERRORS_X
,
63 OBJECTTYPE_DATA_ERRORS_Y
,
64 OBJECTTYPE_DATA_ERRORS_Z
,
65 OBJECTTYPE_DATA_CURVE
,//e.g. a statistical method printed as line
66 OBJECTTYPE_DATA_AVERAGE_LINE
,
67 OBJECTTYPE_DATA_CURVE_EQUATION
,
68 OBJECTTYPE_DATA_STOCK_RANGE
,
69 OBJECTTYPE_DATA_STOCK_LOSS
,
70 OBJECTTYPE_DATA_STOCK_GAIN
,
75 class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier
77 //CID == ClassifiedIdentifier <--> name of shape
78 //semicolon, colon, equal sign and slash have special meanings in a CID
79 //and are therefore not allowed in its components
81 //syntax of a CID: CID:/classification/ObjectID
83 //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString"
84 // or a combination of these separated with a colon
85 //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose
86 //where DragParameterString is any string you like to transport information to your special drag service
87 // only semicolon, colon, equal sign and slash are not allowed characters
88 // also the keywors used in the ObjectIdentifiers are not allowed
90 //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22
91 //where Particle: Type=ParticleID //e.g. Point=22
92 //where Type: getStringForType( ObjectType eType ) or other string
96 ObjectIdentifier( const OUString
& rObjectCID
);
97 ObjectIdentifier( const ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
>& rxShape
);
98 ObjectIdentifier( const ::com::sun::star::uno::Any
& rAny
);
99 virtual ~ObjectIdentifier();
101 ObjectIdentifier( const ObjectIdentifier
& rOID
);
102 ObjectIdentifier
& operator=( const ObjectIdentifier
& rOID
);
103 bool operator==( const ObjectIdentifier
& rOID
) const;
104 bool operator!=( const ObjectIdentifier
& rOID
) const;
105 bool operator<( const ObjectIdentifier
& rOID
) const;
107 static OUString
createClassifiedIdentifierForObject(
108 const ::com::sun::star::uno::Reference
<
109 ::com::sun::star::uno::XInterface
>& xObject
110 , const ::com::sun::star::uno::Reference
<
111 ::com::sun::star::frame::XModel
>& xChartModel
);
113 static OUString
createClassifiedIdentifierForParticle(
114 const OUString
& rParticle
);
116 static OUString
createClassifiedIdentifierForParticles(
117 const OUString
& rParentParticle
118 , const OUString
& rChildParticle
119 , const OUString
& rDragMethodServiceName
= OUString()
120 , const OUString
& rDragParameterString
= OUString() );
122 static OUString
createClassifiedIdentifierForGrid(
123 const ::com::sun::star::uno::Reference
<
124 ::com::sun::star::chart2::XAxis
>& xAxis
125 , const ::com::sun::star::uno::Reference
<
126 ::com::sun::star::frame::XModel
>& xChartModel
127 , sal_Int32 nSubIndex
= -1 );//-1: main grid, 0: first subgrid etc
129 SAL_DLLPRIVATE
static OUString
createParticleForDiagram(
130 const ::com::sun::star::uno::Reference
<
131 ::com::sun::star::chart2::XDiagram
>& xDiagram
132 , const ::com::sun::star::uno::Reference
<
133 ::com::sun::star::frame::XModel
>& xChartModel
);
136 static OUString
createParticleForCoordinateSystem(
137 const ::com::sun::star::uno::Reference
<
138 ::com::sun::star::chart2::XCoordinateSystem
>& xCooSys
139 , const ::com::sun::star::uno::Reference
<
140 ::com::sun::star::frame::XModel
>& xChartModel
);
142 static OUString
createParticleForAxis(
143 sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
145 static OUString
createParticleForGrid(
146 sal_Int32 nDimensionIndex
, sal_Int32 nAxisIndex
);
148 static OUString
createParticleForSeries( sal_Int32 nDiagramIndex
, sal_Int32 nCooSysIndex
149 , sal_Int32 nChartTypeIndex
, sal_Int32 nSeriesIndex
);
151 static OUString
createParticleForLegend(
152 const ::com::sun::star::uno::Reference
<
153 ::com::sun::star::chart2::XLegend
>& xLegend
154 , const ::com::sun::star::uno::Reference
<
155 ::com::sun::star::frame::XModel
>& xChartModel
);
157 static OUString
addChildParticle( const OUString
& rParticle
, const OUString
& rChildParticle
);
158 static OUString
createChildParticleWithIndex( ObjectType eObjectType
, sal_Int32 nIndex
);
159 static sal_Int32
getIndexFromParticleOrCID( const OUString
& rParticleOrCID
);
161 static OUString
createClassifiedIdentifier(
162 enum ObjectType eObjectType
//e.g. OBJECTTYPE_DATA_SERIES
163 , const OUString
& rParticleID
);//e.g. SeriesID
165 static OUString
createClassifiedIdentifierWithParent(
166 enum ObjectType
//e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
167 , const OUString
& rParticleID
//for points or subgrids this is an Index or otherwise an identifier from the model object
168 , const OUString
& rParentPartical
//e.g. "Series=SeriesID" or "Grid=GridId"
169 , const OUString
& rDragMethodServiceName
= OUString()
170 , const OUString
& rDragParameterString
= OUString()
173 static bool isCID( const OUString
& rName
);
174 static OUString
getDragMethodServiceName( const OUString
& rClassifiedIdentifier
);
175 static OUString
getDragParameterString( const OUString
& rCID
);
176 static bool isDragableObject( const OUString
& rClassifiedIdentifier
);
177 bool isDragableObject();
178 static bool isRotateableObject( const OUString
& rClassifiedIdentifier
);
179 static bool isMultiClickObject( const OUString
& rClassifiedIdentifier
);
180 static bool areSiblings( const OUString
& rCID1
, const OUString
& rCID2
);//identical object is no sibling
181 static bool areIdenticalObjects( const OUString
& rCID1
, const OUString
& rCID2
);
183 static OUString
getStringForType( ObjectType eObjectType
);
184 static ObjectType
getObjectType( const OUString
& rCID
);
185 ObjectType
getObjectType();
187 static OUString
createSeriesSubObjectStub( ObjectType eSubObjectType
188 , const OUString
& rSeriesParticle
189 , const OUString
& rDragMethodServiceName
= OUString()
190 , const OUString
& rDragParameterString
= OUString() );
191 static OUString
createPointCID( const OUString
& rPointCID_Stub
, sal_Int32 nIndex
);
193 static OUString
createDataCurveCID( const OUString
& rSeriesParticle
, sal_Int32 nCurveIndex
, bool bAverageLine
);
194 static OUString
createDataCurveEquationCID( const OUString
& rSeriesParticle
, sal_Int32 nCurveIndex
);
196 SAL_DLLPRIVATE
static OUString
getObjectID( const OUString
& rCID
);
197 static OUString
getParticleID( const OUString
& rCID
);
198 static OUString
getFullParentParticle( const OUString
& rCID
);
200 //returns the series particle of a CID when the CID is a child of the series
201 static OUString
getSeriesParticleFromCID( const OUString
& rCID
);
203 //return the model object that is indicated by rObjectCID
204 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
205 getObjectPropertySet(
206 const OUString
& rObjectCID
207 , const ::com::sun::star::uno::Reference
<
208 ::com::sun::star::frame::XModel
>& xChartModel
);
209 static ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>
210 getObjectPropertySet(
211 const OUString
& rObjectCID
212 , const ::com::sun::star::uno::Reference
<
213 ::com::sun::star::chart2::XChartDocument
>& xChartDocument
);
215 //return the axis object that belongs to rObjectCID if any
216 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
>
218 const OUString
& rObjectCID
219 , const ::com::sun::star::uno::Reference
<
220 ::com::sun::star::frame::XModel
>& xChartModel
);
222 //return the series object that belongs to rObjectCID if any
223 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
>
225 const OUString
& rObjectCID
226 , const ::com::sun::star::uno::Reference
<
227 ::com::sun::star::frame::XModel
>& xChartModel
);
229 static ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
>
231 const OUString
& rObjectCID
232 , const ::com::sun::star::uno::Reference
<
233 ::com::sun::star::frame::XModel
>& xChartModel
);
235 static const OUString
& getPieSegmentDragMethodServiceName();
236 static OUString
createPieSegmentDragParameterString(
237 sal_Int32 nOffsetPercent
238 , const ::com::sun::star::awt::Point
& rMinimumPosition
239 , const ::com::sun::star::awt::Point
& rMaximumPosition
);
240 static bool parsePieSegmentDragParameterString( const OUString
& rDragParameterString
241 , sal_Int32
& rOffsetPercent
242 , ::com::sun::star::awt::Point
& rMinimumPosition
243 , ::com::sun::star::awt::Point
& rMaximumPosition
);
245 static TitleHelper::eTitleType
getTitleTypeForCID( const OUString
& rCID
);
247 static OUString
getMovedSeriesCID( const OUString
& rObjectCID
, sal_Bool bForward
);
249 bool isValid() const;
250 bool isAutoGeneratedObject() const;
251 bool isAdditionalShape() const;
252 OUString
getObjectCID() const;
253 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> getAdditionalShape() const;
254 ::com::sun::star::uno::Any
getAny() const;
257 // #i12587# support for shapes in chart
258 // For autogenerated chart objects a CID is specified in m_aObjectCID,
259 // for all other objects m_xAdditionalShape is set.
260 // Note, that if m_aObjectCID is set, m_xAdditionalShape must be empty
262 OUString m_aObjectCID
;
263 ::com::sun::star::uno::Reference
< ::com::sun::star::drawing::XShape
> m_xAdditionalShape
;
266 //.............................................................................
268 //.............................................................................
271 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */