Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XECHART_HXX
30 : : #define SC_XECHART_HXX
31 : :
32 : : #include <tools/gen.hxx>
33 : : #include "xerecord.hxx"
34 : : #include "xlchart.hxx"
35 : : #include "xlformula.hxx"
36 : : #include "xlstyle.hxx"
37 : : #include "xeroot.hxx"
38 : : #include "xestring.hxx"
39 : : #include <boost/shared_ptr.hpp>
40 : : #include <boost/ptr_container/ptr_map.hpp>
41 : :
42 : : class Size;
43 : :
44 : : namespace com { namespace sun { namespace star {
45 : : namespace awt
46 : : {
47 : : struct Rectangle;
48 : : }
49 : : namespace frame
50 : : {
51 : : class XModel;
52 : : }
53 : : namespace chart
54 : : {
55 : : class XAxis;
56 : : }
57 : : namespace chart2
58 : : {
59 : : struct ScaleData;
60 : : class XChartDocument;
61 : : class XDiagram;
62 : : class XCoordinateSystem;
63 : : class XChartType;
64 : : class XDataSeries;
65 : : class XAxis;
66 : : class XTitle;
67 : : class XFormattedString;
68 : : class XRegressionCurve;
69 : : namespace data
70 : : {
71 : : class XDataSequence;
72 : : class XLabeledDataSequence;
73 : : }
74 : : }
75 : : } } }
76 : :
77 : : // Common =====================================================================
78 : :
79 : : struct XclExpChRootData;
80 : : class XclExpChChart;
81 : :
82 : : /** Base class for complex chart classes, provides access to other components
83 : : of the chart.
84 : :
85 : : Keeps also track of future record levels and writes the needed future
86 : : records on demand.
87 : : */
88 [ # # ]: 0 : class XclExpChRoot : public XclExpRoot
89 : : {
90 : : public:
91 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef;
92 : :
93 : : public:
94 : : explicit XclExpChRoot( const XclExpRoot& rRoot, XclExpChChart& rChartData );
95 : : virtual ~XclExpChRoot();
96 : :
97 : : /** Returns this root instance - for code readability in derived classes. */
98 : 0 : inline const XclExpChRoot& GetChRoot() const { return *this; }
99 : : /** Returns the API Chart document model. */
100 : : XChartDocRef GetChartDocument() const;
101 : : /** Returns a reference to the parent chart data object. */
102 : : XclExpChChart& GetChartData() const;
103 : : /** Returns chart type info for a unique chart type identifier. */
104 : : const XclChTypeInfo& GetChartTypeInfo( XclChTypeId eType ) const;
105 : : /** Returns the first fitting chart type info for the passed service name. */
106 : : const XclChTypeInfo& GetChartTypeInfo( const ::rtl::OUString& rServiceName ) const;
107 : :
108 : : /** Returns an info struct about auto formatting for the passed object type. */
109 : : const XclChFormatInfo& GetFormatInfo( XclChObjectType eObjType ) const;
110 : :
111 : : /** Starts the API chart document conversion. Must be called once before all API conversion. */
112 : : void InitConversion( XChartDocRef xChartDoc, const Rectangle& rChartRect ) const;
113 : : /** Finishes the API chart document conversion. Must be called once after all API conversion. */
114 : : void FinishConversion() const;
115 : :
116 : : /** Returns true, if the passed color equals to the specified system color. */
117 : : bool IsSystemColor( const Color& rColor, sal_uInt16 nSysColorIdx ) const;
118 : : /** Sets a system color and the respective color identifier. */
119 : : void SetSystemColor( Color& rColor, sal_uInt32& rnColorId, sal_uInt16 nSysColorIdx ) const;
120 : :
121 : : /** Converts the passed horizontal coordinate from 1/100 mm to Excel chart units. */
122 : : sal_Int32 CalcChartXFromHmm( sal_Int32 nPosX ) const;
123 : : /** Converts the passed vertical coordinate from 1/100 mm to Excel chart units. */
124 : : sal_Int32 CalcChartYFromHmm( sal_Int32 nPosY ) const;
125 : : /** Converts the passed rectangle from 1/100 mm to Excel chart units. */
126 : : XclChRectangle CalcChartRectFromHmm( const ::com::sun::star::awt::Rectangle& rRect ) const;
127 : :
128 : : /** Reads all line properties from the passed property set. */
129 : : void ConvertLineFormat(
130 : : XclChLineFormat& rLineFmt,
131 : : const ScfPropertySet& rPropSet,
132 : : XclChPropertyMode ePropMode ) const;
133 : : /** Reads solid area properties from the passed property set.
134 : : @return true = object contains complex fill properties. */
135 : : bool ConvertAreaFormat(
136 : : XclChAreaFormat& rAreaFmt,
137 : : const ScfPropertySet& rPropSet,
138 : : XclChPropertyMode ePropMode ) const;
139 : : /** Reads gradient or bitmap area properties from the passed property set. */
140 : : void ConvertEscherFormat(
141 : : XclChEscherFormat& rEscherFmt,
142 : : XclChPicFormat& rPicFmt,
143 : : const ScfPropertySet& rPropSet,
144 : : XclChPropertyMode ePropMode ) const;
145 : : /** Reads font properties from the passed property set. */
146 : : sal_uInt16 ConvertFont(
147 : : const ScfPropertySet& rPropSet,
148 : : sal_Int16 nScript ) const;
149 : :
150 : : /** Reads the pie rotation property and returns the converted angle. */
151 : : static sal_uInt16 ConvertPieRotation( const ScfPropertySet& rPropSet );
152 : :
153 : : protected:
154 : : /** Called from XclExpChGroupBase::Save, registers a new future record level. */
155 : : void RegisterFutureRecBlock( const XclChFrBlock& rFrBlock );
156 : : /** Called from XclExpChFutureRecordBase::Save, Initializes the current future record level. */
157 : : void InitializeFutureRecBlock( XclExpStream& rStrm );
158 : : /** Called from XclExpChGroupBase::Save, finalizes the current future record level. */
159 : : void FinalizeFutureRecBlock( XclExpStream& rStrm );
160 : :
161 : : private:
162 : : typedef boost::shared_ptr< XclExpChRootData > XclExpChRootDataRef;
163 : : XclExpChRootDataRef mxChData; /// Reference to the root data object.
164 : : };
165 : :
166 : : // ----------------------------------------------------------------------------
167 : :
168 : : /** Base class for chart record groups. Provides helper functions to write sub records.
169 : :
170 : : A chart record group consists of a header record, followed by a CHBEGIN
171 : : record, followed by group sub records, and finished with a CHEND record.
172 : : */
173 : : class XclExpChGroupBase : public XclExpRecord, protected XclExpChRoot
174 : : {
175 : : public:
176 : : explicit XclExpChGroupBase(
177 : : const XclExpChRoot& rRoot, sal_uInt16 nFrType,
178 : : sal_uInt16 nRecId, sal_Size nRecSize = 0 );
179 : : virtual ~XclExpChGroupBase();
180 : :
181 : : /** Saves the header record. Calls WriteSubRecords() to let derived classes write sub records. */
182 : : virtual void Save( XclExpStream& rStrm );
183 : : /** Derived classes return whether there are any records embedded in this group. */
184 : : virtual bool HasSubRecords() const;
185 : : /** Derived classes implement writing any records embedded in this group. */
186 : : virtual void WriteSubRecords( XclExpStream& rStrm ) = 0;
187 : :
188 : : protected:
189 : : /** Sets context information for future record blocks. */
190 : : void SetFutureRecordContext( sal_uInt16 nFrContext,
191 : : sal_uInt16 nFrValue1 = 0, sal_uInt16 nFrValue2 = 0 );
192 : :
193 : : private:
194 : : XclChFrBlock maFrBlock; /// Future records block settings.
195 : : };
196 : :
197 : : // ----------------------------------------------------------------------------
198 : :
199 : : /** Base class for chart future records. On saving, the record writes missing
200 : : CHFRBLOCKBEGIN records automatically.
201 : : */
202 [ # # ][ # # ]: 0 : class XclExpChFutureRecordBase : public XclExpFutureRecord, protected XclExpChRoot
203 : : {
204 : : public:
205 : : explicit XclExpChFutureRecordBase( const XclExpChRoot& rRoot,
206 : : XclFutureRecType eRecType, sal_uInt16 nRecId, sal_Size nRecSize = 0 );
207 : :
208 : : /** Writes missing CHFRBLOCKBEGIN records and this record. */
209 : : virtual void Save( XclExpStream& rStrm );
210 : : };
211 : :
212 : : // Frame formatting ===========================================================
213 : :
214 [ # # ]: 0 : class XclExpChFramePos : public XclExpRecord
215 : : {
216 : : public:
217 : : explicit XclExpChFramePos( sal_uInt16 nTLMode, sal_uInt16 nBRMode );
218 : :
219 : : /** Returns read/write access to the frame position data. */
220 : 0 : inline XclChFramePos& GetFramePosData() { return maData; }
221 : :
222 : : private:
223 : : virtual void WriteBody( XclExpStream& rStrm );
224 : :
225 : : private:
226 : : XclChFramePos maData; /// Position of the frame.
227 : : };
228 : :
229 : : typedef boost::shared_ptr< XclExpChFramePos > XclExpChFramePosRef;
230 : :
231 : : // ----------------------------------------------------------------------------
232 : :
233 [ # # ]: 0 : class XclExpChLineFormat : public XclExpRecord
234 : : {
235 : : public:
236 : : explicit XclExpChLineFormat( const XclExpChRoot& rRoot );
237 : :
238 : : /** Converts line formatting properties from the passed property set. */
239 : : void Convert( const XclExpChRoot& rRoot,
240 : : const ScfPropertySet& rPropSet, XclChObjectType eObjType );
241 : : /** Sets or clears the automatic flag. */
242 : 0 : inline void SetAuto( bool bAuto ) { ::set_flag( maData.mnFlags, EXC_CHLINEFORMAT_AUTO, bAuto ); }
243 : : /** Sets flag to show or hide an axis. */
244 : 0 : inline void SetShowAxis( bool bShowAxis )
245 : 0 : { ::set_flag( maData.mnFlags, EXC_CHLINEFORMAT_SHOWAXIS, bShowAxis ); }
246 : : /** Sets the line format to the specified default type. */
247 : : void SetDefault( XclChFrameType eDefFrameType );
248 : :
249 : : /** Returns true, if the line format is set to automatic. */
250 : 0 : inline bool IsAuto() const { return ::get_flag( maData.mnFlags, EXC_CHLINEFORMAT_AUTO ); }
251 : : /** Returns true, if the line style is set to something visible. */
252 : 0 : inline bool HasLine() const { return maData.mnPattern != EXC_CHLINEFORMAT_NONE; }
253 : : /** Returns true, if the line contains default formatting according to the passed frame type. */
254 : : bool IsDefault( XclChFrameType eDefFrameType ) const;
255 : :
256 : : private:
257 : : virtual void WriteBody( XclExpStream& rStrm );
258 : :
259 : : private:
260 : : XclChLineFormat maData; /// Contents of the CHLINEFORMAT record.
261 : : sal_uInt32 mnColorId; /// Line color identifier.
262 : : };
263 : :
264 : : typedef boost::shared_ptr< XclExpChLineFormat > XclExpChLineFormatRef;
265 : :
266 : : // ----------------------------------------------------------------------------
267 : :
268 [ # # ]: 0 : class XclExpChAreaFormat : public XclExpRecord
269 : : {
270 : : public:
271 : : explicit XclExpChAreaFormat( const XclExpChRoot& rRoot );
272 : :
273 : : /** Converts area formatting properties from the passed property set.
274 : : @return true = object contains complex fill properties. */
275 : : bool Convert( const XclExpChRoot& rRoot,
276 : : const ScfPropertySet& rPropSet, XclChObjectType eObjType );
277 : : /** Sets or clears the automatic flag. */
278 : 0 : inline void SetAuto( bool bAuto ) { ::set_flag( maData.mnFlags, EXC_CHAREAFORMAT_AUTO, bAuto ); }
279 : : /** Sets the area format to the specified default type. */
280 : : void SetDefault( XclChFrameType eDefFrameType );
281 : :
282 : : /** Returns true, if the area format is set to automatic. */
283 : 0 : inline bool IsAuto() const { return ::get_flag( maData.mnFlags, EXC_CHAREAFORMAT_AUTO ); }
284 : : /** Returns true, if the area style is set to something visible. */
285 : 0 : inline bool HasArea() const { return maData.mnPattern != EXC_PATT_NONE; }
286 : : /** Returns true, if the area contains default formatting according to the passed frame type. */
287 : : bool IsDefault( XclChFrameType eDefFrameType ) const;
288 : :
289 : : private:
290 : : virtual void WriteBody( XclExpStream& rStrm );
291 : :
292 : : private:
293 : : XclChAreaFormat maData; /// Contents of the CHAREAFORMAT record.
294 : : sal_uInt32 mnPattColorId; /// Pattern color identifier.
295 : : sal_uInt32 mnBackColorId; /// Pattern background color identifier.
296 : : };
297 : :
298 : : typedef boost::shared_ptr< XclExpChAreaFormat > XclExpChAreaFormatRef;
299 : :
300 : : // ----------------------------------------------------------------------------
301 : :
302 [ # # ][ # # ]: 0 : class XclExpChEscherFormat : public XclExpChGroupBase
303 : : {
304 : : public:
305 : : explicit XclExpChEscherFormat( const XclExpChRoot& rRoot );
306 : :
307 : : /** Converts complex area formatting from the passed property set. */
308 : : void Convert( const ScfPropertySet& rPropSet, XclChObjectType eObjType );
309 : :
310 : : /** Returns true, if the object contains valid formatting data. */
311 : : bool IsValid() const;
312 : :
313 : : /** Writes the CHESCHERFORMAT record group to the stream, if complex formatting is extant. */
314 : : virtual void Save( XclExpStream& rStrm );
315 : : /** Returns true, if this record group contains a CHPICFORMAT record. */
316 : : virtual bool HasSubRecords() const;
317 : : /** Writes all embedded records. */
318 : : virtual void WriteSubRecords( XclExpStream& rStrm );
319 : :
320 : : private:
321 : : /** Inserts a color from the contained Escher property set into the color palette. */
322 : : sal_uInt32 RegisterColor( sal_uInt16 nPropId );
323 : :
324 : : virtual void WriteBody( XclExpStream& rStrm );
325 : :
326 : : private:
327 : : XclChEscherFormat maData; /// Fill properties for complex areas (CHESCHERFORMAT record).
328 : : XclChPicFormat maPicFmt; /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
329 : : sal_uInt32 mnColor1Id; /// First fill color identifier.
330 : : sal_uInt32 mnColor2Id; /// Second fill color identifier.
331 : : };
332 : :
333 : : typedef boost::shared_ptr< XclExpChEscherFormat > XclExpChEscherFormatRef;
334 : :
335 : : // ----------------------------------------------------------------------------
336 : :
337 : : /** Base class for record groups containing frame formatting.
338 : :
339 : : Frame formatting can be part of several record groups, e.g. CHFRAME,
340 : : CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
341 : : CHESCHERFORMAT group.
342 : : */
343 : : class XclExpChFrameBase
344 : : {
345 : : public:
346 : : explicit XclExpChFrameBase();
347 : : virtual ~XclExpChFrameBase();
348 : :
349 : : protected:
350 : : /** Converts frame formatting properties from the passed property set. */
351 : : void ConvertFrameBase( const XclExpChRoot& rRoot,
352 : : const ScfPropertySet& rPropSet, XclChObjectType eObjType );
353 : : /** Sets the frame formatting to the specified default type. */
354 : : void SetDefaultFrameBase( const XclExpChRoot& rRoot,
355 : : XclChFrameType eDefFrameType, bool bIsFrame );
356 : :
357 : : /** Returns true, if the frame contains default formatting (as if the frame is missing). */
358 : : bool IsDefaultFrameBase( XclChFrameType eDefFrameType ) const;
359 : :
360 : : /** Writes all contained frame records to the passed stream. */
361 : : void WriteFrameRecords( XclExpStream& rStrm );
362 : :
363 : : private:
364 : : XclExpChLineFormatRef mxLineFmt; /// Line format (CHLINEFORMAT record).
365 : : XclExpChAreaFormatRef mxAreaFmt; /// Area format (CHAREAFORMAT record).
366 : : XclExpChEscherFormatRef mxEscherFmt; /// Complex area format (CHESCHERFORMAT record).
367 : : };
368 : :
369 : : // ----------------------------------------------------------------------------
370 : :
371 : : /** Represents the CHFRAME record group containing object frame properties.
372 : :
373 : : The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
374 : : CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
375 : : */
376 [ # # ][ # # ]: 0 : class XclExpChFrame : public XclExpChGroupBase, public XclExpChFrameBase
377 : : {
378 : : public:
379 : : explicit XclExpChFrame( const XclExpChRoot& rRoot, XclChObjectType eObjType );
380 : :
381 : : /** Converts frame formatting properties from the passed property set. */
382 : : void Convert( const ScfPropertySet& rPropSet );
383 : : /** Sets the specified automatic flags. */
384 : : void SetAutoFlags( bool bAutoPos, bool bAutoSize );
385 : :
386 : : /** Returns true, if the frame object contains default formats. */
387 : : bool IsDefault() const;
388 : : /** Returns true, if the frame object can be deleted because it contains default formats. */
389 : : bool IsDeleteable() const;
390 : :
391 : : /** Writes the entire record group. */
392 : : virtual void Save( XclExpStream& rStrm );
393 : : /** Writes all embedded records. */
394 : : virtual void WriteSubRecords( XclExpStream& rStrm );
395 : :
396 : : private:
397 : : virtual void WriteBody( XclExpStream& rStrm );
398 : :
399 : : private:
400 : : XclChFrame maData; /// Contents of the CHFRAME record.
401 : : XclChObjectType meObjType; /// Type of the represented object.
402 : : };
403 : :
404 : : typedef boost::shared_ptr< XclExpChFrame > XclExpChFrameRef;
405 : :
406 : : // Source links ===============================================================
407 : :
408 [ # # ][ # # ]: 0 : class XclExpChSourceLink : public XclExpRecord, protected XclExpChRoot
[ # # ][ # # ]
409 : : {
410 : : public:
411 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > XDataSequenceRef;
412 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString > XFormattedStringRef;
413 : : typedef ::com::sun::star::uno::Sequence< XFormattedStringRef > XFormattedStringSeq;
414 : :
415 : : public:
416 : : explicit XclExpChSourceLink( const XclExpChRoot& rRoot, sal_uInt8 nDestType );
417 : :
418 : : /** Converts the passed source link, returns the number of linked values. */
419 : : sal_uInt16 ConvertDataSequence( XDataSequenceRef xDataSeq, bool bSplitToColumns, sal_uInt16 nDefCount = 0 );
420 : : /** Converts the passed sequence of formatted string objects, returns leading font index. */
421 : : sal_uInt16 ConvertStringSequence( const XFormattedStringSeq& rStringSeq );
422 : : /** Converts the number format from the passed property set. */
423 : : void ConvertNumFmt( const ScfPropertySet& rPropSet, bool bPercent );
424 : :
425 : : void AppendString( const String& rStr );
426 : :
427 : : /** Returns true, if this source link contains explicit string data. */
428 [ # # ][ # # ]: 0 : inline bool HasString() const { return mxString && !mxString->IsEmpty(); }
429 : :
430 : : /** Writes the CHSOURCELINK record and optionally a CHSTRING record with explicit string data. */
431 : : virtual void Save( XclExpStream& rStrm );
432 : :
433 : : private:
434 : : virtual void WriteBody( XclExpStream& rStrm );
435 : :
436 : : private:
437 : : XclChSourceLink maData; /// Contents of the CHSOURCELINK record.
438 : : XclTokenArrayRef mxLinkFmla; /// Formula with link to source data.
439 : : XclExpStringRef mxString; /// Text data (CHSTRING record).
440 : : };
441 : :
442 : : typedef boost::shared_ptr< XclExpChSourceLink > XclExpChSourceLinkRef;
443 : :
444 : : // Text =======================================================================
445 : :
446 : : /** The CHFONT record containing a font index for text objects. */
447 [ # # ]: 0 : class XclExpChFont : public XclExpUInt16Record
448 : : {
449 : : public:
450 : : explicit XclExpChFont( sal_uInt16 nFontIdx );
451 : : };
452 : :
453 : : typedef boost::shared_ptr< XclExpChFont > XclExpChFontRef;
454 : :
455 : : // ----------------------------------------------------------------------------
456 : :
457 : : /** The CHOBJECTLINK record linking a text object to a specific chart object. */
458 [ # # ]: 0 : class XclExpChObjectLink : public XclExpRecord
459 : : {
460 : : public:
461 : : explicit XclExpChObjectLink( sal_uInt16 nLinkTarget, const XclChDataPointPos& rPointPos );
462 : :
463 : : private:
464 : : virtual void WriteBody( XclExpStream& rStrm );
465 : :
466 : : private:
467 : : XclChObjectLink maData; /// Contents of the CHOBJECTLINK record.
468 : : };
469 : :
470 : : typedef boost::shared_ptr< XclExpChObjectLink > XclExpChObjectLinkRef;
471 : :
472 : : // ----------------------------------------------------------------------------
473 : :
474 : : /** Additional data label settings in the future record CHFRLABELPROPS. */
475 [ # # ]: 0 : class XclExpChFrLabelProps : public XclExpChFutureRecordBase
476 : : {
477 : : public:
478 : : explicit XclExpChFrLabelProps( const XclExpChRoot& rRoot );
479 : :
480 : : /** Converts separator and the passed data label flags. */
481 : : void Convert(
482 : : const ScfPropertySet& rPropSet, bool bShowSeries,
483 : : bool bShowCateg, bool bShowValue,
484 : : bool bShowPercent, bool bShowBubble );
485 : :
486 : : private:
487 : : virtual void WriteBody( XclExpStream& rStrm );
488 : :
489 : : private:
490 : : XclChFrLabelProps maData; /// Contents of the CHFRLABELPROPS record.
491 : : };
492 : :
493 : : typedef boost::shared_ptr< XclExpChFrLabelProps > XclExpChFrLabelPropsRef;
494 : :
495 : : // ----------------------------------------------------------------------------
496 : :
497 : : /** Base class for objects with font settings. Provides font conversion helper functions. */
498 : 0 : class XclExpChFontBase
499 : : {
500 : : public:
501 : : virtual ~XclExpChFontBase();
502 : :
503 : : /** Derived classes set font color and color identifier to internal data structures. */
504 : : virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId ) = 0;
505 : : /** Derived classes set text rotation to internal data structures. */
506 : : virtual void SetRotation( sal_uInt16 nRotation ) = 0;
507 : :
508 : : /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
509 : : void ConvertFontBase( const XclExpChRoot& rRoot, sal_uInt16 nFontIdx );
510 : : /** Creates a CHFONT record from the passed font index, calls virtual function SetFont(). */
511 : : void ConvertFontBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet );
512 : : /** Converts rotation settings, calls virtual function SetRotation(). */
513 : : void ConvertRotationBase( const XclExpChRoot& rRoot, const ScfPropertySet& rPropSet, bool bSupportsStacked );
514 : : };
515 : :
516 : : // ----------------------------------------------------------------------------
517 : :
518 : : /** Represents the CHTEXT record group containing text object properties.
519 : :
520 : : The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
521 : : CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
522 : : */
523 [ # # ][ # # ]: 0 : class XclExpChText : public XclExpChGroupBase, public XclExpChFontBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
524 : : {
525 : : public:
526 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > XTitleRef;
527 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > XRegressionCurveRef;
528 : :
529 : : public:
530 : : explicit XclExpChText( const XclExpChRoot& rRoot );
531 : :
532 : : /** Sets font color and color identifier to internal data structures. */
533 : : virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId );
534 : : /** Sets text rotation to internal data structures. */
535 : : virtual void SetRotation( sal_uInt16 nRotation );
536 : :
537 : : /** Converts all text settings of the passed title text object. */
538 : : void ConvertTitle( XTitleRef xTitle, sal_uInt16 nTarget, const String* pSubTitle = NULL );
539 : : /** Converts all text settings of the passed legend. */
540 : : void ConvertLegend( const ScfPropertySet& rPropSet );
541 : : /** Converts all settings of the passed data point caption text object. */
542 : : bool ConvertDataLabel( const ScfPropertySet& rPropSet,
543 : : const XclChTypeInfo& rTypeInfo, const XclChDataPointPos& rPointPos );
544 : : /** Converts all settings of the passed trend line equation box. */
545 : : void ConvertTrendLineEquation( const ScfPropertySet& rPropSet, const XclChDataPointPos& rPointPos );
546 : :
547 : : /** Returns true, if the string object does not contain any text data. */
548 [ # # ][ # # ]: 0 : inline bool HasString() const { return mxSrcLink && mxSrcLink->HasString(); }
549 : : /** Returns the flags needed for the CHATTACHEDLABEL record. */
550 : : sal_uInt16 GetAttLabelFlags() const;
551 : :
552 : : /** Writes all embedded records. */
553 : : virtual void WriteSubRecords( XclExpStream& rStrm );
554 : :
555 : : private:
556 : : virtual void WriteBody( XclExpStream& rStrm );
557 : :
558 : : private:
559 : : XclChText maData; /// Contents of the CHTEXT record.
560 : : XclExpChFramePosRef mxFramePos; /// Relative text frame position (CHFRAMEPOS record).
561 : : XclExpChSourceLinkRef mxSrcLink; /// Linked data (CHSOURCELINK with CHSTRING record).
562 : : XclExpChFrameRef mxFrame; /// Text object frame properties (CHFRAME group).
563 : : XclExpChFontRef mxFont; /// Index into font buffer (CHFONT record).
564 : : XclExpChObjectLinkRef mxObjLink; /// Link target for this text object.
565 : : XclExpChFrLabelPropsRef mxLabelProps; /// Extended data label properties (CHFRLABELPROPS record).
566 : : sal_uInt32 mnTextColorId; /// Text color identifier.
567 : : };
568 : :
569 : : typedef boost::shared_ptr< XclExpChText > XclExpChTextRef;
570 : :
571 : : // Data series ================================================================
572 : :
573 : : /** The CHMARKERFORMAT record containing data point marker formatting data. */
574 [ # # ]: 0 : class XclExpChMarkerFormat : public XclExpRecord
575 : : {
576 : : public:
577 : : explicit XclExpChMarkerFormat( const XclExpChRoot& rRoot );
578 : :
579 : : /** Converts symbol properties from the passed property set. */
580 : : void Convert( const XclExpChRoot& rRoot,
581 : : const ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx );
582 : : /** Converts symbol properties for stock charts from the passed property set. */
583 : : void ConvertStockSymbol( const XclExpChRoot& rRoot,
584 : : const ScfPropertySet& rPropSet, bool bCloseSymbol );
585 : :
586 : : /** Returns true, if markers are enabled. */
587 : 0 : inline bool HasMarker() const { return maData.mnMarkerType != EXC_CHMARKERFORMAT_NOSYMBOL; }
588 : : /** Returns true, if border line of markers is visible. */
589 : 0 : inline bool HasLineColor() const { return !::get_flag( maData.mnFlags, EXC_CHMARKERFORMAT_NOLINE ); }
590 : : /** Returns true, if fill area of markers is visible. */
591 : 0 : inline bool HasFillColor() const { return !::get_flag( maData.mnFlags, EXC_CHMARKERFORMAT_NOFILL ); }
592 : :
593 : : private:
594 : : /** Registers marker colors in palette and stores color identifiers. */
595 : : void RegisterColors( const XclExpChRoot& rRoot );
596 : :
597 : : virtual void WriteBody( XclExpStream& rStrm );
598 : :
599 : : private:
600 : : XclChMarkerFormat maData; /// Contents of the CHMARKERFORMAT record.
601 : : sal_uInt32 mnLineColorId; /// Border line color identifier.
602 : : sal_uInt32 mnFillColorId; /// Fill color identifier.
603 : : };
604 : :
605 : : typedef boost::shared_ptr< XclExpChMarkerFormat > XclExpChMarkerFormatRef;
606 : :
607 : : // ----------------------------------------------------------------------------
608 : :
609 : : /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
610 [ # # ]: 0 : class XclExpChPieFormat : public XclExpUInt16Record
611 : : {
612 : : public:
613 : : explicit XclExpChPieFormat();
614 : :
615 : : /** Sets pie segment properties from the passed property set. */
616 : : void Convert( const ScfPropertySet& rPropSet );
617 : : };
618 : :
619 : : typedef boost::shared_ptr< XclExpChPieFormat > XclExpChPieFormatRef;
620 : :
621 : : // ----------------------------------------------------------------------------
622 : :
623 : : /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
624 [ # # ]: 0 : class XclExpCh3dDataFormat : public XclExpRecord
625 : : {
626 : : public:
627 : : explicit XclExpCh3dDataFormat();
628 : :
629 : : /** Sets 3d bar properties from the passed property set. */
630 : : void Convert( const ScfPropertySet& rPropSet );
631 : :
632 : : private:
633 : : virtual void WriteBody( XclExpStream& rStrm );
634 : :
635 : : private:
636 : : XclCh3dDataFormat maData; /// Contents of the CH3DDATAFORMAT record.
637 : : };
638 : :
639 : : typedef boost::shared_ptr< XclExpCh3dDataFormat > XclExpCh3dDataFormatRef;
640 : :
641 : : // ----------------------------------------------------------------------------
642 : :
643 : : /** The CHATTACHEDLABEL record that contains the type of a data point label. */
644 [ # # ]: 0 : class XclExpChAttachedLabel : public XclExpUInt16Record
645 : : {
646 : : public:
647 : : explicit XclExpChAttachedLabel( sal_uInt16 nFlags );
648 : : };
649 : :
650 : : typedef boost::shared_ptr< XclExpChAttachedLabel > XclExpChAttLabelRef;
651 : :
652 : : // ----------------------------------------------------------------------------
653 : :
654 : : /** Represents the CHDATAFORMAT record group containing data point properties.
655 : :
656 : : The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
657 : : CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
658 : : CHATTACHEDLABEL, CHEND.
659 : : */
660 [ # # ][ # # ]: 0 : class XclExpChDataFormat : public XclExpChGroupBase, public XclExpChFrameBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
661 : : {
662 : : public:
663 : : explicit XclExpChDataFormat( const XclExpChRoot& rRoot,
664 : : const XclChDataPointPos& rPointPos, sal_uInt16 nFormatIdx );
665 : :
666 : : /** Converts the passed data series or data point formatting. */
667 : : void ConvertDataSeries( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo );
668 : : /** Sets default formatting for a series in a stock chart. */
669 : : void ConvertStockSeries( const ScfPropertySet& rPropSet, bool bCloseSymbol );
670 : : /** Converts line formatting for the specified object (e.g. trend lines, error bars). */
671 : : void ConvertLine( const ScfPropertySet& rPropSet, XclChObjectType eObjType );
672 : :
673 : : /** Returns true, if this objects describes the formatting of an entire series. */
674 : 0 : inline bool IsSeriesFormat() const { return maData.maPointPos.mnPointIdx == EXC_CHDATAFORMAT_ALLPOINTS; }
675 : :
676 : : /** Writes all embedded records. */
677 : : virtual void WriteSubRecords( XclExpStream& rStrm );
678 : :
679 : : private:
680 : : virtual void WriteBody( XclExpStream& rStrm );
681 : :
682 : : private:
683 : : XclChDataFormat maData; /// Contents of the CHDATAFORMAT record.
684 : : XclExpChMarkerFormatRef mxMarkerFmt; /// Data point marker (CHMARKERFORMAT record).
685 : : XclExpChPieFormatRef mxPieFmt; /// Pie segment format (CHPIEFORMAT record).
686 : : XclExpRecordRef mxSeriesFmt; /// Series properties (CHSERIESFORMAT record).
687 : : XclExpCh3dDataFormatRef mx3dDataFmt; /// 3D bar format (CH3DDATAFORMAT record).
688 : : XclExpChAttLabelRef mxAttLabel; /// Data point label type (CHATTACHEDLABEL record).
689 : : };
690 : :
691 : : typedef boost::shared_ptr< XclExpChDataFormat > XclExpChDataFormatRef;
692 : :
693 : : // ----------------------------------------------------------------------------
694 : :
695 : : /** Represents the CHSERTRENDLINE record containing settings for a trend line. */
696 [ # # ][ # # ]: 0 : class XclExpChSerTrendLine : public XclExpRecord, protected XclExpChRoot
[ # # ][ # # ]
697 : : {
698 : : public:
699 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > XRegressionCurveRef;
700 : :
701 : : public:
702 : : explicit XclExpChSerTrendLine( const XclExpChRoot& rRoot );
703 : :
704 : : /** Converts the passed trend line, returns true if trend line type is supported. */
705 : : bool Convert( XRegressionCurveRef xRegCurve, sal_uInt16 nSeriesIdx );
706 : :
707 : : /** Returns formatting information of the trend line, created in Convert(). */
708 : 0 : inline XclExpChDataFormatRef GetDataFormat() const { return mxDataFmt; }
709 : : /** Returns formatting of the equation text box, created in Convert(). */
710 : 0 : inline XclExpChTextRef GetDataLabel() const { return mxLabel; }
711 : :
712 : : private:
713 : : virtual void WriteBody( XclExpStream& rStrm );
714 : :
715 : : private:
716 : : XclChSerTrendLine maData; /// Contents of the CHSERTRENDLINE record.
717 : : XclExpChDataFormatRef mxDataFmt; /// Formatting settings of the trend line.
718 : : XclExpChTextRef mxLabel; /// Formatting of the equation text box.
719 : : };
720 : :
721 : : typedef boost::shared_ptr< XclExpChSerTrendLine > XclExpChSerTrendLineRef;
722 : :
723 : : // ----------------------------------------------------------------------------
724 : :
725 : : /** Represents the CHSERERRORBAR record containing settings for error bars. */
726 [ # # ][ # # ]: 0 : class XclExpChSerErrorBar : public XclExpRecord, protected XclExpChRoot
727 : : {
728 : : public:
729 : : explicit XclExpChSerErrorBar( const XclExpChRoot& rRoot, sal_uInt8 nBarType );
730 : :
731 : : /** Converts the passed error bar settings, returns true if error bar type is supported. */
732 : : bool Convert( XclExpChSourceLink& rValueLink, sal_uInt16& rnValueCount, const ScfPropertySet& rPropSet );
733 : :
734 : : private:
735 : : virtual void WriteBody( XclExpStream& rStrm );
736 : :
737 : : private:
738 : : XclChSerErrorBar maData; /// Contents of the CHSERERRORBAR record.
739 : : };
740 : :
741 : : typedef boost::shared_ptr< XclExpChSerErrorBar > XclExpChSerErrorBarRef;
742 : :
743 : : // ----------------------------------------------------------------------------
744 : :
745 : : /** Represents the CHSERIES record group describing a data series in a chart.
746 : :
747 : : The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
748 : : CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
749 : : CHSERTRENDLINE, CHEND.
750 : : */
751 [ # # ][ # # ]: 0 : class XclExpChSeries : public XclExpChGroupBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
752 : : {
753 : : public:
754 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
755 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > XDataSeriesRef;
756 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > XLabeledDataSeqRef;
757 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > XRegressionCurveRef;
758 : :
759 : : public:
760 : : explicit XclExpChSeries( const XclExpChRoot& rRoot, sal_uInt16 nSeriesIdx );
761 : :
762 : : /** Converts the passed data series (source links and formatting). */
763 : : bool ConvertDataSeries(
764 : : XDiagramRef xDiagram, XDataSeriesRef xDataSeries,
765 : : const XclChExtTypeInfo& rTypeInfo,
766 : : sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx );
767 : : /** Converts the passed data series for stock charts. */
768 : : bool ConvertStockSeries(
769 : : XDataSeriesRef xDataSeries,
770 : : const ::rtl::OUString& rValueRole,
771 : : sal_uInt16 nGroupIdx, sal_uInt16 nFormatIdx, bool bCloseSymbol );
772 : : /** Converts the passed error bar settings (called at trend line child series). */
773 : : bool ConvertTrendLine( const XclExpChSeries& rParent, XRegressionCurveRef xRegCurve );
774 : : /** Converts the passed error bar settings (called at error bar child series). */
775 : : bool ConvertErrorBar( const XclExpChSeries& rParent, const ScfPropertySet& rPropSet, sal_uInt8 nBarId );
776 : : /** Converts and inserts category ranges for all inserted series. */
777 : : void ConvertCategSequence( XLabeledDataSeqRef xCategSeq );
778 : :
779 : : /** Writes all embedded records. */
780 : : virtual void WriteSubRecords( XclExpStream& rStrm );
781 : :
782 : : private:
783 : : /** Initializes members of this series to represent a child of the passed series. */
784 : : void InitFromParent( const XclExpChSeries& rParent );
785 : : /** Tries to create trend line series objects (called at parent series). */
786 : : void CreateTrendLines( XDataSeriesRef xDataSeries );
787 : : /** Tries to create positive and negative error bar series objects (called at parent series). */
788 : : void CreateErrorBars( const ScfPropertySet& rPropSet,
789 : : const ::rtl::OUString& rBarPropName,
790 : : sal_uInt8 nPosBarId, sal_uInt8 nNegBarId );
791 : : /** Tries to create an error bar series object (called at parent series). */
792 : : void CreateErrorBar( const ScfPropertySet& rPropSet,
793 : : const ::rtl::OUString& rShowPropName, sal_uInt8 nBarId );
794 : :
795 : : virtual void WriteBody( XclExpStream& rStrm );
796 : :
797 : : private:
798 : : typedef XclExpRecordList< XclExpChDataFormat > XclExpChDataFormatList;
799 : :
800 : : private:
801 : : XclChSeries maData; /// Contents of the CHSERIES record.
802 : : XclExpChSourceLinkRef mxTitleLink; /// Link data for series title.
803 : : XclExpChSourceLinkRef mxValueLink; /// Link data for series values.
804 : : XclExpChSourceLinkRef mxCategLink; /// Link data for series category names.
805 : : XclExpChSourceLinkRef mxBubbleLink; /// Link data for series bubble sizes.
806 : : XclExpChDataFormatRef mxSeriesFmt; /// CHDATAFORMAT group for series format.
807 : : XclExpChDataFormatList maPointFmts; /// CHDATAFORMAT groups for data point formats.
808 : : XclExpChSerTrendLineRef mxTrendLine; /// Trend line settings (CHSERTRENDLINE record).
809 : : XclExpChSerErrorBarRef mxErrorBar; /// Error bar settings (CHSERERRORBAR record).
810 : : sal_uInt16 mnGroupIdx; /// Chart type group (CHTYPEGROUP group) this series is assigned to.
811 : : sal_uInt16 mnSeriesIdx; /// 0-based series index.
812 : : sal_uInt16 mnParentIdx; /// 0-based index of parent series (trend lines and error bars).
813 : : };
814 : :
815 : : typedef boost::shared_ptr< XclExpChSeries > XclExpChSeriesRef;
816 : :
817 : : // Chart type groups ==========================================================
818 : :
819 : : /** Represents the chart type record for all supported chart types. */
820 [ # # ][ # # ]: 0 : class XclExpChType : public XclExpRecord, protected XclExpChRoot
821 : : {
822 : : public:
823 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
824 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > XChartTypeRef;
825 : :
826 : : public:
827 : : explicit XclExpChType( const XclExpChRoot& rRoot );
828 : :
829 : : /** Converts the passed chart type and the contained data series. */
830 : : void Convert( XDiagramRef xDiagram, XChartTypeRef xChartType,
831 : : sal_Int32 nApiAxesSetIdx, bool bSwappedAxesSet, bool bHasXLabels );
832 : : /** Sets stacking mode (standard or percent) for the series in this chart type group. */
833 : : void SetStacked( bool bPercent );
834 : :
835 : : /** Returns true, if this is object represents a valid chart type. */
836 : 0 : inline bool IsValidType() const { return maTypeInfo.meTypeId != EXC_CHTYPEID_UNKNOWN; }
837 : : /** Returns the chart type info struct for the contained chart type. */
838 : 0 : inline const XclChTypeInfo& GetTypeInfo() const { return maTypeInfo; }
839 : :
840 : : private:
841 : : virtual void WriteBody( XclExpStream& rStrm );
842 : :
843 : : private:
844 : : XclChType maData; /// Contents of the chart type record.
845 : : XclChTypeInfo maTypeInfo; /// Chart type info for the contained type.
846 : : };
847 : :
848 : : // ----------------------------------------------------------------------------
849 : :
850 : : /** Represents the CHCHART3D record that contains 3D view settings. */
851 [ # # ]: 0 : class XclExpChChart3d : public XclExpRecord
852 : : {
853 : : public:
854 : : explicit XclExpChChart3d();
855 : :
856 : : /** Converts 3d settings for the passed chart type. */
857 : : void Convert( const ScfPropertySet& rPropSet, bool b3dWallChart );
858 : : /** Sets flag that the data points are clustered on the X axis. */
859 : 0 : inline void SetClustered() { ::set_flag( maData.mnFlags, EXC_CHCHART3D_CLUSTER ); }
860 : :
861 : : /** Returns true, if the data points are clustered on the X axis. */
862 : 0 : inline bool IsClustered() const { return ::get_flag( maData.mnFlags, EXC_CHCHART3D_CLUSTER ); }
863 : :
864 : : private:
865 : : virtual void WriteBody( XclExpStream& rStrm );
866 : :
867 : : private:
868 : : XclChChart3d maData; /// Contents of the CHCHART3D record.
869 : : };
870 : :
871 : : typedef boost::shared_ptr< XclExpChChart3d > XclExpChChart3dRef;
872 : :
873 : : // ----------------------------------------------------------------------------
874 : :
875 : : /** Represents the CHLEGEND record group describing the chart legend.
876 : :
877 : : The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME
878 : : group, CHTEXT group, CHEND.
879 : : */
880 [ # # ][ # # ]: 0 : class XclExpChLegend : public XclExpChGroupBase
[ # # ][ # # ]
881 : : {
882 : : public:
883 : : explicit XclExpChLegend( const XclExpChRoot& rRoot );
884 : :
885 : : /** Converts all legend settings from the passed property set. */
886 : : void Convert( const ScfPropertySet& rPropSet );
887 : :
888 : : /** Writes all embedded records. */
889 : : virtual void WriteSubRecords( XclExpStream& rStrm );
890 : :
891 : : private:
892 : : virtual void WriteBody( XclExpStream& rStrm );
893 : :
894 : : private:
895 : : XclChLegend maData; /// Contents of the CHLEGEND record.
896 : : XclExpChFramePosRef mxFramePos; /// Legend frame position (CHFRAMEPOS record).
897 : : XclExpChTextRef mxText; /// Legend text format (CHTEXT group).
898 : : XclExpChFrameRef mxFrame; /// Legend frame format (CHFRAME group).
899 : : };
900 : :
901 : : typedef boost::shared_ptr< XclExpChLegend > XclExpChLegendRef;
902 : :
903 : : // ----------------------------------------------------------------------------
904 : :
905 : : /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
906 : :
907 : : The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
908 : : CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
909 : : */
910 [ # # ][ # # ]: 0 : class XclExpChDropBar : public XclExpChGroupBase, public XclExpChFrameBase
911 : : {
912 : : public:
913 : : explicit XclExpChDropBar( const XclExpChRoot& rRoot, XclChObjectType eObjType );
914 : :
915 : : /** Converts and writes the contained frame data to the passed property set. */
916 : : void Convert( const ScfPropertySet& rPropSet );
917 : :
918 : : /** Writes all embedded records. */
919 : : virtual void WriteSubRecords( XclExpStream& rStrm );
920 : :
921 : : private:
922 : : virtual void WriteBody( XclExpStream& rStrm );
923 : :
924 : : private:
925 : : XclChObjectType meObjType; /// Type of the dropbar.
926 : : sal_uInt16 mnBarDist; /// Distance between bars (CHDROPBAR record).
927 : : };
928 : :
929 : : typedef boost::shared_ptr< XclExpChDropBar > XclExpChDropBarRef;
930 : :
931 : : // ----------------------------------------------------------------------------
932 : :
933 : : /** Represents the CHTYPEGROUP record group describing a group of series.
934 : :
935 : : The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
936 : : record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
937 : : CHDROPBAR groups, CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT),
938 : : CHDATAFORMAT group, CHEND.
939 : : */
940 [ # # ][ # # ]: 0 : class XclExpChTypeGroup : public XclExpChGroupBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
941 : : {
942 : : public:
943 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
944 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > XChartTypeRef;
945 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > XDataSeriesRef;
946 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > XLabeledDataSeqRef;
947 : :
948 : : public:
949 : : explicit XclExpChTypeGroup( const XclExpChRoot& rRoot, sal_uInt16 nGroupIdx );
950 : :
951 : : /** Converts the passed chart type to Excel type settings. */
952 : : void ConvertType( XDiagramRef xDiagram, XChartTypeRef xChartType,
953 : : sal_Int32 nApiAxesSetIdx, bool b3dChart, bool bSwappedAxesSet, bool bHasXLabels );
954 : : /** Converts and inserts all series from the passed chart type. */
955 : : void ConvertSeries( XDiagramRef xDiagram, XChartTypeRef xChartType,
956 : : sal_Int32 nGroupAxesSetIdx, bool bPercent, bool bConnectorLines );
957 : : /** Converts and inserts category ranges for all inserted series. */
958 : : void ConvertCategSequence( XLabeledDataSeqRef xCategSeq );
959 : : /** Creates a legend object and converts all legend settings. */
960 : : void ConvertLegend( const ScfPropertySet& rPropSet );
961 : :
962 : : /** Returns true, if this chart type group contains at least one valid series. */
963 [ # # ][ # # ]: 0 : inline bool IsValidGroup() const { return !maSeries.IsEmpty() && maType.IsValidType(); }
964 : : /** Returns the index of this chart type group format. */
965 : 0 : inline sal_uInt16 GetGroupIdx() const { return maData.mnGroupIdx; }
966 : : /** Returns the chart type info struct for the contained chart type. */
967 : 0 : inline const XclChExtTypeInfo& GetTypeInfo() const { return maTypeInfo; }
968 : : /** Returns true, if the chart is three-dimensional. */
969 : 0 : inline bool Is3dChart() const { return maTypeInfo.mb3dChart; }
970 : : /** Returns true, if chart type supports wall and floor format. */
971 [ # # ][ # # ]: 0 : inline bool Is3dWallChart() const { return Is3dChart() && (maTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE); }
972 : : /** Returns true, if the series in this chart type group are ordered on the Z axis. */
973 [ # # ][ # # ]: 0 : inline bool Is3dDeepChart() const { return Is3dWallChart() && mxChart3d && !mxChart3d->IsClustered(); }
[ # # ]
974 : : /** Returns true, if this chart type can be combined with other types. */
975 [ # # ][ # # ]: 0 : inline bool IsCombinable2d() const { return !Is3dChart() && maTypeInfo.mbCombinable2d; }
976 : :
977 : : /** Writes all embedded records. */
978 : : virtual void WriteSubRecords( XclExpStream& rStrm );
979 : :
980 : : private:
981 : : /** Returns an unused format index to be used for the next created series. */
982 : : sal_uInt16 GetFreeFormatIdx() const;
983 : : /** Creates all data series of any chart type except stock charts. */
984 : : void CreateDataSeries( XDiagramRef xDiagram,
985 : : XDataSeriesRef xDataSeries );
986 : : /** Creates all data series of a stock chart. */
987 : : void CreateAllStockSeries( XChartTypeRef xChartType,
988 : : XDataSeriesRef xDataSeries );
989 : : /** Creates a single data series of a stock chart. */
990 : : bool CreateStockSeries( XDataSeriesRef xDataSeries,
991 : : const ::rtl::OUString& rValueRole, bool bCloseSymbol );
992 : :
993 : : virtual void WriteBody( XclExpStream& rStrm );
994 : :
995 : : private:
996 : : typedef XclExpRecordList< XclExpChSeries > XclExpChSeriesList;
997 : : typedef ::boost::ptr_map<sal_uInt16, XclExpChLineFormat> XclExpChLineFormatMap;
998 : :
999 : : XclChTypeGroup maData; /// Contents of the CHTYPEGROUP record.
1000 : : XclExpChType maType; /// Chart type (e.g. CHBAR, CHLINE, ...).
1001 : : XclChExtTypeInfo maTypeInfo; /// Extended chart type info.
1002 : : XclExpChSeriesList maSeries; /// List of series data (CHSERIES groups).
1003 : : XclExpChChart3dRef mxChart3d; /// 3D settings (CHCHART3D record).
1004 : : XclExpChLegendRef mxLegend; /// Chart legend (CHLEGEND group).
1005 : : XclExpChDropBarRef mxUpBar; /// White dropbars (CHDROPBAR group).
1006 : : XclExpChDropBarRef mxDownBar; /// Black dropbars (CHDROPBAR group).
1007 : : XclExpChLineFormatMap maChartLines; /// Global line formats (CHCHARTLINE group).
1008 : : };
1009 : :
1010 : : typedef boost::shared_ptr< XclExpChTypeGroup > XclExpChTypeGroupRef;
1011 : :
1012 : : // Axes =======================================================================
1013 : :
1014 [ # # ][ # # ]: 0 : class XclExpChLabelRange : public XclExpRecord, protected XclExpChRoot
1015 : : {
1016 : : public:
1017 : : explicit XclExpChLabelRange( const XclExpChRoot& rRoot );
1018 : :
1019 : : /** Converts category axis scaling settings. */
1020 : : void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData,
1021 : : const ScfPropertySet& rChart1Axis, bool bMirrorOrient );
1022 : : /** Converts position settings of a crossing axis at this axis. */
1023 : : void ConvertAxisPosition( const ScfPropertySet& rPropSet );
1024 : : /** Sets flag for tickmark position between categories or on categories. */
1025 : 0 : inline void SetTicksBetweenCateg( bool bTicksBetween )
1026 : 0 : { ::set_flag( maLabelData.mnFlags, EXC_CHLABELRANGE_BETWEEN, bTicksBetween ); }
1027 : :
1028 : : private:
1029 : : virtual void Save( XclExpStream& rStrm );
1030 : : virtual void WriteBody( XclExpStream& rStrm );
1031 : :
1032 : : private:
1033 : : XclChLabelRange maLabelData; /// Contents of the CHLABELRANGE record.
1034 : : XclChDateRange maDateData; /// Contents of the CHDATERANGE record.
1035 : : };
1036 : :
1037 : : typedef boost::shared_ptr< XclExpChLabelRange > XclExpChLabelRangeRef;
1038 : :
1039 : : // ----------------------------------------------------------------------------
1040 : :
1041 [ # # ][ # # ]: 0 : class XclExpChValueRange : public XclExpRecord, protected XclExpChRoot
1042 : : {
1043 : : public:
1044 : : explicit XclExpChValueRange( const XclExpChRoot& rRoot );
1045 : :
1046 : : /** Converts value axis scaling settings. */
1047 : : void Convert( const ::com::sun::star::chart2::ScaleData& rScaleData );
1048 : : /** Converts position settings of a crossing axis at this axis. */
1049 : : void ConvertAxisPosition( const ScfPropertySet& rPropSet );
1050 : :
1051 : : private:
1052 : : virtual void WriteBody( XclExpStream& rStrm );
1053 : :
1054 : : private:
1055 : : XclChValueRange maData; /// Contents of the CHVALUERANGE record.
1056 : : };
1057 : :
1058 : : typedef boost::shared_ptr< XclExpChValueRange > XclExpChValueRangeRef;
1059 : :
1060 : : // ----------------------------------------------------------------------------
1061 : :
1062 [ # # ][ # # ]: 0 : class XclExpChTick : public XclExpRecord, protected XclExpChRoot
1063 : : {
1064 : : public:
1065 : : explicit XclExpChTick( const XclExpChRoot& rRoot );
1066 : :
1067 : : /** Converts axis tick mark settings. */
1068 : : void Convert( const ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo, sal_uInt16 nAxisType );
1069 : : /** Sets font color and color identifier to internal data structures. */
1070 : : void SetFontColor( const Color& rColor, sal_uInt32 nColorId );
1071 : : /** Sets text rotation to internal data structures. */
1072 : : void SetRotation( sal_uInt16 nRotation );
1073 : :
1074 : : private:
1075 : : virtual void WriteBody( XclExpStream& rStrm );
1076 : :
1077 : : private:
1078 : : XclChTick maData; /// Contents of the CHTICK record.
1079 : : sal_uInt32 mnTextColorId; /// Axis labels text color identifier.
1080 : : };
1081 : :
1082 : : typedef boost::shared_ptr< XclExpChTick > XclExpChTickRef;
1083 : :
1084 : : // ----------------------------------------------------------------------------
1085 : :
1086 : : /** Represents the CHAXIS record group describing an entire chart axis.
1087 : :
1088 : : The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
1089 : : CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
1090 : : CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
1091 : : */
1092 [ # # ][ # # ]: 0 : class XclExpChAxis : public XclExpChGroupBase, public XclExpChFontBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1093 : : {
1094 : : public:
1095 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
1096 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > XAxisRef;
1097 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxis > XChart1AxisRef;
1098 : :
1099 : : public:
1100 : : explicit XclExpChAxis( const XclExpChRoot& rRoot, sal_uInt16 nAxisType );
1101 : :
1102 : : /** Sets font color and color identifier to internal data structures. */
1103 : : virtual void SetFont( XclExpChFontRef xFont, const Color& rColor, sal_uInt32 nColorId );
1104 : : /** Sets text rotation to internal data structures. */
1105 : : virtual void SetRotation( sal_uInt16 nRotation );
1106 : :
1107 : : /** Converts formatting and scaling settings from the passed axis. */
1108 : : void Convert( XAxisRef xAxis, XAxisRef xCrossingAxis,
1109 : : XChart1AxisRef xChart1Axis, const XclChExtTypeInfo& rTypeInfo );
1110 : : /** Converts and writes 3D wall/floor properties from the passed diagram. */
1111 : : void ConvertWall( XDiagramRef xDiagram );
1112 : :
1113 : : /** Returns the type of this axis. */
1114 : 0 : inline sal_uInt16 GetAxisType() const { return maData.mnType; }
1115 : : /** Returns the axis dimension index used by the chart API. */
1116 : 0 : inline sal_Int32 GetApiAxisDimension() const { return maData.GetApiAxisDimension(); }
1117 : :
1118 : : /** Writes all embedded records. */
1119 : : virtual void WriteSubRecords( XclExpStream& rStrm );
1120 : :
1121 : : private:
1122 : : virtual void WriteBody( XclExpStream& rStrm );
1123 : :
1124 : : private:
1125 : : XclChAxis maData; /// Contents of the CHAXIS record.
1126 : : XclExpChLabelRangeRef mxLabelRange; /// Category scaling (CHLABELRANGE record).
1127 : : XclExpChValueRangeRef mxValueRange; /// Value scaling (CHVALUERANGE record).
1128 : : XclExpChTickRef mxTick; /// Axis ticks (CHTICK record).
1129 : : XclExpChFontRef mxFont; /// Index into font buffer (CHFONT record).
1130 : : XclExpChLineFormatRef mxAxisLine; /// Axis line format (CHLINEFORMAT record).
1131 : : XclExpChLineFormatRef mxMajorGrid; /// Major grid line format (CHLINEFORMAT record).
1132 : : XclExpChLineFormatRef mxMinorGrid; /// Minor grid line format (CHLINEFORMAT record).
1133 : : XclExpChFrameRef mxWallFrame; /// Wall/floor format (sub records of CHFRAME group).
1134 : : sal_uInt16 mnNumFmtIdx; /// Index into number format buffer (CHFORMAT record).
1135 : : };
1136 : :
1137 : : typedef boost::shared_ptr< XclExpChAxis > XclExpChAxisRef;
1138 : :
1139 : : // ----------------------------------------------------------------------------
1140 : :
1141 : : /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
1142 : :
1143 : : The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
1144 : : groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
1145 : : CHTYPEGROUP group, CHEND.
1146 : : */
1147 [ # # ][ # # ]: 0 : class XclExpChAxesSet : public XclExpChGroupBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1148 : : {
1149 : : public:
1150 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > XDiagramRef;
1151 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > XCoordSystemRef;
1152 : :
1153 : : public:
1154 : : explicit XclExpChAxesSet( const XclExpChRoot& rRoot, sal_uInt16 nAxesSetId );
1155 : :
1156 : : /** Converts the passed diagram to chart record data.
1157 : : @return First unused chart type group index. */
1158 : : sal_uInt16 Convert( XDiagramRef xDiagram, sal_uInt16 nFirstGroupIdx );
1159 : :
1160 : : /** Returns true, if this axes set exists (returns false if this is a dummy object). */
1161 : 0 : inline bool IsValidAxesSet() const { return !maTypeGroups.IsEmpty(); }
1162 : : /** Returns the index of the axes set (primary/secondary). */
1163 : 0 : inline sal_uInt16 GetAxesSetId() const { return maData.mnAxesSetId; }
1164 : : /** Returns the axes set index used by the chart API. */
1165 : 0 : inline sal_Int32 GetApiAxesSetIndex() const { return maData.GetApiAxesSetIndex(); }
1166 : : /** Returns true, if the chart is three-dimensional. */
1167 : : bool Is3dChart() const;
1168 : :
1169 : : /** Writes all embedded records. */
1170 : : virtual void WriteSubRecords( XclExpStream& rStrm );
1171 : :
1172 : : private:
1173 : : /** Returns first inserted chart type group. */
1174 : : XclExpChTypeGroupRef GetFirstTypeGroup() const;
1175 : : /** Returns last inserted chart type group. */
1176 : : XclExpChTypeGroupRef GetLastTypeGroup() const;
1177 : :
1178 : : /** Converts a complete axis object including axis title. */
1179 : : void ConvertAxis( XclExpChAxisRef& rxChAxis, sal_uInt16 nAxisType,
1180 : : XclExpChTextRef& rxChAxisTitle, sal_uInt16 nTitleTarget,
1181 : : XCoordSystemRef xCoordSystem, const XclChExtTypeInfo& rTypeInfo,
1182 : : sal_Int32 nCrossingAxisDim );
1183 : :
1184 : : virtual void WriteBody( XclExpStream& rStrm );
1185 : :
1186 : : private:
1187 : : typedef XclExpRecordList< XclExpChTypeGroup > XclExpChTypeGroupList;
1188 : :
1189 : : XclChAxesSet maData; /// Contents of the CHAXESSET record.
1190 : : XclExpChFramePosRef mxFramePos; /// Outer plot area position (CHFRAMEPOS record).
1191 : : XclExpChAxisRef mxXAxis; /// The X axis (CHAXIS group).
1192 : : XclExpChAxisRef mxYAxis; /// The Y axis (CHAXIS group).
1193 : : XclExpChAxisRef mxZAxis; /// The Z axis (CHAXIS group).
1194 : : XclExpChTextRef mxXAxisTitle; /// The X axis title (CHTEXT group).
1195 : : XclExpChTextRef mxYAxisTitle; /// The Y axis title (CHTEXT group).
1196 : : XclExpChTextRef mxZAxisTitle; /// The Z axis title (CHTEXT group).
1197 : : XclExpChFrameRef mxPlotFrame; /// Plot area (CHPLOTFRAME group).
1198 : : XclExpChTypeGroupList maTypeGroups; /// Chart type groups (CHTYPEGROUP group).
1199 : : };
1200 : :
1201 : : typedef boost::shared_ptr< XclExpChAxesSet > XclExpChAxesSetRef;
1202 : :
1203 : : // The chart object ===========================================================
1204 : :
1205 : : /** Represents the CHCHART record group describing the chart contents.
1206 : :
1207 : : The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
1208 : : group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
1209 : : with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
1210 : : */
1211 [ # # ][ # # ]: 0 : class XclExpChChart : public XclExpChGroupBase
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
1212 : : {
1213 : : public:
1214 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > XChartDocRef;
1215 : :
1216 : : public:
1217 : : explicit XclExpChChart( const XclExpRoot& rRoot,
1218 : : XChartDocRef xChartDoc, const Rectangle& rChartRect );
1219 : :
1220 : : /** Creates, registers and returns a new data series object. */
1221 : : XclExpChSeriesRef CreateSeries();
1222 : : /** Removes the last created data series object from the series list. */
1223 : : void RemoveLastSeries();
1224 : : /** Stores a CHTEXT group that describes a data point label. */
1225 : : void SetDataLabel( XclExpChTextRef xText );
1226 : : /** Sets the plot area position and size to manual mode. */
1227 : : void SetManualPlotArea();
1228 : :
1229 : : /** Writes all embedded records. */
1230 : : virtual void WriteSubRecords( XclExpStream& rStrm );
1231 : :
1232 : : private:
1233 : : virtual void WriteBody( XclExpStream& rStrm );
1234 : :
1235 : : private:
1236 : : typedef XclExpRecordList< XclExpChSeries > XclExpChSeriesList;
1237 : : typedef XclExpRecordList< XclExpChText > XclExpChTextList;
1238 : :
1239 : : XclChRectangle maRect; /// Position of the chart on the sheet (CHCHART record).
1240 : : XclExpChSeriesList maSeries; /// List of series data (CHSERIES groups).
1241 : : XclExpChFrameRef mxFrame; /// Chart frame format (CHFRAME group).
1242 : : XclChProperties maProps; /// Chart properties (CHPROPERTIES record).
1243 : : XclExpChAxesSetRef mxPrimAxesSet; /// Primary axes set (CHAXESSET group).
1244 : : XclExpChAxesSetRef mxSecnAxesSet; /// Secondary axes set (CHAXESSET group).
1245 : : XclExpChTextRef mxTitle; /// Chart title (CHTEXT group).
1246 : : XclExpChTextList maLabels; /// Data point labels (CHTEXT groups).
1247 : : };
1248 : :
1249 : : // ----------------------------------------------------------------------------
1250 : :
1251 : : /** Represents the group of DFF and OBJ records containing all drawing shapes
1252 : : embedded in the chart object.
1253 : : */
1254 : : class XclExpChartDrawing : public XclExpRecordBase, protected XclExpRoot
1255 : : {
1256 : : public:
1257 : : explicit XclExpChartDrawing(
1258 : : const XclExpRoot& rRoot,
1259 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
1260 : : const Size& rChartSize );
1261 : : virtual ~XclExpChartDrawing();
1262 : :
1263 : : virtual void Save( XclExpStream& rStrm );
1264 : :
1265 : : private:
1266 : : boost::shared_ptr< XclExpObjectManager > mxObjMgr;
1267 : : boost::shared_ptr< XclExpRecordBase > mxObjRecs;
1268 : : };
1269 : :
1270 : : // ----------------------------------------------------------------------------
1271 : :
1272 : : /** Represents the entire chart substream (all records in BOF/EOF block). */
1273 [ # # ][ # # ]: 0 : class XclExpChart : public XclExpSubStream, protected XclExpRoot
1274 : : {
1275 : : public:
1276 : : typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > XModelRef;
1277 : :
1278 : : public:
1279 : : explicit XclExpChart( const XclExpRoot& rRoot,
1280 : : XModelRef xModel, const Rectangle& rChartRect );
1281 : : };
1282 : :
1283 : : // ============================================================================
1284 : :
1285 : : #endif
1286 : :
1287 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|