LCOV - code coverage report
Current view: top level - sc/source/core/inc - doubleref.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 2 2 100.0 %
Date: 2014-11-03 Functions: 2 2 100.0 %
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_SOURCE_CORE_INC_DOUBLEREF_HXX
      21             : #define INCLUDED_SC_SOURCE_CORE_INC_DOUBLEREF_HXX
      22             : 
      23             : #include "address.hxx"
      24             : #include "types.hxx"
      25             : 
      26             : class ScDocument;
      27             : struct ScDBQueryParamBase;
      28             : struct ScQueryParamBase;
      29             : 
      30             : /**
      31             :  * Base class for abstracting range data backends for database functions.
      32             :  */
      33             : class ScDBRangeBase
      34             : {
      35             : public:
      36             :     enum RefType { INTERNAL, EXTERNAL }; // TODO: We may not need this after all... (kohei)
      37             : 
      38             :     virtual ~ScDBRangeBase() = 0;
      39             : 
      40             :     bool fillQueryEntries(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef) const;
      41             : 
      42             :     virtual SCCOL getColSize() const = 0;
      43             :     virtual SCROW getRowSize() const = 0;
      44             :     virtual SCSIZE getVisibleDataCellCount() const = 0;
      45             : 
      46             :     /**
      47             :      * Get a string value of a specified cell position.  Note that the
      48             :      * position of the upper left cell of the range is always (0, 0) even if
      49             :      * the reference type is of internal range.
      50             :      *
      51             :      * @param nCol column position (0 to column size-1)
      52             :      * @param nRow row position (0 to row size-1)
      53             :      */
      54             :     virtual OUString getString(SCCOL nCol, SCROW nRow) const = 0;
      55             : 
      56             :     virtual SCCOL getFirstFieldColumn() const = 0;
      57             : 
      58             :     /**
      59             :      * Get a <i>0-based</i> column index that corresponds with the passed field
      60             :      * index.  Note that the field index passed as the 1st parameter is
      61             :      * <i>1-based.</i>
      62             :      *
      63             :      * @param nIndex 1-based field index.
      64             :      *
      65             :      * @return 0-based column index
      66             :      */
      67             :     virtual SCCOL findFieldColumn(SCCOL nIndex) const = 0;
      68             :     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const = 0;
      69             :     virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
      70             :     virtual bool isRangeEqual(const ScRange& rRange) const = 0;
      71             : 
      72             : protected:
      73             :     ScDBRangeBase(ScDocument* pDoc, RefType eType);
      74        1140 :     ScDocument* getDoc() const { return mpDoc;}
      75             : 
      76             :     /**
      77             :      * Populate query options that are always the same for all database
      78             :      * queries.
      79             :      */
      80             :     static void fillQueryOptions(ScQueryParamBase* pParam);
      81             : 
      82             : private:
      83             :     ScDBRangeBase(); // disabled
      84             : 
      85             :     ScDocument* mpDoc;
      86             :     RefType meType;
      87             : };
      88             : 
      89             : class ScDBInternalRange : public ScDBRangeBase
      90             : {
      91             : public:
      92             :     explicit ScDBInternalRange(ScDocument* pDoc, const ScRange& rRange);
      93             :     virtual ~ScDBInternalRange();
      94             : 
      95          48 :     const ScRange& getRange() const { return maRange;}
      96             : 
      97             :     virtual SCCOL getColSize() const SAL_OVERRIDE;
      98             :     virtual SCROW getRowSize() const SAL_OVERRIDE;
      99             :     virtual SCSIZE getVisibleDataCellCount() const SAL_OVERRIDE;
     100             : 
     101             :     /**
     102             :      * Get a string value of a specified cell position.  Note that the
     103             :      * position of the upper left cell of the range is always (0, 0) even if
     104             :      * the reference type is of internal range.
     105             :      *
     106             :      * @param nCol column position (0 to column size-1)
     107             :      * @param nRow row position (0 to row size-1)
     108             :      */
     109             :     virtual OUString getString(SCCOL nCol, SCROW nRow) const SAL_OVERRIDE;
     110             : 
     111             :     virtual SCCOL getFirstFieldColumn() const SAL_OVERRIDE;
     112             :     /**
     113             :      * Get a <i>0-based</i> column index that corresponds with the passed field
     114             :      * index.  Note that the field index passed as the 1st parameter is
     115             :      * <i>1-based.</i>
     116             :      *
     117             :      * @param nIndex 1-based field index.
     118             :      *
     119             :      * @return 0-based column index
     120             :      */
     121             :     virtual SCCOL findFieldColumn(SCCOL nIndex) const SAL_OVERRIDE;
     122             :     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const SAL_OVERRIDE;
     123             :     virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
     124             :     virtual bool isRangeEqual(const ScRange& rRange) const SAL_OVERRIDE;
     125             : 
     126             : private:
     127             :     ScRange maRange;
     128             : };
     129             : 
     130             : class ScDBExternalRange : public ScDBRangeBase
     131             : {
     132             : public:
     133             :     explicit ScDBExternalRange(ScDocument* pDoc, const ScMatrixRef& pMat);
     134             :     virtual ~ScDBExternalRange();
     135             : 
     136             :     virtual SCCOL getColSize() const SAL_OVERRIDE;
     137             :     virtual SCROW getRowSize() const SAL_OVERRIDE;
     138             :     virtual SCSIZE getVisibleDataCellCount() const SAL_OVERRIDE;
     139             : 
     140             :     /**
     141             :      * Get a string value of a specified cell position.  Note that the
     142             :      * position of the upper left cell of the range is always (0, 0) even if
     143             :      * the reference type is of internal range.
     144             :      *
     145             :      * @param nCol column position (0 to column size-1)
     146             :      * @param nRow row position (0 to row size-1)
     147             :      */
     148             :     virtual OUString getString(SCCOL nCol, SCROW nRow) const SAL_OVERRIDE;
     149             : 
     150             :     virtual SCCOL getFirstFieldColumn() const SAL_OVERRIDE;
     151             : 
     152             :     /**
     153             :      * Get a <i>0-based</i> column index that corresponds with the passed field
     154             :      * index.  Note that the field index passed as the 1st parameter is
     155             :      * <i>1-based.</i>
     156             :      *
     157             :      * @param nIndex 1-based field index.
     158             :      *
     159             :      * @return 0-based column index
     160             :      */
     161             :     virtual SCCOL findFieldColumn(SCCOL nIndex) const SAL_OVERRIDE;
     162             :     virtual SCCOL findFieldColumn(const OUString& rStr, sal_uInt16* pErr = NULL) const SAL_OVERRIDE;
     163             :     virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const SAL_OVERRIDE;
     164             :     virtual bool isRangeEqual(const ScRange& rRange) const SAL_OVERRIDE;
     165             : 
     166             : private:
     167             :     const ScMatrixRef mpMatrix;
     168             :     SCCOL mnCols;
     169             :     SCROW mnRows;
     170             : };
     171             : 
     172             : #endif
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10