diff options
author | Vladimir Glazunov <vg@openoffice.org> | 2010-02-12 17:46:41 +0100 |
---|---|---|
committer | Vladimir Glazunov <vg@openoffice.org> | 2010-02-12 17:46:41 +0100 |
commit | 68bb4c0307a4297e5a7d935459eb2b8f4868cc3c (patch) | |
tree | f7f457717df963a13d58160cf91f3208a316bec2 /sc/source/core/inc | |
parent | ad29ee75ae721392632cfd24c232e3e9ec80c4c8 (diff) | |
parent | bf7748b5b236cba3d47790224bd7db31d73f5665 (diff) |
CWS-TOOLING: integrate CWS kohei03
Diffstat (limited to 'sc/source/core/inc')
-rw-r--r-- | sc/source/core/inc/doubleref.hxx | 194 | ||||
-rw-r--r-- | sc/source/core/inc/interpre.hxx | 6 |
2 files changed, 199 insertions, 1 deletions
diff --git a/sc/source/core/inc/doubleref.hxx b/sc/source/core/inc/doubleref.hxx new file mode 100644 index 000000000..d79b90790 --- /dev/null +++ b/sc/source/core/inc/doubleref.hxx @@ -0,0 +1,194 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: interpre.hxx,v $ + * $Revision: 1.35.44.2 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef SC_DOUBLEREF_HXX +#define SC_DOUBLEREF_HXX + +#include "address.hxx" +#include "scmatrix.hxx" + +class ScDocument; +class ScBaseCell; +struct ScDBQueryParamBase; +struct ScQueryParamBase; + +// ============================================================================ + +/** + * Base class for abstracting range data backends for database functions. + */ +class ScDBRangeBase +{ +public: + enum RefType { INTERNAL, EXTERNAL }; + + virtual ~ScDBRangeBase() = 0; + + RefType getType() const; + bool fillQueryEntries(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef) const; + + virtual SCCOL getColSize() const = 0; + virtual SCROW getRowSize() const = 0; + virtual SCSIZE getVisibleDataCellCount() const = 0; + + /** + * Get a string value of a specified cell position. Note that the + * position of the upper left cell of the range is always (0, 0) even if + * the reference type is of internal range. + * + * @param nCol column position (0 to column size-1) + * @param nRow row position (0 to row size-1) + */ + virtual ::rtl::OUString getString(SCCOL nCol, SCROW nRow) const = 0; + + virtual SCCOL getFirstFieldColumn() const = 0; + + /** + * Get a <i>0-based</i> column index that corresponds with the passed field + * index. Note that the field index passed as the 1st parameter is + * <i>1-based.</i> + * + * @param nIndex 1-based field index. + * + * @return 0-based column index + */ + virtual SCCOL findFieldColumn(SCCOL nIndex) const = 0; + virtual SCCOL findFieldColumn(const ::rtl::OUString& rStr, sal_uInt16* pErr = NULL) const = 0; + virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const = 0; + virtual bool isRangeEqual(const ScRange& rRange) const = 0; + +protected: + ScDBRangeBase(ScDocument* pDoc, RefType eType); + ScDocument* getDoc() const; + + /** + * Populate query options that are always the same for all database + * queries. + */ + static void fillQueryOptions(ScQueryParamBase* pParam); + +private: + ScDBRangeBase(); // disabled + + ScDocument* mpDoc; + RefType meType; +}; + +// ============================================================================ + +class ScDBInternalRange : public ScDBRangeBase +{ +public: + explicit ScDBInternalRange(ScDocument* pDoc, const ScRange& rRange); + virtual ~ScDBInternalRange(); + + const ScRange& getRange() const; + + virtual SCCOL getColSize() const; + virtual SCROW getRowSize() const; + virtual SCSIZE getVisibleDataCellCount() const; + + /** + * Get a string value of a specified cell position. Note that the + * position of the upper left cell of the range is always (0, 0) even if + * the reference type is of internal range. + * + * @param nCol column position (0 to column size-1) + * @param nRow row position (0 to row size-1) + */ + virtual ::rtl::OUString getString(SCCOL nCol, SCROW nRow) const; + + virtual SCCOL getFirstFieldColumn() const; + /** + * Get a <i>0-based</i> column index that corresponds with the passed field + * index. Note that the field index passed as the 1st parameter is + * <i>1-based.</i> + * + * @param nIndex 1-based field index. + * + * @return 0-based column index + */ + virtual SCCOL findFieldColumn(SCCOL nIndex) const; + virtual SCCOL findFieldColumn(const ::rtl::OUString& rStr, sal_uInt16* pErr = NULL) const; + virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const; + virtual bool isRangeEqual(const ScRange& rRange) const; + +private: + sal_uInt16 getCellString(::rtl::OUString& rStr, ScBaseCell* pCell) const; + +private: + ScRange maRange; +}; + +// ============================================================================ + +class ScDBExternalRange : public ScDBRangeBase +{ +public: + explicit ScDBExternalRange(ScDocument* pDoc, const ScMatrixRef& pMat); + virtual ~ScDBExternalRange(); + + virtual SCCOL getColSize() const; + virtual SCROW getRowSize() const; + virtual SCSIZE getVisibleDataCellCount() const; + + /** + * Get a string value of a specified cell position. Note that the + * position of the upper left cell of the range is always (0, 0) even if + * the reference type is of internal range. + * + * @param nCol column position (0 to column size-1) + * @param nRow row position (0 to row size-1) + */ + virtual ::rtl::OUString getString(SCCOL nCol, SCROW nRow) const; + + virtual SCCOL getFirstFieldColumn() const; + + /** + * Get a <i>0-based</i> column index that corresponds with the passed field + * index. Note that the field index passed as the 1st parameter is + * <i>1-based.</i> + * + * @param nIndex 1-based field index. + * + * @return 0-based column index + */ + virtual SCCOL findFieldColumn(SCCOL nIndex) const; + virtual SCCOL findFieldColumn(const ::rtl::OUString& rStr, sal_uInt16* pErr = NULL) const; + virtual ScDBQueryParamBase* createQueryParam(const ScDBRangeBase* pQueryRef) const; + virtual bool isRangeEqual(const ScRange& rRange) const; + +private: + const ScMatrixRef mpMatrix; + SCCOL mnCols; + SCROW mnRows; +}; + +#endif diff --git a/sc/source/core/inc/interpre.hxx b/sc/source/core/inc/interpre.hxx index 58bc46fcb..0252f1d88 100644 --- a/sc/source/core/inc/interpre.hxx +++ b/sc/source/core/inc/interpre.hxx @@ -53,7 +53,10 @@ class SbxVariable; class ScBaseCell; class ScFormulaCell; class SvNumberFormatter; +class ScDBRangeBase; struct MatrixDoubleOp; +struct ScQueryParam; +struct ScDBQueryParamBase; struct ScCompare { @@ -302,6 +305,7 @@ void DoubleRefToVars( const ScToken* p, SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1, SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2, BOOL bDontCheckForTableOp = FALSE ); +ScDBRangeBase* PopDoubleRef(); void PopDoubleRef(SCCOL& rCol1, SCROW &rRow1, SCTAB& rTab1, SCCOL& rCol2, SCROW &rRow2, SCTAB& rTab2, BOOL bDontCheckForTableOp = FALSE ); @@ -491,7 +495,7 @@ void ScSubTotal(); // compatibility). If this was the case then rMissingField is set to TRUE upon // return. If rMissingField==FALSE upon call all "missing cases" are considered // to be an error. -BOOL GetDBParams( SCTAB& rTab, ScQueryParam& rParam, BOOL& rMissingField ); +ScDBQueryParamBase* GetDBParams( BOOL& rMissingField ); void DBIterator( ScIterFunc ); void ScDBSum(); |