1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xechart.hxx,v $
10 * $Revision: 1.7.62.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XECHART_HXX
32 #define SC_XECHART_HXX
34 #include "xerecord.hxx"
35 #include "xlchart.hxx"
36 #include "xlformula.hxx"
37 #include "xlstyle.hxx"
39 #include "xestring.hxx"
43 namespace com
{ namespace sun
{ namespace star
{
53 class XCoordinateSystem
;
58 class XFormattedString
;
59 class XRegressionCurve
;
63 class XLabeledDataSequence
;
68 // Common =====================================================================
70 class 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
* pChartData
);
86 virtual ~XclExpChRoot();
88 /** Returns this root instance - for code readability in derived classes. */
89 inline const XclExpChRoot
& GetChRoot() const { return *this; }
90 /** Returns a reference to the parent chart data object. */
91 XclExpChChart
& GetChartData() const;
92 /** Returns chart type info for a unique chart type identifier. */
93 const XclChTypeInfo
& GetChartTypeInfo( XclChTypeId eType
) const;
94 /** Returns the first fitting chart type info for the passed service name. */
95 const XclChTypeInfo
& GetChartTypeInfo( const ::rtl::OUString
& rServiceName
) const;
97 /** Returns an info struct about auto formatting for the passed object type. */
98 const XclChFormatInfo
& GetFormatInfo( XclChObjectType eObjType
) const;
100 /** Starts the API chart document conversion. Must be called once before all API conversion. */
101 void InitConversion( XChartDocRef xChartDoc
) const;
102 /** Finishes the API chart document conversion. Must be called once after all API conversion. */
103 void FinishConversion() const;
105 /** Returns true, if the passed color equals to the specified system color. */
106 bool IsSystemColor( const Color
& rColor
, sal_uInt16 nSysColorIdx
) const;
107 /** Sets a system color and the respective color identifier. */
108 void SetSystemColor( Color
& rColor
, sal_uInt32
& rnColorId
, sal_uInt16 nSysColorIdx
) const;
110 /** Reads all line properties from the passed property set. */
111 void ConvertLineFormat(
112 XclChLineFormat
& rLineFmt
,
113 const ScfPropertySet
& rPropSet
,
114 XclChPropertyMode ePropMode
) const;
115 /** Reads solid area properties from the passed property set.
116 @return true = object contains complex fill properties. */
117 bool ConvertAreaFormat(
118 XclChAreaFormat
& rAreaFmt
,
119 const ScfPropertySet
& rPropSet
,
120 XclChPropertyMode ePropMode
) const;
121 /** Reads gradient or bitmap area properties from the passed property set. */
122 void ConvertEscherFormat(
123 XclChEscherFormat
& rEscherFmt
,
124 XclChPicFormat
& rPicFmt
,
125 const ScfPropertySet
& rPropSet
,
126 XclChPropertyMode ePropMode
) const;
127 /** Reads font properties from the passed property set. */
128 sal_uInt16
ConvertFont(
129 const ScfPropertySet
& rPropSet
,
130 sal_Int16 nScript
) const;
132 /** Reads the pie rotation property and returns the converted angle. */
133 static sal_uInt16
ConvertPieRotation( const ScfPropertySet
& rPropSet
);
136 /** Called from XclExpChGroupBase::Save, registers a new future record level. */
137 void RegisterFutureRecBlock( const XclChFrBlock
& rFrBlock
);
138 /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
139 void InitializeFutureRecBlock( XclExpStream
& rStrm
);
140 /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
141 void FinalizeFutureRecBlock( XclExpStream
& rStrm
);
144 typedef ScfRef
< XclExpChRootData
> XclExpChRootDataRef
;
145 XclExpChRootDataRef mxChData
; /// Reference to the root data object.
148 // ----------------------------------------------------------------------------
150 /** Base class for chart record groups. Provides helper functions to write sub records.
152 A chart record group consists of a header record, followed by a CHBEGIN
153 record, followed by group sub records, and finished with a CHEND record.
155 class XclExpChGroupBase
: public XclExpRecord
, protected XclExpChRoot
158 explicit XclExpChGroupBase(
159 const XclExpChRoot
& rRoot
, sal_uInt16 nFrType
,
160 sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
161 virtual ~XclExpChGroupBase();
163 /** Saves the header record. Calls WriteSubRecords() to let derived classes write sub records. */
164 virtual void Save( XclExpStream
& rStrm
);
165 /** Derived classes return whether there are any records embedded in this group. */
166 virtual bool HasSubRecords() const;
167 /** Derived classes implement writing any records embedded in this group. */
168 virtual void WriteSubRecords( XclExpStream
& rStrm
) = 0;
171 /** Sets context information for future record blocks. */
172 void SetFutureRecordContext( sal_uInt16 nFrContext
,
173 sal_uInt16 nFrValue1
= 0, sal_uInt16 nFrValue2
= 0 );
176 XclChFrBlock maFrBlock
; /// Future records block settings.
179 // ----------------------------------------------------------------------------
181 /** Base class for chart future records. On saving, the record writes missing
182 CHFRBLOCKBEGIN records automatically.
184 class XclExpChFutureRecordBase
: public XclExpFutureRecord
, protected XclExpChRoot
187 explicit XclExpChFutureRecordBase( const XclExpChRoot
& rRoot
,
188 XclFutureRecType eRecType
, sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
190 /** Writes missing CHFRBLOCKBEGIN records and this record. */
191 virtual void Save( XclExpStream
& rStrm
);
194 // Frame formatting ===========================================================
196 class XclExpChLineFormat
: public XclExpRecord
199 explicit XclExpChLineFormat( const XclExpChRoot
& rRoot
);
201 /** Converts line formatting properties from the passed property set. */
202 void Convert( const XclExpChRoot
& rRoot
,
203 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
204 /** Sets or clears the automatic flag. */
205 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
, bAuto
); }
206 /** Sets flag to show or hide an axis. */
207 inline void SetShowAxis( bool bShowAxis
)
208 { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_SHOWAXIS
, bShowAxis
); }
209 /** Sets the line format to the specified default type. */
210 void SetDefault( XclChFrameType eDefFrameType
);
212 /** Returns true, if the line format is set to automatic. */
213 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
); }
214 /** Returns true, if the line style is set to something visible. */
215 inline bool HasLine() const { return maData
.mnPattern
!= EXC_CHLINEFORMAT_NONE
; }
216 /** Returns true, if the line contains default formatting according to the passed frame type. */
217 bool IsDefault( XclChFrameType eDefFrameType
) const;
220 virtual void WriteBody( XclExpStream
& rStrm
);
223 XclChLineFormat maData
; /// Contents of the CHLINEFORMAT record.
224 sal_uInt32 mnColorId
; /// Line color identifier.
227 typedef ScfRef
< XclExpChLineFormat
> XclExpChLineFormatRef
;
229 // ----------------------------------------------------------------------------
231 class XclExpChAreaFormat
: public XclExpRecord
234 explicit XclExpChAreaFormat( const XclExpChRoot
& rRoot
);
236 /** Converts area formatting properties from the passed property set.
237 @return true = object contains complex fill properties. */
238 bool Convert( const XclExpChRoot
& rRoot
,
239 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
240 /** Sets or clears the automatic flag. */
241 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
, bAuto
); }
242 /** Sets the area format to the specified default type. */
243 void SetDefault( XclChFrameType eDefFrameType
);
245 /** Returns true, if the area format is set to automatic. */
246 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
); }
247 /** Returns true, if the area style is set to something visible. */
248 inline bool HasArea() const { return maData
.mnPattern
!= EXC_PATT_NONE
; }
249 /** Returns true, if the area contains default formatting according to the passed frame type. */
250 bool IsDefault( XclChFrameType eDefFrameType
) const;
253 virtual void WriteBody( XclExpStream
& rStrm
);
256 XclChAreaFormat maData
; /// Contents of the CHAREAFORMAT record.
257 sal_uInt32 mnPattColorId
; /// Pattern color identifier.
258 sal_uInt32 mnBackColorId
; /// Pattern background color identifier.
261 typedef ScfRef
< XclExpChAreaFormat
> XclExpChAreaFormatRef
;
263 // ----------------------------------------------------------------------------
265 class XclExpChEscherFormat
: public XclExpChGroupBase
268 explicit XclExpChEscherFormat( const XclExpChRoot
& rRoot
);
270 /** Converts complex area formatting from the passed property set. */
271 void Convert( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
273 /** Returns true, if the object contains valid formatting data. */
274 bool IsValid() const;
276 /** Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant. */
277 virtual void Save( XclExpStream
& rStrm
);
278 /** Returns true, if this record group contains a CHPICFORMAT record. */
279 virtual bool HasSubRecords() const;
280 /** Writes all embedded records. */
281 virtual void WriteSubRecords( XclExpStream
& rStrm
);
284 /** Inserts a color from the contained Escher property set into the color palette. */
285 sal_uInt32
RegisterColor( sal_uInt16 nPropId
);
287 virtual void WriteBody( XclExpStream
& rStrm
);
290 XclChEscherFormat maData
; /// Fill properties for complex areas (CHESCHERFORMAT record).
291 XclChPicFormat maPicFmt
; /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
292 sal_uInt32 mnColor1Id
; /// First fill color identifier.
293 sal_uInt32 mnColor2Id
; /// Second fill color identifier.
296 typedef ScfRef
< XclExpChEscherFormat
> XclExpChEscherFormatRef
;
298 // ----------------------------------------------------------------------------
300 /** Base class for record groups containing frame formatting.
302 Frame formatting can be part of several record groups, e.g. CHFRAME,
303 CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
304 CHESCHERFORMAT group.
306 class XclExpChFrameBase
309 explicit XclExpChFrameBase();
310 virtual ~XclExpChFrameBase();
313 /** Converts frame formatting properties from the passed property set. */
314 void ConvertFrameBase( const XclExpChRoot
& rRoot
,
315 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
316 /** Sets the frame formatting to the specified default type. */
317 void SetDefaultFrameBase( const XclExpChRoot
& rRoot
,
318 XclChFrameType eDefFrameType
, bool bIsFrame
);
320 /** Returns true, if the frame contains default formatting (as if the frame is missing). */
321 bool IsDefaultFrameBase( XclChFrameType eDefFrameType
) const;
323 /** Writes all contained frame records to the passed stream. */
324 void WriteFrameRecords( XclExpStream
& rStrm
);
327 XclExpChLineFormatRef mxLineFmt
; /// Line format (CHLINEFORMAT record).
328 XclExpChAreaFormatRef mxAreaFmt
; /// Area format (CHAREAFORMAT record).
329 XclExpChEscherFormatRef mxEscherFmt
; /// Complex area format (CHESCHERFORMAT record).
332 // ----------------------------------------------------------------------------
334 /** Represents the CHFRAME record group containing object frame properties.
336 The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
337 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
339 class XclExpChFrame
: public XclExpChGroupBase
, public XclExpChFrameBase
342 explicit XclExpChFrame( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
344 /** Converts frame formatting properties from the passed property set. */
345 void Convert( const ScfPropertySet
& rPropSet
);
347 /** Returns true, if the frame object contains default formats. */
348 bool IsDefault() const;
349 /** Returns true, if the frame object can be deleted because it contains default formats. */
350 bool IsDeleteable() const;
352 /** Writes the entire record group. */
353 virtual void Save( XclExpStream
& rStrm
);
354 /** Writes all embedded records. */
355 virtual void WriteSubRecords( XclExpStream
& rStrm
);
358 virtual void WriteBody( XclExpStream
& rStrm
);
361 XclChFrame maData
; /// Contents of the CHFRAME record.
362 XclChObjectType meObjType
; /// Type of the represented object.
365 typedef ScfRef
< XclExpChFrame
> XclExpChFrameRef
;
367 // Source links ===============================================================
369 class XclExpChSourceLink
: public XclExpRecord
, protected XclExpChRoot
372 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XDataSequence
> XDataSequenceRef
;
373 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XFormattedString
> XFormattedStringRef
;
374 typedef ::com::sun::star::uno::Sequence
< XFormattedStringRef
> XFormattedStringSeq
;
377 explicit XclExpChSourceLink( const XclExpChRoot
& rRoot
, sal_uInt8 nDestType
);
379 /** Converts the passed source link, returns the number of linked values. */
380 sal_uInt16
ConvertDataSequence( XDataSequenceRef xDataSeq
, bool bSplitToColumns
, sal_uInt16 nDefCount
= 0 );
381 /** Converts the passed sequence of formatted string objects, returns leading font index. */
382 sal_uInt16
ConvertStringSequence( const XFormattedStringSeq
& rStringSeq
);
383 /** Converts the number format from the passed property set. */
384 void ConvertNumFmt( const ScfPropertySet
& rPropSet
, bool bPercent
);
386 void AppendString( const String
& rStr
);
388 /** Returns true, if this source link contains explicit string data. */
389 inline bool HasString() const { return mxString
.is() && !mxString
->IsEmpty(); }
391 /** Writes the CHSOURCELINK record and optionally a CHSTRING record with explicit string data. */
392 virtual void Save( XclExpStream
& rStrm
);
395 virtual void WriteBody( XclExpStream
& rStrm
);
398 XclChSourceLink maData
; /// Contents of the CHSOURCELINK record.
399 XclTokenArrayRef mxLinkFmla
; /// Formula with link to source data.
400 XclExpStringRef mxString
; /// Text data (CHSTRING record).
403 typedef ScfRef
< XclExpChSourceLink
> XclExpChSourceLinkRef
;
405 // Text =======================================================================
407 /** The CHFONT record containing a font index for text objects. */
408 class XclExpChFont
: public XclExpUInt16Record
411 explicit XclExpChFont( sal_uInt16 nFontIdx
);
414 typedef ScfRef
< XclExpChFont
> XclExpChFontRef
;
416 // ----------------------------------------------------------------------------
418 /** The CHOBJECTLINK record linking a text object to a specific chart object. */
419 class XclExpChObjectLink
: public XclExpRecord
422 explicit XclExpChObjectLink( sal_uInt16 nLinkTarget
, const XclChDataPointPos
& rPointPos
);
425 virtual void WriteBody( XclExpStream
& rStrm
);
428 XclChObjectLink maData
; /// Contents of the CHOBJECTLINK record.
431 typedef ScfRef
< XclExpChObjectLink
> XclExpChObjectLinkRef
;
433 // ----------------------------------------------------------------------------
435 /** Additional data label settings in the future record CHFRLABELPROPS. */
436 class XclExpChFrLabelProps
: public XclExpChFutureRecordBase
439 explicit XclExpChFrLabelProps( const XclExpChRoot
& rRoot
);
441 /** Converts separator and the passed data label flags. */
443 const ScfPropertySet
& rPropSet
, bool bShowSeries
,
444 bool bShowCateg
, bool bShowValue
,
445 bool bShowPercent
, bool bShowBubble
);
448 virtual void WriteBody( XclExpStream
& rStrm
);
451 XclChFrLabelProps maData
; /// Contents of the CHFRLABELPROPS record.
454 typedef ScfRef
< XclExpChFrLabelProps
> XclExpChFrLabelPropsRef
;
456 // ----------------------------------------------------------------------------
458 /** Base class for objects with font settings. Provides font conversion helper functions. */
459 class XclExpChFontBase
462 virtual ~XclExpChFontBase();
464 /** Derived classes set font color and color identifier to internal data structures. */
465 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) = 0;
466 /** Derived classes set text rotation to internal data structures. */
467 virtual void SetRotation( sal_uInt16 nRotation
) = 0;
469 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
470 void ConvertFontBase( const XclExpChRoot
& rRoot
, sal_uInt16 nFontIdx
);
471 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
472 void ConvertFontBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
);
473 /** Converts rotation settings, calls virtual function SetRotation(). */
474 void ConvertRotationBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
, bool bSupportsStacked
);
477 // ----------------------------------------------------------------------------
479 /** Represents the CHTEXT record group containing text object properties.
481 The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
482 CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
484 class XclExpChText
: public XclExpChGroupBase
, public XclExpChFontBase
487 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XTitle
> XTitleRef
;
488 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
491 explicit XclExpChText( const XclExpChRoot
& rRoot
);
493 /** Sets font color and color identifier to internal data structures. */
494 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
);
495 /** Sets text rotation to internal data structures. */
496 virtual void SetRotation( sal_uInt16 nRotation
);
498 /** Converts all text settings of the passed title text object. */
499 void ConvertTitle( XTitleRef xTitle
, sal_uInt16 nTarget
, const String
* pSubTitle
= NULL
);
500 /** Converts all text settings of the passed legend. */
501 void ConvertLegend( const ScfPropertySet
& rPropSet
);
502 /** Converts all settings of the passed data point caption text object. */
503 bool ConvertDataLabel( const ScfPropertySet
& rPropSet
,
504 const XclChTypeInfo
& rTypeInfo
, const XclChDataPointPos
& rPointPos
);
505 /** Converts all settings of the passed trend line equation box. */
506 void ConvertTrendLineEquation( const ScfPropertySet
& rPropSet
, const XclChDataPointPos
& rPointPos
);
508 /** Returns true, if the string object does not contain any text data. */
509 inline bool HasString() const { return mxSrcLink
.is() && mxSrcLink
->HasString(); }
510 /** Returns the flags needed for the CHATTACHEDLABEL record. */
511 sal_uInt16
GetAttLabelFlags() const;
513 /** Writes all embedded records. */
514 virtual void WriteSubRecords( XclExpStream
& rStrm
);
517 virtual void WriteBody( XclExpStream
& rStrm
);
520 XclChText maData
; /// Contents of the CHTEXT record.
521 XclExpChSourceLinkRef mxSrcLink
; /// Linked data (CHSOURCELINK with CHSTRING record).
522 XclExpChFrameRef mxFrame
; /// Text object frame properties (CHFRAME group).
523 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
524 XclExpChObjectLinkRef mxObjLink
; /// Link target for this text object.
525 XclExpChFrLabelPropsRef mxLabelProps
; /// Extended data label properties (CHFRLABELPROPS record).
526 sal_uInt32 mnTextColorId
; /// Text color identifier.
529 typedef ScfRef
< XclExpChText
> XclExpChTextRef
;
531 // Data series ================================================================
533 /** The CHMARKERFORMAT record containing data point marker formatting data. */
534 class XclExpChMarkerFormat
: public XclExpRecord
537 explicit XclExpChMarkerFormat( const XclExpChRoot
& rRoot
);
539 /** Converts symbol properties from the passed property set. */
540 void Convert( const XclExpChRoot
& rRoot
,
541 const ScfPropertySet
& rPropSet
, sal_uInt16 nFormatIdx
);
542 /** Converts symbol properties for stock charts from the passed property set. */
543 void ConvertStockSymbol( const XclExpChRoot
& rRoot
,
544 const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
546 /** Returns true, if markers are enabled. */
547 inline bool HasMarker() const { return maData
.mnMarkerType
!= EXC_CHMARKERFORMAT_NOSYMBOL
; }
548 /** Returns true, if border line of markers is visible. */
549 inline bool HasLineColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOLINE
); }
550 /** Returns true, if fill area of markers is visible. */
551 inline bool HasFillColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOFILL
); }
554 /** Registers marker colors in palette and stores color identifiers. */
555 void RegisterColors( const XclExpChRoot
& rRoot
);
557 virtual void WriteBody( XclExpStream
& rStrm
);
560 XclChMarkerFormat maData
; /// Contents of the CHMARKERFORMAT record.
561 sal_uInt32 mnLineColorId
; /// Border line color identifier.
562 sal_uInt32 mnFillColorId
; /// Fill color identifier.
565 typedef ScfRef
< XclExpChMarkerFormat
> XclExpChMarkerFormatRef
;
567 // ----------------------------------------------------------------------------
569 /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
570 class XclExpChPieFormat
: public XclExpUInt16Record
573 explicit XclExpChPieFormat();
575 /** Sets pie segment properties from the passed property set. */
576 void Convert( const ScfPropertySet
& rPropSet
);
579 typedef ScfRef
< XclExpChPieFormat
> XclExpChPieFormatRef
;
581 // ----------------------------------------------------------------------------
583 /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
584 class XclExpCh3dDataFormat
: public XclExpRecord
587 explicit XclExpCh3dDataFormat();
589 /** Sets 3d bar properties from the passed property set. */
590 void Convert( const ScfPropertySet
& rPropSet
);
593 virtual void WriteBody( XclExpStream
& rStrm
);
596 XclCh3dDataFormat maData
; /// Contents of the CH3DDATAFORMAT record.
599 typedef ScfRef
< XclExpCh3dDataFormat
> XclExpCh3dDataFormatRef
;
601 // ----------------------------------------------------------------------------
603 /** The CHATTACHEDLABEL record that contains the type of a data point label. */
604 class XclExpChAttachedLabel
: public XclExpUInt16Record
607 explicit XclExpChAttachedLabel( sal_uInt16 nFlags
);
610 typedef ScfRef
< XclExpChAttachedLabel
> XclExpChAttLabelRef
;
612 // ----------------------------------------------------------------------------
614 /** Represents the CHDATAFORMAT record group containing data point properties.
616 The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
617 CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
618 CHATTACHEDLABEL, CHEND.
620 class XclExpChDataFormat
: public XclExpChGroupBase
, public XclExpChFrameBase
623 explicit XclExpChDataFormat( const XclExpChRoot
& rRoot
,
624 const XclChDataPointPos
& rPointPos
, sal_uInt16 nFormatIdx
);
626 /** Converts the passed data series or data point formatting. */
627 void ConvertDataSeries( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
);
628 /** Sets default formatting for a series in a stock chart. */
629 void ConvertStockSeries( const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
630 /** Converts line formatting for the specified object (e.g. trend lines, error bars). */
631 void ConvertLine( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
633 /** Returns true, if this objects describes the formatting of an entire series. */
634 inline bool IsSeriesFormat() const { return maData
.maPointPos
.mnPointIdx
== EXC_CHDATAFORMAT_ALLPOINTS
; }
636 /** Writes all embedded records. */
637 virtual void WriteSubRecords( XclExpStream
& rStrm
);
640 virtual void WriteBody( XclExpStream
& rStrm
);
643 XclChDataFormat maData
; /// Contents of the CHDATAFORMAT record.
644 XclExpChMarkerFormatRef mxMarkerFmt
; /// Data point marker (CHMARKERFORMAT record).
645 XclExpChPieFormatRef mxPieFmt
; /// Pie segment format (CHPIEFORMAT record).
646 XclExpRecordRef mxSeriesFmt
; /// Series properties (CHSERIESFORMAT record).
647 XclExpCh3dDataFormatRef mx3dDataFmt
; /// 3D bar format (CH3DDATAFORMAT record).
648 XclExpChAttLabelRef mxAttLabel
; /// Data point label type (CHATTACHEDLABEL record).
651 typedef ScfRef
< XclExpChDataFormat
> XclExpChDataFormatRef
;
653 // ----------------------------------------------------------------------------
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
);
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 ScfRef
< XclExpChSerTrendLine
> XclExpChSerTrendLineRef
;
683 // ----------------------------------------------------------------------------
685 /** Represents the CHSERERRORBAR record containing settings for error bars. */
686 class XclExpChSerErrorBar
: public XclExpRecord
, protected XclExpChRoot
689 explicit XclExpChSerErrorBar( const XclExpChRoot
& rRoot
, sal_uInt8 nBarType
);
691 /** Converts the passed error bar settings, returns true if error bar type is supported. */
692 bool Convert( XclExpChSourceLink
& rValueLink
, sal_uInt16
& rnValueCount
, const ScfPropertySet
& rPropSet
);
695 virtual void WriteBody( XclExpStream
& rStrm
);
698 XclChSerErrorBar maData
; /// Contents of the CHSERERRORBAR record.
701 typedef ScfRef
< XclExpChSerErrorBar
> XclExpChSerErrorBarRef
;
703 // ----------------------------------------------------------------------------
705 /** Represents the CHSERIES record group describing a data series in a chart.
707 The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
708 CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
709 CHSERTRENDLINE, CHEND.
711 class XclExpChSeries
: public XclExpChGroupBase
714 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
715 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
716 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
717 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
720 explicit XclExpChSeries( const XclExpChRoot
& rRoot
, sal_uInt16 nSeriesIdx
);
722 /** Converts the passed data series (source links and formatting). */
723 bool ConvertDataSeries(
724 XDiagramRef xDiagram
, XDataSeriesRef xDataSeries
,
725 const XclChExtTypeInfo
& rTypeInfo
,
726 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
);
727 /** Converts the passed data series for stock charts. */
728 bool ConvertStockSeries(
729 XDataSeriesRef xDataSeries
,
730 const ::rtl::OUString
& rValueRole
,
731 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
, bool bCloseSymbol
);
732 /** Converts the passed error bar settings (called at trend line child series). */
733 bool ConvertTrendLine( const XclExpChSeries
& rParent
, XRegressionCurveRef xRegCurve
);
734 /** Converts the passed error bar settings (called at error bar child series). */
735 bool ConvertErrorBar( const XclExpChSeries
& rParent
, const ScfPropertySet
& rPropSet
, sal_uInt8 nBarId
);
736 /** Converts and inserts category ranges for all inserted series. */
737 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
739 /** Writes all embedded records. */
740 virtual void WriteSubRecords( XclExpStream
& rStrm
);
743 /** Initializes members of this series to represent a child of the passed series. */
744 void InitFromParent( const XclExpChSeries
& rParent
);
745 /** Tries to create trend line series objects (called at parent series). */
746 void CreateTrendLines( XDataSeriesRef xDataSeries
);
747 /** Tries to create positive and negative error bar series objects (called at parent series). */
748 void CreateErrorBars( const ScfPropertySet
& rPropSet
,
749 const ::rtl::OUString
& rBarPropName
,
750 sal_uInt8 nPosBarId
, sal_uInt8 nNegBarId
);
751 /** Tries to create an error bar series object (called at parent series). */
752 void CreateErrorBar( const ScfPropertySet
& rPropSet
,
753 const ::rtl::OUString
& rShowPropName
, sal_uInt8 nBarId
);
755 virtual void WriteBody( XclExpStream
& rStrm
);
758 typedef XclExpRecordList
< XclExpChDataFormat
> XclExpChDataFormatList
;
761 XclChSeries maData
; /// Contents of the CHSERIES record.
762 XclExpChSourceLinkRef mxTitleLink
; /// Link data for series title.
763 XclExpChSourceLinkRef mxValueLink
; /// Link data for series values.
764 XclExpChSourceLinkRef mxCategLink
; /// Link data for series category names.
765 XclExpChSourceLinkRef mxBubbleLink
; /// Link data for series bubble sizes.
766 XclExpChDataFormatRef mxSeriesFmt
; /// CHDATAFORMAT group for series format.
767 XclExpChDataFormatList maPointFmts
; /// CHDATAFORMAT groups for data point formats.
768 XclExpChSerTrendLineRef mxTrendLine
; /// Trend line settings (CHSERTRENDLINE record).
769 XclExpChSerErrorBarRef mxErrorBar
; /// Error bar settings (CHSERERRORBAR record).
770 sal_uInt16 mnGroupIdx
; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
771 sal_uInt16 mnSeriesIdx
; /// 0-based series index.
772 sal_uInt16 mnParentIdx
; /// 0-based index of parent series (trend lines and error bars).
775 typedef ScfRef
< XclExpChSeries
> XclExpChSeriesRef
;
777 // Chart type groups ==========================================================
779 /** Represents the chart type record for all supported chart types. */
780 class XclExpChType
: public XclExpRecord
, protected XclExpChRoot
783 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
784 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
787 explicit XclExpChType( const XclExpChRoot
& rRoot
);
789 /** Converts the passed chart type and the contained data series. */
790 void Convert( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
791 sal_Int32 nApiAxesSetIdx
, bool bSwappedAxesSet
, bool bHasXLabels
);
792 /** Sets stacking mode (standard or percent) for the series in this chart type group. */
793 void SetStacked( bool bPercent
);
795 /** Returns true, if this is object represents a valid chart type. */
796 inline bool IsValidType() const { return maTypeInfo
.meTypeId
!= EXC_CHTYPEID_UNKNOWN
; }
797 /** Returns the chart type info struct for the contained chart type. */
798 inline const XclChTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
801 virtual void WriteBody( XclExpStream
& rStrm
);
804 XclChType maData
; /// Contents of the chart type record.
805 XclChTypeInfo maTypeInfo
; /// Chart type info for the contained type.
808 // ----------------------------------------------------------------------------
810 /** Represents the CHCHART3D record that contains 3D view settings. */
811 class XclExpChChart3d
: public XclExpRecord
814 explicit XclExpChChart3d();
816 /** Converts 3d settings for the passed chart type. */
817 void Convert( const ScfPropertySet
& rPropSet
, bool b3dWallChart
);
818 /** Sets flag that the data points are clustered on the X axis. */
819 inline void SetClustered() { ::set_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
821 /** Returns true, if the data points are clustered on the X axis. */
822 inline bool IsClustered() const { return ::get_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
825 virtual void WriteBody( XclExpStream
& rStrm
);
828 XclChChart3d maData
; /// Contents of the CHCHART3D record.
831 typedef ScfRef
< XclExpChChart3d
> XclExpChChart3dRef
;
833 // ----------------------------------------------------------------------------
835 /** Represents the CHLEGEND record group describing the chart legend.
837 The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAME group,
840 class XclExpChLegend
: public XclExpChGroupBase
843 explicit XclExpChLegend( const XclExpChRoot
& rRoot
);
845 /** Converts all legend settings from the passed property set. */
846 void Convert( const ScfPropertySet
& rPropSet
);
848 /** Writes all embedded records. */
849 virtual void WriteSubRecords( XclExpStream
& rStrm
);
852 virtual void WriteBody( XclExpStream
& rStrm
);
855 XclChLegend maData
; /// Contents of the CHLEGEND record.
856 XclExpChTextRef mxText
; /// Legend text format (CHTEXT group).
857 XclExpChFrameRef mxFrame
; /// Legend frame format (CHFRAME group).
860 typedef ScfRef
< XclExpChLegend
> XclExpChLegendRef
;
862 // ----------------------------------------------------------------------------
864 /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
866 The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
867 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
869 class XclExpChDropBar
: public XclExpChGroupBase
, public XclExpChFrameBase
872 explicit XclExpChDropBar( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
874 /** Converts and writes the contained frame data to the passed property set. */
875 void Convert( const ScfPropertySet
& rPropSet
);
877 /** Writes all embedded records. */
878 virtual void WriteSubRecords( XclExpStream
& rStrm
);
881 virtual void WriteBody( XclExpStream
& rStrm
);
884 XclChObjectType meObjType
; /// Type of the dropbar.
885 sal_uInt16 mnBarDist
; /// Distance between bars (CHDROPBAR record).
888 typedef ScfRef
< XclExpChDropBar
> XclExpChDropBarRef
;
890 // ----------------------------------------------------------------------------
892 /** Represents the CHTYPEGROUP record group describing a group of series.
894 The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
895 record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
896 CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
897 CHDATAFORMAT group, CHEND.
899 class XclExpChTypeGroup
: public XclExpChGroupBase
902 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
903 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
904 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
905 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
908 explicit XclExpChTypeGroup( const XclExpChRoot
& rRoot
, sal_uInt16 nGroupIdx
);
910 /** Converts the passed chart type to Excel type settings. */
911 void ConvertType( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
912 sal_Int32 nApiAxesSetIdx
, bool b3dChart
, bool bSwappedAxesSet
, bool bHasXLabels
);
913 /** Converts and inserts all series from the passed chart type. */
914 void ConvertSeries( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
915 sal_Int32 nGroupAxesSetIdx
, bool bPercent
, bool bConnectorLines
);
916 /** Converts and inserts category ranges for all inserted series. */
917 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
918 /** Creates a legend object and converts all legend settings. */
919 void ConvertLegend( const ScfPropertySet
& rPropSet
);
921 /** Returns true, if this chart type group contains at least one valid series. */
922 inline bool IsValidGroup() const { return !maSeries
.IsEmpty() && maType
.IsValidType(); }
923 /** Returns the index of this chart type group format. */
924 inline sal_uInt16
GetGroupIdx() const { return maData
.mnGroupIdx
; }
925 /** Returns the chart type info struct for the contained chart type. */
926 inline const XclChExtTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
927 /** Returns true, if the chart is three-dimensional. */
928 inline bool Is3dChart() const { return maTypeInfo
.mb3dChart
; }
929 /** Returns true, if chart type supports wall and floor format. */
930 inline bool Is3dWallChart() const { return Is3dChart() && (maTypeInfo
.meTypeCateg
!= EXC_CHTYPECATEG_PIE
); }
931 /** Returns true, if the series in this chart type group are ordered on the Z axis. */
932 inline bool Is3dDeepChart() const { return Is3dWallChart() && mxChart3d
.is() && !mxChart3d
->IsClustered(); }
933 /** Returns true, if this chart type can be combined with other types. */
934 inline bool IsCombinable2d() const { return !Is3dChart() && maTypeInfo
.mbCombinable2d
; }
936 /** Writes all embedded records. */
937 virtual void WriteSubRecords( XclExpStream
& rStrm
);
940 /** Returns an unused format index to be used for the next created series. */
941 sal_uInt16
GetFreeFormatIdx() const;
942 /** Creates all data series of any chart type except stock charts. */
943 void CreateDataSeries( XDiagramRef xDiagram
,
944 XDataSeriesRef xDataSeries
);
945 /** Creates all data series of a stock chart. */
946 void CreateAllStockSeries( XChartTypeRef xChartType
,
947 XDataSeriesRef xDataSeries
);
948 /** Creates a single data series of a stock chart. */
949 bool CreateStockSeries( XDataSeriesRef xDataSeries
,
950 const ::rtl::OUString
& rValueRole
, bool bCloseSymbol
);
952 virtual void WriteBody( XclExpStream
& rStrm
);
955 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
956 typedef ScfRefMap
< sal_uInt16
, XclExpChLineFormat
> XclExpChLineFormatMap
;
958 XclChTypeGroup maData
; /// Contents of the CHTYPEGROUP record.
959 XclExpChType maType
; /// Chart type (e.g. CHBAR, CHLINE, ...).
960 XclChExtTypeInfo maTypeInfo
; /// Extended chart type info.
961 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
962 XclExpChChart3dRef mxChart3d
; /// 3D settings (CHCHART3D record).
963 XclExpChLegendRef mxLegend
; /// Chart legend (CHLEGEND group).
964 XclExpChDropBarRef mxUpBar
; /// White dropbars (CHDROPBAR group).
965 XclExpChDropBarRef mxDownBar
; /// Black dropbars (CHDROPBAR group).
966 XclExpChLineFormatMap maChartLines
; /// Global line formats (CHCHARTLINE group).
969 typedef ScfRef
< XclExpChTypeGroup
> XclExpChTypeGroupRef
;
971 // Axes =======================================================================
973 class XclExpChLabelRange
: public XclExpRecord
, protected XclExpChRoot
976 explicit XclExpChLabelRange( const XclExpChRoot
& rRoot
);
978 /** Converts category axis scaling settings. */
979 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
, bool bMirrorOrient
);
980 /** Converts position settings of a crossing axis at this axis. */
981 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
982 /** Sets flag for tickmark position between categories or on categories. */
983 inline void SetTicksBetweenCateg( bool bTicksBetween
)
984 { ::set_flag( maData
.mnFlags
, EXC_CHLABELRANGE_BETWEEN
, bTicksBetween
); }
987 virtual void WriteBody( XclExpStream
& rStrm
);
990 XclChLabelRange maData
; /// Contents of the CHLABELRANGE record.
993 typedef ScfRef
< XclExpChLabelRange
> XclExpChLabelRangeRef
;
995 // ----------------------------------------------------------------------------
997 class XclExpChValueRange
: public XclExpRecord
, protected XclExpChRoot
1000 explicit XclExpChValueRange( const XclExpChRoot
& rRoot
);
1002 /** Converts value axis scaling settings. */
1003 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
, bool bPercent
);
1004 /** Converts position settings of a crossing axis at this axis. */
1005 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
1008 virtual void WriteBody( XclExpStream
& rStrm
);
1011 XclChValueRange maData
; /// Contents of the CHVALUERANGE record.
1014 typedef ScfRef
< XclExpChValueRange
> XclExpChValueRangeRef
;
1016 // ----------------------------------------------------------------------------
1018 class XclExpChTick
: public XclExpRecord
, protected XclExpChRoot
1021 explicit XclExpChTick( const XclExpChRoot
& rRoot
);
1023 /** Converts axis tick mark settings. */
1024 void Convert( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
, sal_uInt16 nAxisType
);
1025 /** Sets font color and color identifier to internal data structures. */
1026 void SetFontColor( const Color
& rColor
, sal_uInt32 nColorId
);
1027 /** Sets text rotation to internal data structures. */
1028 void SetRotation( sal_uInt16 nRotation
);
1031 virtual void WriteBody( XclExpStream
& rStrm
);
1034 XclChTick maData
; /// Contents of the CHTICK record.
1035 sal_uInt32 mnTextColorId
; /// Axis labels text color identifier.
1038 typedef ScfRef
< XclExpChTick
> XclExpChTickRef
;
1040 // ----------------------------------------------------------------------------
1042 /** Represents the CHAXIS record group describing an entire chart axis.
1044 The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
1045 CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
1046 CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
1048 class XclExpChAxis
: public XclExpChGroupBase
, public XclExpChFontBase
1051 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1052 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
> XAxisRef
;
1055 explicit XclExpChAxis( const XclExpChRoot
& rRoot
, sal_uInt16 nAxisType
);
1057 /** Sets font color and color identifier to internal data structures. */
1058 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
);
1059 /** Sets text rotation to internal data structures. */
1060 virtual void SetRotation( sal_uInt16 nRotation
);
1062 /** Converts formatting and scaling settings from the passed axis. */
1063 void Convert( XAxisRef xAxis
, XAxisRef xCrossingAxis
, const XclChExtTypeInfo
& rTypeInfo
, bool bPercent
);
1064 /** Converts and writes 3D wall/floor properties from the passed diagram. */
1065 void ConvertWall( XDiagramRef xDiagram
);
1067 /** Returns the type of this axis. */
1068 inline sal_uInt16
GetAxisType() const { return maData
.mnType
; }
1069 /** Returns the axis dimension index used by the chart API. */
1070 inline sal_Int32
GetApiAxisDimension() const { return maData
.GetApiAxisDimension(); }
1072 /** Writes all embedded records. */
1073 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1076 virtual void WriteBody( XclExpStream
& rStrm
);
1079 XclChAxis maData
; /// Contents of the CHAXIS record.
1080 XclExpChLabelRangeRef mxLabelRange
; /// Category scaling (CHLABELRANGE record).
1081 XclExpChValueRangeRef mxValueRange
; /// Value scaling (CHVALUERANGE record).
1082 XclExpChTickRef mxTick
; /// Axis ticks (CHTICK record).
1083 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
1084 XclExpChLineFormatRef mxAxisLine
; /// Axis line format (CHLINEFORMAT record).
1085 XclExpChLineFormatRef mxMajorGrid
; /// Major grid line format (CHLINEFORMAT record).
1086 XclExpChLineFormatRef mxMinorGrid
; /// Minor grid line format (CHLINEFORMAT record).
1087 XclExpChFrameRef mxWallFrame
; /// Wall/floor format (sub records of CHFRAME group).
1088 sal_uInt16 mnNumFmtIdx
; /// Index into number format buffer (CHFORMAT record).
1091 typedef ScfRef
< XclExpChAxis
> XclExpChAxisRef
;
1093 // ----------------------------------------------------------------------------
1095 /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
1097 The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
1098 groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
1099 CHTYPEGROUP group, CHEND.
1101 class XclExpChAxesSet
: public XclExpChGroupBase
1104 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1105 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XCoordinateSystem
> XCoordSystemRef
;
1108 explicit XclExpChAxesSet( const XclExpChRoot
& rRoot
, sal_uInt16 nAxesSetId
);
1110 /** Converts the passed diagram to chart record data.
1111 @return First unused chart type group index. */
1112 sal_uInt16
Convert( XDiagramRef xDiagram
, sal_uInt16 nFirstGroupIdx
);
1114 /** Returns true, if this axes set exists (returns false if this is a dummy object). */
1115 inline bool IsValidAxesSet() const { return !maTypeGroups
.IsEmpty(); }
1116 /** Returns the index of the axes set (primary/secondary). */
1117 inline sal_uInt16
GetAxesSetId() const { return maData
.mnAxesSetId
; }
1118 /** Returns the axes set index used by the chart API. */
1119 inline sal_Int32
GetApiAxesSetIndex() const { return maData
.GetApiAxesSetIndex(); }
1120 /** Returns true, if the chart is three-dimensional. */
1121 bool Is3dChart() const;
1123 /** Writes all embedded records. */
1124 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1127 /** Returns first inserted chart type group. */
1128 XclExpChTypeGroupRef
GetFirstTypeGroup() const;
1129 /** Returns last inserted chart type group. */
1130 XclExpChTypeGroupRef
GetLastTypeGroup() const;
1132 /** Converts a complete axis object including axis title. */
1133 void ConvertAxis( XclExpChAxisRef
& rxChAxis
, sal_uInt16 nAxisType
,
1134 XclExpChTextRef
& rxChAxisTitle
, sal_uInt16 nTitleTarget
,
1135 XCoordSystemRef xCoordSystem
, const XclChExtTypeInfo
& rTypeInfo
,
1136 sal_Int32 nCrossingAxisDim
,
1139 virtual void WriteBody( XclExpStream
& rStrm
);
1142 typedef XclExpRecordList
< XclExpChTypeGroup
> XclExpChTypeGroupList
;
1144 XclChAxesSet maData
; /// Contents of the CHAXESSET record.
1145 XclExpChAxisRef mxXAxis
; /// The X axis (CHAXIS group).
1146 XclExpChAxisRef mxYAxis
; /// The Y axis (CHAXIS group).
1147 XclExpChAxisRef mxZAxis
; /// The Z axis (CHAXIS group).
1148 XclExpChTextRef mxXAxisTitle
; /// The X axis title (CHTEXT group).
1149 XclExpChTextRef mxYAxisTitle
; /// The Y axis title (CHTEXT group).
1150 XclExpChTextRef mxZAxisTitle
; /// The Z axis title (CHTEXT group).
1151 XclExpChFrameRef mxPlotFrame
; /// Plot area (CHPLOTFRAME group).
1152 XclExpChTypeGroupList maTypeGroups
; /// Chart type groups (CHTYPEGROUP group).
1155 typedef ScfRef
< XclExpChAxesSet
> XclExpChAxesSetRef
;
1157 // The chart object ===========================================================
1159 /** Represents the CHCHART record group describing the chart contents.
1161 The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
1162 group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
1163 with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
1165 class XclExpChChart
: public XclExpChGroupBase
1168 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> XChartDocRef
;
1171 explicit XclExpChChart( const XclExpRoot
& rRoot
,
1172 XChartDocRef xChartDoc
, const Size
& rSize
);
1174 /** Creates, registers and returns a new data series object. */
1175 XclExpChSeriesRef
CreateSeries();
1176 /** Removes the last created data series object from the series list. */
1177 void RemoveLastSeries();
1178 /** Stores a CHTEXT group that describes a data point label. */
1179 void SetDataLabel( XclExpChTextRef xText
);
1181 /** Writes all embedded records. */
1182 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1185 virtual void WriteBody( XclExpStream
& rStrm
);
1188 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
1189 typedef XclExpRecordList
< XclExpChText
> XclExpChTextList
;
1191 XclChRectangle maRect
; /// Position of the chart on the sheet (CHCHART record).
1192 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
1193 XclExpChFrameRef mxFrame
; /// Chart frame format (CHFRAME group).
1194 XclChProperties maProps
; /// Chart properties (CHPROPERTIES record).
1195 XclExpChAxesSetRef mxPrimAxesSet
; /// Primary axes set (CHAXESSET group).
1196 XclExpChAxesSetRef mxSecnAxesSet
; /// Secondary axes set (CHAXESSET group).
1197 XclExpChTextRef mxTitle
; /// Chart title (CHTEXT group).
1198 XclExpChTextList maLabels
; /// Data point labels (CHTEXT groups).
1201 // ----------------------------------------------------------------------------
1203 /** Represents the entire chart substream (all records in BOF/EOF block). */
1204 class XclExpChart
: public XclExpSubStream
, protected XclExpRoot
1207 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> XModelRef
;
1210 explicit XclExpChart( const XclExpRoot
& rRoot
,
1211 XModelRef xModel
, const Size
& rSize
);
1214 // ============================================================================