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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XECHART_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XECHART_HXX
23 #include "xerecord.hxx"
24 #include "xlchart.hxx"
25 #include "xlformula.hxx"
26 #include "xlstyle.hxx"
28 #include "xestring.hxx"
34 namespace tools
{ class Rectangle
; }
36 namespace com
{ namespace sun
{ namespace star
{
54 class XCoordinateSystem
;
59 class XFormattedString
;
60 class XRegressionCurve
;
64 class XLabeledDataSequence
;
69 // Common =====================================================================
71 struct XclExpChRootData
;
74 /** Base class for complex chart classes, provides access to other components
77 Keeps also track of future record levels and writes the needed future
80 class XclExpChRoot
: public XclExpRoot
83 explicit XclExpChRoot( const XclExpRoot
& rRoot
, XclExpChChart
& rChartData
);
84 virtual ~XclExpChRoot() override
;
86 XclExpChRoot(XclExpChRoot
const &) = default;
87 XclExpChRoot(XclExpChRoot
&&) = default;
88 XclExpChRoot
& operator =(XclExpChRoot
const &) = delete; // due to XclExpRoot
89 XclExpChRoot
& operator =(XclExpChRoot
&&) = delete; // due to XclExpRoot
91 /** Returns this root instance - for code readability in derived classes. */
92 const XclExpChRoot
& GetChRoot() const { return *this; }
93 /** Returns the API Chart document model. */
94 css::uno::Reference
< css::chart2::XChartDocument
> const &
95 GetChartDocument() const;
96 /** Returns a reference to the parent chart data object. */
97 XclExpChChart
& GetChartData() const;
98 /** Returns chart type info for a unique chart type identifier. */
99 const XclChTypeInfo
& GetChartTypeInfo( XclChTypeId eType
) const;
100 /** Returns the first fitting chart type info for the passed service name. */
101 const XclChTypeInfo
& GetChartTypeInfo( const OUString
& rServiceName
) const;
103 /** Returns an info struct about auto formatting for the passed object type. */
104 const XclChFormatInfo
& GetFormatInfo( XclChObjectType eObjType
) const;
106 /** Starts the API chart document conversion. Must be called once before all API conversion. */
107 void InitConversion( css::uno::Reference
< css::chart2::XChartDocument
> const & xChartDoc
,
108 const tools::Rectangle
& rChartRect
) const;
109 /** Finishes the API chart document conversion. Must be called once after all API conversion. */
110 void FinishConversion() const;
112 /** Returns true, if the passed color equals to the specified system color. */
113 bool IsSystemColor( const Color
& rColor
, sal_uInt16 nSysColorIdx
) const;
114 /** Sets a system color and the respective color identifier. */
115 void SetSystemColor( Color
& rColor
, sal_uInt32
& rnColorId
, sal_uInt16 nSysColorIdx
) const;
117 /** Converts the passed horizontal coordinate from 1/100 mm to Excel chart units. */
118 sal_Int32
CalcChartXFromHmm( sal_Int32 nPosX
) const;
119 /** Converts the passed vertical coordinate from 1/100 mm to Excel chart units. */
120 sal_Int32
CalcChartYFromHmm( sal_Int32 nPosY
) const;
121 /** Converts the passed rectangle from 1/100 mm to Excel chart units. */
122 XclChRectangle
CalcChartRectFromHmm( const css::awt::Rectangle
& rRect
) const;
124 /** Reads all line properties from the passed property set. */
125 void ConvertLineFormat(
126 XclChLineFormat
& rLineFmt
,
127 const ScfPropertySet
& rPropSet
,
128 XclChPropertyMode ePropMode
) const;
129 /** Reads solid area properties from the passed property set.
130 @return true = object contains complex fill properties. */
131 bool ConvertAreaFormat(
132 XclChAreaFormat
& rAreaFmt
,
133 const ScfPropertySet
& rPropSet
,
134 XclChPropertyMode ePropMode
) const;
135 /** Reads gradient or bitmap area properties from the passed property set. */
136 void ConvertEscherFormat(
137 XclChEscherFormat
& rEscherFmt
,
138 XclChPicFormat
& rPicFmt
,
139 const ScfPropertySet
& rPropSet
,
140 XclChPropertyMode ePropMode
) const;
141 /** Reads font properties from the passed property set. */
142 sal_uInt16
ConvertFont(
143 const ScfPropertySet
& rPropSet
,
144 sal_Int16 nScript
) const;
146 /** Reads the pie rotation property and returns the converted angle. */
147 static sal_uInt16
ConvertPieRotation( const ScfPropertySet
& rPropSet
);
150 /** Called from XclExpChGroupBase::Save, registers a new future record level. */
151 void RegisterFutureRecBlock( const XclChFrBlock
& rFrBlock
);
152 /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
153 void InitializeFutureRecBlock( XclExpStream
& rStrm
);
154 /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
155 void FinalizeFutureRecBlock( XclExpStream
& rStrm
);
158 typedef std::shared_ptr
< XclExpChRootData
> XclExpChRootDataRef
;
159 XclExpChRootDataRef mxChData
; /// Reference to the root data object.
162 /** Base class for chart record groups. Provides helper functions to write sub records.
164 A chart record group consists of a header record, followed by a CHBEGIN
165 record, followed by group sub records, and finished with a CHEND record.
167 class XclExpChGroupBase
: public XclExpRecord
, protected XclExpChRoot
170 explicit XclExpChGroupBase(
171 const XclExpChRoot
& rRoot
, sal_uInt16 nFrType
,
172 sal_uInt16 nRecId
, std::size_t nRecSize
= 0 );
173 virtual ~XclExpChGroupBase() override
;
175 /** Saves the header record. Calls WriteSubRecords() to let derived classes write sub records. */
176 virtual void Save( XclExpStream
& rStrm
) override
;
177 /** Derived classes return whether there are any records embedded in this group. */
178 virtual bool HasSubRecords() const;
179 /** Derived classes implement writing any records embedded in this group. */
180 virtual void WriteSubRecords( XclExpStream
& rStrm
) = 0;
183 /** Sets context information for future record blocks. */
184 void SetFutureRecordContext( sal_uInt16 nFrContext
,
185 sal_uInt16 nFrValue1
= 0, sal_uInt16 nFrValue2
= 0 );
188 XclChFrBlock maFrBlock
; /// Future records block settings.
191 /** Base class for chart future records. On saving, the record writes missing
192 CHFRBLOCKBEGIN records automatically.
194 class XclExpChFutureRecordBase
: public XclExpFutureRecord
, protected XclExpChRoot
197 explicit XclExpChFutureRecordBase( const XclExpChRoot
& rRoot
,
198 XclFutureRecType eRecType
, sal_uInt16 nRecId
, std::size_t nRecSize
);
200 /** Writes missing CHFRBLOCKBEGIN records and this record. */
201 virtual void Save( XclExpStream
& rStrm
) override
;
204 // Frame formatting ===========================================================
206 class XclExpChFramePos
: public XclExpRecord
209 explicit XclExpChFramePos( sal_uInt16 nTLMode
);
211 /** Returns read/write access to the frame position data. */
212 XclChFramePos
& GetFramePosData() { return maData
; }
215 virtual void WriteBody( XclExpStream
& rStrm
) override
;
218 XclChFramePos maData
; /// Position of the frame.
221 typedef std::shared_ptr
< XclExpChFramePos
> XclExpChFramePosRef
;
223 class XclExpChLineFormat
: public XclExpRecord
226 explicit XclExpChLineFormat( const XclExpChRoot
& rRoot
);
228 /** Converts line formatting properties from the passed property set. */
229 void Convert( const XclExpChRoot
& rRoot
,
230 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
231 /** Sets or clears the automatic flag. */
232 void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
, bAuto
); }
233 /** Sets flag to show or hide an axis. */
234 void SetShowAxis( bool bShowAxis
)
235 { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_SHOWAXIS
, bShowAxis
); }
236 /** Sets the line format to the specified default type. */
237 void SetDefault( XclChFrameType eDefFrameType
);
239 /** Returns true, if the line format is set to automatic. */
240 bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
); }
241 /** Returns true, if the line style is set to something visible. */
242 bool HasLine() const { return maData
.mnPattern
!= EXC_CHLINEFORMAT_NONE
; }
243 /** Returns true, if the line contains default formatting according to the passed frame type. */
244 bool IsDefault( XclChFrameType eDefFrameType
) const;
247 virtual void WriteBody( XclExpStream
& rStrm
) override
;
250 XclChLineFormat maData
; /// Contents of the CHLINEFORMAT record.
251 sal_uInt32 mnColorId
; /// Line color identifier.
254 typedef std::shared_ptr
< XclExpChLineFormat
> XclExpChLineFormatRef
;
256 class XclExpChAreaFormat
: public XclExpRecord
259 explicit XclExpChAreaFormat( const XclExpChRoot
& rRoot
);
261 /** Converts area formatting properties from the passed property set.
262 @return true = object contains complex fill properties. */
263 bool Convert( const XclExpChRoot
& rRoot
,
264 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
265 /** Sets or clears the automatic flag. */
266 void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
, bAuto
); }
267 /** Sets the area format to the specified default type. */
268 void SetDefault( XclChFrameType eDefFrameType
);
270 /** Returns true, if the area format is set to automatic. */
271 bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
); }
272 /** Returns true, if the area style is set to something visible. */
273 bool HasArea() const { return maData
.mnPattern
!= EXC_PATT_NONE
; }
274 /** Returns true, if the area contains default formatting according to the passed frame type. */
275 bool IsDefault( XclChFrameType eDefFrameType
) const;
278 virtual void WriteBody( XclExpStream
& rStrm
) override
;
281 XclChAreaFormat maData
; /// Contents of the CHAREAFORMAT record.
282 sal_uInt32 mnPattColorId
; /// Pattern color identifier.
283 sal_uInt32 mnBackColorId
; /// Pattern background color identifier.
286 typedef std::shared_ptr
< XclExpChAreaFormat
> XclExpChAreaFormatRef
;
288 class XclExpChEscherFormat
: public XclExpChGroupBase
291 explicit XclExpChEscherFormat( const XclExpChRoot
& rRoot
);
293 /** Converts complex area formatting from the passed property set. */
294 void Convert( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
296 /** Returns true, if the object contains valid formatting data. */
297 bool IsValid() const;
299 /** Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant. */
300 virtual void Save( XclExpStream
& rStrm
) override
;
301 /** Returns true, if this record group contains a CHPICFORMAT record. */
302 virtual bool HasSubRecords() const override
;
303 /** Writes all embedded records. */
304 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
307 /** Inserts a color from the contained Escher property set into the color palette. */
308 sal_uInt32
RegisterColor( sal_uInt16 nPropId
);
310 virtual void WriteBody( XclExpStream
& rStrm
) override
;
313 XclChEscherFormat maData
; /// Fill properties for complex areas (CHESCHERFORMAT record).
314 XclChPicFormat maPicFmt
; /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
315 sal_uInt32 mnColor1Id
; /// First fill color identifier.
316 sal_uInt32 mnColor2Id
; /// Second fill color identifier.
319 typedef std::shared_ptr
< XclExpChEscherFormat
> XclExpChEscherFormatRef
;
321 /** Base class for record groups containing frame formatting.
323 Frame formatting can be part of several record groups, e.g. CHFRAME,
324 CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
325 CHESCHERFORMAT group.
327 class XclExpChFrameBase
330 explicit XclExpChFrameBase();
331 virtual ~XclExpChFrameBase();
334 /** Converts frame formatting properties from the passed property set. */
335 void ConvertFrameBase( const XclExpChRoot
& rRoot
,
336 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
337 /** Sets the frame formatting to the specified default type. */
338 void SetDefaultFrameBase( const XclExpChRoot
& rRoot
,
339 XclChFrameType eDefFrameType
, bool bIsFrame
);
341 /** Returns true, if the frame contains default formatting (as if the frame is missing). */
342 bool IsDefaultFrameBase( XclChFrameType eDefFrameType
) const;
344 /** Writes all contained frame records to the passed stream. */
345 void WriteFrameRecords( XclExpStream
& rStrm
);
348 XclExpChLineFormatRef mxLineFmt
; /// Line format (CHLINEFORMAT record).
349 XclExpChAreaFormatRef mxAreaFmt
; /// Area format (CHAREAFORMAT record).
350 XclExpChEscherFormatRef mxEscherFmt
; /// Complex area format (CHESCHERFORMAT record).
353 /** Represents the CHFRAME record group containing object frame properties.
355 The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
356 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
358 class XclExpChFrame
: public XclExpChGroupBase
, public XclExpChFrameBase
361 explicit XclExpChFrame( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
363 /** Converts frame formatting properties from the passed property set. */
364 void Convert( const ScfPropertySet
& rPropSet
);
365 /** Sets the specified automatic flags. */
366 void SetAutoFlags( bool bAutoPos
, bool bAutoSize
);
368 /** Returns true, if the frame object contains default formats. */
369 bool IsDefault() const;
370 /** Returns true, if the frame object can be deleted because it contains default formats. */
371 bool IsDeleteable() const;
373 /** Writes the entire record group. */
374 virtual void Save( XclExpStream
& rStrm
) override
;
375 /** Writes all embedded records. */
376 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
379 virtual void WriteBody( XclExpStream
& rStrm
) override
;
382 XclChFrame maData
; /// Contents of the CHFRAME record.
383 XclChObjectType meObjType
; /// Type of the represented object.
386 typedef std::shared_ptr
< XclExpChFrame
> XclExpChFrameRef
;
388 // Source links ===============================================================
390 class XclExpChSourceLink
: public XclExpRecord
, protected XclExpChRoot
393 explicit XclExpChSourceLink( const XclExpChRoot
& rRoot
, sal_uInt8 nDestType
);
395 void ConvertString( const OUString
& aString
);
396 /** Converts the passed source link, returns the number of linked values. */
397 sal_uInt16
ConvertDataSequence( css::uno::Reference
< css::chart2::data::XDataSequence
> const & xDataSeq
,
398 bool bSplitToColumns
, sal_uInt16 nDefCount
= 0 );
399 /** Converts the passed sequence of formatted string objects, returns leading font index. */
400 sal_uInt16
ConvertStringSequence( const css::uno::Sequence
< css::uno::Reference
< css::chart2::XFormattedString
> >& rStringSeq
);
401 /** Converts the number format from the passed property set. */
402 void ConvertNumFmt( const ScfPropertySet
& rPropSet
, bool bPercent
);
404 void AppendString( const OUString
& rStr
);
406 /** Returns true, if this source link contains explicit string data. */
407 bool HasString() const { return mxString
&& !mxString
->IsEmpty(); }
409 /** Writes the CHSOURCELINK record and optionally a CHSTRING record with explicit string data. */
410 virtual void Save( XclExpStream
& rStrm
) override
;
413 virtual void WriteBody( XclExpStream
& rStrm
) override
;
416 XclChSourceLink maData
; /// Contents of the CHSOURCELINK record.
417 XclTokenArrayRef mxLinkFmla
; /// Formula with link to source data.
418 XclExpStringRef mxString
; /// Text data (CHSTRING record).
421 typedef std::shared_ptr
< XclExpChSourceLink
> XclExpChSourceLinkRef
;
423 // Text =======================================================================
425 /** The CHFONT record containing a font index for text objects. */
426 class XclExpChFont
: public XclExpUInt16Record
429 explicit XclExpChFont( sal_uInt16 nFontIdx
);
432 typedef std::shared_ptr
< XclExpChFont
> XclExpChFontRef
;
434 /** The CHOBJECTLINK record linking a text object to a specific chart object. */
435 class XclExpChObjectLink
: public XclExpRecord
438 explicit XclExpChObjectLink( sal_uInt16 nLinkTarget
, const XclChDataPointPos
& rPointPos
);
441 virtual void WriteBody( XclExpStream
& rStrm
) override
;
444 XclChObjectLink maData
; /// Contents of the CHOBJECTLINK record.
447 typedef std::shared_ptr
< XclExpChObjectLink
> XclExpChObjectLinkRef
;
449 /** Additional data label settings in the future record CHFRLABELPROPS. */
450 class XclExpChFrLabelProps
: public XclExpChFutureRecordBase
453 explicit XclExpChFrLabelProps( const XclExpChRoot
& rRoot
);
455 /** Converts separator and the passed data label flags. */
457 const ScfPropertySet
& rPropSet
,
458 bool bShowCateg
, bool bShowValue
,
459 bool bShowPercent
, bool bShowBubble
);
462 virtual void WriteBody( XclExpStream
& rStrm
) override
;
465 XclChFrLabelProps maData
; /// Contents of the CHFRLABELPROPS record.
468 typedef std::shared_ptr
< XclExpChFrLabelProps
> XclExpChFrLabelPropsRef
;
470 /** Base class for objects with font settings. Provides font conversion helper functions. */
471 class XclExpChFontBase
474 virtual ~XclExpChFontBase();
476 /** Derived classes set font color and color identifier to internal data structures. */
477 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) = 0;
478 /** Derived classes set text rotation to internal data structures. */
479 virtual void SetRotation( sal_uInt16 nRotation
) = 0;
481 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
482 void ConvertFontBase( const XclExpChRoot
& rRoot
, sal_uInt16 nFontIdx
);
483 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
484 void ConvertFontBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
);
485 /** Converts rotation settings, calls virtual function SetRotation(). */
486 void ConvertRotationBase( const ScfPropertySet
& rPropSet
, bool bSupportsStacked
);
489 /** Represents the CHTEXT record group containing text object properties.
491 The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
492 CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
494 class XclExpChText
: public XclExpChGroupBase
, public XclExpChFontBase
497 explicit XclExpChText( const XclExpChRoot
& rRoot
);
499 /** Sets font color and color identifier to internal data structures. */
500 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) override
;
501 /** Sets text rotation to internal data structures. */
502 virtual void SetRotation( sal_uInt16 nRotation
) override
;
504 /** Converts all text settings of the passed title text object. */
505 void ConvertTitle( css::uno::Reference
< css::chart2::XTitle
> const & xTitle
, sal_uInt16 nTarget
, const OUString
* pSubTitle
);
506 /** Converts all text settings of the passed legend. */
507 void ConvertLegend( const ScfPropertySet
& rPropSet
);
508 /** Converts all settings of the passed data point caption text object. */
509 bool ConvertDataLabel( const ScfPropertySet
& rPropSet
,
510 const XclChTypeInfo
& rTypeInfo
, const XclChDataPointPos
& rPointPos
);
511 /** Converts all settings of the passed trend line equation box. */
512 void ConvertTrendLineEquation( const ScfPropertySet
& rPropSet
, const XclChDataPointPos
& rPointPos
);
514 /** Returns true, if the string object does not contain any text data. */
515 bool HasString() const { return mxSrcLink
&& mxSrcLink
->HasString(); }
516 /** Returns the flags needed for the CHATTACHEDLABEL record. */
517 sal_uInt16
GetAttLabelFlags() const;
519 /** Writes all embedded records. */
520 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
523 virtual void WriteBody( XclExpStream
& rStrm
) override
;
526 XclChText maData
; /// Contents of the CHTEXT record.
527 XclExpChFramePosRef mxFramePos
; /// Relative text frame position (CHFRAMEPOS record).
528 XclExpChSourceLinkRef mxSrcLink
; /// Linked data (CHSOURCELINK with CHSTRING record).
529 XclExpChFrameRef mxFrame
; /// Text object frame properties (CHFRAME group).
530 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
531 XclExpChObjectLinkRef mxObjLink
; /// Link target for this text object.
532 XclExpChFrLabelPropsRef mxLabelProps
; /// Extended data label properties (CHFRLABELPROPS record).
533 sal_uInt32 mnTextColorId
; /// Text color identifier.
536 typedef std::shared_ptr
< XclExpChText
> XclExpChTextRef
;
538 // Data series ================================================================
540 /** The CHMARKERFORMAT record containing data point marker formatting data. */
541 class XclExpChMarkerFormat
: public XclExpRecord
544 explicit XclExpChMarkerFormat( const XclExpChRoot
& rRoot
);
546 /** Converts symbol properties from the passed property set. */
547 void Convert( const XclExpChRoot
& rRoot
,
548 const ScfPropertySet
& rPropSet
, sal_uInt16 nFormatIdx
);
549 /** Converts symbol properties for stock charts from the passed property set. */
550 void ConvertStockSymbol( const XclExpChRoot
& rRoot
,
551 const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
553 /** Returns true, if markers are enabled. */
554 bool HasMarker() const { return maData
.mnMarkerType
!= EXC_CHMARKERFORMAT_NOSYMBOL
; }
555 /** Returns true, if border line of markers is visible. */
556 bool HasLineColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOLINE
); }
557 /** Returns true, if fill area of markers is visible. */
558 bool HasFillColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOFILL
); }
561 /** Registers marker colors in palette and stores color identifiers. */
562 void RegisterColors( const XclExpChRoot
& rRoot
);
564 virtual void WriteBody( XclExpStream
& rStrm
) override
;
567 XclChMarkerFormat maData
; /// Contents of the CHMARKERFORMAT record.
568 sal_uInt32 mnLineColorId
; /// Border line color identifier.
569 sal_uInt32 mnFillColorId
; /// Fill color identifier.
572 typedef std::shared_ptr
< XclExpChMarkerFormat
> XclExpChMarkerFormatRef
;
574 /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
575 class XclExpChPieFormat
: public XclExpUInt16Record
578 explicit XclExpChPieFormat();
580 /** Sets pie segment properties from the passed property set. */
581 void Convert( const ScfPropertySet
& rPropSet
);
584 typedef std::shared_ptr
< XclExpChPieFormat
> XclExpChPieFormatRef
;
586 /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
587 class XclExpCh3dDataFormat
: public XclExpRecord
590 explicit XclExpCh3dDataFormat();
592 /** Sets 3d bar properties from the passed property set. */
593 void Convert( const ScfPropertySet
& rPropSet
);
596 virtual void WriteBody( XclExpStream
& rStrm
) override
;
599 XclCh3dDataFormat maData
; /// Contents of the CH3DDATAFORMAT record.
602 typedef std::shared_ptr
< XclExpCh3dDataFormat
> XclExpCh3dDataFormatRef
;
604 /** The CHATTACHEDLABEL record that contains the type of a data point label. */
605 class XclExpChAttachedLabel
: public XclExpUInt16Record
608 explicit XclExpChAttachedLabel( sal_uInt16 nFlags
);
611 typedef std::shared_ptr
< XclExpChAttachedLabel
> XclExpChAttLabelRef
;
613 /** Represents the CHDATAFORMAT record group containing data point properties.
615 The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
616 CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
617 CHATTACHEDLABEL, CHEND.
619 class XclExpChDataFormat
: public XclExpChGroupBase
, public XclExpChFrameBase
622 explicit XclExpChDataFormat( const XclExpChRoot
& rRoot
,
623 const XclChDataPointPos
& rPointPos
, sal_uInt16 nFormatIdx
);
625 /** Converts the passed data series or data point formatting. */
626 void ConvertDataSeries( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
);
627 /** Sets default formatting for a series in a stock chart. */
628 void ConvertStockSeries( const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
629 /** Converts line formatting for the specified object (e.g. trend lines, error bars). */
630 void ConvertLine( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
632 /** Returns true, if this objects describes the formatting of an entire series. */
633 bool IsSeriesFormat() const { return maData
.maPointPos
.mnPointIdx
== EXC_CHDATAFORMAT_ALLPOINTS
; }
635 /** Writes all embedded records. */
636 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
639 virtual void WriteBody( XclExpStream
& rStrm
) override
;
642 XclChDataFormat maData
; /// Contents of the CHDATAFORMAT record.
643 XclExpChMarkerFormatRef mxMarkerFmt
; /// Data point marker (CHMARKERFORMAT record).
644 XclExpChPieFormatRef mxPieFmt
; /// Pie segment format (CHPIEFORMAT record).
645 XclExpRecordRef mxSeriesFmt
; /// Series properties (CHSERIESFORMAT record).
646 XclExpCh3dDataFormatRef mx3dDataFmt
; /// 3D bar format (CH3DDATAFORMAT record).
647 XclExpChAttLabelRef mxAttLabel
; /// Data point label type (CHATTACHEDLABEL record).
650 typedef std::shared_ptr
< XclExpChDataFormat
> XclExpChDataFormatRef
;
652 /** Represents the CHSERTRENDLINE record containing settings for a trend line. */
653 class XclExpChSerTrendLine
: public XclExpRecord
, protected XclExpChRoot
656 explicit XclExpChSerTrendLine( const XclExpChRoot
& rRoot
);
658 /** Converts the passed trend line, returns true if trend line type is supported. */
659 bool Convert( css::uno::Reference
< css::chart2::XRegressionCurve
> const & xRegCurve
,
660 sal_uInt16 nSeriesIdx
);
662 /** Returns formatting information of the trend line, created in Convert(). */
663 const XclExpChDataFormatRef
& GetDataFormat() const { return mxDataFmt
; }
664 /** Returns formatting of the equation text box, created in Convert(). */
665 const XclExpChTextRef
& GetDataLabel() const { return mxLabel
; }
668 virtual void WriteBody( XclExpStream
& rStrm
) override
;
671 XclChSerTrendLine maData
; /// Contents of the CHSERTRENDLINE record.
672 XclExpChDataFormatRef mxDataFmt
; /// Formatting settings of the trend line.
673 XclExpChTextRef mxLabel
; /// Formatting of the equation text box.
676 typedef std::shared_ptr
< XclExpChSerTrendLine
> XclExpChSerTrendLineRef
;
678 /** Represents the CHSERERRORBAR record containing settings for error bars. */
679 class XclExpChSerErrorBar
: public XclExpRecord
, protected XclExpChRoot
682 explicit XclExpChSerErrorBar( const XclExpChRoot
& rRoot
, sal_uInt8 nBarType
);
684 /** Converts the passed error bar settings, returns true if error bar type is supported. */
685 bool Convert( XclExpChSourceLink
& rValueLink
, sal_uInt16
& rnValueCount
, const ScfPropertySet
& rPropSet
);
688 virtual void WriteBody( XclExpStream
& rStrm
) override
;
691 XclChSerErrorBar maData
; /// Contents of the CHSERERRORBAR record.
694 typedef std::shared_ptr
< XclExpChSerErrorBar
> XclExpChSerErrorBarRef
;
696 /** Represents the CHSERIES record group describing a data series in a chart.
698 The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
699 CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
700 CHSERTRENDLINE, CHEND.
702 class XclExpChSeries
: public XclExpChGroupBase
705 explicit XclExpChSeries( const XclExpChRoot
& rRoot
, sal_uInt16 nSeriesIdx
);
707 /** Converts the passed data series (source links and formatting). */
708 bool ConvertDataSeries(
709 css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
710 css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
,
711 const XclChExtTypeInfo
& rTypeInfo
,
712 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
);
713 /** Converts the passed data series for stock charts. */
714 bool ConvertStockSeries(
715 css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
,
716 const OUString
& rValueRole
,
717 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
, bool bCloseSymbol
);
718 /** Converts the passed error bar settings (called at trend line child series). */
719 bool ConvertTrendLine( const XclExpChSeries
& rParent
,
720 css::uno::Reference
< css::chart2::XRegressionCurve
> const & xRegCurve
);
721 /** Converts the passed error bar settings (called at error bar child series). */
722 bool ConvertErrorBar( const XclExpChSeries
& rParent
, const ScfPropertySet
& rPropSet
, sal_uInt8 nBarId
);
723 /** Converts and inserts category ranges for all inserted series. */
724 void ConvertCategSequence( css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> const & xCategSeq
);
726 /** Writes all embedded records. */
727 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
730 /** Initializes members of this series to represent a child of the passed series. */
731 void InitFromParent( const XclExpChSeries
& rParent
);
732 /** Tries to create trend line series objects (called at parent series). */
733 void CreateTrendLines( css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
);
734 /** Tries to create positive and negative error bar series objects (called at parent series). */
735 void CreateErrorBars( const ScfPropertySet
& rPropSet
,
736 const OUString
& rBarPropName
,
737 sal_uInt8 nPosBarId
, sal_uInt8 nNegBarId
);
738 /** Tries to create an error bar series object (called at parent series). */
739 void CreateErrorBar( const ScfPropertySet
& rPropSet
,
740 const OUString
& rShowPropName
, sal_uInt8 nBarId
);
742 virtual void WriteBody( XclExpStream
& rStrm
) override
;
745 typedef XclExpRecordList
< XclExpChDataFormat
> XclExpChDataFormatList
;
748 XclChSeries maData
; /// Contents of the CHSERIES record.
749 XclExpChSourceLinkRef mxTitleLink
; /// Link data for series title.
750 XclExpChSourceLinkRef mxValueLink
; /// Link data for series values.
751 XclExpChSourceLinkRef mxCategLink
; /// Link data for series category names.
752 XclExpChSourceLinkRef mxBubbleLink
; /// Link data for series bubble sizes.
753 XclExpChDataFormatRef mxSeriesFmt
; /// CHDATAFORMAT group for series format.
754 XclExpChDataFormatList maPointFmts
; /// CHDATAFORMAT groups for data point formats.
755 XclExpChSerTrendLineRef mxTrendLine
; /// Trend line settings (CHSERTRENDLINE record).
756 XclExpChSerErrorBarRef mxErrorBar
; /// Error bar settings (CHSERERRORBAR record).
757 sal_uInt16 mnGroupIdx
; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
758 sal_uInt16 mnSeriesIdx
; /// 0-based series index.
759 sal_uInt16 mnParentIdx
; /// 0-based index of parent series (trend lines and error bars).
762 typedef std::shared_ptr
< XclExpChSeries
> XclExpChSeriesRef
;
764 // Chart type groups ==========================================================
766 /** Represents the chart type record for all supported chart types. */
767 class XclExpChType
: public XclExpRecord
, protected XclExpChRoot
770 explicit XclExpChType( const XclExpChRoot
& rRoot
);
772 /** Converts the passed chart type and the contained data series. */
773 void Convert( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
774 css::uno::Reference
< css::chart2::XChartType
> const & xChartType
,
775 sal_Int32 nApiAxesSetIdx
, bool bSwappedAxesSet
, bool bHasXLabels
);
776 /** Sets stacking mode (standard or percent) for the series in this chart type group. */
777 void SetStacked( bool bPercent
);
779 /** Returns true, if this is object represents a valid chart type. */
780 bool IsValidType() const { return maTypeInfo
.meTypeId
!= EXC_CHTYPEID_UNKNOWN
; }
781 /** Returns the chart type info struct for the contained chart type. */
782 const XclChTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
785 virtual void WriteBody( XclExpStream
& rStrm
) override
;
788 XclChType maData
; /// Contents of the chart type record.
789 XclChTypeInfo maTypeInfo
; /// Chart type info for the contained type.
792 /** Represents the CHCHART3D record that contains 3D view settings. */
793 class XclExpChChart3d
: public XclExpRecord
796 explicit XclExpChChart3d();
798 /** Converts 3d settings for the passed chart type. */
799 void Convert( const ScfPropertySet
& rPropSet
, bool b3dWallChart
);
800 /** Sets flag that the data points are clustered on the X axis. */
801 void SetClustered() { ::set_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
803 /** Returns true, if the data points are clustered on the X axis. */
804 bool IsClustered() const { return ::get_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
807 virtual void WriteBody( XclExpStream
& rStrm
) override
;
810 XclChChart3d maData
; /// Contents of the CHCHART3D record.
813 typedef std::shared_ptr
< XclExpChChart3d
> XclExpChChart3dRef
;
815 /** Represents the CHLEGEND record group describing the chart legend.
817 The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME
818 group, CHTEXT group, CHEND.
820 class XclExpChLegend
: public XclExpChGroupBase
823 explicit XclExpChLegend( const XclExpChRoot
& rRoot
);
825 /** Converts all legend settings from the passed property set. */
826 void Convert( const ScfPropertySet
& rPropSet
);
828 /** Writes all embedded records. */
829 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
832 virtual void WriteBody( XclExpStream
& rStrm
) override
;
835 XclChLegend maData
; /// Contents of the CHLEGEND record.
836 XclExpChFramePosRef mxFramePos
; /// Legend frame position (CHFRAMEPOS record).
837 XclExpChTextRef mxText
; /// Legend text format (CHTEXT group).
838 XclExpChFrameRef mxFrame
; /// Legend frame format (CHFRAME group).
841 typedef std::shared_ptr
< XclExpChLegend
> XclExpChLegendRef
;
843 /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
845 The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
846 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
848 class XclExpChDropBar
: public XclExpChGroupBase
, public XclExpChFrameBase
851 explicit XclExpChDropBar( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
853 /** Converts and writes the contained frame data to the passed property set. */
854 void Convert( const ScfPropertySet
& rPropSet
);
856 /** Writes all embedded records. */
857 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
860 virtual void WriteBody( XclExpStream
& rStrm
) override
;
863 XclChObjectType meObjType
; /// Type of the dropbar.
866 typedef std::shared_ptr
< XclExpChDropBar
> XclExpChDropBarRef
;
868 /** Represents the CHTYPEGROUP record group describing a group of series.
870 The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
871 record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
872 CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
873 CHDATAFORMAT group, CHEND.
875 class XclExpChTypeGroup
: public XclExpChGroupBase
878 explicit XclExpChTypeGroup( const XclExpChRoot
& rRoot
, sal_uInt16 nGroupIdx
);
880 /** Converts the passed chart type to Excel type settings. */
881 void ConvertType( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
882 css::uno::Reference
< css::chart2::XChartType
> const & xChartType
,
883 sal_Int32 nApiAxesSetIdx
, bool b3dChart
, bool bSwappedAxesSet
, bool bHasXLabels
);
884 /** Converts and inserts all series from the passed chart type. */
885 void ConvertSeries( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
886 css::uno::Reference
< css::chart2::XChartType
> const & xChartType
,
887 sal_Int32 nGroupAxesSetIdx
, bool bPercent
, bool bConnectorLines
);
888 /** Converts and inserts category ranges for all inserted series. */
889 void ConvertCategSequence( css::uno::Reference
< css::chart2::data::XLabeledDataSequence
> const & xCategSeq
);
890 /** Creates a legend object and converts all legend settings. */
891 void ConvertLegend( const ScfPropertySet
& rPropSet
);
893 /** Returns true, if this chart type group contains at least one valid series. */
894 bool IsValidGroup() const { return !maSeries
.IsEmpty() && maType
.IsValidType(); }
895 /** Returns the index of this chart type group format. */
896 sal_uInt16
GetGroupIdx() const { return maData
.mnGroupIdx
; }
897 /** Returns the chart type info struct for the contained chart type. */
898 const XclChExtTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
899 /** Returns true, if the chart is three-dimensional. */
900 bool Is3dChart() const { return maTypeInfo
.mb3dChart
; }
901 /** Returns true, if chart type supports wall and floor format. */
902 bool Is3dWallChart() const { return Is3dChart() && (maTypeInfo
.meTypeCateg
!= EXC_CHTYPECATEG_PIE
); }
903 /** Returns true, if the series in this chart type group are ordered on the Z axis. */
904 bool Is3dDeepChart() const { return Is3dWallChart() && mxChart3d
&& !mxChart3d
->IsClustered(); }
905 /** Returns true, if this chart type can be combined with other types. */
906 bool IsCombinable2d() const { return !Is3dChart() && maTypeInfo
.mbCombinable2d
; }
908 /** Writes all embedded records. */
909 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
912 /** Returns an unused format index to be used for the next created series. */
913 sal_uInt16
GetFreeFormatIdx() const;
914 /** Creates all data series of any chart type except stock charts. */
915 void CreateDataSeries( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
916 css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
);
917 /** Creates all data series of a stock chart. */
918 void CreateAllStockSeries( css::uno::Reference
< css::chart2::XChartType
> const & xChartType
,
919 css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
);
920 /** Creates a single data series of a stock chart. */
921 bool CreateStockSeries( css::uno::Reference
< css::chart2::XDataSeries
> const & xDataSeries
,
922 const OUString
& rValueRole
, bool bCloseSymbol
);
924 virtual void WriteBody( XclExpStream
& rStrm
) override
;
927 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
928 typedef ::std::map
<sal_uInt16
, std::unique_ptr
<XclExpChLineFormat
>> XclExpChLineFormatMap
;
930 XclChTypeGroup maData
; /// Contents of the CHTYPEGROUP record.
931 XclExpChType maType
; /// Chart type (e.g. CHBAR, CHLINE, ...).
932 XclChExtTypeInfo maTypeInfo
; /// Extended chart type info.
933 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
934 XclExpChChart3dRef mxChart3d
; /// 3D settings (CHCHART3D record).
935 XclExpChLegendRef mxLegend
; /// Chart legend (CHLEGEND group).
936 XclExpChDropBarRef mxUpBar
; /// White dropbars (CHDROPBAR group).
937 XclExpChDropBarRef mxDownBar
; /// Black dropbars (CHDROPBAR group).
938 XclExpChLineFormatMap m_ChartLines
; /// Global line formats (CHCHARTLINE group).
941 typedef std::shared_ptr
< XclExpChTypeGroup
> XclExpChTypeGroupRef
;
943 // Axes =======================================================================
945 class XclExpChLabelRange
: public XclExpRecord
, protected XclExpChRoot
948 explicit XclExpChLabelRange( const XclExpChRoot
& rRoot
);
950 /** Converts category axis scaling settings. */
951 void Convert( const css::chart2::ScaleData
& rScaleData
,
952 const ScfPropertySet
& rChart1Axis
, bool bMirrorOrient
);
953 /** Converts position settings of a crossing axis at this axis. */
954 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
955 /** Sets flag for tickmark position between categories or on categories. */
956 void SetTicksBetweenCateg( bool bTicksBetween
)
957 { ::set_flag( maLabelData
.mnFlags
, EXC_CHLABELRANGE_BETWEEN
, bTicksBetween
); }
960 virtual void Save( XclExpStream
& rStrm
) override
;
961 virtual void WriteBody( XclExpStream
& rStrm
) override
;
964 XclChLabelRange maLabelData
; /// Contents of the CHLABELRANGE record.
965 XclChDateRange maDateData
; /// Contents of the CHDATERANGE record.
968 typedef std::shared_ptr
< XclExpChLabelRange
> XclExpChLabelRangeRef
;
970 class XclExpChValueRange
: public XclExpRecord
, protected XclExpChRoot
973 explicit XclExpChValueRange( const XclExpChRoot
& rRoot
);
975 /** Converts value axis scaling settings. */
976 void Convert( const css::chart2::ScaleData
& rScaleData
);
977 /** Converts position settings of a crossing axis at this axis. */
978 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
981 virtual void WriteBody( XclExpStream
& rStrm
) override
;
984 XclChValueRange maData
; /// Contents of the CHVALUERANGE record.
987 typedef std::shared_ptr
< XclExpChValueRange
> XclExpChValueRangeRef
;
989 class XclExpChTick
: public XclExpRecord
, protected XclExpChRoot
992 explicit XclExpChTick( const XclExpChRoot
& rRoot
);
994 /** Converts axis tick mark settings. */
995 void Convert( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
, sal_uInt16 nAxisType
);
996 /** Sets font color and color identifier to internal data structures. */
997 void SetFontColor( const Color
& rColor
, sal_uInt32 nColorId
);
998 /** Sets text rotation to internal data structures. */
999 void SetRotation( sal_uInt16 nRotation
);
1002 virtual void WriteBody( XclExpStream
& rStrm
) override
;
1005 XclChTick maData
; /// Contents of the CHTICK record.
1006 sal_uInt32 mnTextColorId
; /// Axis labels text color identifier.
1009 typedef std::shared_ptr
< XclExpChTick
> XclExpChTickRef
;
1011 /** Represents the CHAXIS record group describing an entire chart axis.
1013 The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
1014 CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
1015 CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
1017 class XclExpChAxis
: public XclExpChGroupBase
, public XclExpChFontBase
1020 explicit XclExpChAxis( const XclExpChRoot
& rRoot
, sal_uInt16 nAxisType
);
1022 /** Sets font color and color identifier to internal data structures. */
1023 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) override
;
1024 /** Sets text rotation to internal data structures. */
1025 virtual void SetRotation( sal_uInt16 nRotation
) override
;
1027 /** Converts formatting and scaling settings from the passed axis. */
1028 void Convert( css::uno::Reference
< css::chart2::XAxis
> const & xAxis
,
1029 css::uno::Reference
< css::chart2::XAxis
> const & xCrossingAxis
,
1030 css::uno::Reference
< css::chart::XAxis
> const & xChart1Axis
,
1031 const XclChExtTypeInfo
& rTypeInfo
);
1032 /** Converts and writes 3D wall/floor properties from the passed diagram. */
1033 void ConvertWall( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
);
1035 /** Returns the type of this axis. */
1036 sal_uInt16
GetAxisType() const { return maData
.mnType
; }
1037 /** Returns the axis dimension index used by the chart API. */
1038 sal_Int32
GetApiAxisDimension() const { return maData
.GetApiAxisDimension(); }
1040 /** Writes all embedded records. */
1041 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
1044 virtual void WriteBody( XclExpStream
& rStrm
) override
;
1047 XclChAxis maData
; /// Contents of the CHAXIS record.
1048 XclExpChLabelRangeRef mxLabelRange
; /// Category scaling (CHLABELRANGE record).
1049 XclExpChValueRangeRef mxValueRange
; /// Value scaling (CHVALUERANGE record).
1050 XclExpChTickRef mxTick
; /// Axis ticks (CHTICK record).
1051 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
1052 XclExpChLineFormatRef mxAxisLine
; /// Axis line format (CHLINEFORMAT record).
1053 XclExpChLineFormatRef mxMajorGrid
; /// Major grid line format (CHLINEFORMAT record).
1054 XclExpChLineFormatRef mxMinorGrid
; /// Minor grid line format (CHLINEFORMAT record).
1055 XclExpChFrameRef mxWallFrame
; /// Wall/floor format (sub records of CHFRAME group).
1056 sal_uInt16 mnNumFmtIdx
; /// Index into number format buffer (CHFORMAT record).
1059 typedef std::shared_ptr
< XclExpChAxis
> XclExpChAxisRef
;
1061 /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
1063 The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
1064 groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
1065 CHTYPEGROUP group, CHEND.
1067 class XclExpChAxesSet
: public XclExpChGroupBase
1070 explicit XclExpChAxesSet( const XclExpChRoot
& rRoot
, sal_uInt16 nAxesSetId
);
1072 /** Converts the passed diagram to chart record data.
1073 @return First unused chart type group index. */
1074 sal_uInt16
Convert( css::uno::Reference
< css::chart2::XDiagram
> const & xDiagram
,
1075 sal_uInt16 nFirstGroupIdx
);
1077 /** Returns true, if this axes set exists (returns false if this is a dummy object). */
1078 bool IsValidAxesSet() const { return !maTypeGroups
.IsEmpty(); }
1079 /** Returns the index of the axes set (primary/secondary). */
1080 sal_uInt16
GetAxesSetId() const { return maData
.mnAxesSetId
; }
1081 /** Returns the axes set index used by the chart API. */
1082 sal_Int32
GetApiAxesSetIndex() const { return maData
.GetApiAxesSetIndex(); }
1083 /** Returns true, if the chart is three-dimensional. */
1084 bool Is3dChart() const;
1086 /** Writes all embedded records. */
1087 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
1090 /** Returns first inserted chart type group. */
1091 XclExpChTypeGroupRef
GetFirstTypeGroup() const;
1092 /** Returns last inserted chart type group. */
1093 XclExpChTypeGroupRef
GetLastTypeGroup() const;
1095 /** Converts a complete axis object including axis title. */
1096 void ConvertAxis( XclExpChAxisRef
& rxChAxis
, sal_uInt16 nAxisType
,
1097 XclExpChTextRef
& rxChAxisTitle
, sal_uInt16 nTitleTarget
,
1098 css::uno::Reference
< css::chart2::XCoordinateSystem
> const & xCoordSystem
,
1099 const XclChExtTypeInfo
& rTypeInfo
,
1100 sal_Int32 nCrossingAxisDim
);
1102 virtual void WriteBody( XclExpStream
& rStrm
) override
;
1105 typedef XclExpRecordList
< XclExpChTypeGroup
> XclExpChTypeGroupList
;
1107 XclChAxesSet maData
; /// Contents of the CHAXESSET record.
1108 XclExpChFramePosRef mxFramePos
; /// Outer plot area position (CHFRAMEPOS record).
1109 XclExpChAxisRef mxXAxis
; /// The X axis (CHAXIS group).
1110 XclExpChAxisRef mxYAxis
; /// The Y axis (CHAXIS group).
1111 XclExpChAxisRef mxZAxis
; /// The Z axis (CHAXIS group).
1112 XclExpChTextRef mxXAxisTitle
; /// The X axis title (CHTEXT group).
1113 XclExpChTextRef mxYAxisTitle
; /// The Y axis title (CHTEXT group).
1114 XclExpChTextRef mxZAxisTitle
; /// The Z axis title (CHTEXT group).
1115 XclExpChFrameRef mxPlotFrame
; /// Plot area (CHPLOTFRAME group).
1116 XclExpChTypeGroupList maTypeGroups
; /// Chart type groups (CHTYPEGROUP group).
1119 typedef std::shared_ptr
< XclExpChAxesSet
> XclExpChAxesSetRef
;
1121 // The chart object ===========================================================
1123 /** Represents the CHCHART record group describing the chart contents.
1125 The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
1126 group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
1127 with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
1129 class XclExpChChart
: public XclExpChGroupBase
1132 explicit XclExpChChart( const XclExpRoot
& rRoot
,
1133 css::uno::Reference
< css::chart2::XChartDocument
> const & xChartDoc
,
1134 const tools::Rectangle
& rChartRect
);
1136 /** Creates, registers and returns a new data series object. */
1137 XclExpChSeriesRef
CreateSeries();
1138 /** Removes the last created data series object from the series list. */
1139 void RemoveLastSeries();
1140 /** Stores a CHTEXT group that describes a data point label. */
1141 void SetDataLabel( XclExpChTextRef
const & xText
);
1142 /** Sets the plot area position and size to manual mode. */
1143 void SetManualPlotArea();
1145 /** Writes all embedded records. */
1146 virtual void WriteSubRecords( XclExpStream
& rStrm
) override
;
1149 virtual void WriteBody( XclExpStream
& rStrm
) override
;
1152 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
1153 typedef XclExpRecordList
< XclExpChText
> XclExpChTextList
;
1155 XclChRectangle maRect
; /// Position of the chart on the sheet (CHCHART record).
1156 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
1157 XclExpChFrameRef mxFrame
; /// Chart frame format (CHFRAME group).
1158 XclChProperties maProps
; /// Chart properties (CHPROPERTIES record).
1159 XclExpChAxesSetRef mxPrimAxesSet
; /// Primary axes set (CHAXESSET group).
1160 XclExpChAxesSetRef mxSecnAxesSet
; /// Secondary axes set (CHAXESSET group).
1161 XclExpChTextRef mxTitle
; /// Chart title (CHTEXT group).
1162 XclExpChTextList maLabels
; /// Data point labels (CHTEXT groups).
1165 /** Represents the group of DFF and OBJ records containing all drawing shapes
1166 embedded in the chart object.
1168 class XclExpChartDrawing
: public XclExpRecordBase
, protected XclExpRoot
1171 explicit XclExpChartDrawing(
1172 const XclExpRoot
& rRoot
,
1173 const css::uno::Reference
< css::frame::XModel
>& rxModel
,
1174 const Size
& rChartSize
);
1175 virtual ~XclExpChartDrawing() override
;
1177 virtual void Save( XclExpStream
& rStrm
) override
;
1180 std::shared_ptr
< XclExpObjectManager
> mxObjMgr
;
1181 std::shared_ptr
< XclExpRecordBase
> mxObjRecs
;
1184 /** Represents the entire chart substream (all records in BOF/EOF block). */
1185 class XclExpChart
: public XclExpSubStream
, protected XclExpRoot
1188 explicit XclExpChart( const XclExpRoot
& rRoot
,
1189 css::uno::Reference
< css::frame::XModel
> const & xModel
,
1190 const tools::Rectangle
& rChartRect
);
1195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */