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