1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_XECHART_HXX
29 #define SC_XECHART_HXX
31 #include <tools/gen.hxx>
32 #include "xerecord.hxx"
33 #include "xlchart.hxx"
34 #include "xlformula.hxx"
35 #include "xlstyle.hxx"
37 #include "xestring.hxx"
41 namespace com
{ namespace sun
{ namespace star
{
55 class XCoordinateSystem
;
60 class XFormattedString
;
61 class XRegressionCurve
;
65 class XLabeledDataSequence
;
70 // Common =====================================================================
72 struct XclExpChRootData
;
75 /** Base class for complex chart classes, provides access to other components
78 Keeps also track of future record levels and writes the needed future
81 class XclExpChRoot
: public XclExpRoot
84 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> XChartDocRef
;
87 explicit XclExpChRoot( const XclExpRoot
& rRoot
, XclExpChChart
& rChartData
);
88 virtual ~XclExpChRoot();
90 /** Returns this root instance - for code readability in derived classes. */
91 inline const XclExpChRoot
& GetChRoot() const { return *this; }
92 /** Returns the API Chart document model. */
93 XChartDocRef
GetChartDocument() const;
94 /** Returns a reference to the parent chart data object. */
95 XclExpChChart
& GetChartData() const;
96 /** Returns chart type info for a unique chart type identifier. */
97 const XclChTypeInfo
& GetChartTypeInfo( XclChTypeId eType
) const;
98 /** Returns the first fitting chart type info for the passed service name. */
99 const XclChTypeInfo
& GetChartTypeInfo( const ::rtl::OUString
& rServiceName
) const;
101 /** Returns an info struct about auto formatting for the passed object type. */
102 const XclChFormatInfo
& GetFormatInfo( XclChObjectType eObjType
) const;
104 /** Starts the API chart document conversion. Must be called once before all API conversion. */
105 void InitConversion( XChartDocRef xChartDoc
, const Rectangle
& rChartRect
) const;
106 /** Finishes the API chart document conversion. Must be called once after all API conversion. */
107 void FinishConversion() const;
109 /** Returns true, if the passed color equals to the specified system color. */
110 bool IsSystemColor( const Color
& rColor
, sal_uInt16 nSysColorIdx
) const;
111 /** Sets a system color and the respective color identifier. */
112 void SetSystemColor( Color
& rColor
, sal_uInt32
& rnColorId
, sal_uInt16 nSysColorIdx
) const;
114 /** Converts the passed horizontal coordinate from 1/100 mm to Excel chart units. */
115 sal_Int32
CalcChartXFromHmm( sal_Int32 nPosX
) const;
116 /** Converts the passed vertical coordinate from 1/100 mm to Excel chart units. */
117 sal_Int32
CalcChartYFromHmm( sal_Int32 nPosY
) const;
118 /** Converts the passed rectangle from 1/100 mm to Excel chart units. */
119 XclChRectangle
CalcChartRectFromHmm( const ::com::sun::star::awt::Rectangle
& rRect
) const;
121 /** Converts the passed horizontal coordinate from a relative position to Excel chart units. */
122 sal_Int32
CalcChartXFromRelative( double fPosX
) const;
123 /** Converts the passed vertical coordinate from a relative position to Excel chart units. */
124 sal_Int32
CalcChartYFromRelative( double fPosY
) const;
126 /** Reads all line properties from the passed property set. */
127 void ConvertLineFormat(
128 XclChLineFormat
& rLineFmt
,
129 const ScfPropertySet
& rPropSet
,
130 XclChPropertyMode ePropMode
) const;
131 /** Reads solid area properties from the passed property set.
132 @return true = object contains complex fill properties. */
133 bool ConvertAreaFormat(
134 XclChAreaFormat
& rAreaFmt
,
135 const ScfPropertySet
& rPropSet
,
136 XclChPropertyMode ePropMode
) const;
137 /** Reads gradient or bitmap area properties from the passed property set. */
138 void ConvertEscherFormat(
139 XclChEscherFormat
& rEscherFmt
,
140 XclChPicFormat
& rPicFmt
,
141 const ScfPropertySet
& rPropSet
,
142 XclChPropertyMode ePropMode
) const;
143 /** Reads font properties from the passed property set. */
144 sal_uInt16
ConvertFont(
145 const ScfPropertySet
& rPropSet
,
146 sal_Int16 nScript
) const;
148 /** Reads the pie rotation property and returns the converted angle. */
149 static sal_uInt16
ConvertPieRotation( const ScfPropertySet
& rPropSet
);
152 /** Called from XclExpChGroupBase::Save, registers a new future record level. */
153 void RegisterFutureRecBlock( const XclChFrBlock
& rFrBlock
);
154 /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
155 void InitializeFutureRecBlock( XclExpStream
& rStrm
);
156 /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
157 void FinalizeFutureRecBlock( XclExpStream
& rStrm
);
160 typedef ScfRef
< XclExpChRootData
> XclExpChRootDataRef
;
161 XclExpChRootDataRef mxChData
; /// Reference to the root data object.
164 // ----------------------------------------------------------------------------
166 /** Base class for chart record groups. Provides helper functions to write sub records.
168 A chart record group consists of a header record, followed by a CHBEGIN
169 record, followed by group sub records, and finished with a CHEND record.
171 class XclExpChGroupBase
: public XclExpRecord
, protected XclExpChRoot
174 explicit XclExpChGroupBase(
175 const XclExpChRoot
& rRoot
, sal_uInt16 nFrType
,
176 sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
177 virtual ~XclExpChGroupBase();
179 /** Saves the header record. Calls WriteSubRecords() to let derived classes write sub records. */
180 virtual void Save( XclExpStream
& rStrm
);
181 /** Derived classes return whether there are any records embedded in this group. */
182 virtual bool HasSubRecords() const;
183 /** Derived classes implement writing any records embedded in this group. */
184 virtual void WriteSubRecords( XclExpStream
& rStrm
) = 0;
187 /** Sets context information for future record blocks. */
188 void SetFutureRecordContext( sal_uInt16 nFrContext
,
189 sal_uInt16 nFrValue1
= 0, sal_uInt16 nFrValue2
= 0 );
192 XclChFrBlock maFrBlock
; /// Future records block settings.
195 // ----------------------------------------------------------------------------
197 /** Base class for chart future records. On saving, the record writes missing
198 CHFRBLOCKBEGIN records automatically.
200 class XclExpChFutureRecordBase
: public XclExpFutureRecord
, protected XclExpChRoot
203 explicit XclExpChFutureRecordBase( const XclExpChRoot
& rRoot
,
204 XclFutureRecType eRecType
, sal_uInt16 nRecId
, sal_Size nRecSize
= 0 );
206 /** Writes missing CHFRBLOCKBEGIN records and this record. */
207 virtual void Save( XclExpStream
& rStrm
);
210 // Frame formatting ===========================================================
212 class XclExpChFramePos
: public XclExpRecord
215 explicit XclExpChFramePos( sal_uInt16 nTLMode
, sal_uInt16 nBRMode
);
217 /** Returns read/write access to the frame position data. */
218 inline XclChFramePos
& GetFramePosData() { return maData
; }
221 virtual void WriteBody( XclExpStream
& rStrm
);
224 XclChFramePos maData
; /// Position of the frame.
227 typedef ScfRef
< XclExpChFramePos
> XclExpChFramePosRef
;
229 // ----------------------------------------------------------------------------
231 class XclExpChLineFormat
: public XclExpRecord
234 explicit XclExpChLineFormat( const XclExpChRoot
& rRoot
);
236 /** Converts line formatting properties from the passed property set. */
237 void Convert( const XclExpChRoot
& rRoot
,
238 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
239 /** Sets or clears the automatic flag. */
240 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
, bAuto
); }
241 /** Sets flag to show or hide an axis. */
242 inline void SetShowAxis( bool bShowAxis
)
243 { ::set_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_SHOWAXIS
, bShowAxis
); }
244 /** Sets the line format to the specified default type. */
245 void SetDefault( XclChFrameType eDefFrameType
);
247 /** Returns true, if the line format is set to automatic. */
248 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHLINEFORMAT_AUTO
); }
249 /** Returns true, if the line style is set to something visible. */
250 inline bool HasLine() const { return maData
.mnPattern
!= EXC_CHLINEFORMAT_NONE
; }
251 /** Returns true, if the line contains default formatting according to the passed frame type. */
252 bool IsDefault( XclChFrameType eDefFrameType
) const;
255 virtual void WriteBody( XclExpStream
& rStrm
);
258 XclChLineFormat maData
; /// Contents of the CHLINEFORMAT record.
259 sal_uInt32 mnColorId
; /// Line color identifier.
262 typedef ScfRef
< XclExpChLineFormat
> XclExpChLineFormatRef
;
264 // ----------------------------------------------------------------------------
266 class XclExpChAreaFormat
: public XclExpRecord
269 explicit XclExpChAreaFormat( const XclExpChRoot
& rRoot
);
271 /** Converts area formatting properties from the passed property set.
272 @return true = object contains complex fill properties. */
273 bool Convert( const XclExpChRoot
& rRoot
,
274 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
275 /** Sets or clears the automatic flag. */
276 inline void SetAuto( bool bAuto
) { ::set_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
, bAuto
); }
277 /** Sets the area format to the specified default type. */
278 void SetDefault( XclChFrameType eDefFrameType
);
280 /** Returns true, if the area format is set to automatic. */
281 inline bool IsAuto() const { return ::get_flag( maData
.mnFlags
, EXC_CHAREAFORMAT_AUTO
); }
282 /** Returns true, if the area style is set to something visible. */
283 inline bool HasArea() const { return maData
.mnPattern
!= EXC_PATT_NONE
; }
284 /** Returns true, if the area contains default formatting according to the passed frame type. */
285 bool IsDefault( XclChFrameType eDefFrameType
) const;
288 virtual void WriteBody( XclExpStream
& rStrm
);
291 XclChAreaFormat maData
; /// Contents of the CHAREAFORMAT record.
292 sal_uInt32 mnPattColorId
; /// Pattern color identifier.
293 sal_uInt32 mnBackColorId
; /// Pattern background color identifier.
296 typedef ScfRef
< XclExpChAreaFormat
> XclExpChAreaFormatRef
;
298 // ----------------------------------------------------------------------------
300 class XclExpChEscherFormat
: public XclExpChGroupBase
303 explicit XclExpChEscherFormat( const XclExpChRoot
& rRoot
);
305 /** Converts complex area formatting from the passed property set. */
306 void Convert( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
308 /** Returns true, if the object contains valid formatting data. */
309 bool IsValid() const;
311 /** Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant. */
312 virtual void Save( XclExpStream
& rStrm
);
313 /** Returns true, if this record group contains a CHPICFORMAT record. */
314 virtual bool HasSubRecords() const;
315 /** Writes all embedded records. */
316 virtual void WriteSubRecords( XclExpStream
& rStrm
);
319 /** Inserts a color from the contained Escher property set into the color palette. */
320 sal_uInt32
RegisterColor( sal_uInt16 nPropId
);
322 virtual void WriteBody( XclExpStream
& rStrm
);
325 XclChEscherFormat maData
; /// Fill properties for complex areas (CHESCHERFORMAT record).
326 XclChPicFormat maPicFmt
; /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
327 sal_uInt32 mnColor1Id
; /// First fill color identifier.
328 sal_uInt32 mnColor2Id
; /// Second fill color identifier.
331 typedef ScfRef
< XclExpChEscherFormat
> XclExpChEscherFormatRef
;
333 // ----------------------------------------------------------------------------
335 /** Base class for record groups containing frame formatting.
337 Frame formatting can be part of several record groups, e.g. CHFRAME,
338 CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
339 CHESCHERFORMAT group.
341 class XclExpChFrameBase
344 explicit XclExpChFrameBase();
345 virtual ~XclExpChFrameBase();
348 /** Converts frame formatting properties from the passed property set. */
349 void ConvertFrameBase( const XclExpChRoot
& rRoot
,
350 const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
351 /** Sets the frame formatting to the specified default type. */
352 void SetDefaultFrameBase( const XclExpChRoot
& rRoot
,
353 XclChFrameType eDefFrameType
, bool bIsFrame
);
355 /** Returns true, if the frame contains default formatting (as if the frame is missing). */
356 bool IsDefaultFrameBase( XclChFrameType eDefFrameType
) const;
358 /** Writes all contained frame records to the passed stream. */
359 void WriteFrameRecords( XclExpStream
& rStrm
);
362 XclExpChLineFormatRef mxLineFmt
; /// Line format (CHLINEFORMAT record).
363 XclExpChAreaFormatRef mxAreaFmt
; /// Area format (CHAREAFORMAT record).
364 XclExpChEscherFormatRef mxEscherFmt
; /// Complex area format (CHESCHERFORMAT record).
367 // ----------------------------------------------------------------------------
369 /** Represents the CHFRAME record group containing object frame properties.
371 The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
372 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
374 class XclExpChFrame
: public XclExpChGroupBase
, public XclExpChFrameBase
377 explicit XclExpChFrame( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
379 /** Converts frame formatting properties from the passed property set. */
380 void Convert( const ScfPropertySet
& rPropSet
);
382 /** Returns true, if the frame object contains default formats. */
383 bool IsDefault() const;
384 /** Returns true, if the frame object can be deleted because it contains default formats. */
385 bool IsDeleteable() const;
387 /** Writes the entire record group. */
388 virtual void Save( XclExpStream
& rStrm
);
389 /** Writes all embedded records. */
390 virtual void WriteSubRecords( XclExpStream
& rStrm
);
393 virtual void WriteBody( XclExpStream
& rStrm
);
396 XclChFrame maData
; /// Contents of the CHFRAME record.
397 XclChObjectType meObjType
; /// Type of the represented object.
400 typedef ScfRef
< XclExpChFrame
> XclExpChFrameRef
;
402 // Source links ===============================================================
404 class XclExpChSourceLink
: public XclExpRecord
, protected XclExpChRoot
407 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XDataSequence
> XDataSequenceRef
;
408 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XFormattedString
> XFormattedStringRef
;
409 typedef ::com::sun::star::uno::Sequence
< XFormattedStringRef
> XFormattedStringSeq
;
412 explicit XclExpChSourceLink( const XclExpChRoot
& rRoot
, sal_uInt8 nDestType
);
414 /** Converts the passed source link, returns the number of linked values. */
415 sal_uInt16
ConvertDataSequence( XDataSequenceRef xDataSeq
, bool bSplitToColumns
, sal_uInt16 nDefCount
= 0 );
416 /** Converts the passed sequence of formatted string objects, returns leading font index. */
417 sal_uInt16
ConvertStringSequence( const XFormattedStringSeq
& rStringSeq
);
418 /** Converts the number format from the passed property set. */
419 void ConvertNumFmt( const ScfPropertySet
& rPropSet
, bool bPercent
);
421 /** Returns true, if this source link contains explicit string data. */
422 inline bool HasString() const { return mxString
.is() && !mxString
->IsEmpty(); }
424 /** Writes the CHSOURCELINK record and optionally a CHSTRING record with explicit string data. */
425 virtual void Save( XclExpStream
& rStrm
);
428 virtual void WriteBody( XclExpStream
& rStrm
);
431 XclChSourceLink maData
; /// Contents of the CHSOURCELINK record.
432 XclTokenArrayRef mxLinkFmla
; /// Formula with link to source data.
433 XclExpStringRef mxString
; /// Text data (CHSTRING record).
436 typedef ScfRef
< XclExpChSourceLink
> XclExpChSourceLinkRef
;
438 // Text =======================================================================
440 /** The CHFONT record containing a font index for text objects. */
441 class XclExpChFont
: public XclExpUInt16Record
444 explicit XclExpChFont( sal_uInt16 nFontIdx
);
447 typedef ScfRef
< XclExpChFont
> XclExpChFontRef
;
449 // ----------------------------------------------------------------------------
451 /** The CHOBJECTLINK record linking a text object to a specific chart object. */
452 class XclExpChObjectLink
: public XclExpRecord
455 explicit XclExpChObjectLink( sal_uInt16 nLinkTarget
, const XclChDataPointPos
& rPointPos
);
458 virtual void WriteBody( XclExpStream
& rStrm
);
461 XclChObjectLink maData
; /// Contents of the CHOBJECTLINK record.
464 typedef ScfRef
< XclExpChObjectLink
> XclExpChObjectLinkRef
;
466 // ----------------------------------------------------------------------------
468 /** Additional data label settings in the future record CHFRLABELPROPS. */
469 class XclExpChFrLabelProps
: public XclExpChFutureRecordBase
472 explicit XclExpChFrLabelProps( const XclExpChRoot
& rRoot
);
474 /** Converts separator and the passed data label flags. */
476 const ScfPropertySet
& rPropSet
, bool bShowSeries
,
477 bool bShowCateg
, bool bShowValue
,
478 bool bShowPercent
, bool bShowBubble
);
481 virtual void WriteBody( XclExpStream
& rStrm
);
484 XclChFrLabelProps maData
; /// Contents of the CHFRLABELPROPS record.
487 typedef ScfRef
< XclExpChFrLabelProps
> XclExpChFrLabelPropsRef
;
489 // ----------------------------------------------------------------------------
491 /** Base class for objects with font settings. Provides font conversion helper functions. */
492 class XclExpChFontBase
495 virtual ~XclExpChFontBase();
497 /** Derived classes set font color and color identifier to internal data structures. */
498 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
) = 0;
499 /** Derived classes set text rotation to internal data structures. */
500 virtual void SetRotation( sal_uInt16 nRotation
) = 0;
502 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
503 void ConvertFontBase( const XclExpChRoot
& rRoot
, sal_uInt16 nFontIdx
);
504 /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
505 void ConvertFontBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
);
506 /** Converts rotation settings, calls virtual function SetRotation(). */
507 void ConvertRotationBase( const XclExpChRoot
& rRoot
, const ScfPropertySet
& rPropSet
, bool bSupportsStacked
);
510 // ----------------------------------------------------------------------------
512 /** Represents the CHTEXT record group containing text object properties.
514 The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
515 CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
517 class XclExpChText
: public XclExpChGroupBase
, public XclExpChFontBase
520 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XTitle
> XTitleRef
;
521 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
524 explicit XclExpChText( const XclExpChRoot
& rRoot
);
526 /** Sets font color and color identifier to internal data structures. */
527 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
);
528 /** Sets text rotation to internal data structures. */
529 virtual void SetRotation( sal_uInt16 nRotation
);
531 /** Converts all text settings of the passed title text object. */
532 void ConvertTitle( XTitleRef xTitle
, sal_uInt16 nTarget
);
533 /** Converts all text settings of the passed legend. */
534 void ConvertLegend( const ScfPropertySet
& rPropSet
);
535 /** Converts all settings of the passed data point caption text object. */
536 bool ConvertDataLabel( const ScfPropertySet
& rPropSet
,
537 const XclChTypeInfo
& rTypeInfo
, const XclChDataPointPos
& rPointPos
);
538 /** Converts all settings of the passed trend line equation box. */
539 void ConvertTrendLineEquation( const ScfPropertySet
& rPropSet
, const XclChDataPointPos
& rPointPos
);
541 /** Returns true, if the string object does not contain any text data. */
542 inline bool HasString() const { return mxSrcLink
.is() && mxSrcLink
->HasString(); }
543 /** Returns the flags needed for the CHATTACHEDLABEL record. */
544 sal_uInt16
GetAttLabelFlags() const;
546 /** Writes all embedded records. */
547 virtual void WriteSubRecords( XclExpStream
& rStrm
);
550 virtual void WriteBody( XclExpStream
& rStrm
);
553 XclChText maData
; /// Contents of the CHTEXT record.
554 XclExpChFramePosRef mxFramePos
; /// Relative text frame position (CHFRAMEPOS record).
555 XclExpChSourceLinkRef mxSrcLink
; /// Linked data (CHSOURCELINK with CHSTRING record).
556 XclExpChFrameRef mxFrame
; /// Text object frame properties (CHFRAME group).
557 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
558 XclExpChObjectLinkRef mxObjLink
; /// Link target for this text object.
559 XclExpChFrLabelPropsRef mxLabelProps
; /// Extended data label properties (CHFRLABELPROPS record).
560 sal_uInt32 mnTextColorId
; /// Text color identifier.
563 typedef ScfRef
< XclExpChText
> XclExpChTextRef
;
565 // Data series ================================================================
567 /** The CHMARKERFORMAT record containing data point marker formatting data. */
568 class XclExpChMarkerFormat
: public XclExpRecord
571 explicit XclExpChMarkerFormat( const XclExpChRoot
& rRoot
);
573 /** Converts symbol properties from the passed property set. */
574 void Convert( const XclExpChRoot
& rRoot
,
575 const ScfPropertySet
& rPropSet
, sal_uInt16 nFormatIdx
);
576 /** Converts symbol properties for stock charts from the passed property set. */
577 void ConvertStockSymbol( const XclExpChRoot
& rRoot
,
578 const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
580 /** Returns true, if markers are enabled. */
581 inline bool HasMarker() const { return maData
.mnMarkerType
!= EXC_CHMARKERFORMAT_NOSYMBOL
; }
582 /** Returns true, if border line of markers is visible. */
583 inline bool HasLineColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOLINE
); }
584 /** Returns true, if fill area of markers is visible. */
585 inline bool HasFillColor() const { return !::get_flag( maData
.mnFlags
, EXC_CHMARKERFORMAT_NOFILL
); }
588 /** Registers marker colors in palette and stores color identifiers. */
589 void RegisterColors( const XclExpChRoot
& rRoot
);
591 virtual void WriteBody( XclExpStream
& rStrm
);
594 XclChMarkerFormat maData
; /// Contents of the CHMARKERFORMAT record.
595 sal_uInt32 mnLineColorId
; /// Border line color identifier.
596 sal_uInt32 mnFillColorId
; /// Fill color identifier.
599 typedef ScfRef
< XclExpChMarkerFormat
> XclExpChMarkerFormatRef
;
601 // ----------------------------------------------------------------------------
603 /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
604 class XclExpChPieFormat
: public XclExpUInt16Record
607 explicit XclExpChPieFormat();
609 /** Sets pie segment properties from the passed property set. */
610 void Convert( const ScfPropertySet
& rPropSet
);
613 typedef ScfRef
< XclExpChPieFormat
> XclExpChPieFormatRef
;
615 // ----------------------------------------------------------------------------
617 /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
618 class XclExpCh3dDataFormat
: public XclExpRecord
621 explicit XclExpCh3dDataFormat();
623 /** Sets 3d bar properties from the passed property set. */
624 void Convert( const ScfPropertySet
& rPropSet
);
627 virtual void WriteBody( XclExpStream
& rStrm
);
630 XclCh3dDataFormat maData
; /// Contents of the CH3DDATAFORMAT record.
633 typedef ScfRef
< XclExpCh3dDataFormat
> XclExpCh3dDataFormatRef
;
635 // ----------------------------------------------------------------------------
637 /** The CHATTACHEDLABEL record that contains the type of a data point label. */
638 class XclExpChAttachedLabel
: public XclExpUInt16Record
641 explicit XclExpChAttachedLabel( sal_uInt16 nFlags
);
644 typedef ScfRef
< XclExpChAttachedLabel
> XclExpChAttLabelRef
;
646 // ----------------------------------------------------------------------------
648 /** Represents the CHDATAFORMAT record group containing data point properties.
650 The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
651 CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
652 CHATTACHEDLABEL, CHEND.
654 class XclExpChDataFormat
: public XclExpChGroupBase
, public XclExpChFrameBase
657 explicit XclExpChDataFormat( const XclExpChRoot
& rRoot
,
658 const XclChDataPointPos
& rPointPos
, sal_uInt16 nFormatIdx
);
660 /** Converts the passed data series or data point formatting. */
661 void ConvertDataSeries( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
);
662 /** Sets default formatting for a series in a stock chart. */
663 void ConvertStockSeries( const ScfPropertySet
& rPropSet
, bool bCloseSymbol
);
664 /** Converts line formatting for the specified object (e.g. trend lines, error bars). */
665 void ConvertLine( const ScfPropertySet
& rPropSet
, XclChObjectType eObjType
);
667 /** Returns true, if this objects describes the formatting of an entire series. */
668 inline bool IsSeriesFormat() const { return maData
.maPointPos
.mnPointIdx
== EXC_CHDATAFORMAT_ALLPOINTS
; }
670 /** Writes all embedded records. */
671 virtual void WriteSubRecords( XclExpStream
& rStrm
);
674 virtual void WriteBody( XclExpStream
& rStrm
);
677 XclChDataFormat maData
; /// Contents of the CHDATAFORMAT record.
678 XclExpChMarkerFormatRef mxMarkerFmt
; /// Data point marker (CHMARKERFORMAT record).
679 XclExpChPieFormatRef mxPieFmt
; /// Pie segment format (CHPIEFORMAT record).
680 XclExpRecordRef mxSeriesFmt
; /// Series properties (CHSERIESFORMAT record).
681 XclExpCh3dDataFormatRef mx3dDataFmt
; /// 3D bar format (CH3DDATAFORMAT record).
682 XclExpChAttLabelRef mxAttLabel
; /// Data point label type (CHATTACHEDLABEL record).
685 typedef ScfRef
< XclExpChDataFormat
> XclExpChDataFormatRef
;
687 // ----------------------------------------------------------------------------
689 /** Represents the CHSERTRENDLINE record containing settings for a trend line. */
690 class XclExpChSerTrendLine
: public XclExpRecord
, protected XclExpChRoot
693 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
696 explicit XclExpChSerTrendLine( const XclExpChRoot
& rRoot
);
698 /** Converts the passed trend line, returns true if trend line type is supported. */
699 bool Convert( XRegressionCurveRef xRegCurve
, sal_uInt16 nSeriesIdx
);
701 /** Returns formatting information of the trend line, created in Convert(). */
702 inline XclExpChDataFormatRef
GetDataFormat() const { return mxDataFmt
; }
703 /** Returns formatting of the equation text box, created in Convert(). */
704 inline XclExpChTextRef
GetDataLabel() const { return mxLabel
; }
707 virtual void WriteBody( XclExpStream
& rStrm
);
710 XclChSerTrendLine maData
; /// Contents of the CHSERTRENDLINE record.
711 XclExpChDataFormatRef mxDataFmt
; /// Formatting settings of the trend line.
712 XclExpChTextRef mxLabel
; /// Formatting of the equation text box.
715 typedef ScfRef
< XclExpChSerTrendLine
> XclExpChSerTrendLineRef
;
717 // ----------------------------------------------------------------------------
719 /** Represents the CHSERERRORBAR record containing settings for error bars. */
720 class XclExpChSerErrorBar
: public XclExpRecord
, protected XclExpChRoot
723 explicit XclExpChSerErrorBar( const XclExpChRoot
& rRoot
, sal_uInt8 nBarType
);
725 /** Converts the passed error bar settings, returns true if error bar type is supported. */
726 bool Convert( XclExpChSourceLink
& rValueLink
, sal_uInt16
& rnValueCount
, const ScfPropertySet
& rPropSet
);
729 virtual void WriteBody( XclExpStream
& rStrm
);
732 XclChSerErrorBar maData
; /// Contents of the CHSERERRORBAR record.
735 typedef ScfRef
< XclExpChSerErrorBar
> XclExpChSerErrorBarRef
;
737 // ----------------------------------------------------------------------------
739 /** Represents the CHSERIES record group describing a data series in a chart.
741 The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
742 CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
743 CHSERTRENDLINE, CHEND.
745 class XclExpChSeries
: public XclExpChGroupBase
748 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
749 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
750 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
751 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XRegressionCurve
> XRegressionCurveRef
;
754 explicit XclExpChSeries( const XclExpChRoot
& rRoot
, sal_uInt16 nSeriesIdx
);
756 /** Converts the passed data series (source links and formatting). */
757 bool ConvertDataSeries(
758 XDiagramRef xDiagram
, XDataSeriesRef xDataSeries
,
759 const XclChExtTypeInfo
& rTypeInfo
,
760 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
);
761 /** Converts the passed data series for stock charts. */
762 bool ConvertStockSeries(
763 XDataSeriesRef xDataSeries
,
764 const ::rtl::OUString
& rValueRole
,
765 sal_uInt16 nGroupIdx
, sal_uInt16 nFormatIdx
, bool bCloseSymbol
);
766 /** Converts the passed error bar settings (called at trend line child series). */
767 bool ConvertTrendLine( const XclExpChSeries
& rParent
, XRegressionCurveRef xRegCurve
);
768 /** Converts the passed error bar settings (called at error bar child series). */
769 bool ConvertErrorBar( const XclExpChSeries
& rParent
, const ScfPropertySet
& rPropSet
, sal_uInt8 nBarId
);
770 /** Converts and inserts category ranges for all inserted series. */
771 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
773 /** Writes all embedded records. */
774 virtual void WriteSubRecords( XclExpStream
& rStrm
);
777 /** Initializes members of this series to represent a child of the passed series. */
778 void InitFromParent( const XclExpChSeries
& rParent
);
779 /** Tries to create trend line series objects (called at parent series). */
780 void CreateTrendLines( XDataSeriesRef xDataSeries
);
781 /** Tries to create positive and negative error bar series objects (called at parent series). */
782 void CreateErrorBars( const ScfPropertySet
& rPropSet
,
783 const ::rtl::OUString
& rBarPropName
,
784 sal_uInt8 nPosBarId
, sal_uInt8 nNegBarId
);
785 /** Tries to create an error bar series object (called at parent series). */
786 void CreateErrorBar( const ScfPropertySet
& rPropSet
,
787 const ::rtl::OUString
& rShowPropName
, sal_uInt8 nBarId
);
789 virtual void WriteBody( XclExpStream
& rStrm
);
792 typedef XclExpRecordList
< XclExpChDataFormat
> XclExpChDataFormatList
;
795 XclChSeries maData
; /// Contents of the CHSERIES record.
796 XclExpChSourceLinkRef mxTitleLink
; /// Link data for series title.
797 XclExpChSourceLinkRef mxValueLink
; /// Link data for series values.
798 XclExpChSourceLinkRef mxCategLink
; /// Link data for series category names.
799 XclExpChSourceLinkRef mxBubbleLink
; /// Link data for series bubble sizes.
800 XclExpChDataFormatRef mxSeriesFmt
; /// CHDATAFORMAT group for series format.
801 XclExpChDataFormatList maPointFmts
; /// CHDATAFORMAT groups for data point formats.
802 XclExpChSerTrendLineRef mxTrendLine
; /// Trend line settings (CHSERTRENDLINE record).
803 XclExpChSerErrorBarRef mxErrorBar
; /// Error bar settings (CHSERERRORBAR record).
804 sal_uInt16 mnGroupIdx
; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
805 sal_uInt16 mnSeriesIdx
; /// 0-based series index.
806 sal_uInt16 mnParentIdx
; /// 0-based index of parent series (trend lines and error bars).
809 typedef ScfRef
< XclExpChSeries
> XclExpChSeriesRef
;
811 // Chart type groups ==========================================================
813 /** Represents the chart type record for all supported chart types. */
814 class XclExpChType
: public XclExpRecord
, protected XclExpChRoot
817 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
818 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
821 explicit XclExpChType( const XclExpChRoot
& rRoot
);
823 /** Converts the passed chart type and the contained data series. */
824 void Convert( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
825 sal_Int32 nApiAxesSetIdx
, bool bSwappedAxesSet
, bool bHasXLabels
);
826 /** Sets stacking mode (standard or percent) for the series in this chart type group. */
827 void SetStacked( bool bPercent
);
829 /** Returns true, if this is object represents a valid chart type. */
830 inline bool IsValidType() const { return maTypeInfo
.meTypeId
!= EXC_CHTYPEID_UNKNOWN
; }
831 /** Returns the chart type info struct for the contained chart type. */
832 inline const XclChTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
835 virtual void WriteBody( XclExpStream
& rStrm
);
838 XclChType maData
; /// Contents of the chart type record.
839 XclChTypeInfo maTypeInfo
; /// Chart type info for the contained type.
842 // ----------------------------------------------------------------------------
844 /** Represents the CHCHART3D record that contains 3D view settings. */
845 class XclExpChChart3d
: public XclExpRecord
848 explicit XclExpChChart3d();
850 /** Converts 3d settings for the passed chart type. */
851 void Convert( const ScfPropertySet
& rPropSet
, bool b3dWallChart
);
852 /** Sets flag that the data points are clustered on the X axis. */
853 inline void SetClustered() { ::set_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
855 /** Returns true, if the data points are clustered on the X axis. */
856 inline bool IsClustered() const { return ::get_flag( maData
.mnFlags
, EXC_CHCHART3D_CLUSTER
); }
859 virtual void WriteBody( XclExpStream
& rStrm
);
862 XclChChart3d maData
; /// Contents of the CHCHART3D record.
865 typedef ScfRef
< XclExpChChart3d
> XclExpChChart3dRef
;
867 // ----------------------------------------------------------------------------
869 /** Represents the CHLEGEND record group describing the chart legend.
871 The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME
872 group, CHTEXT group, CHEND.
874 class XclExpChLegend
: public XclExpChGroupBase
877 explicit XclExpChLegend( const XclExpChRoot
& rRoot
);
879 /** Converts all legend settings from the passed property set. */
880 void Convert( const ScfPropertySet
& rPropSet
);
882 /** Writes all embedded records. */
883 virtual void WriteSubRecords( XclExpStream
& rStrm
);
886 virtual void WriteBody( XclExpStream
& rStrm
);
889 XclChLegend maData
; /// Contents of the CHLEGEND record.
890 XclExpChFramePosRef mxFramePos
; /// Legend frame position (CHFRAMEPOS record).
891 XclExpChTextRef mxText
; /// Legend text format (CHTEXT group).
892 XclExpChFrameRef mxFrame
; /// Legend frame format (CHFRAME group).
895 typedef ScfRef
< XclExpChLegend
> XclExpChLegendRef
;
897 // ----------------------------------------------------------------------------
899 /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
901 The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
902 CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
904 class XclExpChDropBar
: public XclExpChGroupBase
, public XclExpChFrameBase
907 explicit XclExpChDropBar( const XclExpChRoot
& rRoot
, XclChObjectType eObjType
);
909 /** Converts and writes the contained frame data to the passed property set. */
910 void Convert( const ScfPropertySet
& rPropSet
);
912 /** Writes all embedded records. */
913 virtual void WriteSubRecords( XclExpStream
& rStrm
);
916 virtual void WriteBody( XclExpStream
& rStrm
);
919 XclChObjectType meObjType
; /// Type of the dropbar.
920 sal_uInt16 mnBarDist
; /// Distance between bars (CHDROPBAR record).
923 typedef ScfRef
< XclExpChDropBar
> XclExpChDropBarRef
;
925 // ----------------------------------------------------------------------------
927 /** Represents the CHTYPEGROUP record group describing a group of series.
929 The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
930 record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
931 CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
932 CHDATAFORMAT group, CHEND.
934 class XclExpChTypeGroup
: public XclExpChGroupBase
937 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
938 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartType
> XChartTypeRef
;
939 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDataSeries
> XDataSeriesRef
;
940 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::data::XLabeledDataSequence
> XLabeledDataSeqRef
;
943 explicit XclExpChTypeGroup( const XclExpChRoot
& rRoot
, sal_uInt16 nGroupIdx
);
945 /** Converts the passed chart type to Excel type settings. */
946 void ConvertType( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
947 sal_Int32 nApiAxesSetIdx
, bool b3dChart
, bool bSwappedAxesSet
, bool bHasXLabels
);
948 /** Converts and inserts all series from the passed chart type. */
949 void ConvertSeries( XDiagramRef xDiagram
, XChartTypeRef xChartType
,
950 sal_Int32 nGroupAxesSetIdx
, bool bPercent
, bool bConnectorLines
);
951 /** Converts and inserts category ranges for all inserted series. */
952 void ConvertCategSequence( XLabeledDataSeqRef xCategSeq
);
953 /** Creates a legend object and converts all legend settings. */
954 void ConvertLegend( const ScfPropertySet
& rPropSet
);
956 /** Returns true, if this chart type group contains at least one valid series. */
957 inline bool IsValidGroup() const { return !maSeries
.IsEmpty() && maType
.IsValidType(); }
958 /** Returns the index of this chart type group format. */
959 inline sal_uInt16
GetGroupIdx() const { return maData
.mnGroupIdx
; }
960 /** Returns the chart type info struct for the contained chart type. */
961 inline const XclChExtTypeInfo
& GetTypeInfo() const { return maTypeInfo
; }
962 /** Returns true, if the chart is three-dimensional. */
963 inline bool Is3dChart() const { return maTypeInfo
.mb3dChart
; }
964 /** Returns true, if chart type supports wall and floor format. */
965 inline bool Is3dWallChart() const { return Is3dChart() && (maTypeInfo
.meTypeCateg
!= EXC_CHTYPECATEG_PIE
); }
966 /** Returns true, if the series in this chart type group are ordered on the Z axis. */
967 inline bool Is3dDeepChart() const { return Is3dWallChart() && mxChart3d
.is() && !mxChart3d
->IsClustered(); }
968 /** Returns true, if this chart type can be combined with other types. */
969 inline bool IsCombinable2d() const { return !Is3dChart() && maTypeInfo
.mbCombinable2d
; }
971 /** Writes all embedded records. */
972 virtual void WriteSubRecords( XclExpStream
& rStrm
);
975 /** Returns an unused format index to be used for the next created series. */
976 sal_uInt16
GetFreeFormatIdx() const;
977 /** Creates all data series of any chart type except stock charts. */
978 void CreateDataSeries( XDiagramRef xDiagram
,
979 XDataSeriesRef xDataSeries
);
980 /** Creates all data series of a stock chart. */
981 void CreateAllStockSeries( XChartTypeRef xChartType
,
982 XDataSeriesRef xDataSeries
);
983 /** Creates a single data series of a stock chart. */
984 bool CreateStockSeries( XDataSeriesRef xDataSeries
,
985 const ::rtl::OUString
& rValueRole
, bool bCloseSymbol
);
987 virtual void WriteBody( XclExpStream
& rStrm
);
990 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
991 typedef ScfRefMap
< sal_uInt16
, XclExpChLineFormat
> XclExpChLineFormatMap
;
993 XclChTypeGroup maData
; /// Contents of the CHTYPEGROUP record.
994 XclExpChType maType
; /// Chart type (e.g. CHBAR, CHLINE, ...).
995 XclChExtTypeInfo maTypeInfo
; /// Extended chart type info.
996 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
997 XclExpChChart3dRef mxChart3d
; /// 3D settings (CHCHART3D record).
998 XclExpChLegendRef mxLegend
; /// Chart legend (CHLEGEND group).
999 XclExpChDropBarRef mxUpBar
; /// White dropbars (CHDROPBAR group).
1000 XclExpChDropBarRef mxDownBar
; /// Black dropbars (CHDROPBAR group).
1001 XclExpChLineFormatMap maChartLines
; /// Global line formats (CHCHARTLINE group).
1004 typedef ScfRef
< XclExpChTypeGroup
> XclExpChTypeGroupRef
;
1006 // Axes =======================================================================
1008 class XclExpChLabelRange
: public XclExpRecord
, protected XclExpChRoot
1011 explicit XclExpChLabelRange( const XclExpChRoot
& rRoot
);
1013 /** Converts category axis scaling settings. */
1014 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
, bool bMirrorOrient
);
1015 /** Converts position settings of a crossing axis at this axis. */
1016 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
1017 /** Sets flag for tickmark position between categories or on categories. */
1018 inline void SetTicksBetweenCateg( bool bTicksBetween
)
1019 { ::set_flag( maData
.mnFlags
, EXC_CHLABELRANGE_BETWEEN
, bTicksBetween
); }
1022 virtual void WriteBody( XclExpStream
& rStrm
);
1025 XclChLabelRange maData
; /// Contents of the CHLABELRANGE record.
1028 typedef ScfRef
< XclExpChLabelRange
> XclExpChLabelRangeRef
;
1030 // ----------------------------------------------------------------------------
1032 class XclExpChValueRange
: public XclExpRecord
, protected XclExpChRoot
1035 explicit XclExpChValueRange( const XclExpChRoot
& rRoot
);
1037 /** Converts value axis scaling settings. */
1038 void Convert( const ::com::sun::star::chart2::ScaleData
& rScaleData
);
1039 /** Converts position settings of a crossing axis at this axis. */
1040 void ConvertAxisPosition( const ScfPropertySet
& rPropSet
);
1043 virtual void WriteBody( XclExpStream
& rStrm
);
1046 XclChValueRange maData
; /// Contents of the CHVALUERANGE record.
1049 typedef ScfRef
< XclExpChValueRange
> XclExpChValueRangeRef
;
1051 // ----------------------------------------------------------------------------
1053 class XclExpChTick
: public XclExpRecord
, protected XclExpChRoot
1056 explicit XclExpChTick( const XclExpChRoot
& rRoot
);
1058 /** Converts axis tick mark settings. */
1059 void Convert( const ScfPropertySet
& rPropSet
, const XclChExtTypeInfo
& rTypeInfo
, sal_uInt16 nAxisType
);
1060 /** Sets font color and color identifier to internal data structures. */
1061 void SetFontColor( const Color
& rColor
, sal_uInt32 nColorId
);
1062 /** Sets text rotation to internal data structures. */
1063 void SetRotation( sal_uInt16 nRotation
);
1066 virtual void WriteBody( XclExpStream
& rStrm
);
1069 XclChTick maData
; /// Contents of the CHTICK record.
1070 sal_uInt32 mnTextColorId
; /// Axis labels text color identifier.
1073 typedef ScfRef
< XclExpChTick
> XclExpChTickRef
;
1075 // ----------------------------------------------------------------------------
1077 /** Represents the CHAXIS record group describing an entire chart axis.
1079 The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
1080 CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
1081 CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
1083 class XclExpChAxis
: public XclExpChGroupBase
, public XclExpChFontBase
1086 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1087 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XAxis
> XAxisRef
;
1090 explicit XclExpChAxis( const XclExpChRoot
& rRoot
, sal_uInt16 nAxisType
);
1092 /** Sets font color and color identifier to internal data structures. */
1093 virtual void SetFont( XclExpChFontRef xFont
, const Color
& rColor
, sal_uInt32 nColorId
);
1094 /** Sets text rotation to internal data structures. */
1095 virtual void SetRotation( sal_uInt16 nRotation
);
1097 /** Converts formatting and scaling settings from the passed axis. */
1098 void Convert( XAxisRef xAxis
, XAxisRef xCrossingAxis
, const XclChExtTypeInfo
& rTypeInfo
);
1099 /** Converts and writes 3D wall/floor properties from the passed diagram. */
1100 void ConvertWall( XDiagramRef xDiagram
);
1102 /** Returns the type of this axis. */
1103 inline sal_uInt16
GetAxisType() const { return maData
.mnType
; }
1104 /** Returns the axis dimension index used by the chart API. */
1105 inline sal_Int32
GetApiAxisDimension() const { return maData
.GetApiAxisDimension(); }
1107 /** Writes all embedded records. */
1108 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1111 virtual void WriteBody( XclExpStream
& rStrm
);
1114 XclChAxis maData
; /// Contents of the CHAXIS record.
1115 XclExpChLabelRangeRef mxLabelRange
; /// Category scaling (CHLABELRANGE record).
1116 XclExpChValueRangeRef mxValueRange
; /// Value scaling (CHVALUERANGE record).
1117 XclExpChTickRef mxTick
; /// Axis ticks (CHTICK record).
1118 XclExpChFontRef mxFont
; /// Index into font buffer (CHFONT record).
1119 XclExpChLineFormatRef mxAxisLine
; /// Axis line format (CHLINEFORMAT record).
1120 XclExpChLineFormatRef mxMajorGrid
; /// Major grid line format (CHLINEFORMAT record).
1121 XclExpChLineFormatRef mxMinorGrid
; /// Minor grid line format (CHLINEFORMAT record).
1122 XclExpChFrameRef mxWallFrame
; /// Wall/floor format (sub records of CHFRAME group).
1123 sal_uInt16 mnNumFmtIdx
; /// Index into number format buffer (CHFORMAT record).
1126 typedef ScfRef
< XclExpChAxis
> XclExpChAxisRef
;
1128 // ----------------------------------------------------------------------------
1130 /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
1132 The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
1133 groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
1134 CHTYPEGROUP group, CHEND.
1136 class XclExpChAxesSet
: public XclExpChGroupBase
1139 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XDiagram
> XDiagramRef
;
1140 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XCoordinateSystem
> XCoordSystemRef
;
1143 explicit XclExpChAxesSet( const XclExpChRoot
& rRoot
, sal_uInt16 nAxesSetId
);
1145 /** Converts the passed diagram to chart record data.
1146 @return First unused chart type group index. */
1147 sal_uInt16
Convert( XDiagramRef xDiagram
, sal_uInt16 nFirstGroupIdx
);
1149 /** Returns true, if this axes set exists (returns false if this is a dummy object). */
1150 inline bool IsValidAxesSet() const { return !maTypeGroups
.IsEmpty(); }
1151 /** Returns the index of the axes set (primary/secondary). */
1152 inline sal_uInt16
GetAxesSetId() const { return maData
.mnAxesSetId
; }
1153 /** Returns the axes set index used by the chart API. */
1154 inline sal_Int32
GetApiAxesSetIndex() const { return maData
.GetApiAxesSetIndex(); }
1155 /** Returns true, if the chart is three-dimensional. */
1156 bool Is3dChart() const;
1158 /** Writes all embedded records. */
1159 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1162 /** Returns first inserted chart type group. */
1163 XclExpChTypeGroupRef
GetFirstTypeGroup() const;
1164 /** Returns last inserted chart type group. */
1165 XclExpChTypeGroupRef
GetLastTypeGroup() const;
1167 /** Converts a complete axis object including axis title. */
1168 void ConvertAxis( XclExpChAxisRef
& rxChAxis
, sal_uInt16 nAxisType
,
1169 XclExpChTextRef
& rxChAxisTitle
, sal_uInt16 nTitleTarget
,
1170 XCoordSystemRef xCoordSystem
, const XclChExtTypeInfo
& rTypeInfo
,
1171 sal_Int32 nCrossingAxisDim
);
1173 virtual void WriteBody( XclExpStream
& rStrm
);
1176 typedef XclExpRecordList
< XclExpChTypeGroup
> XclExpChTypeGroupList
;
1178 XclChAxesSet maData
; /// Contents of the CHAXESSET record.
1179 XclExpChFramePosRef mxFramePos
; /// Outer plot area position (CHFRAMEPOS record).
1180 XclExpChAxisRef mxXAxis
; /// The X axis (CHAXIS group).
1181 XclExpChAxisRef mxYAxis
; /// The Y axis (CHAXIS group).
1182 XclExpChAxisRef mxZAxis
; /// The Z axis (CHAXIS group).
1183 XclExpChTextRef mxXAxisTitle
; /// The X axis title (CHTEXT group).
1184 XclExpChTextRef mxYAxisTitle
; /// The Y axis title (CHTEXT group).
1185 XclExpChTextRef mxZAxisTitle
; /// The Z axis title (CHTEXT group).
1186 XclExpChFrameRef mxPlotFrame
; /// Plot area (CHPLOTFRAME group).
1187 XclExpChTypeGroupList maTypeGroups
; /// Chart type groups (CHTYPEGROUP group).
1190 typedef ScfRef
< XclExpChAxesSet
> XclExpChAxesSetRef
;
1192 // The chart object ===========================================================
1194 /** Represents the CHCHART record group describing the chart contents.
1196 The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
1197 group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
1198 with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
1200 class XclExpChChart
: public XclExpChGroupBase
1203 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::chart2::XChartDocument
> XChartDocRef
;
1206 explicit XclExpChChart( const XclExpRoot
& rRoot
,
1207 XChartDocRef xChartDoc
, const Rectangle
& rChartRect
);
1209 /** Creates, registers and returns a new data series object. */
1210 XclExpChSeriesRef
CreateSeries();
1211 /** Removes the last created data series object from the series list. */
1212 void RemoveLastSeries();
1213 /** Stores a CHTEXT group that describes a data point label. */
1214 void SetDataLabel( XclExpChTextRef xText
);
1215 /** Sets the plot area position and size to manual mode. */
1216 void SetManualPlotArea();
1218 /** Writes all embedded records. */
1219 virtual void WriteSubRecords( XclExpStream
& rStrm
);
1222 virtual void WriteBody( XclExpStream
& rStrm
);
1225 typedef XclExpRecordList
< XclExpChSeries
> XclExpChSeriesList
;
1226 typedef XclExpRecordList
< XclExpChText
> XclExpChTextList
;
1228 XclChRectangle maRect
; /// Position of the chart on the sheet (CHCHART record).
1229 XclExpChSeriesList maSeries
; /// List of series data (CHSERIES groups).
1230 XclExpChFrameRef mxFrame
; /// Chart frame format (CHFRAME group).
1231 XclChProperties maProps
; /// Chart properties (CHPROPERTIES record).
1232 XclExpChAxesSetRef mxPrimAxesSet
; /// Primary axes set (CHAXESSET group).
1233 XclExpChAxesSetRef mxSecnAxesSet
; /// Secondary axes set (CHAXESSET group).
1234 XclExpChTextRef mxTitle
; /// Chart title (CHTEXT group).
1235 XclExpChTextList maLabels
; /// Data point labels (CHTEXT groups).
1238 // ----------------------------------------------------------------------------
1240 /** Represents the group of DFF and OBJ records containing all drawing shapes
1241 embedded in the chart object.
1243 class XclExpChartDrawing
: public XclExpRecordBase
, protected XclExpRoot
1246 explicit XclExpChartDrawing(
1247 const XclExpRoot
& rRoot
,
1248 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
>& rxModel
,
1249 const Size
& rChartSize
);
1250 virtual ~XclExpChartDrawing();
1252 virtual void Save( XclExpStream
& rStrm
);
1255 ScfRef
< XclExpObjectManager
> mxObjMgr
;
1256 ScfRef
< XclExpRecordBase
> mxObjRecs
;
1259 // ----------------------------------------------------------------------------
1261 /** Represents the entire chart substream (all records in BOF/EOF block). */
1262 class XclExpChart
: public XclExpSubStream
, protected XclExpRoot
1265 typedef ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XModel
> XModelRef
;
1268 explicit XclExpChart( const XclExpRoot
& rRoot
,
1269 XModelRef xModel
, const Rectangle
& rChartRect
);
1272 // ============================================================================