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"
29 #include <boost/ptr_container/ptr_map.hpp>
35 namespace com
{ namespace sun
{ namespace star
{
53 class XCoordinateSystem
;
58 class XFormattedString
;
59 class XRegressionCurve
;
63 class XLabeledDataSequence
;
68 // Common =====================================================================
70 struct XclExpChRootData
;
73 /** Base class for complex chart classes, provides access to other components
76 Keeps also track of future record levels and writes the needed future
79 class XclExpChRoot
: public XclExpRoot
82 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> XChartDocRef
;
85 explicit XclExpChRoot( const XclExpRoot
& rRoot
, XclExpChChart
& rChartData
);
86 virtual ~XclExpChRoot();
88 /** Returns this root instance - for code readability in derived classes. */
89 inline const XclExpChRoot
& GetChRoot() const { return *this; }
90 /** Returns the API Chart document model. */
91 XChartDocRef
GetChartDocument() const;
92 /** Returns a reference to the parent chart data object. */
93 XclExpChChart
& GetChartData() const;
94 /** Returns chart type info for a unique chart type identifier. */
95 const XclChTypeInfo
& GetChartTypeInfo( XclChTypeId eType
) const;
96 /** Returns the first fitting chart type info for the passed service name. */
97 const XclChTypeInfo
& GetChartTypeInfo( const OUString
& rServiceName
) const;
99 /** Returns an info struct about auto formatting for the passed object type. */
100 const XclChFormatInfo
& GetFormatInfo( XclChObjectType eObjType
) const;
102 /** Starts the API chart document conversion. Must be called once before all API conversion. */
103 void InitConversion( XChartDocRef xChartDoc
, const Rectangle
& rChartRect
) const;
104 /** Finishes the API chart document conversion. Must be called once after all API conversion. */
105 void FinishConversion() const;
107 /** Returns true, if the passed color equals to the specified system color. */
108 bool IsSystemColor( const Color
& rColor
, sal_uInt16 nSysColorIdx
) const;
109 /** Sets a system color and the respective color identifier. */
110 void SetSystemColor( Color
& rColor
, sal_uInt32
& rnColorId
, sal_uInt16 nSysColorIdx
) const;
112 /** Converts the passed horizontal coordinate from 1/100 mm to Excel chart units. */
113 sal_Int32
CalcChartXFromHmm( sal_Int32 nPosX
) const;
114 /** Converts the passed vertical coordinate from 1/100 mm to Excel chart units. */
115 sal_Int32
CalcChartYFromHmm( sal_Int32 nPosY
) const;
116 /** Converts the passed rectangle from 1/100 mm to Excel chart units. */
117 XclChRectangle
CalcChartRectFromHmm( const ::com::sun::star::awt::Rectangle
& rRect
) const;
119 /** Reads all line properties from the passed property set. */
120 void ConvertLineFormat(
121 XclChLineFormat
& rLineFmt
,
122 const ScfPropertySet
& rPropSet
,
123 XclChPropertyMode ePropMode
) const;
124 /** Reads solid area properties from the passed property set.
125 @return true = object contains complex fill properties. */
126 bool ConvertAreaFormat(
127 XclChAreaFormat
& rAreaFmt
,
128 const ScfPropertySet
& rPropSet
,
129 XclChPropertyMode ePropMode
) const;
130 /** Reads gradient or bitmap area properties from the passed property set. */
131 void ConvertEscherFormat(
132 XclChEscherFormat
& rEscherFmt
,
133 XclChPicFormat
& rPicFmt
,
134 const ScfPropertySet
& rPropSet
,
135 XclChPropertyMode ePropMode
) const;
136 /** Reads font properties from the passed property set. */
137 sal_uInt16
ConvertFont(
138 const ScfPropertySet
& rPropSet
,
139 sal_Int16 nScript
) const;
141 /** Reads the pie rotation property and returns the converted angle. */
142 static sal_uInt16
ConvertPieRotation( const ScfPropertySet
& rPropSet
);
145 /** Called from XclExpChGroupBase::Save, registers a new future record level. */
146 void RegisterFutureRecBlock( const XclChFrBlock
& rFrBlock
);
147 /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
148 void InitializeFutureRecBlock( XclExpStream
& rStrm
);
149 /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
150 void FinalizeFutureRecBlock( XclExpStream
& rStrm
);
153 typedef std::shared_ptr
< XclExpChRootData
> XclExpChRootDataRef
;
154 XclExpChRootDataRef mxChData
; /// Reference to the root data object.
157 /** Base class for chart record groups. Provides helper functions to write sub records.
159 A chart record group consists of a header record, followed by a CHBEGIN
160 record, followed by group sub records, and finished with a CHEND record.
162 class XclExpChGroupBase
: public XclExpRecord
, protected XclExpChRoot
165 explicit XclExpChGroupBase(
166 const XclExpChRoot
& rRoot
, sal_uInt16 nFrType
,
167 sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
168 virtual ~XclExpChGroupBase();
170 /** Saves the header record. Calls WriteSubRecords() to let derived classes write sub records. */
171 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
172 /** Derived classes return whether there are any records embedded in this group. */
173 virtual bool HasSubRecords() const;
174 /** Derived classes implement writing any records embedded in this group. */
175 virtual void WriteSubRecords( XclExpStream
& rStrm
) = 0;
178 /** Sets context information for future record blocks. */
179 void SetFutureRecordContext( sal_uInt16 nFrContext
,
180 sal_uInt16 nFrValue1
= 0, sal_uInt16 nFrValue2
= 0 );
183 XclChFrBlock maFrBlock
; /// Future records block settings.
186 /** Base class for chart future records. On saving, the record writes missing
187 CHFRBLOCKBEGIN records automatically.
189 class XclExpChFutureRecordBase
: public XclExpFutureRecord
, protected XclExpChRoot
192 explicit XclExpChFutureRecordBase( const XclExpChRoot
& rRoot
,
193 XclFutureRecType eRecType
, sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
195 /** Writes missing CHFRBLOCKBEGIN records and this record. */
196 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
199 // Frame formatting ===========================================================
201 class XclExpChFramePos
: public XclExpRecord
204 explicit XclExpChFramePos( sal_uInt16 nTLMode
, sal_uInt16 nBRMode
);
206 /** Returns read/write access to the frame position data. */
207 inline XclChFramePos
& GetFramePosData() { return maData
; }
210 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
213 XclChFramePos maData
; /// Position of the frame.
216 typedef std::shared_ptr
< XclExpChFramePos
> XclExpChFramePosRef
;
218 class XclExpChLineFormat
: public XclExpRecord
221 explicit XclExpChLineFormat( const XclExpChRoot
& rRoot
);
223 /** Converts line formatting properties from the passed property set. */
224 void Convert( const XclExpChRoot
& rRoot
,
225 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
226 /** Sets or clears the automatic flag. */
227 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
, bAuto
); }
228 /** Sets flag to show or hide an axis. */
229 inline void SetShowAxis( bool bShowAxis
)
230 { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_SHOWAXIS
, bShowAxis
); }
231 /** Sets the line format to the specified default type. */
232 void SetDefault( XclChFrameType eDefFrameType
);
234 /** Returns true, if the line format is set to automatic. */
235 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
); }
236 /** Returns true, if the line style is set to something visible. */
237 inline bool HasLine() const { return maData
.mnPattern
!= EXC_CHLINEFORMAT_NONE
; }
238 /** Returns true, if the line contains default formatting according to the passed frame type. */
239 bool IsDefault( XclChFrameType eDefFrameType
) const;
242 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
245 XclChLineFormat maData
; /// Contents of the CHLINEFORMAT record.
246 sal_uInt32 mnColorId
; /// Line color identifier.
249 typedef std::shared_ptr
< XclExpChLineFormat
> XclExpChLineFormatRef
;
251 class XclExpChAreaFormat
: public XclExpRecord
254 explicit XclExpChAreaFormat( const XclExpChRoot
& rRoot
);
256 /** Converts area formatting properties from the passed property set.
257 @return true = object contains complex fill properties. */
258 bool Convert( const XclExpChRoot
& rRoot
,
259 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
260 /** Sets or clears the automatic flag. */
261 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
, bAuto
); }
262 /** Sets the area format to the specified default type. */
263 void SetDefault( XclChFrameType eDefFrameType
);
265 /** Returns true, if the area format is set to automatic. */
266 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
); }
267 /** Returns true, if the area style is set to something visible. */
268 inline bool HasArea() const { return maData
.mnPattern
!= EXC_PATT_NONE
; }
269 /** Returns true, if the area contains default formatting according to the passed frame type. */
270 bool IsDefault( XclChFrameType eDefFrameType
) const;
273 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
276 XclChAreaFormat maData
; /// Contents of the CHAREAFORMAT record.
277 sal_uInt32 mnPattColorId
; /// Pattern color identifier.
278 sal_uInt32 mnBackColorId
; /// Pattern background color identifier.
281 typedef std::shared_ptr
< XclExpChAreaFormat
> XclExpChAreaFormatRef
;
283 class XclExpChEscherFormat
: public XclExpChGroupBase
286 explicit XclExpChEscherFormat( const XclExpChRoot
& rRoot
);
288 /** Converts complex area formatting from the passed property set. */
289 void Convert( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
291 /** Returns true, if the object contains valid formatting data. */
292 bool IsValid() const;
294 /** Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant. */
295 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
296 /** Returns true, if this record group contains a CHPICFORMAT record. */
297 virtual bool HasSubRecords() const SAL_OVERRIDE
;
298 /** Writes all embedded records. */
299 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
302 /** Inserts a color from the contained Escher property set into the color palette. */
303 sal_uInt32
RegisterColor( sal_uInt16 nPropId
);
305 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
308 XclChEscherFormat maData
; /// Fill properties for complex areas (CHESCHERFORMAT record).
309 XclChPicFormat maPicFmt
; /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
310 sal_uInt32 mnColor1Id
; /// First fill color identifier.
311 sal_uInt32 mnColor2Id
; /// Second fill color identifier.
314 typedef std::shared_ptr
< XclExpChEscherFormat
> XclExpChEscherFormatRef
;
316 /** Base class for record groups containing frame formatting.
318 Frame formatting can be part of several record groups, e.g. CHFRAME,
319 CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
320 CHESCHERFORMAT group.
322 class XclExpChFrameBase
325 explicit XclExpChFrameBase();
326 virtual ~XclExpChFrameBase();
329 /** Converts frame formatting properties from the passed property set. */
330 void ConvertFrameBase( const XclExpChRoot
& rRoot
,
331 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
332 /** Sets the frame formatting to the specified default type. */
333 void SetDefaultFrameBase( const XclExpChRoot
& rRoot
,
334 XclChFrameType eDefFrameType
, bool bIsFrame
);
336 /** Returns true, if the frame contains default formatting (as if the frame is missing). */
337 bool IsDefaultFrameBase( XclChFrameType eDefFrameType
) const;
339 /** Writes all contained frame records to the passed stream. */
340 void WriteFrameRecords( XclExpStream
& rStrm
);
343 XclExpChLineFormatRef mxLineFmt
; /// Line format (CHLINEFORMAT record).
344 XclExpChAreaFormatRef mxAreaFmt
; /// Area format (CHAREAFORMAT record).
345 XclExpChEscherFormatRef mxEscherFmt
; /// Complex area format (CHESCHERFORMAT record).
348 /** Represents the CHFRAME record group containing object frame properties.
350 The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
351 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
353 class XclExpChFrame
: public XclExpChGroupBase
, public XclExpChFrameBase
356 explicit XclExpChFrame( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
358 /** Converts frame formatting properties from the passed property set. */
359 void Convert( const ScfPropertySet
& rPropSet
);
360 /** Sets the specified automatic flags. */
361 void SetAutoFlags( bool bAutoPos
, bool bAutoSize
);
363 /** Returns true, if the frame object contains default formats. */
364 bool IsDefault() const;
365 /** Returns true, if the frame object can be deleted because it contains default formats. */
366 bool IsDeleteable() const;
368 /** Writes the entire record group. */
369 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
370 /** Writes all embedded records. */
371 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
374 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
377 XclChFrame maData
; /// Contents of the CHFRAME record.
378 XclChObjectType meObjType
; /// Type of the represented object.
381 typedef std::shared_ptr
< XclExpChFrame
> XclExpChFrameRef
;
383 // Source links ===============================================================
385 class XclExpChSourceLink
: public XclExpRecord
, protected XclExpChRoot
388 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XDataSequence
> XDataSequenceRef
;
389 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XFormattedString
> XFormattedStringRef
;
390 typedef ::com::sun::star::uno::Sequence
< XFormattedStringRef
> XFormattedStringSeq
;
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( XDataSequenceRef xDataSeq
, bool bSplitToColumns
, sal_uInt16 nDefCount
= 0 );
398 /** Converts the passed sequence of formatted string objects, returns leading font index. */
399 sal_uInt16
ConvertStringSequence( const XFormattedStringSeq
& rStringSeq
);
400 /** Converts the number format from the passed property set. */
401 void ConvertNumFmt( const ScfPropertySet
& rPropSet
, bool bPercent
);
403 void AppendString( const OUString
& rStr
);
405 /** Returns true, if this source link contains explicit string data. */
406 inline bool HasString() const { return mxString
&& !mxString
->IsEmpty(); }
408 /** Writes the CHSOURCELINK record and optionally a CHSTRING record with explicit string data. */
409 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
412 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
415 XclChSourceLink maData
; /// Contents of the CHSOURCELINK record.
416 XclTokenArrayRef mxLinkFmla
; /// Formula with link to source data.
417 XclExpStringRef mxString
; /// Text data (CHSTRING record).
420 typedef std::shared_ptr
< XclExpChSourceLink
> XclExpChSourceLinkRef
;
422 // Text =======================================================================
424 /** The CHFONT record containing a font index for text objects. */
425 class XclExpChFont
: public XclExpUInt16Record
428 explicit XclExpChFont( sal_uInt16 nFontIdx
);
431 typedef std::shared_ptr
< XclExpChFont
> XclExpChFontRef
;
433 /** The CHOBJECTLINK record linking a text object to a specific chart object. */
434 class XclExpChObjectLink
: public XclExpRecord
437 explicit XclExpChObjectLink( sal_uInt16 nLinkTarget
, const XclChDataPointPos
& rPointPos
);
440 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
443 XclChObjectLink maData
; /// Contents of the CHOBJECTLINK record.
446 typedef std::shared_ptr
< XclExpChObjectLink
> XclExpChObjectLinkRef
;
448 /** Additional data label settings in the future record CHFRLABELPROPS. */
449 class XclExpChFrLabelProps
: public XclExpChFutureRecordBase
452 explicit XclExpChFrLabelProps( const XclExpChRoot
& rRoot
);
454 /** Converts separator and the passed data label flags. */
456 const ScfPropertySet
& rPropSet
, bool bShowSeries
,
457 bool bShowCateg
, bool bShowValue
,
458 bool bShowPercent
, bool bShowBubble
);
461 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
464 XclChFrLabelProps maData
; /// Contents of the CHFRLABELPROPS record.
467 typedef std::shared_ptr
< XclExpChFrLabelProps
> XclExpChFrLabelPropsRef
;
469 /** Base class for objects with font settings. Provides font conversion helper functions. */
470 class XclExpChFontBase
473 virtual ~XclExpChFontBase();
475 /** Derived classes set font color and color identifier to internal data structures. */
476 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) = 0;
477 /** Derived classes set text rotation to internal data structures. */
478 virtual void SetRotation( sal_uInt16 nRotation
) = 0;
480 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
481 void ConvertFontBase( const XclExpChRoot
& rRoot
, sal_uInt16 nFontIdx
);
482 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
483 void ConvertFontBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
);
484 /** Converts rotation settings, calls virtual function SetRotation(). */
485 void ConvertRotationBase( const ScfPropertySet
& rPropSet
, bool bSupportsStacked
);
488 /** Represents the CHTEXT record group containing text object properties.
490 The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
491 CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
493 class XclExpChText
: public XclExpChGroupBase
, public XclExpChFontBase
496 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XTitle
> XTitleRef
;
497 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
500 explicit XclExpChText( const XclExpChRoot
& rRoot
);
502 /** Sets font color and color identifier to internal data structures. */
503 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) SAL_OVERRIDE
;
504 /** Sets text rotation to internal data structures. */
505 virtual void SetRotation( sal_uInt16 nRotation
) SAL_OVERRIDE
;
507 /** Converts all text settings of the passed title text object. */
508 void ConvertTitle( XTitleRef xTitle
, sal_uInt16 nTarget
, const OUString
* pSubTitle
= NULL
);
509 /** Converts all text settings of the passed legend. */
510 void ConvertLegend( const ScfPropertySet
& rPropSet
);
511 /** Converts all settings of the passed data point caption text object. */
512 bool ConvertDataLabel( const ScfPropertySet
& rPropSet
,
513 const XclChTypeInfo
& rTypeInfo
, const XclChDataPointPos
& rPointPos
);
514 /** Converts all settings of the passed trend line equation box. */
515 void ConvertTrendLineEquation( const ScfPropertySet
& rPropSet
, const XclChDataPointPos
& rPointPos
);
517 /** Returns true, if the string object does not contain any text data. */
518 inline bool HasString() const { return mxSrcLink
&& mxSrcLink
->HasString(); }
519 /** Returns the flags needed for the CHATTACHEDLABEL record. */
520 sal_uInt16
GetAttLabelFlags() const;
522 /** Writes all embedded records. */
523 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
526 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
529 XclChText maData
; /// Contents of the CHTEXT record.
530 XclExpChFramePosRef mxFramePos
; /// Relative text frame position (CHFRAMEPOS record).
531 XclExpChSourceLinkRef mxSrcLink
; /// Linked data (CHSOURCELINK with CHSTRING record).
532 XclExpChFrameRef mxFrame
; /// Text object frame properties (CHFRAME group).
533 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
534 XclExpChObjectLinkRef mxObjLink
; /// Link target for this text object.
535 XclExpChFrLabelPropsRef mxLabelProps
; /// Extended data label properties (CHFRLABELPROPS record).
536 sal_uInt32 mnTextColorId
; /// Text color identifier.
539 typedef std::shared_ptr
< XclExpChText
> XclExpChTextRef
;
541 // Data series ================================================================
543 /** The CHMARKERFORMAT record containing data point marker formatting data. */
544 class XclExpChMarkerFormat
: public XclExpRecord
547 explicit XclExpChMarkerFormat( const XclExpChRoot
& rRoot
);
549 /** Converts symbol properties from the passed property set. */
550 void Convert( const XclExpChRoot
& rRoot
,
551 const ScfPropertySet
& rPropSet
, sal_uInt16 nFormatIdx
);
552 /** Converts symbol properties for stock charts from the passed property set. */
553 void ConvertStockSymbol( const XclExpChRoot
& rRoot
,
554 const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
556 /** Returns true, if markers are enabled. */
557 inline bool HasMarker() const { return maData
.mnMarkerType
!= EXC_CHMARKERFORMAT_NOSYMBOL
; }
558 /** Returns true, if border line of markers is visible. */
559 inline bool HasLineColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOLINE
); }
560 /** Returns true, if fill area of markers is visible. */
561 inline bool HasFillColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOFILL
); }
564 /** Registers marker colors in palette and stores color identifiers. */
565 void RegisterColors( const XclExpChRoot
& rRoot
);
567 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
570 XclChMarkerFormat maData
; /// Contents of the CHMARKERFORMAT record.
571 sal_uInt32 mnLineColorId
; /// Border line color identifier.
572 sal_uInt32 mnFillColorId
; /// Fill color identifier.
575 typedef std::shared_ptr
< XclExpChMarkerFormat
> XclExpChMarkerFormatRef
;
577 /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
578 class XclExpChPieFormat
: public XclExpUInt16Record
581 explicit XclExpChPieFormat();
583 /** Sets pie segment properties from the passed property set. */
584 void Convert( const ScfPropertySet
& rPropSet
);
587 typedef std::shared_ptr
< XclExpChPieFormat
> XclExpChPieFormatRef
;
589 /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
590 class XclExpCh3dDataFormat
: public XclExpRecord
593 explicit XclExpCh3dDataFormat();
595 /** Sets 3d bar properties from the passed property set. */
596 void Convert( const ScfPropertySet
& rPropSet
);
599 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
602 XclCh3dDataFormat maData
; /// Contents of the CH3DDATAFORMAT record.
605 typedef std::shared_ptr
< XclExpCh3dDataFormat
> XclExpCh3dDataFormatRef
;
607 /** The CHATTACHEDLABEL record that contains the type of a data point label. */
608 class XclExpChAttachedLabel
: public XclExpUInt16Record
611 explicit XclExpChAttachedLabel( sal_uInt16 nFlags
);
614 typedef std::shared_ptr
< XclExpChAttachedLabel
> XclExpChAttLabelRef
;
616 /** Represents the CHDATAFORMAT record group containing data point properties.
618 The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
619 CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
620 CHATTACHEDLABEL, CHEND.
622 class XclExpChDataFormat
: public XclExpChGroupBase
, public XclExpChFrameBase
625 explicit XclExpChDataFormat( const XclExpChRoot
& rRoot
,
626 const XclChDataPointPos
& rPointPos
, sal_uInt16 nFormatIdx
);
628 /** Converts the passed data series or data point formatting. */
629 void ConvertDataSeries( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
);
630 /** Sets default formatting for a series in a stock chart. */
631 void ConvertStockSeries( const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
632 /** Converts line formatting for the specified object (e.g. trend lines, error bars). */
633 void ConvertLine( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
635 /** Returns true, if this objects describes the formatting of an entire series. */
636 inline bool IsSeriesFormat() const { return maData
.maPointPos
.mnPointIdx
== EXC_CHDATAFORMAT_ALLPOINTS
; }
638 /** Writes all embedded records. */
639 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
642 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
645 XclChDataFormat maData
; /// Contents of the CHDATAFORMAT record.
646 XclExpChMarkerFormatRef mxMarkerFmt
; /// Data point marker (CHMARKERFORMAT record).
647 XclExpChPieFormatRef mxPieFmt
; /// Pie segment format (CHPIEFORMAT record).
648 XclExpRecordRef mxSeriesFmt
; /// Series properties (CHSERIESFORMAT record).
649 XclExpCh3dDataFormatRef mx3dDataFmt
; /// 3D bar format (CH3DDATAFORMAT record).
650 XclExpChAttLabelRef mxAttLabel
; /// Data point label type (CHATTACHEDLABEL record).
653 typedef std::shared_ptr
< XclExpChDataFormat
> XclExpChDataFormatRef
;
655 /** Represents the CHSERTRENDLINE record containing settings for a trend line. */
656 class XclExpChSerTrendLine
: public XclExpRecord
, protected XclExpChRoot
659 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
662 explicit XclExpChSerTrendLine( const XclExpChRoot
& rRoot
);
664 /** Converts the passed trend line, returns true if trend line type is supported. */
665 bool Convert( XRegressionCurveRef xRegCurve
, sal_uInt16 nSeriesIdx
);
667 /** Returns formatting information of the trend line, created in Convert(). */
668 inline XclExpChDataFormatRef
GetDataFormat() const { return mxDataFmt
; }
669 /** Returns formatting of the equation text box, created in Convert(). */
670 inline XclExpChTextRef
GetDataLabel() const { return mxLabel
; }
673 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
676 XclChSerTrendLine maData
; /// Contents of the CHSERTRENDLINE record.
677 XclExpChDataFormatRef mxDataFmt
; /// Formatting settings of the trend line.
678 XclExpChTextRef mxLabel
; /// Formatting of the equation text box.
681 typedef std::shared_ptr
< XclExpChSerTrendLine
> XclExpChSerTrendLineRef
;
683 /** Represents the CHSERERRORBAR record containing settings for error bars. */
684 class XclExpChSerErrorBar
: public XclExpRecord
, protected XclExpChRoot
687 explicit XclExpChSerErrorBar( const XclExpChRoot
& rRoot
, sal_uInt8 nBarType
);
689 /** Converts the passed error bar settings, returns true if error bar type is supported. */
690 bool Convert( XclExpChSourceLink
& rValueLink
, sal_uInt16
& rnValueCount
, const ScfPropertySet
& rPropSet
);
693 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
696 XclChSerErrorBar maData
; /// Contents of the CHSERERRORBAR record.
699 typedef std::shared_ptr
< XclExpChSerErrorBar
> XclExpChSerErrorBarRef
;
701 /** Represents the CHSERIES record group describing a data series in a chart.
703 The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
704 CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
705 CHSERTRENDLINE, CHEND.
707 class XclExpChSeries
: public XclExpChGroupBase
710 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
711 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
712 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
713 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
716 explicit XclExpChSeries( const XclExpChRoot
& rRoot
, sal_uInt16 nSeriesIdx
);
718 /** Converts the passed data series (source links and formatting). */
719 bool ConvertDataSeries(
720 XDiagramRef xDiagram
, XDataSeriesRef xDataSeries
,
721 const XclChExtTypeInfo
& rTypeInfo
,
722 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
);
723 /** Converts the passed data series for stock charts. */
724 bool ConvertStockSeries(
725 XDataSeriesRef xDataSeries
,
726 const OUString
& rValueRole
,
727 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
, bool bCloseSymbol
);
728 /** Converts the passed error bar settings (called at trend line child series). */
729 bool ConvertTrendLine( const XclExpChSeries
& rParent
, XRegressionCurveRef xRegCurve
);
730 /** Converts the passed error bar settings (called at error bar child series). */
731 bool ConvertErrorBar( const XclExpChSeries
& rParent
, const ScfPropertySet
& rPropSet
, sal_uInt8 nBarId
);
732 /** Converts and inserts category ranges for all inserted series. */
733 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
735 /** Writes all embedded records. */
736 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
739 /** Initializes members of this series to represent a child of the passed series. */
740 void InitFromParent( const XclExpChSeries
& rParent
);
741 /** Tries to create trend line series objects (called at parent series). */
742 void CreateTrendLines( XDataSeriesRef xDataSeries
);
743 /** Tries to create positive and negative error bar series objects (called at parent series). */
744 void CreateErrorBars( const ScfPropertySet
& rPropSet
,
745 const OUString
& rBarPropName
,
746 sal_uInt8 nPosBarId
, sal_uInt8 nNegBarId
);
747 /** Tries to create an error bar series object (called at parent series). */
748 void CreateErrorBar( const ScfPropertySet
& rPropSet
,
749 const OUString
& rShowPropName
, sal_uInt8 nBarId
);
751 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
754 typedef XclExpRecordList
< XclExpChDataFormat
> XclExpChDataFormatList
;
757 XclChSeries maData
; /// Contents of the CHSERIES record.
758 XclExpChSourceLinkRef mxTitleLink
; /// Link data for series title.
759 XclExpChSourceLinkRef mxValueLink
; /// Link data for series values.
760 XclExpChSourceLinkRef mxCategLink
; /// Link data for series category names.
761 XclExpChSourceLinkRef mxBubbleLink
; /// Link data for series bubble sizes.
762 XclExpChDataFormatRef mxSeriesFmt
; /// CHDATAFORMAT group for series format.
763 XclExpChDataFormatList maPointFmts
; /// CHDATAFORMAT groups for data point formats.
764 XclExpChSerTrendLineRef mxTrendLine
; /// Trend line settings (CHSERTRENDLINE record).
765 XclExpChSerErrorBarRef mxErrorBar
; /// Error bar settings (CHSERERRORBAR record).
766 sal_uInt16 mnGroupIdx
; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
767 sal_uInt16 mnSeriesIdx
; /// 0-based series index.
768 sal_uInt16 mnParentIdx
; /// 0-based index of parent series (trend lines and error bars).
771 typedef std::shared_ptr
< XclExpChSeries
> XclExpChSeriesRef
;
773 // Chart type groups ==========================================================
775 /** Represents the chart type record for all supported chart types. */
776 class XclExpChType
: public XclExpRecord
, protected XclExpChRoot
779 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
780 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
783 explicit XclExpChType( const XclExpChRoot
& rRoot
);
785 /** Converts the passed chart type and the contained data series. */
786 void Convert( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
787 sal_Int32 nApiAxesSetIdx
, bool bSwappedAxesSet
, bool bHasXLabels
);
788 /** Sets stacking mode (standard or percent) for the series in this chart type group. */
789 void SetStacked( bool bPercent
);
791 /** Returns true, if this is object represents a valid chart type. */
792 inline bool IsValidType() const { return maTypeInfo
.meTypeId
!= EXC_CHTYPEID_UNKNOWN
; }
793 /** Returns the chart type info struct for the contained chart type. */
794 inline const XclChTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
797 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
800 XclChType maData
; /// Contents of the chart type record.
801 XclChTypeInfo maTypeInfo
; /// Chart type info for the contained type.
804 /** Represents the CHCHART3D record that contains 3D view settings. */
805 class XclExpChChart3d
: public XclExpRecord
808 explicit XclExpChChart3d();
810 /** Converts 3d settings for the passed chart type. */
811 void Convert( const ScfPropertySet
& rPropSet
, bool b3dWallChart
);
812 /** Sets flag that the data points are clustered on the X axis. */
813 inline void SetClustered() { ::set_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
815 /** Returns true, if the data points are clustered on the X axis. */
816 inline bool IsClustered() const { return ::get_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
819 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
822 XclChChart3d maData
; /// Contents of the CHCHART3D record.
825 typedef std::shared_ptr
< XclExpChChart3d
> XclExpChChart3dRef
;
827 /** Represents the CHLEGEND record group describing the chart legend.
829 The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME
830 group, CHTEXT group, CHEND.
832 class XclExpChLegend
: public XclExpChGroupBase
835 explicit XclExpChLegend( const XclExpChRoot
& rRoot
);
837 /** Converts all legend settings from the passed property set. */
838 void Convert( const ScfPropertySet
& rPropSet
);
840 /** Writes all embedded records. */
841 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
844 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
847 XclChLegend maData
; /// Contents of the CHLEGEND record.
848 XclExpChFramePosRef mxFramePos
; /// Legend frame position (CHFRAMEPOS record).
849 XclExpChTextRef mxText
; /// Legend text format (CHTEXT group).
850 XclExpChFrameRef mxFrame
; /// Legend frame format (CHFRAME group).
853 typedef std::shared_ptr
< XclExpChLegend
> XclExpChLegendRef
;
855 /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
857 The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
858 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
860 class XclExpChDropBar
: public XclExpChGroupBase
, public XclExpChFrameBase
863 explicit XclExpChDropBar( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
865 /** Converts and writes the contained frame data to the passed property set. */
866 void Convert( const ScfPropertySet
& rPropSet
);
868 /** Writes all embedded records. */
869 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
872 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
875 XclChObjectType meObjType
; /// Type of the dropbar.
876 sal_uInt16 mnBarDist
; /// Distance between bars (CHDROPBAR record).
879 typedef std::shared_ptr
< XclExpChDropBar
> XclExpChDropBarRef
;
881 /** Represents the CHTYPEGROUP record group describing a group of series.
883 The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
884 record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
885 CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
886 CHDATAFORMAT group, CHEND.
888 class XclExpChTypeGroup
: public XclExpChGroupBase
891 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
892 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
893 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
894 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
897 explicit XclExpChTypeGroup( const XclExpChRoot
& rRoot
, sal_uInt16 nGroupIdx
);
899 /** Converts the passed chart type to Excel type settings. */
900 void ConvertType( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
901 sal_Int32 nApiAxesSetIdx
, bool b3dChart
, bool bSwappedAxesSet
, bool bHasXLabels
);
902 /** Converts and inserts all series from the passed chart type. */
903 void ConvertSeries( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
904 sal_Int32 nGroupAxesSetIdx
, bool bPercent
, bool bConnectorLines
);
905 /** Converts and inserts category ranges for all inserted series. */
906 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
907 /** Creates a legend object and converts all legend settings. */
908 void ConvertLegend( const ScfPropertySet
& rPropSet
);
910 /** Returns true, if this chart type group contains at least one valid series. */
911 inline bool IsValidGroup() const { return !maSeries
.IsEmpty() && maType
.IsValidType(); }
912 /** Returns the index of this chart type group format. */
913 inline sal_uInt16
GetGroupIdx() const { return maData
.mnGroupIdx
; }
914 /** Returns the chart type info struct for the contained chart type. */
915 inline const XclChExtTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
916 /** Returns true, if the chart is three-dimensional. */
917 inline bool Is3dChart() const { return maTypeInfo
.mb3dChart
; }
918 /** Returns true, if chart type supports wall and floor format. */
919 inline bool Is3dWallChart() const { return Is3dChart() && (maTypeInfo
.meTypeCateg
!= EXC_CHTYPECATEG_PIE
); }
920 /** Returns true, if the series in this chart type group are ordered on the Z axis. */
921 inline bool Is3dDeepChart() const { return Is3dWallChart() && mxChart3d
&& !mxChart3d
->IsClustered(); }
922 /** Returns true, if this chart type can be combined with other types. */
923 inline bool IsCombinable2d() const { return !Is3dChart() && maTypeInfo
.mbCombinable2d
; }
925 /** Writes all embedded records. */
926 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
929 /** Returns an unused format index to be used for the next created series. */
930 sal_uInt16
GetFreeFormatIdx() const;
931 /** Creates all data series of any chart type except stock charts. */
932 void CreateDataSeries( XDiagramRef xDiagram
,
933 XDataSeriesRef xDataSeries
);
934 /** Creates all data series of a stock chart. */
935 void CreateAllStockSeries( XChartTypeRef xChartType
,
936 XDataSeriesRef xDataSeries
);
937 /** Creates a single data series of a stock chart. */
938 bool CreateStockSeries( XDataSeriesRef xDataSeries
,
939 const OUString
& rValueRole
, bool bCloseSymbol
);
941 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
944 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
945 typedef ::boost::ptr_map
<sal_uInt16
, XclExpChLineFormat
> XclExpChLineFormatMap
;
947 XclChTypeGroup maData
; /// Contents of the CHTYPEGROUP record.
948 XclExpChType maType
; /// Chart type (e.g. CHBAR, CHLINE, ...).
949 XclChExtTypeInfo maTypeInfo
; /// Extended chart type info.
950 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
951 XclExpChChart3dRef mxChart3d
; /// 3D settings (CHCHART3D record).
952 XclExpChLegendRef mxLegend
; /// Chart legend (CHLEGEND group).
953 XclExpChDropBarRef mxUpBar
; /// White dropbars (CHDROPBAR group).
954 XclExpChDropBarRef mxDownBar
; /// Black dropbars (CHDROPBAR group).
955 XclExpChLineFormatMap maChartLines
; /// Global line formats (CHCHARTLINE group).
958 typedef std::shared_ptr
< XclExpChTypeGroup
> XclExpChTypeGroupRef
;
960 // Axes =======================================================================
962 class XclExpChLabelRange
: public XclExpRecord
, protected XclExpChRoot
965 explicit XclExpChLabelRange( const XclExpChRoot
& rRoot
);
967 /** Converts category axis scaling settings. */
968 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
,
969 const ScfPropertySet
& rChart1Axis
, bool bMirrorOrient
);
970 /** Converts position settings of a crossing axis at this axis. */
971 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
972 /** Sets flag for tickmark position between categories or on categories. */
973 inline void SetTicksBetweenCateg( bool bTicksBetween
)
974 { ::set_flag( maLabelData
.mnFlags
, EXC_CHLABELRANGE_BETWEEN
, bTicksBetween
); }
977 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
978 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
981 XclChLabelRange maLabelData
; /// Contents of the CHLABELRANGE record.
982 XclChDateRange maDateData
; /// Contents of the CHDATERANGE record.
985 typedef std::shared_ptr
< XclExpChLabelRange
> XclExpChLabelRangeRef
;
987 class XclExpChValueRange
: public XclExpRecord
, protected XclExpChRoot
990 explicit XclExpChValueRange( const XclExpChRoot
& rRoot
);
992 /** Converts value axis scaling settings. */
993 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
);
994 /** Converts position settings of a crossing axis at this axis. */
995 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
998 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1001 XclChValueRange maData
; /// Contents of the CHVALUERANGE record.
1004 typedef std::shared_ptr
< XclExpChValueRange
> XclExpChValueRangeRef
;
1006 class XclExpChTick
: public XclExpRecord
, protected XclExpChRoot
1009 explicit XclExpChTick( const XclExpChRoot
& rRoot
);
1011 /** Converts axis tick mark settings. */
1012 void Convert( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
, sal_uInt16 nAxisType
);
1013 /** Sets font color and color identifier to internal data structures. */
1014 void SetFontColor( const Color
& rColor
, sal_uInt32 nColorId
);
1015 /** Sets text rotation to internal data structures. */
1016 void SetRotation( sal_uInt16 nRotation
);
1019 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1022 XclChTick maData
; /// Contents of the CHTICK record.
1023 sal_uInt32 mnTextColorId
; /// Axis labels text color identifier.
1026 typedef std::shared_ptr
< XclExpChTick
> XclExpChTickRef
;
1028 /** Represents the CHAXIS record group describing an entire chart axis.
1030 The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
1031 CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
1032 CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
1034 class XclExpChAxis
: public XclExpChGroupBase
, public XclExpChFontBase
1037 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1038 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
> XAxisRef
;
1039 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart::XAxis
> XChart1AxisRef
;
1042 explicit XclExpChAxis( const XclExpChRoot
& rRoot
, sal_uInt16 nAxisType
);
1044 /** Sets font color and color identifier to internal data structures. */
1045 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) SAL_OVERRIDE
;
1046 /** Sets text rotation to internal data structures. */
1047 virtual void SetRotation( sal_uInt16 nRotation
) SAL_OVERRIDE
;
1049 /** Converts formatting and scaling settings from the passed axis. */
1050 void Convert( XAxisRef xAxis
, XAxisRef xCrossingAxis
,
1051 XChart1AxisRef xChart1Axis
, const XclChExtTypeInfo
& rTypeInfo
);
1052 /** Converts and writes 3D wall/floor properties from the passed diagram. */
1053 void ConvertWall( XDiagramRef xDiagram
);
1055 /** Returns the type of this axis. */
1056 inline sal_uInt16
GetAxisType() const { return maData
.mnType
; }
1057 /** Returns the axis dimension index used by the chart API. */
1058 inline sal_Int32
GetApiAxisDimension() const { return maData
.GetApiAxisDimension(); }
1060 /** Writes all embedded records. */
1061 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1064 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1067 XclChAxis maData
; /// Contents of the CHAXIS record.
1068 XclExpChLabelRangeRef mxLabelRange
; /// Category scaling (CHLABELRANGE record).
1069 XclExpChValueRangeRef mxValueRange
; /// Value scaling (CHVALUERANGE record).
1070 XclExpChTickRef mxTick
; /// Axis ticks (CHTICK record).
1071 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
1072 XclExpChLineFormatRef mxAxisLine
; /// Axis line format (CHLINEFORMAT record).
1073 XclExpChLineFormatRef mxMajorGrid
; /// Major grid line format (CHLINEFORMAT record).
1074 XclExpChLineFormatRef mxMinorGrid
; /// Minor grid line format (CHLINEFORMAT record).
1075 XclExpChFrameRef mxWallFrame
; /// Wall/floor format (sub records of CHFRAME group).
1076 sal_uInt16 mnNumFmtIdx
; /// Index into number format buffer (CHFORMAT record).
1079 typedef std::shared_ptr
< XclExpChAxis
> XclExpChAxisRef
;
1081 /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
1083 The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
1084 groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
1085 CHTYPEGROUP group, CHEND.
1087 class XclExpChAxesSet
: public XclExpChGroupBase
1090 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1091 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XCoordinateSystem
> XCoordSystemRef
;
1094 explicit XclExpChAxesSet( const XclExpChRoot
& rRoot
, sal_uInt16 nAxesSetId
);
1096 /** Converts the passed diagram to chart record data.
1097 @return First unused chart type group index. */
1098 sal_uInt16
Convert( XDiagramRef xDiagram
, sal_uInt16 nFirstGroupIdx
);
1100 /** Returns true, if this axes set exists (returns false if this is a dummy object). */
1101 inline bool IsValidAxesSet() const { return !maTypeGroups
.IsEmpty(); }
1102 /** Returns the index of the axes set (primary/secondary). */
1103 inline sal_uInt16
GetAxesSetId() const { return maData
.mnAxesSetId
; }
1104 /** Returns the axes set index used by the chart API. */
1105 inline sal_Int32
GetApiAxesSetIndex() const { return maData
.GetApiAxesSetIndex(); }
1106 /** Returns true, if the chart is three-dimensional. */
1107 bool Is3dChart() const;
1109 /** Writes all embedded records. */
1110 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1113 /** Returns first inserted chart type group. */
1114 XclExpChTypeGroupRef
GetFirstTypeGroup() const;
1115 /** Returns last inserted chart type group. */
1116 XclExpChTypeGroupRef
GetLastTypeGroup() const;
1118 /** Converts a complete axis object including axis title. */
1119 void ConvertAxis( XclExpChAxisRef
& rxChAxis
, sal_uInt16 nAxisType
,
1120 XclExpChTextRef
& rxChAxisTitle
, sal_uInt16 nTitleTarget
,
1121 XCoordSystemRef xCoordSystem
, const XclChExtTypeInfo
& rTypeInfo
,
1122 sal_Int32 nCrossingAxisDim
);
1124 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1127 typedef XclExpRecordList
< XclExpChTypeGroup
> XclExpChTypeGroupList
;
1129 XclChAxesSet maData
; /// Contents of the CHAXESSET record.
1130 XclExpChFramePosRef mxFramePos
; /// Outer plot area position (CHFRAMEPOS record).
1131 XclExpChAxisRef mxXAxis
; /// The X axis (CHAXIS group).
1132 XclExpChAxisRef mxYAxis
; /// The Y axis (CHAXIS group).
1133 XclExpChAxisRef mxZAxis
; /// The Z axis (CHAXIS group).
1134 XclExpChTextRef mxXAxisTitle
; /// The X axis title (CHTEXT group).
1135 XclExpChTextRef mxYAxisTitle
; /// The Y axis title (CHTEXT group).
1136 XclExpChTextRef mxZAxisTitle
; /// The Z axis title (CHTEXT group).
1137 XclExpChFrameRef mxPlotFrame
; /// Plot area (CHPLOTFRAME group).
1138 XclExpChTypeGroupList maTypeGroups
; /// Chart type groups (CHTYPEGROUP group).
1141 typedef std::shared_ptr
< XclExpChAxesSet
> XclExpChAxesSetRef
;
1143 // The chart object ===========================================================
1145 /** Represents the CHCHART record group describing the chart contents.
1147 The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
1148 group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
1149 with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
1151 class XclExpChChart
: public XclExpChGroupBase
1154 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> XChartDocRef
;
1157 explicit XclExpChChart( const XclExpRoot
& rRoot
,
1158 XChartDocRef xChartDoc
, const Rectangle
& rChartRect
);
1160 /** Creates, registers and returns a new data series object. */
1161 XclExpChSeriesRef
CreateSeries();
1162 /** Removes the last created data series object from the series list. */
1163 void RemoveLastSeries();
1164 /** Stores a CHTEXT group that describes a data point label. */
1165 void SetDataLabel( XclExpChTextRef xText
);
1166 /** Sets the plot area position and size to manual mode. */
1167 void SetManualPlotArea();
1169 /** Writes all embedded records. */
1170 virtual void WriteSubRecords( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1173 virtual void WriteBody( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1176 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
1177 typedef XclExpRecordList
< XclExpChText
> XclExpChTextList
;
1179 XclChRectangle maRect
; /// Position of the chart on the sheet (CHCHART record).
1180 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
1181 XclExpChFrameRef mxFrame
; /// Chart frame format (CHFRAME group).
1182 XclChProperties maProps
; /// Chart properties (CHPROPERTIES record).
1183 XclExpChAxesSetRef mxPrimAxesSet
; /// Primary axes set (CHAXESSET group).
1184 XclExpChAxesSetRef mxSecnAxesSet
; /// Secondary axes set (CHAXESSET group).
1185 XclExpChTextRef mxTitle
; /// Chart title (CHTEXT group).
1186 XclExpChTextList maLabels
; /// Data point labels (CHTEXT groups).
1189 /** Represents the group of DFF and OBJ records containing all drawing shapes
1190 embedded in the chart object.
1192 class XclExpChartDrawing
: public XclExpRecordBase
, protected XclExpRoot
1195 explicit XclExpChartDrawing(
1196 const XclExpRoot
& rRoot
,
1197 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& rxModel
,
1198 const Size
& rChartSize
);
1199 virtual ~XclExpChartDrawing();
1201 virtual void Save( XclExpStream
& rStrm
) SAL_OVERRIDE
;
1204 std::shared_ptr
< XclExpObjectManager
> mxObjMgr
;
1205 std::shared_ptr
< XclExpRecordBase
> mxObjRecs
;
1208 /** Represents the entire chart substream (all records in BOF/EOF block). */
1209 class XclExpChart
: public XclExpSubStream
, protected XclExpRoot
1212 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> XModelRef
;
1215 explicit XclExpChart( const XclExpRoot
& rRoot
,
1216 XModelRef xModel
, const Rectangle
& rChartRect
);
1221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */