LCOV - code coverage report
Current view: top level - sc/inc - chartarr.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 15 93.3 %
Date: 2015-06-13 12:38:46 Functions: 14 15 93.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SC_INC_CHARTARR_HXX
      21             : #define INCLUDED_SC_INC_CHARTARR_HXX
      22             : 
      23             : #include "rangelst.hxx"
      24             : #include "chartpos.hxx"
      25             : 
      26             : #include <boost/ptr_container/ptr_vector.hpp>
      27             : 
      28             : class ScDocument;
      29             : 
      30             : // ScMemChart is a stripped-down SchMemChart from old chart,
      31             : // used only to transport a rectangular data array for the UNO API,
      32             : // contains only column/row header text and data values.
      33             : 
      34             : class ScMemChart
      35             : {
      36             :     SCROW nRowCnt;
      37             :     SCCOL nColCnt;
      38             :     double* pData;
      39             :     OUString* pColText;
      40             :     OUString* pRowText;
      41             : 
      42             :     ScMemChart(const ScMemChart& rMemChart) SAL_DELETED_FUNCTION;
      43             : 
      44             : public:
      45             :     ScMemChart(SCCOL nCols, SCROW nRows);
      46             :     ~ScMemChart();
      47             : 
      48          12 :     SCCOL GetColCount() const { return nColCnt; }
      49          12 :     SCROW GetRowCount() const { return nRowCnt; }
      50          12 :     const OUString& GetColText(SCCOL nCol) const { return pColText[nCol]; }
      51          45 :     const OUString& GetRowText(SCROW nRow) const { return pRowText[nRow]; }
      52          94 :     double GetData(SCCOL nCol, SCROW nRow) const { return pData[nCol * nRowCnt + nRow]; }
      53         232 :     void SetData(SCCOL nCol, SCROW nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; }
      54          36 :     void SetColText(SCCOL nCol, const OUString& rText) { pColText[nCol] = rText; }
      55         144 :     void SetRowText(SCROW nRow, const OUString& rText) { pRowText[nRow] = rText; }
      56             : };
      57             : 
      58             : class SC_DLLPUBLIC ScChartArray             // only parameter-struct
      59             : {
      60             :     OUString aName;
      61             :     ScDocument* pDocument;
      62             :     ScChartPositioner aPositioner;
      63             :     bool        bValid;             // for creation out of SchMemChart
      64             : 
      65             : private:
      66             :     ScMemChart* CreateMemChartSingle();
      67             :     ScMemChart* CreateMemChartMulti();
      68             : public:
      69             :     ScChartArray( ScDocument* pDoc, SCTAB nTab,
      70             :                   SCCOL nStartColP, SCROW nStartRowP,
      71             :                   SCCOL nEndColP, SCROW nEndRowP,
      72             :                   const OUString& rChartName );
      73             :     ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList,
      74             :                   const OUString& rChartName );
      75             :     ScChartArray( const ScChartArray& rArr );
      76             :     ~ScChartArray();
      77             : 
      78          26 :     const ScRangeListRef&   GetRangeList() const { return aPositioner.GetRangeList(); }
      79             :     void    SetRangeList( const ScRangeListRef& rNew ) { aPositioner.SetRangeList(rNew); }
      80             :     void    SetRangeList( const ScRange& rNew ) { aPositioner.SetRangeList(rNew); }
      81         288 :     const   ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); }
      82             : 
      83          26 :     void    SetHeaders(bool bCol, bool bRow) { aPositioner.SetHeaders(bCol, bRow); }
      84          44 :     bool    HasColHeaders() const { return aPositioner.HasColHeaders(); }
      85         152 :     bool    HasRowHeaders() const { return aPositioner.HasRowHeaders(); }
      86             :     bool IsValid() const { return bValid; }
      87             :     void SetName(const OUString& rNew) { aName = rNew; }
      88           0 :     const OUString& GetName() const { return aName; }
      89             : 
      90             :     bool operator==(const ScChartArray& rCmp) const;
      91             : 
      92             :     ScMemChart* CreateMemChart();
      93             : };
      94             : 
      95        2287 : class ScChartCollection
      96             : {
      97             :     typedef ::boost::ptr_vector<ScChartArray> DataType;
      98             :     DataType maData;
      99             : public:
     100             :     ScChartCollection();
     101             :     ScChartCollection(const ScChartCollection& rColl);
     102             : 
     103             :     SC_DLLPUBLIC void push_back(ScChartArray* p);
     104             :     void clear();
     105             :     size_t size() const;
     106             :     bool empty() const;
     107             :     ScChartArray* operator[](size_t nIndex);
     108             :     const ScChartArray* operator[](size_t nIndex) const;
     109             : 
     110             :     bool operator==(const ScChartCollection& rCmp) const;
     111             : };
     112             : 
     113             : #endif
     114             : 
     115             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11