LCOV - code coverage report
Current view: top level - sc/source/filter/inc - xichart.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 74 96 77.1 %
Date: 2012-08-25 Functions: 85 119 71.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 93 262 35.5 %

           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_XICHART_HXX
      30                 :            : #define SC_XICHART_HXX
      31                 :            : 
      32                 :            : #include <vector>
      33                 :            : #include <map>
      34                 :            : #include <set>
      35                 :            : #include <list>
      36                 :            : 
      37                 :            : #include <svl/itemset.hxx>
      38                 :            : 
      39                 :            : #include "rangelst.hxx"
      40                 :            : #include "token.hxx"
      41                 :            : #include "xlchart.hxx"
      42                 :            : #include "xlstyle.hxx"
      43                 :            : #include "xiescher.hxx"
      44                 :            : #include "xistring.hxx"
      45                 :            : #include <boost/shared_ptr.hpp>
      46                 :            : #include <boost/ptr_container/ptr_map.hpp>
      47                 :            : 
      48                 :            : namespace com { namespace sun { namespace star {
      49                 :            :     namespace awt
      50                 :            :     {
      51                 :            :         struct Rectangle;
      52                 :            :     }
      53                 :            :     namespace frame
      54                 :            :     {
      55                 :            :         class XModel;
      56                 :            :     }
      57                 :            :     namespace drawing
      58                 :            :     {
      59                 :            :         class XShape;
      60                 :            :     }
      61                 :            :     namespace chart2
      62                 :            :     {
      63                 :            :         struct ScaleData;
      64                 :            :         class XChartDocument;
      65                 :            :         class XDiagram;
      66                 :            :         class XCoordinateSystem;
      67                 :            :         class XChartType;
      68                 :            :         class XDataSeries;
      69                 :            :         class XRegressionCurve;
      70                 :            :         class XAxis;
      71                 :            :         class XLegend;
      72                 :            :         class XTitle;
      73                 :            :         class XFormattedString;
      74                 :            :         namespace data
      75                 :            :         {
      76                 :            :             class XDataProvider;
      77                 :            :             class XDataSequence;
      78                 :            :             class XLabeledDataSequence;
      79                 :            :         }
      80                 :            :     }
      81                 :            : } } }
      82                 :            : 
      83                 :            : struct XclObjLineData;
      84                 :            : struct XclObjFillData;
      85                 :            : 
      86                 :            : // Common =====================================================================
      87                 :            : 
      88                 :            : struct XclImpChRootData;
      89                 :            : class XclImpChChart;
      90                 :            : class ScTokenArray;
      91                 :            : 
      92                 :            : /** Base class for complex chart classes, provides access to other components of the chart. */
      93         [ +  - ]:        198 : class XclImpChRoot : public XclImpRoot
      94                 :            : {
      95                 :            : public:
      96                 :            :     explicit            XclImpChRoot( const XclImpRoot& rRoot, XclImpChChart& rChartData );
      97                 :            :     virtual             ~XclImpChRoot();
      98                 :            : 
      99                 :            :     /** Returns this root instance - for code readability in derived classes. */
     100                 :        279 :     inline const XclImpChRoot& GetChRoot() const { return *this; }
     101                 :            :     /** Returns a reference to the parent chart data object. */
     102                 :            :     XclImpChChart&      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 an Excel chart type record identifier. */
     106                 :            :     const XclChTypeInfo& GetChartTypeInfo( sal_uInt16 nRecId ) const;
     107                 :            :     /** Returns an info struct about auto formatting for the passed object type. */
     108                 :            :     const XclChFormatInfo& GetFormatInfo( XclChObjectType eObjType ) const;
     109                 :            : 
     110                 :            :     /** Returns the default text color for charts. */
     111                 :            :     Color               GetFontAutoColor() const;
     112                 :            :     /** Returns the automatic line color of linear series. */
     113                 :            :     Color               GetSeriesLineAutoColor( sal_uInt16 nFormatIdx ) const;
     114                 :            :     /** Returns the automatic fill color of filled series. */
     115                 :            :     Color               GetSeriesFillAutoColor( sal_uInt16 nFormatIdx ) const;
     116                 :            : 
     117                 :            :     /** Starts the API chart document conversion. Must be called once before all API conversion. */
     118                 :            :     void                InitConversion(
     119                 :            :         const ::com::sun::star::uno::Reference<
     120                 :            :             com::sun::star::chart2::XChartDocument>& xChartDoc, const Rectangle& rChartRect ) const;
     121                 :            : 
     122                 :            :     /** Finishes the API chart document conversion. Must be called once after all API conversion. */
     123                 :            :     void                FinishConversion( XclImpDffConverter& rDffConv ) const;
     124                 :            : 
     125                 :            :     /** Returns the data provider for the chart document. */
     126                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider >
     127                 :            :                         GetDataProvider() const;
     128                 :            :     /** Returns the drawing shape interface of the specified title object. */
     129                 :            :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     130                 :            :                         GetTitleShape( const XclChTextKey& rTitleKey ) const;
     131                 :            : 
     132                 :            :     /** Converts the passed horizontal coordinate from Excel chart units into 1/100 mm. */
     133                 :            :     sal_Int32           CalcHmmFromChartX( sal_Int32 nPosX ) const;
     134                 :            :     /** Converts the passed vertical coordinate from Excel chart units into 1/100 mm. */
     135                 :            :     sal_Int32           CalcHmmFromChartY( sal_Int32 nPosY ) const;
     136                 :            :     /** Converts the passed rectangle from Excel chart units into 1/100 mm. */
     137                 :            :     ::com::sun::star::awt::Rectangle CalcHmmFromChartRect( const XclChRectangle& rRect ) const;
     138                 :            : 
     139                 :            :     /** Converts the passed horizontal coordinate from 1/100 mm into a relative position. */
     140                 :            :     double              CalcRelativeFromHmmX( sal_Int32 nPosX ) const;
     141                 :            :     /** Converts the passed vertical coordinate from 1/100 mm into a relative position. */
     142                 :            :     double              CalcRelativeFromHmmY( sal_Int32 nPosY ) const;
     143                 :            : 
     144                 :            :     /** Converts the passed horizontal coordinate from Excel chart units into a relative position. */
     145                 :            :     double              CalcRelativeFromChartX( sal_Int32 nPosX ) const;
     146                 :            :     /** Converts the passed vertical coordinate from Excel chart units into a relative position. */
     147                 :            :     double              CalcRelativeFromChartY( sal_Int32 nPosY ) const;
     148                 :            : 
     149                 :            :     /** Writes all line properties to the passed property set. */
     150                 :            :     void                ConvertLineFormat(
     151                 :            :                             ScfPropertySet& rPropSet,
     152                 :            :                             const XclChLineFormat& rLineFmt,
     153                 :            :                             XclChPropertyMode ePropMode ) const;
     154                 :            :     /** Writes solid area properties to the passed property set. */
     155                 :            :     void                ConvertAreaFormat(
     156                 :            :                             ScfPropertySet& rPropSet,
     157                 :            :                             const XclChAreaFormat& rAreaFmt,
     158                 :            :                             XclChPropertyMode ePropMode ) const;
     159                 :            :     /** Writes gradient or bitmap area properties to the passed property set. */
     160                 :            :     void                ConvertEscherFormat(
     161                 :            :                             ScfPropertySet& rPropSet,
     162                 :            :                             const XclChEscherFormat& rEscherFmt,
     163                 :            :                             const XclChPicFormat* pPicFmt,
     164                 :            :                             sal_uInt32 nDffFillType,
     165                 :            :                             XclChPropertyMode ePropMode ) const;
     166                 :            :     /** Writes font properties to the passed property set. */
     167                 :            :     void                ConvertFont(
     168                 :            :                             ScfPropertySet& rPropSet,
     169                 :            :                             sal_uInt16 nFontIdx,
     170                 :            :                             const Color* pFontColor = 0 ) const;
     171                 :            : 
     172                 :            :     /** Writes the pie rotation property for the passed angle. */
     173                 :            :     static void         ConvertPieRotation(
     174                 :            :                             ScfPropertySet& rPropSet,
     175                 :            :                             sal_uInt16 nAngle );
     176                 :            : 
     177                 :            : private:
     178                 :            :     typedef boost::shared_ptr< XclImpChRootData > XclImpChRootDataRef;
     179                 :            :     XclImpChRootDataRef mxChData;           /// Reference to the root data object.
     180                 :            : };
     181                 :            : 
     182                 :            : // ----------------------------------------------------------------------------
     183                 :            : 
     184                 :            : /** Base class for chart record groups. Provides helper functions to read sub records.
     185                 :            : 
     186                 :            :     A chart record group consists of a header record, followed by a CHBEGIN
     187                 :            :     record, followed by group sub records, and finished with a CHEND record.
     188                 :            :  */
     189                 :        114 : class XclImpChGroupBase
     190                 :            : {
     191                 :            : public:
     192                 :            :     virtual             ~XclImpChGroupBase();
     193                 :            : 
     194                 :            :     /** Reads the entire record group.
     195                 :            :         @descr  First calls ReadHeaderRecord() to read the contents of the
     196                 :            :             header record. Then tries to read the sub records. If next record
     197                 :            :             is a CHBEGIN record, ReadSubRecord() is called for each following
     198                 :            :             record until a CHEND record is found. */
     199                 :            :     void                ReadRecordGroup( XclImpStream& rStrm );
     200                 :            : 
     201                 :            :     /** Helper to skip a CHBEGIN/CHEND block, includes nested blocks. */
     202                 :            :     static void         SkipBlock( XclImpStream& rStrm );
     203                 :            : 
     204                 :            :     /** Derived classes implement to read the group header record. */
     205                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm ) = 0;
     206                 :            :     /** Derived classes implement to read a record from the group. */
     207                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm ) = 0;
     208                 :            : };
     209                 :            : 
     210                 :            : // Frame formatting ===========================================================
     211                 :            : 
     212                 :         36 : class XclImpChFramePos
     213                 :            : {
     214                 :            : public:
     215                 :            :     /** Reads the CHFRAMEPOS record (frame position and size). */
     216                 :            :     void                ReadChFramePos( XclImpStream& rStrm );
     217                 :            : 
     218                 :            :     /** Returns read-only access to the imported frame position data. */
     219                 :         12 :     inline const XclChFramePos& GetFramePosData() const { return maData; }
     220                 :            : 
     221                 :            : private:
     222                 :            :     XclChFramePos       maData;             /// Position of the frame.
     223                 :            : };
     224                 :            : 
     225                 :            : typedef boost::shared_ptr< XclImpChFramePos > XclImpChFramePosRef;
     226                 :            : 
     227                 :            : // ----------------------------------------------------------------------------
     228                 :            : 
     229                 :            : /** The CHLINEFORMAT record containing line formatting data. */
     230                 :            : class XclImpChLineFormat
     231                 :            : {
     232                 :            : public:
     233                 :            :     /** Creates a new line format object with automatic formatting. */
     234                 :         42 :     inline explicit     XclImpChLineFormat() {}
     235                 :            :     /** Creates a new line format object with the passed formatting. */
     236                 :         24 :     inline explicit     XclImpChLineFormat( const XclChLineFormat& rLineFmt ) : maData( rLineFmt ) {}
     237                 :            : 
     238                 :            :     /** Reads the CHLINEFORMAT record (basic line properties). */
     239                 :            :     void                ReadChLineFormat( XclImpStream& rStrm );
     240                 :            : 
     241                 :            :     /** Returns true, if the line format is set to automatic. */
     242                 :         54 :     inline bool         IsAuto() const { return ::get_flag( maData.mnFlags, EXC_CHLINEFORMAT_AUTO ); }
     243                 :            :     /** Returns true, if the line style is set to something visible. */
     244 [ -  + ][ #  # ]:          6 :     inline bool         HasLine() const { return IsAuto() || (maData.mnPattern != EXC_CHLINEFORMAT_NONE); }
     245                 :            :     /** Returns the line width of this line format (returns 'single', if the line is invisible). */
     246 [ -  + ][ #  # ]:          3 :     inline sal_Int16    GetWeight() const { return (IsAuto() || !HasLine()) ? EXC_CHLINEFORMAT_SINGLE : maData.mnWeight; }
     247                 :            :     /** Returns true, if the "show axis" flag is set. */
     248                 :         12 :     inline bool         IsShowAxis() const { return ::get_flag( maData.mnFlags, EXC_CHLINEFORMAT_SHOWAXIS ); }
     249                 :            : 
     250                 :            :     /** Converts and writes the contained data to the passed property set. */
     251                 :            :     void                Convert( const XclImpChRoot& rRoot,
     252                 :            :                             ScfPropertySet& rPropSet, XclChObjectType eObjType,
     253                 :            :                             sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const;
     254                 :            : 
     255                 :            : private:
     256                 :            :     XclChLineFormat     maData;             /// Contents of the CHLINEFORMAT record.
     257                 :            : };
     258                 :            : 
     259                 :            : typedef boost::shared_ptr< XclImpChLineFormat > XclImpChLineFormatRef;
     260                 :            : 
     261                 :            : // ----------------------------------------------------------------------------
     262                 :            : 
     263                 :            : /** The CHAREAFORMAT record containing simple area formatting data (solid or patterns). */
     264                 :            : class XclImpChAreaFormat
     265                 :            : {
     266                 :            : public:
     267                 :            :     /** Creates a new area format object with automatic formatting. */
     268                 :         36 :     inline explicit     XclImpChAreaFormat() {}
     269                 :            :     /** Creates a new area format object with the passed formatting. */
     270                 :         12 :     inline explicit     XclImpChAreaFormat( const XclChAreaFormat& rAreaFmt ) : maData( rAreaFmt ) {}
     271                 :            : 
     272                 :            :     /** Reads the CHAREAFORMAT record (basic fill properties, e.g. transparent or colored). */
     273                 :            :     void                ReadChAreaFormat( XclImpStream& rStrm );
     274                 :            : 
     275                 :            :     /** Returns true, if the area format is set to automatic. */
     276                 :         21 :     inline bool         IsAuto() const { return ::get_flag( maData.mnFlags, EXC_CHAREAFORMAT_AUTO ); }
     277                 :            :     /** Returns true, if the area style is set to something visible. */
     278 [ #  # ][ #  # ]:          0 :     inline bool         HasArea() const { return IsAuto() || (maData.mnPattern != EXC_PATT_NONE); }
     279                 :            : 
     280                 :            :     /** Converts and writes the contained data to the passed property set. */
     281                 :            :     void                Convert( const XclImpChRoot& rRoot,
     282                 :            :                             ScfPropertySet& rPropSet, XclChObjectType eObjType,
     283                 :            :                             sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const;
     284                 :            : 
     285                 :            : private:
     286                 :            :     XclChAreaFormat     maData;             /// Contents of the CHAREAFORMAT record.
     287                 :            : };
     288                 :            : 
     289                 :            : typedef boost::shared_ptr< XclImpChAreaFormat > XclImpChAreaFormatRef;
     290                 :            : 
     291                 :            : // ----------------------------------------------------------------------------
     292                 :            : 
     293                 :            : /** The CHESCHERFORMAT record containing complex area formatting data (bitmaps, hatches). */
     294 [ #  # ][ #  # ]:          0 : class XclImpChEscherFormat : public XclImpChGroupBase
     295                 :            : {
     296                 :            : public:
     297                 :            :     explicit            XclImpChEscherFormat( const XclImpRoot& rRoot );
     298                 :            : 
     299                 :            :     /** Reads the CHESCHERFORMAT record (complex fill data) (called by base class). */
     300                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     301                 :            :     /** Reads a record from the CHESCHERFORMAT group (called by base class). */
     302                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     303                 :            : 
     304                 :            :     /** Converts and writes the contained data to the passed property set. */
     305                 :            :     void                Convert( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet,
     306                 :            :                             XclChObjectType eObjType, bool bUsePicFmt ) const;
     307                 :            : 
     308                 :            : private:
     309                 :            :     XclChEscherFormat   maData;             /// Fill properties for complex areas (CHESCHERFORMAT record).
     310                 :            :     XclChPicFormat      maPicFmt;           /// Image options, e.g. stretched, stacked (CHPICFORMAT record).
     311                 :            :     sal_uInt32          mnDffFillType;      /// Fill type imported from the DFF property set.
     312                 :            : };
     313                 :            : 
     314                 :            : typedef boost::shared_ptr< XclImpChEscherFormat > XclImpChEscherFormatRef;
     315                 :            : 
     316                 :            : // ----------------------------------------------------------------------------
     317                 :            : 
     318                 :            : /** Base class for record groups containing frame formatting.
     319                 :            : 
     320                 :            :     Frame formatting can be part of several record groups, e.g. CHFRAME,
     321                 :            :     CHDATAFORMAT, CHDROPBAR. It consists of CHLINEFORMAT, CHAREAFORMAT, and
     322                 :            :     CHESCHERFORMAT group.
     323                 :            :  */
     324 [ +  - ][ +  - ]:         36 : class XclImpChFrameBase : public XclImpChGroupBase
         [ +  - ][ -  + ]
     325                 :            : {
     326                 :            : public:
     327                 :            :     /** Creates a new frame object without internal formatting objects. */
     328 [ +  - ][ +  - ]:          6 :     inline explicit     XclImpChFrameBase() {}
                 [ +  - ]
     329                 :            :     /** Creates a new frame object with specific default formatting. */
     330                 :            :     explicit            XclImpChFrameBase( const XclChFormatInfo& rFmtInfo );
     331                 :            : 
     332                 :            :     /** Reads a frame formatting record (called by base class). */
     333                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     334                 :            : 
     335                 :            :     /** Returns true, if the line format is set to automatic. */
     336 [ +  - ][ +  - ]:          3 :     inline bool         IsAutoLine() const { return !mxLineFmt || mxLineFmt->IsAuto(); }
     337                 :            :     /** Returns true, if the line style is set to something visible. */
     338 [ -  + ][ #  # ]:          3 :     inline bool         HasLine() const { return IsAutoLine() || mxLineFmt->HasLine(); }
     339                 :            :     /** Returns the line weight used for this frame. */
     340         [ +  - ]:          3 :     inline sal_Int16    GetLineWeight() const { return mxLineFmt ? mxLineFmt->GetWeight() : EXC_CHLINEFORMAT_SINGLE; }
     341                 :            : 
     342                 :            :     /** Returns true, if the area format is set to automatic. */
     343 [ #  # ][ #  # ]:          0 :     inline bool         IsAutoArea() const { return !mxEscherFmt && (!mxAreaFmt || mxAreaFmt->IsAuto()); }
                 [ #  # ]
     344                 :            :     /** Returns true, if the area style is set to something visible. */
     345                 :            :     inline bool         HasArea() const { return mxEscherFmt || IsAutoArea() || mxAreaFmt->HasArea(); }
     346                 :            : 
     347                 :            : protected:
     348                 :            :     /** Converts and writes the contained line formatting to the passed property set. */
     349                 :            :     void                ConvertLineBase( const XclImpChRoot& rRoot,
     350                 :            :                             ScfPropertySet& rPropSet, XclChObjectType eObjType,
     351                 :            :                             sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN ) const;
     352                 :            :     /** Converts and writes the contained area formatting to the passed property set. */
     353                 :            :     void                ConvertAreaBase( const XclImpChRoot& rRoot,
     354                 :            :                             ScfPropertySet& rPropSet, XclChObjectType eObjType,
     355                 :            :                             sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const;
     356                 :            :     /** Converts and writes the contained data to the passed property set. */
     357                 :            :     void                ConvertFrameBase( const XclImpChRoot& rRoot,
     358                 :            :                             ScfPropertySet& rPropSet, XclChObjectType eObjType,
     359                 :            :                             sal_uInt16 nFormatIdx = EXC_CHDATAFORMAT_UNKNOWN, bool bUsePicFmt = false ) const;
     360                 :            : 
     361                 :            : protected:
     362                 :            :     XclImpChLineFormatRef mxLineFmt;        /// Line format (CHLINEFORMAT record).
     363                 :            :     XclImpChAreaFormatRef mxAreaFmt;        /// Area format (CHAREAFORMAT record).
     364                 :            :     XclImpChEscherFormatRef mxEscherFmt;    /// Complex area format (CHESCHERFORMAT record).
     365                 :            : };
     366                 :            : 
     367                 :            : // ----------------------------------------------------------------------------
     368                 :            : 
     369                 :            : /** Represents the CHFRAME record group containing object frame properties.
     370                 :            : 
     371                 :            :     The CHFRAME group consists of: CHFRAME, CHBEGIN, CHLINEFORMAT,
     372                 :            :     CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
     373                 :            :  */
     374 [ +  - ][ -  + ]:         60 : class XclImpChFrame : public XclImpChFrameBase, protected XclImpChRoot
     375                 :            : {
     376                 :            : public:
     377                 :            :     /** Creates a new frame object with specific default formatting. */
     378                 :            :     explicit            XclImpChFrame(
     379                 :            :                             const XclImpChRoot& rRoot,
     380                 :            :                             XclChObjectType eObjType );
     381                 :            : 
     382                 :            :     /** Reads the CHFRAME record (called by base class). */
     383                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     384                 :            : 
     385                 :            :     /** Sets formatting from BIFF3-BIFF5 OBJ record, if own formatting is invisible. */
     386                 :            :     void                UpdateObjFrame( const XclObjLineData& rLineData, const XclObjFillData& rFillData );
     387                 :            : 
     388                 :            :     /** Converts and writes the contained data to the passed property set. */
     389                 :            :     void                Convert( ScfPropertySet& rPropSet, bool bUsePicFmt = false ) const;
     390                 :            : 
     391                 :            : private:
     392                 :            :     XclChFrame          maData;             /// Contents of the CHFRAME record.
     393                 :            :     XclChObjectType     meObjType;          /// Type of the represented object.
     394                 :            : };
     395                 :            : 
     396                 :            : typedef boost::shared_ptr< XclImpChFrame > XclImpChFrameRef;
     397                 :            : 
     398                 :            : // Source links ===============================================================
     399                 :            : 
     400                 :            : class XclImpChSourceLink : protected XclImpChRoot
     401                 :            : {
     402                 :            : public:
     403                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >   XDataSequenceRef;
     404                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XFormattedString >      XFormattedStringRef;
     405                 :            :     typedef ::com::sun::star::uno::Sequence< XFormattedStringRef >                              XFormattedStringSeq;
     406                 :            : 
     407                 :            : public:
     408                 :            :     explicit            XclImpChSourceLink( const XclImpChRoot& rRoot );
     409                 :            :     virtual             ~XclImpChSourceLink();
     410                 :            : 
     411                 :            :     /** Reads the CHSOURCELINK record (link to source data). */
     412                 :            :     void                ReadChSourceLink( XclImpStream& rStrm );
     413                 :            :     /** Sets explicit string data for this text object. */
     414                 :            :     void                SetString( const String& rString );
     415                 :            :     /** Sets formatting runs read from a CHFORMATRUNS record. */
     416                 :            :     void                SetTextFormats( const XclFormatRunVec& rFormats );
     417                 :            : 
     418                 :            :     /** Returns the destination object (title, values, category, ...). */
     419                 :         24 :     inline sal_uInt8    GetDestType() const { return maData.mnDestType; }
     420                 :            :     /** Returns the link type (to worksheet, directly, default, ...). */
     421                 :         48 :     inline sal_uInt8    GetLinkType() const { return maData.mnLinkType; }
     422                 :            : 
     423                 :            :     /** Returns true, if the source link contains explicit string data. */
     424 [ +  - ][ +  - ]:         24 :     inline bool         HasString() const { return mxString && !mxString->IsEmpty(); }
     425                 :            :     /** Returns explicit string data or an empty string. */
     426         [ #  # ]:          0 :     inline const String& GetString() const { return mxString ? mxString->GetText() : String::EmptyString(); }
     427                 :            :     /** Returns the number of data points of this source link. */
     428                 :            :     sal_uInt16          GetCellCount() const;
     429                 :            : 
     430                 :            :     /** Converts and writes the contained number format to the passed property set. */
     431                 :            :     void                ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) const;
     432                 :            : 
     433                 :            :     /** Creates a data sequence containing the link into the Calc document. */
     434                 :            :     XDataSequenceRef    CreateDataSequence( const ::rtl::OUString& rRole ) const;
     435                 :            :     /** Creates a sequence of formatted string objects. */
     436                 :            :     XFormattedStringSeq CreateStringSequence( const XclImpChRoot& rRoot,
     437                 :            :                             sal_uInt16 nLeadFontIdx, const Color& rLeadFontColor ) const;
     438                 :            : 
     439                 :            :     void                FillSourceLink(::std::vector<ScTokenRef>& rTokens) const;
     440                 :            : 
     441                 :            : private:
     442                 :            :     XclChSourceLink     maData;             /// Contents of the CHSOURCELINK record.
     443                 :            :     XclImpStringRef     mxString;           /// Text data (CHSTRING record).
     444                 :            :     boost::shared_ptr< ScTokenArray> mxTokenArray;     /// Token array representing the data ranges.
     445                 :            : };
     446                 :            : 
     447                 :            : typedef boost::shared_ptr< XclImpChSourceLink > XclImpChSourceLinkRef;
     448                 :            : 
     449                 :            : // Text =======================================================================
     450                 :            : 
     451                 :            : /** Base class for objects with font settings. Provides font conversion helper functions. */
     452                 :         36 : class XclImpChFontBase
     453                 :            : {
     454                 :            : public:
     455                 :            :     virtual             ~XclImpChFontBase();
     456                 :            : 
     457                 :            :     /** Derived classes return the leading font index for the text object. */
     458                 :            :     virtual sal_uInt16  GetFontIndex() const = 0;
     459                 :            :     /** Derived classes return the leading font color for the text object. */
     460                 :            :     virtual Color       GetFontColor() const = 0;
     461                 :            :     /** Derived classes return the rotation value for the text object. */
     462                 :            :     virtual sal_uInt16  GetRotation() const = 0;
     463                 :            : 
     464                 :            :     /** Converts and writes the contained font settings to the passed property set. */
     465                 :            :     void                ConvertFontBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet ) const;
     466                 :            :     /** Converts and writes the contained rotation settings to the passed property set. */
     467                 :            :     void                ConvertRotationBase( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet, bool bSupportsStacked ) const;
     468                 :            : };
     469                 :            : 
     470                 :            : // ----------------------------------------------------------------------------
     471                 :            : 
     472                 :            : /** The CHFONT record containing a font index for text objects. */
     473                 :            : class XclImpChFont
     474                 :            : {
     475                 :            : public:
     476                 :            :     explicit            XclImpChFont();
     477                 :            :     /** Reads the CHFONT record (font index). */
     478                 :            :     void                ReadChFont( XclImpStream& rStrm );
     479                 :            : 
     480                 :            :     /** Returns the contained font index. */
     481                 :         24 :     inline sal_uInt16   GetFontIndex() const { return mnFontIdx; }
     482                 :            : 
     483                 :            : private:
     484                 :            :     sal_uInt16          mnFontIdx;          /// Index into font buffer.
     485                 :            : };
     486                 :            : 
     487                 :            : typedef boost::shared_ptr< XclImpChFont > XclImpChFontRef;
     488                 :            : 
     489                 :            : // ----------------------------------------------------------------------------
     490                 :            : 
     491                 :            : /** Represents the CHTEXT record group containing text object properties.
     492                 :            : 
     493                 :            :     The CHTEXT group consists of: CHTEXT, CHBEGIN, CHFRAMEPOS, CHFONT,
     494                 :            :     CHFORMATRUNS, CHSOURCELINK, CHSTRING, CHFRAME group, CHOBJECTLINK, and CHEND.
     495                 :            :  */
     496 [ +  - ][ +  - ]:         48 : class XclImpChText : public XclImpChGroupBase, public XclImpChFontBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ -  + ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     497                 :            : {
     498                 :            : public:
     499                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > XTitleRef;
     500                 :            : 
     501                 :            : public:
     502                 :            :     explicit            XclImpChText( const XclImpChRoot& rRoot );
     503                 :            : 
     504                 :            :     /** Reads the CHTEXT record (called by base class). */
     505                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     506                 :            :     /** Reads a record from the CHTEXT group (called by base class). */
     507                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     508                 :            : 
     509                 :            :     /** Returns the leading font index for the text object. */
     510                 :            :     virtual sal_uInt16  GetFontIndex() const;
     511                 :            :     /** Returns the leading font color for the text object. */
     512                 :            :     virtual Color       GetFontColor() const;
     513                 :            :     /** Returns the rotation value for the text object. */
     514                 :            :     virtual sal_uInt16  GetRotation() const;
     515                 :            : 
     516                 :            :     /** Sets explicit string data for this text object. */
     517                 :            :     void                SetString( const String& rString );
     518                 :            :     /** Updates missing parts of this text object from the passed object. */
     519                 :            :     void                UpdateText( const XclImpChText* pParentText );
     520                 :            :     /** Updates display type of this data point label text object. */
     521                 :            :     void                UpdateDataLabel( bool bCateg, bool bValue, bool bPercent );
     522                 :            : 
     523                 :            :     /** Returns the target object this text is linked to. */
     524                 :          6 :     inline sal_uInt16   GetLinkTarget() const { return maObjLink.mnTarget; }
     525                 :            :     /** Returns the position of the data point label this text is linked to. */
     526                 :          0 :     inline const XclChDataPointPos& GetPointPos() const { return maObjLink.maPointPos; }
     527                 :            :     /** Returns true, if this text group contains string data. */
     528 [ +  - ][ +  - ]:         18 :     inline bool         HasString() const { return mxSrcLink && mxSrcLink->HasString(); }
     529                 :            :     /** Returns true, if the text object is marked as deleted. */
     530                 :          6 :     inline bool         IsDeleted() const { return ::get_flag( maData.mnFlags, EXC_CHTEXT_DELETED ); }
     531                 :            : 
     532                 :            :     /** Converts and writes the contained font settings to the passed property set. */
     533                 :            :     void                ConvertFont( ScfPropertySet& rPropSet ) const;
     534                 :            :     /** Converts and writes the contained rotation settings to the passed property set. */
     535                 :            :     void                ConvertRotation( ScfPropertySet& rPropSet, bool bSupportsStacked ) const;
     536                 :            :     /** Converts and writes the contained frame data to the passed property set. */
     537                 :            :     void                ConvertFrame( ScfPropertySet& rPropSet ) const;
     538                 :            :     /** Converts and writes the contained number format to the passed property set. */
     539                 :            :     void                ConvertNumFmt( ScfPropertySet& rPropSet, bool bPercent ) const;
     540                 :            :     /** Converts and writes all contained data to the passed data point label property set. */
     541                 :            :     void                ConvertDataLabel( ScfPropertySet& rPropSet, const XclChTypeInfo& rTypeInfo ) const;
     542                 :            :     /** Creates a title text object. */
     543                 :            :     XTitleRef           CreateTitle() const;
     544                 :            :     /** Converts the manual position of the specified title */
     545                 :            :     void                ConvertTitlePosition( const XclChTextKey& rTitleKey ) const;
     546                 :            : 
     547                 :            : private:
     548                 :            :     using               XclImpChRoot::ConvertFont;
     549                 :            : 
     550                 :            :     /** Reads a CHFRLABELPROPS record. */
     551                 :            :     void                ReadChFrLabelProps( XclImpStream& rStrm );
     552                 :            : 
     553                 :            : private:
     554                 :            :     typedef boost::shared_ptr< XclChFrLabelProps > XclChFrLabelPropsRef;
     555                 :            : 
     556                 :            :     XclChText           maData;             /// Contents of the CHTEXT record.
     557                 :            :     XclChObjectLink     maObjLink;          /// Link target for this text object.
     558                 :            :     XclFormatRunVec     maFormats;          /// Formatting runs (CHFORMATRUNS record).
     559                 :            :     XclImpChFramePosRef mxFramePos;         /// Relative text frame position (CHFRAMEPOS record).
     560                 :            :     XclImpChSourceLinkRef mxSrcLink;        /// Linked data (CHSOURCELINK with CHSTRING record).
     561                 :            :     XclImpChFrameRef    mxFrame;            /// Text object frame properties (CHFRAME group).
     562                 :            :     XclImpChFontRef     mxFont;             /// Index into font buffer (CHFONT record).
     563                 :            :     XclChFrLabelPropsRef mxLabelProps;      /// Extended data label properties (CHFRLABELPROPS record).
     564                 :            : };
     565                 :            : 
     566                 :            : typedef boost::shared_ptr< XclImpChText > XclImpChTextRef;
     567                 :            : 
     568                 :            : // Data series ================================================================
     569                 :            : 
     570                 :            : /** The CHMARKERFORMAT record containing data point marker formatting data. */
     571                 :          6 : class XclImpChMarkerFormat
     572                 :            : {
     573                 :            : public:
     574                 :            :     /** Reads the CHMARKERFORMAT record (data point marker properties). */
     575                 :            :     void                ReadChMarkerFormat( XclImpStream& rStrm );
     576                 :            : 
     577                 :            :     /** Returns true, if the marker format is set to automatic. */
     578                 :          3 :     inline bool         IsAuto() const { return ::get_flag( maData.mnFlags, EXC_CHMARKERFORMAT_AUTO ); }
     579                 :            : 
     580                 :            :     /** Converts and writes the contained data to the passed property set. */
     581                 :            :     void                Convert( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet,
     582                 :            :                             sal_uInt16 nFormatIdx, sal_Int16 nLineWeight ) const;
     583                 :            :     /** Sets the marker fill color as main color to the passed property set. */
     584                 :            :     void                ConvertColor( const XclImpChRoot& rRoot,
     585                 :            :                             ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx ) const;
     586                 :            : 
     587                 :            : private:
     588                 :            :     XclChMarkerFormat   maData;             /// Contents of the CHMARKERFORMAT record.
     589                 :            : };
     590                 :            : 
     591                 :            : typedef boost::shared_ptr< XclImpChMarkerFormat > XclImpChMarkerFormatRef;
     592                 :            : 
     593                 :            : // ----------------------------------------------------------------------------
     594                 :            : 
     595                 :            : /** The CHPIEFORMAT record containing data point formatting data for pie segments. */
     596                 :            : class XclImpChPieFormat
     597                 :            : {
     598                 :            : public:
     599                 :            :     explicit            XclImpChPieFormat();
     600                 :            :     /** Reads the CHPIEFORMAT record (pie segment properties). */
     601                 :            :     void                ReadChPieFormat( XclImpStream& rStrm );
     602                 :            :     /** Converts and writes the contained data to the passed property set. */
     603                 :            :     void                Convert( ScfPropertySet& rPropSet ) const;
     604                 :            : 
     605                 :            : private:
     606                 :            :     sal_uInt16          mnPieDist;          /// Pie distance to diagram center.
     607                 :            : };
     608                 :            : 
     609                 :            : typedef boost::shared_ptr< XclImpChPieFormat > XclImpChPieFormatRef;
     610                 :            : 
     611                 :            : // ----------------------------------------------------------------------------
     612                 :            : 
     613                 :            : /** The CHSERIESFORMAT record containing additional settings for a data series. */
     614                 :            : class XclImpChSeriesFormat
     615                 :            : {
     616                 :            : public:
     617                 :            :     explicit            XclImpChSeriesFormat();
     618                 :            :     /** Reads the CHSERIESFORMAT record (additional settings for a series). */
     619                 :            :     void                ReadChSeriesFormat( XclImpStream& rStrm );
     620                 :            :     /** Returns true, if the series line is smoothed. */
     621                 :          0 :     inline bool         HasSpline() const { return ::get_flag( mnFlags, EXC_CHSERIESFORMAT_SMOOTHED ); }
     622                 :            : 
     623                 :            : private:
     624                 :            :     sal_uInt16          mnFlags;            /// Additional flags.
     625                 :            : };
     626                 :            : 
     627                 :            : typedef boost::shared_ptr< XclImpChSeriesFormat > XclImpChSeriesFormatRef;
     628                 :            : 
     629                 :            : // ----------------------------------------------------------------------------
     630                 :            : 
     631                 :            : /** The CH3DDATAFORMAT record containing the bar type in 3D bar charts. */
     632                 :          6 : class XclImpCh3dDataFormat
     633                 :            : {
     634                 :            : public:
     635                 :            :     /** Reads the CH3DDATAFORMAT record (3D bar properties). */
     636                 :            :     void                ReadCh3dDataFormat( XclImpStream& rStrm );
     637                 :            :     /** Converts and writes the contained data to the passed property set. */
     638                 :            :     void                Convert( ScfPropertySet& rPropSet ) const;
     639                 :            : 
     640                 :            : private:
     641                 :            :     XclCh3dDataFormat   maData;             /// Contents of the CH3DDATAFORMAT record.
     642                 :            : };
     643                 :            : 
     644                 :            : typedef boost::shared_ptr< XclImpCh3dDataFormat > XclImpCh3dDataFormatRef;
     645                 :            : 
     646                 :            : // ----------------------------------------------------------------------------
     647                 :            : 
     648                 :            : /** The CHATTACHEDLABEL record that contains the type of a data point label. */
     649         [ #  # ]:          0 : class XclImpChAttachedLabel : protected XclImpChRoot
     650                 :            : {
     651                 :            : public:
     652                 :            :     explicit            XclImpChAttachedLabel( const XclImpChRoot& rRoot );
     653                 :            :     /** Reads the CHATTACHEDLABEL record (data series/point labels). */
     654                 :            :     void                ReadChAttachedLabel( XclImpStream& rStrm );
     655                 :            :     /** Creates a CHTEXT group for the label. Clones xParentText and sets additional label settings */
     656                 :            :     XclImpChTextRef     CreateDataLabel( const XclImpChText* pParent ) const;
     657                 :            : 
     658                 :            : private:
     659                 :            :     sal_uInt16          mnFlags;            /// Additional flags.
     660                 :            : };
     661                 :            : 
     662                 :            : typedef boost::shared_ptr< XclImpChAttachedLabel > XclImpChAttLabelRef;
     663                 :            : 
     664                 :            : // ----------------------------------------------------------------------------
     665                 :            : 
     666                 :            : /** Represents the CHDATAFORMAT record group containing data point properties.
     667                 :            : 
     668                 :            :     The CHDATAFORMAT group consists of: CHDATAFORMAT, CHBEGIN, CHFRAME group,
     669                 :            :     CHMARKERFORMAT, CHPIEFORMAT, CH3DDATAFORMAT, CHSERIESFORMAT,
     670                 :            :     CHATTACHEDLABEL, CHEND.
     671                 :            :  */
     672 [ +  - ][ +  - ]:         12 : class XclImpChDataFormat : public XclImpChFrameBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
     673                 :            : {
     674                 :            : public:
     675                 :            :     explicit            XclImpChDataFormat( const XclImpChRoot& rRoot );
     676                 :            : 
     677                 :            :     /** Reads the CHDATAFORMAT record (called by base class). */
     678                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     679                 :            :     /** Reads a record from the CHDATAFORMAT group (called by base class). */
     680                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     681                 :            : 
     682                 :            :     /** Sets this object to the specified data point position. */
     683                 :            :     void                SetPointPos( const XclChDataPointPos& rPointPos, sal_uInt16 nFormatIdx );
     684                 :            :     /** Sets type and text formatting for a data point label (CHTEXT group). */
     685                 :          0 :     inline void         SetDataLabel( XclImpChTextRef xLabel ) { mxLabel = xLabel; }
     686                 :            : 
     687                 :            :     /** Updates default data format for series group. */
     688                 :            :     void                UpdateGroupFormat( const XclChExtTypeInfo& rTypeInfo );
     689                 :            :     /** Updates missing series settings from the passed chart type group data format. */
     690                 :            :     void                UpdateSeriesFormat( const XclChExtTypeInfo& rTypeInfo, const XclImpChDataFormat* pGroupFmt );
     691                 :            :     /** Updates missing data point settings from the passed series format. */
     692                 :            :     void                UpdatePointFormat( const XclChExtTypeInfo& rTypeInfo, const XclImpChDataFormat* pSeriesFmt );
     693                 :            :     /** Updates default data format for trend lines. */
     694                 :            :     void                UpdateTrendLineFormat();
     695                 :            : 
     696                 :            :     /** Returns the position of the data point described by this group. */
     697                 :         18 :     inline const XclChDataPointPos& GetPointPos() const { return maData.maPointPos; }
     698                 :            :     /** Returns the format index of the data point described by this group. */
     699                 :          6 :     inline sal_uInt16   GetFormatIdx() const { return maData.mnFormatIdx; }
     700                 :            :     /** Returns true, if markers are set to automatic format. */
     701 [ #  # ][ #  # ]:          0 :     inline bool         IsAutoMarker() const { return !mxMarkerFmt || mxMarkerFmt->IsAuto(); }
     702                 :            :     /** Returns true, if the series line is smoothed. */
     703 [ -  + ][ #  # ]:          6 :     inline bool         HasSpline() const { return mxSeriesFmt && mxSeriesFmt->HasSpline(); }
     704                 :            :     /** Returns the data label text object. */
     705                 :          0 :     inline const XclImpChText* GetDataLabel() const { return mxLabel.get(); }
     706                 :            : 
     707                 :            :     /** Converts and writes the contained data to the passed property set. */
     708                 :            :     void                Convert( ScfPropertySet& rPropSet, const XclChExtTypeInfo& rTypeInfo ) const;
     709                 :            :     /** Writes the line format only, e.g. for trend lines or error bars. */
     710                 :            :     void                ConvertLine( ScfPropertySet& rPropSet, XclChObjectType eObjType ) const;
     711                 :            :     /** Writes the area format only for the series or a data point. */
     712                 :            :     void                ConvertArea( ScfPropertySet& rPropSet, sal_uInt16 nFormatIdx, bool bUsePicFmt ) const;
     713                 :            : 
     714                 :            : private:
     715                 :            :     /** Removes unused formatting (e.g. pie distance in a bar chart). */
     716                 :            :     void                RemoveUnusedFormats( const XclChExtTypeInfo& rTypeInfo );
     717                 :            :     /** Updates or creates the data point label. */
     718                 :            :     void                UpdateDataLabel( const XclImpChDataFormat* pParentFmt );
     719                 :            : 
     720                 :            : private:
     721                 :            :     XclChDataFormat     maData;             /// Contents of the CHDATAFORMAT record.
     722                 :            :     XclImpChMarkerFormatRef mxMarkerFmt;    /// Data point marker (CHMARKERFORMAT record).
     723                 :            :     XclImpChPieFormatRef mxPieFmt;          /// Pie segment format (CHPIEFORMAT record).
     724                 :            :     XclImpChSeriesFormatRef mxSeriesFmt;    /// Series properties (CHSERIESFORMAT record).
     725                 :            :     XclImpCh3dDataFormatRef mx3dDataFmt;    /// 3D bar format (CH3DDATAFORMAT record).
     726                 :            :     XclImpChAttLabelRef mxAttLabel;         /// Data point label type (CHATTACHEDLABEL record).
     727                 :            :     XclImpChTextRef     mxLabel;            /// Data point label formatting (CHTEXT group).
     728                 :            : };
     729                 :            : 
     730                 :            : typedef boost::shared_ptr< XclImpChDataFormat > XclImpChDataFormatRef;
     731                 :            : 
     732                 :            : // ----------------------------------------------------------------------------
     733                 :            : 
     734                 :            : /** Represents the CHSERTRENDLINE record containing settings for a trend line. */
     735 [ #  # ][ #  # ]:          0 : class XclImpChSerTrendLine : protected XclImpChRoot
     736                 :            : {
     737                 :            : public:
     738                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XRegressionCurve > XRegressionCurveRef;
     739                 :            : 
     740                 :            : public:
     741                 :            :     explicit            XclImpChSerTrendLine( const XclImpChRoot& rRoot );
     742                 :            : 
     743                 :            :     /** Reads the CHSERTRENDLINE record. */
     744                 :            :     void                ReadChSerTrendLine( XclImpStream& rStrm );
     745                 :            :     /** Sets formatting information for the trend line. */
     746                 :          0 :     inline void         SetDataFormat( XclImpChDataFormatRef xDataFmt ) { mxDataFmt = xDataFmt; }
     747                 :            : 
     748                 :            :     /** Creates an API object representing this trend line. */
     749                 :            :     XRegressionCurveRef CreateRegressionCurve() const;
     750                 :            : 
     751                 :            : private:
     752                 :            :     XclChSerTrendLine   maData;             /// Contents of the CHSERTRENDLINE record.
     753                 :            :     XclImpChDataFormatRef mxDataFmt;        /// Formatting settings of the trend line.
     754                 :            : };
     755                 :            : 
     756                 :            : typedef boost::shared_ptr< XclImpChSerTrendLine > XclImpChSerTrendLineRef;
     757                 :            : 
     758                 :            : // ----------------------------------------------------------------------------
     759                 :            : 
     760                 :            : /** Represents the CHSERERRORBAR record containing settings for error bars. */
     761 [ #  # ][ #  # ]:          0 : class XclImpChSerErrorBar : protected XclImpChRoot
         [ #  # ][ #  # ]
                 [ #  # ]
     762                 :            : {
     763                 :            : public:
     764                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >    XLabeledDataSeqRef;
     765                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >                   XPropertySetRef;
     766                 :            : 
     767                 :            : public:
     768                 :            :     explicit            XclImpChSerErrorBar( const XclImpChRoot& rRoot );
     769                 :            : 
     770                 :            :     /** Reads the CHSERERRORBAR record. */
     771                 :            :     void                ReadChSerErrorBar( XclImpStream& rStrm );
     772                 :            :     /** Sets link and formatting information for the error bars. */
     773                 :            :     void                SetSeriesData(
     774                 :            :                             XclImpChSourceLinkRef xValueLink,
     775                 :            :                             XclImpChDataFormatRef xDataFmt );
     776                 :            : 
     777                 :            :     /** Returns the type of this error bar (X/Y, plus/minus). */
     778                 :          0 :     inline sal_uInt8    GetBarType() const { return maData.mnBarType; }
     779                 :            :     /** Creates a labeled data sequence object from value data link. */
     780                 :            :     XLabeledDataSeqRef  CreateValueSequence() const;
     781                 :            : 
     782                 :            :     /** Tries to create an error bar API object from the specified Excel error bars. */
     783                 :            :     static XPropertySetRef CreateErrorBar(
     784                 :            :                             const XclImpChSerErrorBar* pPosBar,
     785                 :            :                             const XclImpChSerErrorBar* pNegBar );
     786                 :            : 
     787                 :            : private:
     788                 :            :     XclChSerErrorBar    maData;             /// Contents of the CHSERERRORBAR record.
     789                 :            :     XclImpChSourceLinkRef mxValueLink;      /// Link data for manual error bar values.
     790                 :            :     XclImpChDataFormatRef mxDataFmt;        /// Formatting settings of the error bars.
     791                 :            : };
     792                 :            : 
     793                 :            : typedef boost::shared_ptr< XclImpChSerErrorBar > XclImpChSerErrorBarRef;
     794                 :            : 
     795                 :            : // ----------------------------------------------------------------------------
     796                 :            : 
     797                 :            : /** Represents the CHSERIES record group describing a data series in a chart.
     798                 :            : 
     799                 :            :     The CHSERIES group consists of: CHSERIES, CHBEGIN, CHSOURCELINK groups,
     800                 :            :     CHDATAFORMAT groups, CHSERGROUP, CHSERPARENT, CHSERERRORBAR,
     801                 :            :     CHSERTRENDLINE, CHEND.
     802                 :            :  */
     803 [ +  - ][ +  - ]:         12 : class XclImpChSeries : public XclImpChGroupBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
     804                 :            : {
     805                 :            : public:
     806                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >                   XDataSeriesRef;
     807                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >    XLabeledDataSeqRef;
     808                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >                   XPropertySetRef;
     809                 :            : 
     810                 :            : public:
     811                 :            :     explicit            XclImpChSeries( const XclImpChRoot& rRoot, sal_uInt16 nSeriesIdx );
     812                 :            : 
     813                 :            :     /** Reads the CHSERIES record (called by base class). */
     814                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     815                 :            :     /** Reads a record from the CHSERIES group (called by base class). */
     816                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     817                 :            : 
     818                 :            :     /** Sets a data point or series format (CHDATAFORMAT group) for this series. */
     819                 :            :     void                SetDataFormat( const XclImpChDataFormatRef& xDataFmt );
     820                 :            :     /** Sets a label text (CHTEXT group) attached  to a series or data point. */
     821                 :            :     void                SetDataLabel( const XclImpChTextRef& xLabel );
     822                 :            :     /** Adds error bar settings from the passed series to the own series. */
     823                 :            :     void                AddChildSeries( const XclImpChSeries& rSeries );
     824                 :            :     /** Updates missing series formatting by using default formatting from axes sets. */
     825                 :            :     void                FinalizeDataFormats();
     826                 :            : 
     827                 :            :     /** Returns the axes set identifier this series is assigned to (primary/secondary). */
     828                 :          6 :     inline sal_uInt16   GetGroupIdx() const { return mnGroupIdx; }
     829                 :            :     /** Returns the 0-based series index described by this series. */
     830                 :            :     inline sal_uInt16   GetSeriesIdx() const { return mnSeriesIdx; }
     831                 :            :     /** Returns the 0-based index of the parent series (e.g. of a trend line). */
     832                 :          0 :     inline sal_uInt16   GetParentIdx() const { return mnParentIdx; }
     833                 :            :     /** Returns the format index of the series used for automatic line and area colors. */
     834                 :            :     inline sal_uInt16   GetFormatIdx() const { return mxSeriesFmt ? mxSeriesFmt->GetFormatIdx() : EXC_CHDATAFORMAT_DEFAULT; }
     835                 :            :     /** Returns true, if the series is child of another series (e.g. trend line). */
     836                 :         18 :     inline bool         HasParentSeries() const { return mnParentIdx != EXC_CHSERIES_INVALID; }
     837                 :            :     /** Returns true, if the series contains child series (e.g. trend lines). */
     838 [ #  # ][ #  # ]:          0 :     inline bool         HasChildSeries() const { return !maTrendLines.empty() || !maErrorBars.empty(); }
     839                 :            :     /** Returns series title or an empty string, if the series does not contain a title. */
     840         [ #  # ]:          0 :     inline const String& GetTitle() const { return mxTitleLink ? mxTitleLink->GetString() : String::EmptyString(); }
     841                 :            : 
     842                 :            :     /** Returns true, if the series line is smoothed. */
     843 [ +  - ][ -  + ]:          6 :     inline bool         HasSpline() const { return mxSeriesFmt && mxSeriesFmt->HasSpline(); }
     844                 :            : 
     845                 :            :     /** Creates a labeled data sequence object from value data link. */
     846                 :            :     XLabeledDataSeqRef  CreateValueSequence( const ::rtl::OUString& rValueRole ) const;
     847                 :            :     /** Creates a labeled data sequence object from category data link. */
     848                 :            :     XLabeledDataSeqRef  CreateCategSequence( const ::rtl::OUString& rCategRole ) const;
     849                 :            :     /** Creates a data series object with initialized source links. */
     850                 :            :     XDataSeriesRef      CreateDataSeries() const;
     851                 :            : 
     852                 :            :     void                FillAllSourceLinks(::std::vector<ScTokenRef>& rTokens) const;
     853                 :            : 
     854                 :            : private:
     855                 :            :     /** Reads a CHSOURCELINK record. */
     856                 :            :     void                ReadChSourceLink( XclImpStream& rStrm );
     857                 :            :     /** Reads a CHDATAFORMAT group containing series and point formatting. */
     858                 :            :     void                ReadChDataFormat( XclImpStream& rStrm );
     859                 :            :     /** Reads a CHSERPARENT record specifying the parent series of this series. */
     860                 :            :     void                ReadChSerParent( XclImpStream& rStrm );
     861                 :            :     /** Reads a CHSERTRENDLINE record containing trend line settings. */
     862                 :            :     void                ReadChSerTrendLine( XclImpStream& rStrm );
     863                 :            :     /** Reads a CHSERERRORBAR record containing error bar settings. */
     864                 :            :     void                ReadChSerErrorBar( XclImpStream& rStrm );
     865                 :            : 
     866                 :            :     /** Creates a new CHDATAFORMAT group with the specified point index. */
     867                 :            :     XclImpChDataFormatRef CreateDataFormat( sal_uInt16 nPointIdx, sal_uInt16 nFormatIdx );
     868                 :            : 
     869                 :            :     /** Converts all trend lines and inserts them into the passed API data series object. */
     870                 :            :     void                ConvertTrendLines( XDataSeriesRef xDataSeries ) const;
     871                 :            :     /** Tries to create an error bar API object from the specified Excel error bars. */
     872                 :            :     XPropertySetRef     CreateErrorBar( sal_uInt8 nPosBarId, sal_uInt8 nNegBarId ) const;
     873                 :            : 
     874                 :            : private:
     875                 :            :     typedef ::std::map<sal_uInt16, XclImpChDataFormatRef> XclImpChDataFormatMap;
     876                 :            :     typedef ::std::map<sal_uInt16, XclImpChTextRef>       XclImpChTextMap;
     877                 :            :     typedef ::std::list< XclImpChSerTrendLineRef >        XclImpChSerTrendLineList;
     878                 :            :     typedef ::boost::ptr_map<sal_uInt8, XclImpChSerErrorBar> XclImpChSerErrorBarMap;
     879                 :            : 
     880                 :            :     XclChSeries         maData;             /// Contents of the CHSERIES record.
     881                 :            :     XclImpChSourceLinkRef mxValueLink;      /// Link data for series values.
     882                 :            :     XclImpChSourceLinkRef mxCategLink;      /// Link data for series category names.
     883                 :            :     XclImpChSourceLinkRef mxTitleLink;      /// Link data for series title.
     884                 :            :     XclImpChSourceLinkRef mxBubbleLink;     /// Link data for series bubble sizes.
     885                 :            :     XclImpChDataFormatRef mxSeriesFmt;      /// CHDATAFORMAT group for series format.
     886                 :            :     XclImpChDataFormatMap maPointFmts;      /// CHDATAFORMAT groups for data point formats.
     887                 :            :     XclImpChTextMap     maLabels;           /// Data point labels (CHTEXT groups).
     888                 :            :     XclImpChSerTrendLineList maTrendLines;  /// Trend line settings (CHSERTRENDLINE records).
     889                 :            :     XclImpChSerErrorBarMap maErrorBars;     /// Error bar settings (CHSERERRORBAR records).
     890                 :            :     sal_uInt16          mnGroupIdx;         /// Chart type group (CHTYPEGROUP group) this series is assigned to.
     891                 :            :     sal_uInt16          mnSeriesIdx;        /// 0-based series index.
     892                 :            :     sal_uInt16          mnParentIdx;        /// 0-based index of parent series (trend lines and error bars).
     893                 :            : };
     894                 :            : 
     895                 :            : typedef boost::shared_ptr< XclImpChSeries > XclImpChSeriesRef;
     896                 :            : 
     897                 :            : // Chart type groups ==========================================================
     898                 :            : 
     899         [ -  + ]:          6 : class XclImpChType : protected XclImpChRoot
     900                 :            : {
     901                 :            : public:
     902                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >          XDiagramRef;
     903                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > XCoordSystemRef;
     904                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >        XChartTypeRef;
     905                 :            : 
     906                 :            : public:
     907                 :            :     explicit            XclImpChType( const XclImpChRoot& rRoot );
     908                 :            : 
     909                 :            :     /** Reads a chart type record (e.g. CHBAR, CHLINE, CHPIE, ...). */
     910                 :            :     void                ReadChType( XclImpStream& rStrm );
     911                 :            :     /** Final processing after reading the entire chart. */
     912                 :            :     void                Finalize( bool bStockChart );
     913                 :            : 
     914                 :            :     /** Returns the record identifier of the chart type record. */
     915                 :          6 :     inline sal_uInt16   GetRecId() const { return mnRecId; }
     916                 :            :     /** Returns the chart type info struct for the contained chart type. */
     917                 :         12 :     inline const XclChTypeInfo& GetTypeInfo() const { return maTypeInfo; }
     918                 :            :     /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
     919                 :            :     bool                IsStacked() const;
     920                 :            :     /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
     921                 :            :     bool                IsPercent() const;
     922                 :            :     /** Returns true, if chart type has category labels enabled (may be disabled in radar charts). */
     923                 :            :     bool                HasCategoryLabels() const;
     924                 :            : 
     925                 :            :     /** Creates a coordinate system according to the contained chart type. */
     926                 :            :     XCoordSystemRef     CreateCoordSystem( bool b3dChart ) const;
     927                 :            :     /** Creates and returns an object that represents the contained chart type. */
     928                 :            :     XChartTypeRef       CreateChartType( XDiagramRef xDiagram, bool b3dChart ) const;
     929                 :            : 
     930                 :            : private:
     931                 :            :     XclChType           maData;             /// Contents of the chart type record.
     932                 :            :     sal_uInt16          mnRecId;            /// Record identifier for chart type.
     933                 :            :     XclChTypeInfo       maTypeInfo;         /// Chart type info for the contained type.
     934                 :            : };
     935                 :            : 
     936                 :            : // ----------------------------------------------------------------------------
     937                 :            : 
     938                 :            : /** Represents the CHCHART3D record that contains 3D view settings. */
     939                 :          0 : class XclImpChChart3d
     940                 :            : {
     941                 :            : public:
     942                 :            :     /** Reads the CHCHART3D record (properties for 3D charts). */
     943                 :            :     void                ReadChChart3d( XclImpStream& rStrm );
     944                 :            :     /** Returns true, if the data points are clustered on the X axis. */
     945                 :          0 :     inline bool         IsClustered() const { return ::get_flag( maData.mnFlags, EXC_CHCHART3D_CLUSTER ); }
     946                 :            :     /** Converts and writes the contained data to the passed property set. */
     947                 :            :     void                Convert( ScfPropertySet& rPropSet, bool b3dWallChart ) const;
     948                 :            : 
     949                 :            : private:
     950                 :            :     XclChChart3d        maData;             /// Contents of the CHCHART3D record.
     951                 :            : };
     952                 :            : 
     953                 :            : typedef boost::shared_ptr< XclImpChChart3d > XclImpChChart3dRef;
     954                 :            : 
     955                 :            : // ----------------------------------------------------------------------------
     956                 :            : 
     957                 :            : /** Represents the CHLEGEND record group describing the chart legend.
     958                 :            : 
     959                 :            :     The CHLEGEND group consists of: CHLEGEND, CHBEGIN, CHFRAMEPOS, CHFRAME
     960                 :            :     group, CHTEXT group, CHEND.
     961                 :            :  */
     962 [ +  - ][ +  - ]:         12 : class XclImpChLegend : public XclImpChGroupBase, protected XclImpChRoot
         [ +  - ][ +  - ]
                 [ -  + ]
     963                 :            : {
     964                 :            : public:
     965                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XLegend > XLegendRef;
     966                 :            : 
     967                 :            : public:
     968                 :            :     explicit            XclImpChLegend( const XclImpChRoot& rRoot );
     969                 :            : 
     970                 :            :     /** Reads the CHLEGEND record (called by base class). */
     971                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
     972                 :            :     /** Reads a record from the CHLEGEND group (called by base class). */
     973                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
     974                 :            :     /** Final processing after reading the entire chart. */
     975                 :            :     void                Finalize();
     976                 :            : 
     977                 :            :     /** Creates a new legend object. */
     978                 :            :     XLegendRef          CreateLegend() const;
     979                 :            : 
     980                 :            : private:
     981                 :            :     XclChLegend         maData;             /// Contents of the CHLEGEND record.
     982                 :            :     XclImpChFramePosRef mxFramePos;         /// Legend frame position (CHFRAMEPOS record).
     983                 :            :     XclImpChTextRef     mxText;             /// Legend text format (CHTEXT group).
     984                 :            :     XclImpChFrameRef    mxFrame;            /// Legend frame format (CHFRAME group).
     985                 :            : };
     986                 :            : 
     987                 :            : typedef boost::shared_ptr< XclImpChLegend > XclImpChLegendRef;
     988                 :            : 
     989                 :            : // ----------------------------------------------------------------------------
     990                 :            : 
     991                 :            : /** Represents the CHDROPBAR record group describing pos/neg bars in line charts.
     992                 :            : 
     993                 :            :     The CHDROPBAR group consists of: CHDROPBAR, CHBEGIN, CHLINEFORMAT,
     994                 :            :     CHAREAFORMAT, CHESCHERFORMAT group, CHEND.
     995                 :            :  */
     996         [ #  # ]:          0 : class XclImpChDropBar : public XclImpChFrameBase
     997                 :            : {
     998                 :            : public:
     999                 :            :     explicit            XclImpChDropBar( sal_uInt16 nDropBar );
    1000                 :            : 
    1001                 :            :     /** Reads the CHDROPBAR record (called by base class). */
    1002                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
    1003                 :            : 
    1004                 :            :     /** Converts and writes the contained frame data to the passed property set. */
    1005                 :            :     void                Convert( const XclImpChRoot& rRoot, ScfPropertySet& rPropSet ) const;
    1006                 :            : 
    1007                 :            : private:
    1008                 :            :     sal_uInt16          mnDropBar;          /// Drop bar identifier, needed for auto format.
    1009                 :            :     sal_uInt16          mnBarDist;          /// Distance between bars (CHDROPBAR record).
    1010                 :            : };
    1011                 :            : 
    1012                 :            : typedef boost::shared_ptr< XclImpChDropBar > XclImpChDropBarRef;
    1013                 :            : 
    1014                 :            : // ----------------------------------------------------------------------------
    1015                 :            : 
    1016                 :            : /** Represents the CHTYPEGROUP record group describing a group of series.
    1017                 :            : 
    1018                 :            :     The CHTYPEGROUP group consists of: CHTYPEGROUP, CHBEGIN, a chart type
    1019                 :            :     record (e.g. CHBAR, CHLINE, CHAREA, CHPIE, ...), CHCHART3D, CHLEGEND group,
    1020                 :            :     CHDEFAULTTEXT groups (CHDEFAULTTEXT with CHTEXT groups), CHDROPBAR groups,
    1021                 :            :     CHCHARTLINE groups (CHCHARTLINE with CHLINEFORMAT), CHDATAFORMAT group,
    1022                 :            :     CHEND.
    1023                 :            :  */
    1024 [ +  - ][ +  - ]:         12 : class XclImpChTypeGroup : public XclImpChGroupBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ -  + ]
    1025                 :            : {
    1026                 :            : public:
    1027                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >                      XDiagramRef;
    1028                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >             XCoordSystemRef;
    1029                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >                    XChartTypeRef;
    1030                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >                   XDataSeriesRef;
    1031                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence >    XLabeledDataSeqRef;
    1032                 :            : 
    1033                 :            : public:
    1034                 :            :     explicit            XclImpChTypeGroup( const XclImpChRoot& rRoot );
    1035                 :            : 
    1036                 :            :     /** Reads the CHTYPEGROUP record (called by base class). */
    1037                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
    1038                 :            :     /** Reads a record from the CHTYPEGROUP group (called by base class). */
    1039                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
    1040                 :            :     /** Final processing after reading the entire chart. */
    1041                 :            :     void                Finalize();
    1042                 :            : 
    1043                 :            :     /** Inserts a series attached to this chart type group.*/
    1044                 :            :     void                AddSeries( XclImpChSeriesRef xSeries );
    1045                 :            :     /** Marks the passed format index as used. PopUnusedFormatIndex() will not return this index. */
    1046                 :            :     void                SetUsedFormatIndex( sal_uInt16 nFormatIdx );
    1047                 :            :     /** Returns the next unused format index and marks it as used. */
    1048                 :            :     sal_uInt16          PopUnusedFormatIndex();
    1049                 :            : 
    1050                 :            :     /** Returns the index of this chart type group. */
    1051                 :          6 :     inline sal_uInt16   GetGroupIdx() const { return maData.mnGroupIdx; }
    1052                 :            :     /** Returns the chart type info struct for the contained chart type. */
    1053                 :         33 :     inline const XclChExtTypeInfo& GetTypeInfo() const { return maTypeInfo; }
    1054                 :            :     /** Returns true, if this chart type group contains at least one valid series. */
    1055                 :          6 :     inline bool         IsValidGroup() const { return !maSeries.empty(); }
    1056                 :            :     /** Returns true, if the series in this chart type group are stacked on each other (no percentage). */
    1057                 :            :     inline bool         IsStacked() const { return maType.IsStacked(); }
    1058                 :            :     /** Returns true, if the series in this chart type group are stacked on each other as percentage. */
    1059                 :          6 :     inline bool         IsPercent() const { return maType.IsPercent(); }
    1060                 :            :     /** Returns true, if the chart is three-dimensional. */
    1061 [ -  + ][ #  # ]:         36 :     inline bool         Is3dChart() const { return mxChart3d && maTypeInfo.mbSupports3d; }
    1062                 :            :     /** Returns true, if chart type supports wall and floor format in 3d mode. */
    1063 [ -  + ][ #  # ]:         15 :     inline bool         Is3dWallChart() const { return Is3dChart() && (maTypeInfo.meTypeCateg != EXC_CHTYPECATEG_PIE); }
    1064                 :            :     /** Returns true, if the series in this chart type group are ordered on the Z axis. */
    1065 [ -  + ][ #  # ]:          9 :     inline bool         Is3dDeepChart() const { return Is3dWallChart() && mxChart3d && !mxChart3d->IsClustered(); }
                 [ #  # ]
    1066                 :            :     /** Returns true, if category (X axis) labels are enabled (may be disabled in radar charts). */
    1067                 :          6 :     inline bool         HasCategoryLabels() const { return maType.HasCategoryLabels(); }
    1068                 :            :     /** Returns true, if points of a series show varying automatic area format. */
    1069                 :            :     bool                HasVarPointFormat() const;
    1070                 :            :     /** Returns true, if bars are connected with lines (stacked bar charts only). */
    1071                 :            :     bool                HasConnectorLines() const;
    1072                 :            : 
    1073                 :            :     /** Returns the legend object. */
    1074                 :          6 :     inline XclImpChLegendRef GetLegend() const { return mxLegend; }
    1075                 :            :     /** Returns the default series data format. */
    1076                 :          6 :     inline XclImpChDataFormatRef GetGroupFormat() const { return mxGroupFmt; }
    1077                 :            :     /** Returns series title, if the chart type group contains only one single series. */
    1078                 :            :     const String&       GetSingleSeriesTitle() const;
    1079                 :            : 
    1080                 :            :     /** Converts and writes all 3D settings to the passed diagram. */
    1081                 :            :     void                ConvertChart3d( ScfPropertySet& rPropSet ) const;
    1082                 :            :     /** Creates a coordinate system according to the contained chart type. */
    1083                 :            :     XCoordSystemRef     CreateCoordSystem() const;
    1084                 :            :     /** Creates and returns an object that represents the contained chart type. */
    1085                 :            :     XChartTypeRef       CreateChartType( XDiagramRef xDiagram, sal_Int32 nApiAxesSetIdx ) const;
    1086                 :            :     /** Creates a labeled data sequence object for axis categories. */
    1087                 :            :     XLabeledDataSeqRef  CreateCategSequence() const;
    1088                 :            : 
    1089                 :            : private:
    1090                 :            :     /** Reads a CHDROPBAR record group. */
    1091                 :            :     void                ReadChDropBar( XclImpStream& rStrm );
    1092                 :            :     /** Reads a CHCHARTLINE record group. */
    1093                 :            :     void                ReadChChartLine( XclImpStream& rStrm );
    1094                 :            :     /** Reads a CHDATAFORMAT record group (default series format). */
    1095                 :            :     void                ReadChDataFormat( XclImpStream& rStrm );
    1096                 :            : 
    1097                 :            :     /** Returns true, if the chart type group contains a hi-lo line format. */
    1098 [ +  - ][ +  - ]:          3 :     inline bool         HasHiLoLine() const { return maChartLines.find( EXC_CHCHARTLINE_HILO ) != maChartLines.end(); }
    1099                 :            :     /** Returns true, if the chart type group contains drop bar formats. */
    1100                 :          0 :     inline bool         HasDropBars() const { return !maDropBars.empty(); }
    1101                 :            : 
    1102                 :            :     /** Inserts the passed series into the chart type. Adds additional properties to the series. */
    1103                 :            :     void                InsertDataSeries( XChartTypeRef xChartType,
    1104                 :            :                             XDataSeriesRef xSeries, sal_Int32 nApiAxesSetIdx ) const;
    1105                 :            :     /** Creates all data series of any chart type except stock charts. */
    1106                 :            :     void                CreateDataSeries( XChartTypeRef xChartType, sal_Int32 nApiAxesSetIdx ) const;
    1107                 :            :     /** Creates all data series of of a stock chart. */
    1108                 :            :     void                CreateStockSeries( XChartTypeRef xChartType, sal_Int32 nApiAxesSetIdx ) const;
    1109                 :            : 
    1110                 :            : private:
    1111                 :            :     typedef ::std::vector< XclImpChSeriesRef >               XclImpChSeriesVec;
    1112                 :            :     typedef boost::ptr_map<sal_uInt16, XclImpChDropBar>      XclImpChDropBarMap;
    1113                 :            :     typedef boost::ptr_map<sal_uInt16, XclImpChLineFormat>   XclImpChLineFormatMap;
    1114                 :            :     typedef ::std::set< sal_uInt16 >                         UInt16Set;
    1115                 :            : 
    1116                 :            :     XclChTypeGroup      maData;             /// Contents of the CHTYPEGROUP record.
    1117                 :            :     XclImpChType        maType;             /// Chart type (e.g. CHBAR, CHLINE, ...).
    1118                 :            :     XclChExtTypeInfo    maTypeInfo;         /// Extended chart type info.
    1119                 :            :     XclImpChSeriesVec   maSeries;           /// Series attached to this chart type group (CHSERIES groups).
    1120                 :            :     XclImpChSeriesRef   mxFirstSeries;      /// First series in this chart type group (CHSERIES groups).
    1121                 :            :     XclImpChChart3dRef  mxChart3d;          /// 3D settings (CHCHART3D record).
    1122                 :            :     XclImpChLegendRef   mxLegend;           /// Chart legend (CHLEGEND group).
    1123                 :            :     XclImpChDropBarMap  maDropBars;         /// Dropbars (CHDROPBAR group).
    1124                 :            :     XclImpChLineFormatMap maChartLines;     /// Global line formats (CHCHARTLINE group).
    1125                 :            :     XclImpChDataFormatRef mxGroupFmt;       /// Default format for all series (CHDATAFORMAT group).
    1126                 :            :     UInt16Set           maUnusedFormats;    /// Contains unused format indexes for automatic colors.
    1127                 :            : };
    1128                 :            : 
    1129                 :            : typedef boost::shared_ptr< XclImpChTypeGroup > XclImpChTypeGroupRef;
    1130                 :            : 
    1131                 :            : // Axes =======================================================================
    1132                 :            : 
    1133         [ -  + ]:         24 : class XclImpChLabelRange : protected XclImpChRoot
    1134                 :            : {
    1135                 :            : public:
    1136                 :            :     typedef ::com::sun::star::chart2::ScaleData ScaleData;
    1137                 :            : 
    1138                 :            : public:
    1139                 :            :     explicit            XclImpChLabelRange( const XclImpChRoot& rRoot );
    1140                 :            :     /** Reads the CHLABELRANGE record (category axis scaling properties). */
    1141                 :            :     void                ReadChLabelRange( XclImpStream& rStrm );
    1142                 :            :     /** Reads the CHDATERANGE record (date axis scaling properties). */
    1143                 :            :     void                ReadChDateRange( XclImpStream& rStrm );
    1144                 :            :     /** Converts category axis scaling settings. */
    1145                 :            :     void                Convert( ScfPropertySet& rPropSet, ScaleData& rScaleData, bool bMirrorOrient ) const;
    1146                 :            :     /** Converts position settings of this axis at a crossing axis. */
    1147                 :            :     void                ConvertAxisPosition( ScfPropertySet& rPropSet, bool b3dChart ) const;
    1148                 :            : 
    1149                 :            : private:
    1150                 :            :     XclChLabelRange     maLabelData;        /// Contents of the CHLABELRANGE record.
    1151                 :            :     XclChDateRange      maDateData;         /// Contents of the CHDATERANGE record.
    1152                 :            : };
    1153                 :            : 
    1154                 :            : typedef boost::shared_ptr< XclImpChLabelRange > XclImpChLabelRangeRef;
    1155                 :            : 
    1156                 :            : // ----------------------------------------------------------------------------
    1157                 :            : 
    1158         [ -  + ]:         24 : class XclImpChValueRange : protected XclImpChRoot
    1159                 :            : {
    1160                 :            : public:
    1161                 :            :     typedef ::com::sun::star::chart2::ScaleData ScaleData;
    1162                 :            : 
    1163                 :            : public:
    1164                 :            :     explicit            XclImpChValueRange( const XclImpChRoot& rRoot );
    1165                 :            :     /** Reads the CHVALUERANGE record (numeric axis scaling properties). */
    1166                 :            :     void                ReadChValueRange( XclImpStream& rStrm );
    1167                 :            :     /** Converts value axis scaling settings. */
    1168                 :            :     void                Convert( ScaleData& rScaleData, bool bMirrorOrient ) const;
    1169                 :            :     /** Converts position settings of this axis at a crossing axis. */
    1170                 :            :     void                ConvertAxisPosition( ScfPropertySet& rPropSet ) const;
    1171                 :            : 
    1172                 :            : private:
    1173                 :            :     XclChValueRange     maData;             /// Contents of the CHVALUERANGE record.
    1174                 :            : };
    1175                 :            : 
    1176                 :            : typedef boost::shared_ptr< XclImpChValueRange > XclImpChValueRangeRef;
    1177                 :            : 
    1178                 :            : // ----------------------------------------------------------------------------
    1179                 :            : 
    1180         [ -  + ]:         24 : class XclImpChTick : protected XclImpChRoot
    1181                 :            : {
    1182                 :            : public:
    1183                 :            :     explicit            XclImpChTick( const XclImpChRoot& rRoot );
    1184                 :            :     /** Reads the CHTICK record (axis ticks properties). */
    1185                 :            :     void                ReadChTick( XclImpStream& rStrm );
    1186                 :            : 
    1187                 :            :     /** Returns true, if the axis shows attached labels. */
    1188                 :         12 :     inline bool         HasLabels() const { return maData.mnLabelPos != EXC_CHTICK_NOLABEL; }
    1189                 :            :     /** Returns the leading font color for the axis labels. */
    1190                 :            :     Color               GetFontColor() const;
    1191                 :            :     /** Returns the rotation value for the axis labels. */
    1192                 :            :     sal_uInt16          GetRotation() const;
    1193                 :            : 
    1194                 :            :     /** Converts and writes the contained data to the passed property set. */
    1195                 :            :     void                Convert( ScfPropertySet& rPropSet ) const;
    1196                 :            : 
    1197                 :            : private:
    1198                 :            :     XclChTick           maData;             /// Contents of the CHTICK record.
    1199                 :            : };
    1200                 :            : 
    1201                 :            : typedef boost::shared_ptr< XclImpChTick > XclImpChTickRef;
    1202                 :            : 
    1203                 :            : // ----------------------------------------------------------------------------
    1204                 :            : 
    1205                 :            : /** Represents the CHAXIS record group describing an entire chart axis.
    1206                 :            : 
    1207                 :            :     The CHAXIS group consists of: CHAXIS, CHBEGIN, CHLABELRANGE, CHEXTRANGE,
    1208                 :            :     CHVALUERANGE, CHFORMAT, CHTICK, CHFONT, CHAXISLINE groups (CHAXISLINE with
    1209                 :            :     CHLINEFORMAT, CHAREAFORMAT, and CHESCHERFORMAT group), CHEND.
    1210                 :            :  */
    1211 [ +  - ][ +  - ]:         24 : class XclImpChAxis : public XclImpChGroupBase, public XclImpChFontBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
    1212                 :            : {
    1213                 :            : public:
    1214                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > XAxisRef;
    1215                 :            : 
    1216                 :            : public:
    1217                 :            :     explicit            XclImpChAxis( const XclImpChRoot& rRoot, sal_uInt16 nAxisType = EXC_CHAXIS_NONE );
    1218                 :            : 
    1219                 :            :     /** Reads the CHAXIS record (called by base class). */
    1220                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
    1221                 :            :     /** Reads a record from the CHAXIS group (called by base class). */
    1222                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
    1223                 :            :     /** Final processing after reading the entire chart. */
    1224                 :            :     void                Finalize();
    1225                 :            : 
    1226                 :            :     /** Returns the font index for the axis labels. */
    1227                 :            :     virtual sal_uInt16  GetFontIndex() const;
    1228                 :            :     /** Returns the font color for the axis labels. */
    1229                 :            :     virtual Color       GetFontColor() const;
    1230                 :            :     /** Returns the rotation value for axis labels. */
    1231                 :            :     virtual sal_uInt16  GetRotation() const;
    1232                 :            : 
    1233                 :            :     /** Returns the type of this axis. */
    1234                 :         66 :     inline sal_uInt16   GetAxisType() const { return maData.mnType; }
    1235                 :            :     /** Returns the axis dimension index used by the chart API. */
    1236                 :         12 :     inline sal_Int32    GetApiAxisDimension() const { return maData.GetApiAxisDimension(); }
    1237                 :            :     /** Returns true, if the axis is active. */
    1238 [ +  - ][ +  - ]:         12 :     inline bool         IsActivated() const { return !mxAxisLine || mxAxisLine->IsShowAxis(); }
    1239                 :            :     /** Returns true, if the axis contains caption labels. */
    1240 [ +  - ][ +  - ]:         12 :     inline bool         HasLabels() const { return !mxTick || mxTick->HasLabels(); }
    1241                 :            :     /** Returns true, if the axis shows its major grid lines. */
    1242                 :         12 :     inline bool         HasMajorGrid() const { return mxMajorGrid; }
    1243                 :            :     /** Returns true, if the axis shows its minor grid lines. */
    1244                 :         12 :     inline bool         HasMinorGrid() const { return mxMinorGrid; }
    1245                 :            : 
    1246                 :            :     /** Creates an API axis object. */
    1247                 :            :     XAxisRef            CreateAxis( const XclImpChTypeGroup& rTypeGroup, const XclImpChAxis* pCrossingAxis ) const;
    1248                 :            :     /** Converts and writes 3D wall/floor properties to the passed property set. */
    1249                 :            :     void                ConvertWall( ScfPropertySet& rPropSet ) const;
    1250                 :            :     /** Converts position settings of this axis at a crossing axis. */
    1251                 :            :     void                ConvertAxisPosition( ScfPropertySet& rPropSet, const XclImpChTypeGroup& rTypeGroup ) const;
    1252                 :            : 
    1253                 :            : private:
    1254                 :            :     /** Reads a CHAXISLINE record specifying the target for following line properties. */
    1255                 :            :     void                ReadChAxisLine( XclImpStream& rStrm );
    1256                 :            :     /** Creates a CHFRAME object and stores it into the mxWallFrame member. */
    1257                 :            :     void                CreateWallFrame();
    1258                 :            : 
    1259                 :            : private:
    1260                 :            :     XclChAxis           maData;             /// Contents of the CHAXIS record.
    1261                 :            :     XclImpChLabelRangeRef mxLabelRange;     /// Category scaling (CHLABELRANGE record).
    1262                 :            :     XclImpChValueRangeRef mxValueRange;     /// Value scaling (CHVALUERANGE record).
    1263                 :            :     XclImpChTickRef     mxTick;             /// Axis ticks (CHTICK record).
    1264                 :            :     XclImpChFontRef     mxFont;             /// Index into font buffer (CHFONT record).
    1265                 :            :     XclImpChLineFormatRef mxAxisLine;       /// Axis line format (CHLINEFORMAT record).
    1266                 :            :     XclImpChLineFormatRef mxMajorGrid;      /// Major grid line format (CHLINEFORMAT record).
    1267                 :            :     XclImpChLineFormatRef mxMinorGrid;      /// Minor grid line format (CHLINEFORMAT record).
    1268                 :            :     XclImpChFrameRef    mxWallFrame;        /// Wall/floor format (sub records of CHFRAME group).
    1269                 :            :     sal_uInt16          mnNumFmtIdx;        /// Index into number format buffer (CHFORMAT record).
    1270                 :            : };
    1271                 :            : 
    1272                 :            : typedef boost::shared_ptr< XclImpChAxis > XclImpChAxisRef;
    1273                 :            : 
    1274                 :            : // ----------------------------------------------------------------------------
    1275                 :            : 
    1276                 :            : /** Represents the CHAXESSET record group describing an axes set (X/Y/Z axes).
    1277                 :            : 
    1278                 :            :     The CHAXESSET group consists of: CHAXESSET, CHBEGIN, CHFRAMEPOS, CHAXIS
    1279                 :            :     groups, CHTEXT groups, CHPLOTFRAME group (CHPLOTFRAME with CHFRAME group),
    1280                 :            :     CHTYPEGROUP group, CHEND.
    1281                 :            :  */
    1282 [ +  - ][ +  - ]:         36 : class XclImpChAxesSet : public XclImpChGroupBase, protected XclImpChRoot
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ -  + ]
    1283                 :            : {
    1284                 :            : public:
    1285                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >          XDiagramRef;
    1286                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > XCoordSystemRef;
    1287                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >             XAxisRef;
    1288                 :            : 
    1289                 :            : public:
    1290                 :            :     explicit            XclImpChAxesSet( const XclImpChRoot& rRoot, sal_uInt16 nAxesSetId );
    1291                 :            : 
    1292                 :            :     /** Reads the CHAXESSET record (called by base class). */
    1293                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
    1294                 :            :     /** Reads a record from the CHAXESSET group (called by base class). */
    1295                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
    1296                 :            :     /** Final processing after reading the entire chart. */
    1297                 :            :     void                Finalize();
    1298                 :            : 
    1299                 :            :     /** Returns true, if this axes set exists (returns false if this is a dummy object). */
    1300                 :         36 :     inline bool         IsValidAxesSet() const { return !maTypeGroups.empty(); }
    1301                 :            :     /** Returns the index of the axes set (primary/secondary). */
    1302                 :         12 :     inline sal_uInt16   GetAxesSetId() const { return maData.mnAxesSetId; }
    1303                 :            :     /** Returns the axes set index used by the chart API. */
    1304                 :         18 :     inline sal_Int32    GetApiAxesSetIndex() const { return maData.GetApiAxesSetIndex(); }
    1305                 :            : 
    1306                 :            :     /** Returns the outer plot area position, if existing. */
    1307                 :          6 :     inline XclImpChFramePosRef GetPlotAreaFramePos() const { return mxFramePos; }
    1308                 :            :     /** Returns the specified chart type group. */
    1309                 :            :     XclImpChTypeGroupRef GetTypeGroup( sal_uInt16 nGroupIdx ) const;
    1310                 :            :     /** Returns the first chart type group. */
    1311                 :            :     XclImpChTypeGroupRef GetFirstTypeGroup() const;
    1312                 :            :     /** Looks for a legend in all chart type groups and returns it. */
    1313                 :            :     XclImpChLegendRef   GetLegend() const;
    1314                 :            :     /** Returns series title, if the axes set contains only one single series. */
    1315                 :            :     const String&       GetSingleSeriesTitle() const;
    1316                 :            : 
    1317                 :            :     /** Creates a coordinate system and converts all series and axis settings. */
    1318                 :            :     void                Convert( XDiagramRef xDiagram ) const;
    1319                 :            :     /** Converts the manual positions of all axis titles. */
    1320                 :            :     void                ConvertTitlePositions() const;
    1321                 :            : 
    1322                 :            : private:
    1323                 :            :     /** Reads a CHAXIS record group containing a single axis. */
    1324                 :            :     void                ReadChAxis( XclImpStream& rStrm );
    1325                 :            :     /** Reads a CHTEXT record group containing an axis title. */
    1326                 :            :     void                ReadChText( XclImpStream& rStrm );
    1327                 :            :     /** Reads the CHPLOTFRAME record group containing diagram area formatting. */
    1328                 :            :     void                ReadChPlotFrame( XclImpStream& rStrm );
    1329                 :            :     /** Reads a CHTYPEGROUP record group containing chart type and chart settings. */
    1330                 :            :     void                ReadChTypeGroup( XclImpStream& rStrm );
    1331                 :            : 
    1332                 :            :     /** Updates text formatting of the passed axis title with global text formatting. */
    1333                 :            :     void                UpdateAxisTitle( XclImpChTextRef xTitle );
    1334                 :            : 
    1335                 :            :     /** Creates a coordinate system that contains all chart types for this axes set. */
    1336                 :            :     XCoordSystemRef     CreateCoordSystem( XDiagramRef xDiagram ) const;
    1337                 :            :     /** Creates and inserts an axis into the container and registers the coordinate system. */
    1338                 :            :     void                ConvertAxis( XclImpChAxisRef xChAxis, XclImpChTextRef xChAxisTitle,
    1339                 :            :                             XCoordSystemRef xCoordSystem, const XclImpChAxis* pCrossingAxis ) const;
    1340                 :            :     /** Creates and returns an API axis object. */
    1341                 :            :     XAxisRef            CreateAxis( const XclImpChAxis& rChAxis, const XclImpChAxis* pCrossingAxis ) const;
    1342                 :            :     /** Writes all properties of the background area to the passed diagram. */
    1343                 :            :     void                ConvertBackground( XDiagramRef xDiagram ) const;
    1344                 :            : 
    1345                 :            : private:
    1346                 :            :     typedef ::std::map<sal_uInt16, XclImpChTypeGroupRef> XclImpChTypeGroupMap;
    1347                 :            : 
    1348                 :            :     XclChAxesSet        maData;             /// Contents of the CHAXESSET record.
    1349                 :            :     XclImpChFramePosRef mxFramePos;         /// Outer plot area position (CHFRAMEPOS record).
    1350                 :            :     XclImpChAxisRef     mxXAxis;            /// The X axis (CHAXIS group).
    1351                 :            :     XclImpChAxisRef     mxYAxis;            /// The Y axis (CHAXIS group).
    1352                 :            :     XclImpChAxisRef     mxZAxis;            /// The Z axis (CHAXIS group).
    1353                 :            :     XclImpChTextRef     mxXAxisTitle;       /// The X axis title (CHTEXT group).
    1354                 :            :     XclImpChTextRef     mxYAxisTitle;       /// The Y axis title (CHTEXT group).
    1355                 :            :     XclImpChTextRef     mxZAxisTitle;       /// The Z axis title (CHTEXT group).
    1356                 :            :     XclImpChFrameRef    mxPlotFrame;        /// Plot area (CHPLOTFRAME group).
    1357                 :            :     XclImpChTypeGroupMap maTypeGroups;      /// Chart type groups (CHTYPEGROUP group).
    1358                 :            : };
    1359                 :            : 
    1360                 :            : typedef boost::shared_ptr< XclImpChAxesSet > XclImpChAxesSetRef;
    1361                 :            : 
    1362                 :            : // The chart object ===========================================================
    1363                 :            : 
    1364                 :            : /** Represents the CHCHART record group describing the chart contents.
    1365                 :            : 
    1366                 :            :     The CHCHART group consists of: CHCHART, CHBEGIN, SCL, CHPLOTGROWTH, CHFRAME
    1367                 :            :     group, CHSERIES groups, CHPROPERTIES, CHDEFAULTTEXT groups (CHDEFAULTTEXT
    1368                 :            :     with CHTEXT groups), CHUSEDAXESSETS, CHAXESSET groups, CHTEXT groups, CHEND.
    1369                 :            :  */
    1370                 :            : class XclImpChChart : public XclImpChGroupBase, protected XclImpChRoot
    1371                 :            : {
    1372                 :            : public:
    1373                 :            :     explicit            XclImpChChart( const XclImpRoot& rRoot );
    1374                 :            :     virtual             ~XclImpChChart();
    1375                 :            : 
    1376                 :            :     /** Reads the CHCHART record (called by base class). */
    1377                 :            :     virtual void        ReadHeaderRecord( XclImpStream& rStrm );
    1378                 :            :     /** Reads a record from the CHCHART group (called by base class). */
    1379                 :            :     virtual void        ReadSubRecord( XclImpStream& rStrm );
    1380                 :            :     /** Reads a CHDEFAULTTEXT group (default text formats). */
    1381                 :            :     void                ReadChDefaultText( XclImpStream& rStrm );
    1382                 :            :     /** Reads a CHDATAFORMAT group describing a series format or a data point format. */
    1383                 :            :     void                ReadChDataFormat( XclImpStream& rStrm );
    1384                 :            : 
    1385                 :            :     /** Sets formatting from BIFF3-BIFF5 OBJ record, if own formatting is invisible. */
    1386                 :            :     void                UpdateObjFrame( const XclObjLineData& rLineData, const XclObjFillData& rFillData );
    1387                 :            : 
    1388                 :            :     /** Returns the specified chart type group. */
    1389                 :            :     XclImpChTypeGroupRef GetTypeGroup( sal_uInt16 nGroupIdx ) const;
    1390                 :            :     /** Returns the specified default text. */
    1391                 :            :     const XclImpChText*  GetDefaultText( XclChTextType eTextType ) const;
    1392                 :            :     /** Returns true, if the plot area has benn moved and/or resized manually. */
    1393                 :            :     bool                IsManualPlotArea() const;
    1394                 :            :     /** Returns the number of units on the progress bar needed for the chart. */
    1395                 :          6 :     inline sal_Size     GetProgressSize() const { return 2 * EXC_CHART_PROGRESS_SIZE; }
    1396                 :            : 
    1397                 :            :     /** Converts and writes all properties to the passed chart. */
    1398                 :            :     void                Convert(
    1399                 :            :         const ::com::sun::star::uno::Reference<
    1400                 :            :             com::sun::star::chart2::XChartDocument>& xChartDoc,
    1401                 :            :         XclImpDffConverter& rDffConv,
    1402                 :            :         const ::rtl::OUString& rObjName,
    1403                 :            :         const Rectangle& rChartRect ) const;
    1404                 :            : 
    1405                 :            : private:
    1406                 :            :     /** Reads a CHSERIES group (data series source and formatting). */
    1407                 :            :     void                ReadChSeries( XclImpStream& rStrm );
    1408                 :            :     /** Reads a CHPROPERTIES record (global chart properties). */
    1409                 :            :     void                ReadChProperties( XclImpStream& rStrm );
    1410                 :            :     /** Reads a CHAXESSET group (primary/secondary axes set). */
    1411                 :            :     void                ReadChAxesSet( XclImpStream& rStrm );
    1412                 :            :     /** Reads a CHTEXT group (chart title and series/point captions). */
    1413                 :            :     void                ReadChText( XclImpStream& rStrm );
    1414                 :            : 
    1415                 :            :     /** Final processing after reading the entire chart data. */
    1416                 :            :     void                Finalize();
    1417                 :            :     /** Finalizes series list, assigns child series to parent series. */
    1418                 :            :     void                FinalizeSeries();
    1419                 :            :     /** Assigns all imported CHDATAFORMAT groups to the respective series. */
    1420                 :            :     void                FinalizeDataFormats();
    1421                 :            :     /** Finalizes chart title, tries to detect title auto-generated from series name. */
    1422                 :            :     void                FinalizeTitle();
    1423                 :            : 
    1424                 :            :     /** Creates and returns a new diagram object and converts global chart settings. */
    1425                 :            :     com::sun::star::uno::Reference<com::sun::star::chart2::XDiagram>
    1426                 :            :         CreateDiagram() const;
    1427                 :            : 
    1428                 :            : private:
    1429                 :            :     typedef ::std::vector< XclImpChSeriesRef >                   XclImpChSeriesVec;
    1430                 :            :     typedef ::std::map<XclChDataPointPos, XclImpChDataFormatRef> XclImpChDataFormatMap;
    1431                 :            :     typedef ::boost::ptr_map<sal_uInt16, XclImpChText>           XclImpChTextMap;
    1432                 :            : 
    1433                 :            :     XclChRectangle      maRect;             /// Position of the chart on the sheet (CHCHART record).
    1434                 :            :     XclImpChSeriesVec   maSeries;           /// List of series data (CHSERIES groups).
    1435                 :            :     XclImpChDataFormatMap maDataFmts;       /// All series and point formats (CHDATAFORMAT groups).
    1436                 :            :     XclImpChFrameRef    mxFrame;            /// Chart frame format (CHFRAME group).
    1437                 :            :     XclChProperties     maProps;            /// Chart properties (CHPROPERTIES record).
    1438                 :            :     XclImpChTextMap     maDefTexts;         /// Default text objects (CHDEFAULTTEXT groups).
    1439                 :            :     XclImpChAxesSetRef  mxPrimAxesSet;      /// Primary axes set (CHAXESSET group).
    1440                 :            :     XclImpChAxesSetRef  mxSecnAxesSet;      /// Secondary axes set (CHAXESSET group).
    1441                 :            :     XclImpChTextRef     mxTitle;            /// Chart title (CHTEXT group).
    1442                 :            :     XclImpChLegendRef   mxLegend;           /// Chart legend (CHLEGEND group).
    1443                 :            : };
    1444                 :            : 
    1445                 :            : typedef boost::shared_ptr< XclImpChChart > XclImpChChartRef;
    1446                 :            : 
    1447                 :            : // ----------------------------------------------------------------------------
    1448                 :            : 
    1449                 :            : /** Drawing container of a chart. */
    1450         [ #  # ]:          0 : class XclImpChartDrawing : public XclImpDrawing
    1451                 :            : {
    1452                 :            : public:
    1453                 :            :     explicit            XclImpChartDrawing( const XclImpRoot& rRoot, bool bOwnTab );
    1454                 :            : 
    1455                 :            :     /** Converts all objects and inserts them into the chart drawing page. */
    1456                 :            :     void                ConvertObjects(
    1457                 :            :                             XclImpDffConverter& rDffConv,
    1458                 :            :                             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel,
    1459                 :            :                             const Rectangle& rChartRect );
    1460                 :            : 
    1461                 :            :     /** Calculate the resulting rectangle of the passed anchor. */
    1462                 :            :     virtual Rectangle   CalcAnchorRect( const XclObjAnchor& rAnchor, bool bDffAnchor ) const;
    1463                 :            :     /** Called whenever an object has been inserted into the draw page. */
    1464                 :            :     virtual void        OnObjectInserted( const XclImpDrawObjBase& rDrawObj );
    1465                 :            : 
    1466                 :            : private:
    1467                 :            :     Rectangle           maChartRect;        /// Position and size of the chart shape in 1/100 mm.
    1468                 :            :     SCTAB               mnScTab;            /// Index of the sheet that contains the chart.
    1469                 :            :     bool                mbOwnTab;           /// True = own sheet, false = embedded object.
    1470                 :            : };
    1471                 :            : 
    1472                 :            : // ----------------------------------------------------------------------------
    1473                 :            : 
    1474                 :            : /** Represents the entire chart substream (all records in BOF/EOF block). */
    1475                 :            : class XclImpChart : protected XclImpRoot
    1476                 :            : {
    1477                 :            : public:
    1478                 :            :     typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > XModelRef;
    1479                 :            : 
    1480                 :            : public:
    1481                 :            :     /** Constructs a new chart object.
    1482                 :            :         @param bOwnTab  True = chart is on an own sheet; false = chart is an embedded object. */
    1483                 :            :     explicit            XclImpChart( const XclImpRoot& rRoot, bool bOwnTab );
    1484                 :            :     virtual             ~XclImpChart();
    1485                 :            : 
    1486                 :            :     /** Reads the complete chart substream (BOF/EOF block).
    1487                 :            :         @descr  The passed stream must be located in the BOF record of the chart substream. */
    1488                 :            :     void                ReadChartSubStream( XclImpStream& rStrm );
    1489                 :            :     /** Sets formatting from BIFF3-BIFF5 OBJ record, if own formatting is invisible. */
    1490                 :            :     void                UpdateObjFrame( const XclObjLineData& rLineData, const XclObjFillData& rFillData );
    1491                 :            : 
    1492                 :            :     /** Returns the number of units on the progress bar needed for the chart. */
    1493                 :            :     sal_Size            GetProgressSize() const;
    1494                 :            :     /** Returns true, if the chart is based on a pivot table. */
    1495                 :          6 :     inline bool         IsPivotChart() const { return mbIsPivotChart; }
    1496                 :            : 
    1497                 :            :     /** Creates the chart object in the passed component. */
    1498                 :            :     void                Convert( XModelRef xModel,
    1499                 :            :                             XclImpDffConverter& rDffConv,
    1500                 :            :                             const ::rtl::OUString& rObjName,
    1501                 :            :                             const Rectangle& rChartRect ) const;
    1502                 :            : 
    1503                 :            : private:
    1504                 :            :     /** Returns (initially creates) the drawing container for embedded shapes. **/
    1505                 :            :     XclImpChartDrawing& GetChartDrawing();
    1506                 :            :     /** Reads the CHCHART group (entire chart data). */
    1507                 :            :     void                ReadChChart( XclImpStream& rStrm );
    1508                 :            : 
    1509                 :            : private:
    1510                 :            :     typedef boost::shared_ptr< XclImpChartDrawing > XclImpChartDrawingRef;
    1511                 :            : 
    1512                 :            :     XclImpChChartRef    mxChartData;        /// The chart data (CHCHART group).
    1513                 :            :     XclImpChartDrawingRef mxChartDrawing;   /// Drawing container for embedded shapes.
    1514                 :            :     bool                mbOwnTab;           /// true = own sheet; false = embedded object.
    1515                 :            :     bool                mbIsPivotChart;     /// true = chart is based on a pivot table.
    1516                 :            : };
    1517                 :            : 
    1518                 :            : // ============================================================================
    1519                 :            : 
    1520                 :            : #endif
    1521                 :            : 
    1522                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10