LCOV - code coverage report
Current view: top level - sc/inc - chartarr.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 14 15 93.3 %
Date: 2012-08-25 Functions: 14 15 93.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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_CHARTARR_HXX
      30                 :            : #define SC_CHARTARR_HXX
      31                 :            : 
      32                 :            : // -----------------------------------------------------------------------
      33                 :            : 
      34                 :            : #include "rangelst.hxx"
      35                 :            : #include "chartpos.hxx"
      36                 :            : 
      37                 :            : #include <boost/ptr_container/ptr_vector.hpp>
      38                 :            : 
      39                 :            : class ScDocument;
      40                 :            : 
      41                 :            : // ScMemChart is a stripped-down SchMemChart from old chart,
      42                 :            : // used only to transport a rectangular data array for the UNO API,
      43                 :            : // contains only column/row header text and data values.
      44                 :            : 
      45                 :            : class ScMemChart
      46                 :            : {
      47                 :            :     short           nRowCnt;
      48                 :            :     short           nColCnt;
      49                 :            :     double*         pData;
      50                 :            :     ::rtl::OUString* pColText;
      51                 :            :     ::rtl::OUString* pRowText;
      52                 :            : 
      53                 :            :     ScMemChart(const ScMemChart& rMemChart);      // not implemented
      54                 :            : 
      55                 :            : public:
      56                 :            :     ScMemChart(short nCols, short nRows);
      57                 :            :     ~ScMemChart();
      58                 :            : 
      59                 :         18 :     short GetColCount() const { return nColCnt; }
      60                 :         18 :     short GetRowCount() const { return nRowCnt; }
      61                 :         20 :     const ::rtl::OUString& GetColText(short nCol) const { return pColText[nCol]; }
      62                 :         53 :     const ::rtl::OUString& GetRowText(short nRow) const { return pRowText[nRow]; }
      63                 :        158 :     double GetData(short nCol, short nRow) const { return pData[nCol * nRowCnt + nRow]; }
      64                 :        360 :     void SetData(short nCol, short nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
      65                 :         68 :     void SetColText(short nCol, const ::rtl::OUString& rText) { pColText[nCol] = rText; }
      66                 :        176 :     void SetRowText(short nRow, const ::rtl::OUString& rText) { pRowText[nRow] = rText; }
      67                 :            : };
      68                 :            : 
      69                 :            : class SC_DLLPUBLIC ScChartArray             // only parameter-struct
      70                 :            : {
      71                 :            :     ::rtl::OUString aName;
      72                 :            :     ScDocument* pDocument;
      73                 :            :     ScChartPositioner aPositioner;
      74                 :            :     bool        bValid;             // for creation out of SchMemChart
      75                 :            : 
      76                 :            : private:
      77                 :            :     ScMemChart* CreateMemChartSingle();
      78                 :            :     ScMemChart* CreateMemChartMulti();
      79                 :            : public:
      80                 :            :     ScChartArray( ScDocument* pDoc, SCTAB nTab,
      81                 :            :                   SCCOL nStartColP, SCROW nStartRowP,
      82                 :            :                   SCCOL nEndColP, SCROW nEndRowP,
      83                 :            :                   const ::rtl::OUString& rChartName );
      84                 :            :     ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList,
      85                 :            :                   const ::rtl::OUString& rChartName );
      86                 :            :     ScChartArray( const ScChartArray& rArr );
      87                 :            :     ~ScChartArray();
      88                 :            : 
      89                 :         42 :     const ScRangeListRef&   GetRangeList() const { return aPositioner.GetRangeList(); }
      90                 :            :     void    SetRangeList( const ScRangeListRef& rNew ) { aPositioner.SetRangeList(rNew); }
      91                 :            :     void    SetRangeList( const ScRange& rNew ) { aPositioner.SetRangeList(rNew); }
      92                 :        291 :     const   ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
      93                 :            : 
      94                 :         37 :     void    SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); }
      95                 :         84 :     bool    HasColHeaders() const { return aPositioner.HasColHeaders(); }
      96                 :        192 :     bool    HasRowHeaders() const { return aPositioner.HasRowHeaders(); }
      97                 :            :     bool IsValid() const { return bValid; }
      98                 :            :     void SetName(const ::rtl::OUString& rNew) { aName = rNew; }
      99                 :          0 :     const ::rtl::OUString& GetName() const { return aName; }
     100                 :            : 
     101                 :            :     bool operator==(const ScChartArray& rCmp) const;
     102                 :            : 
     103                 :            :     ScMemChart* CreateMemChart();
     104                 :            : };
     105                 :            : 
     106                 :       1611 : class ScChartCollection
     107                 :            : {
     108                 :            :     typedef ::boost::ptr_vector<ScChartArray> DataType;
     109                 :            :     DataType maData;
     110                 :            : public:
     111                 :            :     ScChartCollection();
     112                 :            :     ScChartCollection(const ScChartCollection& rColl);
     113                 :            : 
     114                 :            :     SC_DLLPUBLIC void push_back(ScChartArray* p);
     115                 :            :     void clear();
     116                 :            :     size_t size() const;
     117                 :            :     bool empty() const;
     118                 :            :     ScChartArray* operator[](size_t nIndex);
     119                 :            :     const ScChartArray* operator[](size_t nIndex) const;
     120                 :            : 
     121                 :            :     bool operator==(const ScChartCollection& rCmp) const;
     122                 :            : };
     123                 :            : 
     124                 :            : #endif
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10