1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_DOUBLEREF_HXX
21 #define SC_DOUBLEREF_HXX
23 #include "address.hxx"
27 struct ScDBQueryParamBase
;
28 struct ScQueryParamBase
;
30 // ============================================================================
33 * Base class for abstracting range data backends for database functions.
38 enum RefType
{ INTERNAL
, EXTERNAL
}; // TODO: We may not need this after all... (kohei)
40 virtual ~ScDBRangeBase() = 0;
42 bool fillQueryEntries(ScQueryParamBase
* pParam
, const ScDBRangeBase
* pDBRef
) const;
44 virtual SCCOL
getColSize() const = 0;
45 virtual SCROW
getRowSize() const = 0;
46 virtual SCSIZE
getVisibleDataCellCount() const = 0;
49 * Get a string value of a specified cell position. Note that the
50 * position of the upper left cell of the range is always (0, 0) even if
51 * the reference type is of internal range.
53 * @param nCol column position (0 to column size-1)
54 * @param nRow row position (0 to row size-1)
56 virtual OUString
getString(SCCOL nCol
, SCROW nRow
) const = 0;
58 virtual SCCOL
getFirstFieldColumn() const = 0;
61 * Get a <i>0-based</i> column index that corresponds with the passed field
62 * index. Note that the field index passed as the 1st parameter is
65 * @param nIndex 1-based field index.
67 * @return 0-based column index
69 virtual SCCOL
findFieldColumn(SCCOL nIndex
) const = 0;
70 virtual SCCOL
findFieldColumn(const OUString
& rStr
, sal_uInt16
* pErr
= NULL
) const = 0;
71 virtual ScDBQueryParamBase
* createQueryParam(const ScDBRangeBase
* pQueryRef
) const = 0;
72 virtual bool isRangeEqual(const ScRange
& rRange
) const = 0;
75 ScDBRangeBase(ScDocument
* pDoc
, RefType eType
);
76 ScDocument
* getDoc() const;
79 * Populate query options that are always the same for all database
82 static void fillQueryOptions(ScQueryParamBase
* pParam
);
85 ScDBRangeBase(); // disabled
91 // ============================================================================
93 class ScDBInternalRange
: public ScDBRangeBase
96 explicit ScDBInternalRange(ScDocument
* pDoc
, const ScRange
& rRange
);
97 virtual ~ScDBInternalRange();
99 const ScRange
& getRange() const;
101 virtual SCCOL
getColSize() const;
102 virtual SCROW
getRowSize() const;
103 virtual SCSIZE
getVisibleDataCellCount() const;
106 * Get a string value of a specified cell position. Note that the
107 * position of the upper left cell of the range is always (0, 0) even if
108 * the reference type is of internal range.
110 * @param nCol column position (0 to column size-1)
111 * @param nRow row position (0 to row size-1)
113 virtual OUString
getString(SCCOL nCol
, SCROW nRow
) const;
115 virtual SCCOL
getFirstFieldColumn() const;
117 * Get a <i>0-based</i> column index that corresponds with the passed field
118 * index. Note that the field index passed as the 1st parameter is
121 * @param nIndex 1-based field index.
123 * @return 0-based column index
125 virtual SCCOL
findFieldColumn(SCCOL nIndex
) const;
126 virtual SCCOL
findFieldColumn(const OUString
& rStr
, sal_uInt16
* pErr
= NULL
) const;
127 virtual ScDBQueryParamBase
* createQueryParam(const ScDBRangeBase
* pQueryRef
) const;
128 virtual bool isRangeEqual(const ScRange
& rRange
) const;
134 // ============================================================================
136 class ScDBExternalRange
: public ScDBRangeBase
139 explicit ScDBExternalRange(ScDocument
* pDoc
, const ScMatrixRef
& pMat
);
140 virtual ~ScDBExternalRange();
142 virtual SCCOL
getColSize() const;
143 virtual SCROW
getRowSize() const;
144 virtual SCSIZE
getVisibleDataCellCount() const;
147 * Get a string value of a specified cell position. Note that the
148 * position of the upper left cell of the range is always (0, 0) even if
149 * the reference type is of internal range.
151 * @param nCol column position (0 to column size-1)
152 * @param nRow row position (0 to row size-1)
154 virtual OUString
getString(SCCOL nCol
, SCROW nRow
) const;
156 virtual SCCOL
getFirstFieldColumn() const;
159 * Get a <i>0-based</i> column index that corresponds with the passed field
160 * index. Note that the field index passed as the 1st parameter is
163 * @param nIndex 1-based field index.
165 * @return 0-based column index
167 virtual SCCOL
findFieldColumn(SCCOL nIndex
) const;
168 virtual SCCOL
findFieldColumn(const OUString
& rStr
, sal_uInt16
* pErr
= NULL
) const;
169 virtual ScDBQueryParamBase
* createQueryParam(const ScDBRangeBase
* pQueryRef
) const;
170 virtual bool isRangeEqual(const ScRange
& rRange
) const;
173 const ScMatrixRef mpMatrix
;
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */