LibreOffice Module chart2 (master) 1
ObjectIdentifier.hxx
Go to the documentation of this file.
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#pragma once
20
21#include <sal/config.h>
22
23#include <string_view>
24
25#include "TitleHelper.hxx"
26#include "charttoolsdllapi.hxx"
27
28#include <rtl/ustring.hxx>
29#include <rtl/ref.hxx>
30
31namespace chart { class ChartModel; }
32namespace com::sun::star::awt { struct Point; }
33namespace com::sun::star::beans { class XPropertySet; }
34namespace com::sun::star::chart2 { class XAxis; }
35namespace com::sun::star::chart2 { class XChartDocument; }
36namespace com::sun::star::chart2 { class XCoordinateSystem; }
37namespace com::sun::star::chart2 { class XDataSeries; }
38namespace com::sun::star::chart2 { class XDiagram; }
39namespace com::sun::star::drawing { class XShape; }
40namespace com::sun::star::frame { class XModel; }
41namespace com::sun::star::uno { class XInterface; }
42
43namespace chart
44{
45class Axis;
46class BaseCoordinateSystem;
47class DataSeries;
48class Diagram;
49class Legend;
50
52{
71 OBJECTTYPE_DATA_CURVE,//e.g. a statistical method printed as line
80};
81
83{
84 //CID == ClassifiedIdentifier <--> name of shape
85 //semicolon, colon, equal sign and slash have special meanings in a CID
86 //and are therefore not allowed in its components
87
88 //syntax of a CID: CID:/classification/ObjectID
89
90 //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString"
91 // or a combination of these separated with a colon
92 //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose
93 //where DragParameterString is any string you like to transport information to your special drag service
94 // only semicolon, colon, equal sign and slash are not allowed characters
95 // also the keywords used in the ObjectIdentifiers are not allowed
96
97 //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22
98 //where Particle: Type=ParticleID //e.g. Point=22
99 //where Type: getStringForType( ObjectType eType ) or other string
100
101public:
103 ObjectIdentifier( OUString aObjectCID );
104 ObjectIdentifier( const css::uno::Reference< css::drawing::XShape >& rxShape );
105 ObjectIdentifier( const css::uno::Any& rAny );
106
107 bool operator==( const ObjectIdentifier& rOID ) const;
108 bool operator!=( const ObjectIdentifier& rOID ) const;
109 bool operator<( const ObjectIdentifier& rOID ) const;
110
112 const css::uno::Reference< css::uno::XInterface >& xObject
113 , const rtl::Reference<::chart::ChartModel>& xChartModel );
114 static OUString createClassifiedIdentifierForObject(
116 , const rtl::Reference<::chart::ChartModel>& xChartModel );
119 , const rtl::Reference<::chart::ChartModel>& xChartModel );
120 static OUString createClassifiedIdentifierForObject(
122 , const rtl::Reference<::chart::ChartModel>& xChartModel );
123
124 static OUString createClassifiedIdentifierForParticle(
125 std::u16string_view rParticle );
126
127 static OUString createClassifiedIdentifierForParticles(
128 std::u16string_view rParentParticle
129 , std::u16string_view rChildParticle
130 , std::u16string_view rDragMethodServiceName = std::u16string_view()
131 , std::u16string_view rDragParameterString = std::u16string_view() );
132
133 static OUString createClassifiedIdentifierForGrid(
134 const css::uno::Reference< css::chart2::XAxis >& xAxis
135 , const rtl::Reference<::chart::ChartModel>& xChartModel
136 , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc
137
138 SAL_DLLPRIVATE static OUString createParticleForDiagram();
139
140 static OUString createParticleForCoordinateSystem(
142 , const rtl::Reference<::chart::ChartModel>& xChartModel );
143
144 static OUString createParticleForAxis(
145 sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
146
147 static OUString createParticleForGrid(
148 sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
149
150 static OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
151 , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex );
152
153 static OUString createParticleForLegend(
154 const rtl::Reference<::chart::ChartModel>& xChartModel );
155
157 static OUString createParticleForDataTable(
158 const rtl::Reference<::chart::ChartModel>& xChartModel );
159
160 static OUString addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle );
161 static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex );
162 static sal_Int32 getIndexFromParticleOrCID( std::u16string_view rParticleOrCID );
163
164 static OUString createClassifiedIdentifier(
165 enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
166 , std::u16string_view rParticleID );//e.g. SeriesID
167
168 static OUString createClassifiedIdentifierWithParent(
169 enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
170 , std::u16string_view rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object
171 , std::u16string_view rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
172 , std::u16string_view rDragMethodServiceName = std::u16string_view()
173 , std::u16string_view rDragParameterString = std::u16string_view()
174 );
175
176 static bool isCID( std::u16string_view rName );
177 static std::u16string_view getDragMethodServiceName( std::u16string_view rClassifiedIdentifier );
178 static std::u16string_view getDragParameterString( std::u16string_view rCID );
179 static bool isDragableObject( std::u16string_view rClassifiedIdentifier );
180 bool isDragableObject() const;
181 static bool isRotateableObject( std::u16string_view rClassifiedIdentifier );
182 static bool isMultiClickObject( std::u16string_view rClassifiedIdentifier );
183 static bool areSiblings( std::u16string_view rCID1, std::u16string_view rCID2 );//identical object is no sibling
184 static bool areIdenticalObjects( std::u16string_view rCID1, std::u16string_view rCID2 );
185
186 static OUString getStringForType( ObjectType eObjectType );
187 static ObjectType getObjectType( std::u16string_view rCID );
188 ObjectType getObjectType() const;
189
190 static OUString createSeriesSubObjectStub( ObjectType eSubObjectType
191 , std::u16string_view rSeriesParticle
192 , std::u16string_view rDragMethodServiceName = std::u16string_view()
193 , std::u16string_view rDragParameterString = std::u16string_view() );
194 static OUString createPointCID( std::u16string_view rPointCID_Stub, sal_Int32 nIndex );
195
196 static OUString createDataCurveCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine );
197 static OUString createDataCurveEquationCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex );
198
199 SAL_DLLPRIVATE static OUString getObjectID( std::u16string_view rCID );
200 static std::u16string_view getParticleID( std::u16string_view rCID );
201 static std::u16string_view getFullParentParticle( std::u16string_view rCID );
202
203 //returns the series particle of a CID when the CID is a child of the series
204 static OUString getSeriesParticleFromCID( std::u16string_view rCID );
205
206 //return the model object that is indicated by rObjectCID
207 static css::uno::Reference< css::beans::XPropertySet >
208 getObjectPropertySet(
209 std::u16string_view rObjectCID
210 , const rtl::Reference< ::chart::ChartModel >& xChartDocument );
211
212 //return the axis object that belongs to rObjectCID if any
214 getAxisForCID(
215 std::u16string_view rObjectCID
216 , const rtl::Reference<::chart::ChartModel>& xChartModel );
217
218 //return the series object that belongs to rObjectCID if any
220 getDataSeriesForCID(
221 std::u16string_view rObjectCID
222 , const rtl::Reference<::chart::ChartModel>& xChartModel );
223
225 getDiagramForCID(
226 std::u16string_view rObjectCID
227 , const rtl::Reference<::chart::ChartModel>& xChartModel );
228
229 static const OUString& getPieSegmentDragMethodServiceName();
230 static OUString createPieSegmentDragParameterString(
231 sal_Int32 nOffsetPercent
232 , const css::awt::Point& rMinimumPosition
233 , const css::awt::Point& rMaximumPosition );
234 static bool parsePieSegmentDragParameterString( std::u16string_view rDragParameterString
235 , sal_Int32& rOffsetPercent
236 , css::awt::Point& rMinimumPosition
237 , css::awt::Point& rMaximumPosition );
238
239 static TitleHelper::eTitleType getTitleTypeForCID( std::u16string_view rCID );
240
241 static OUString getMovedSeriesCID( std::u16string_view rObjectCID, bool bForward );
242
243 bool isValid() const;
244 bool isAutoGeneratedObject() const;
245 bool isAdditionalShape() const;
246 const OUString& getObjectCID() const { return m_aObjectCID;}
247 const css::uno::Reference< css::drawing::XShape >& getAdditionalShape() const { return m_xAdditionalShape;}
248 css::uno::Any getAny() const;
249
250private:
251 // #i12587# support for shapes in chart
252 // For autogenerated chart objects a CID is specified in m_aObjectCID,
253 // for all other objects m_xAdditionalShape is set.
254 // Note, that if m_aObjectCID is set, m_xAdditionalShape must be empty
255 // and vice versa.
256 OUString m_aObjectCID;
257 css::uno::Reference< css::drawing::XShape > m_xAdditionalShape;
258};
259
260} //namespace chart
261
262/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define OOO_DLLPUBLIC_CHARTTOOLS
css::uno::Reference< css::drawing::XShape > m_xAdditionalShape
ObjectIdentifier(const css::uno::Reference< css::drawing::XShape > &rxShape)
const OUString & getObjectCID() const
ObjectIdentifier(const css::uno::Any &rAny)
static OUString createClassifiedIdentifierForObject(const rtl::Reference< ::chart::Legend > &xObject, const rtl::Reference<::chart::ChartModel > &xChartModel)
const css::uno::Reference< css::drawing::XShape > & getAdditionalShape() const
static OUString createClassifiedIdentifierForObject(const css::uno::Reference< css::uno::XInterface > &xObject, const rtl::Reference<::chart::ChartModel > &xChartModel)
@ OBJECTTYPE_DATA_SERIES
@ OBJECTTYPE_DATA_LABELS
@ OBJECTTYPE_DATA_TABLE
@ OBJECTTYPE_DIAGRAM
@ OBJECTTYPE_LEGEND_ENTRY
@ OBJECTTYPE_DATA_ERRORS_X
@ OBJECTTYPE_DATA_STOCK_LOSS
@ OBJECTTYPE_DIAGRAM_FLOOR
@ OBJECTTYPE_DATA_POINT
@ OBJECTTYPE_DATA_STOCK_RANGE
@ OBJECTTYPE_UNKNOWN
@ OBJECTTYPE_SUBGRID
@ OBJECTTYPE_DATA_ERRORS_Y
@ OBJECTTYPE_AXIS_UNITLABEL
@ OBJECTTYPE_DATA_CURVE_EQUATION
@ OBJECTTYPE_DATA_STOCK_GAIN
@ OBJECTTYPE_DATA_AVERAGE_LINE
@ OBJECTTYPE_DATA_ERRORS_Z
@ OBJECTTYPE_DATA_CURVE
@ OBJECTTYPE_DATA_LABEL
@ OBJECTTYPE_DIAGRAM_WALL
class SAL_NO_VTABLE XPropertySet
bool operator<(const wwFont &r1, const wwFont &r2)
bool operator!=(const XclExpString &rLeft, const XclExpString &rRight)
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)