fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / inc / doubleref.hxx
blob3c7d18248cc90c545a163641f65c2163d378d645
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 INCLUDED_SC_SOURCE_CORE_INC_DOUBLEREF_HXX
21 #define INCLUDED_SC_SOURCE_CORE_INC_DOUBLEREF_HXX
23 #include "address.hxx"
24 #include "types.hxx"
26 class ScDocument;
27 struct ScDBQueryParamBase;
28 struct ScQueryParamBase;
30 /**
31 * Base class for abstracting range data backends for database functions.
33 class ScDBRangeBase
35 public:
36 enum RefType { INTERNAL, EXTERNAL }; // TODO: We may not need this after all... (kohei)
38 virtual ~ScDBRangeBase() = 0;
40 bool fillQueryEntries(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef) const;
42 virtual SCCOL getColSize() const = 0;
43 virtual SCROW getRowSize() const = 0;
44 virtual SCSIZE getVisibleDataCellCount() const = 0;
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.
51 * @param nCol column position (0 to column size-1)
52 * @param nRow row position (0 to row size-1)
54 virtual OUString getString(SCCOL nCol, SCROW nRow) const = 0;
56 virtual SCCOL getFirstFieldColumn() const = 0;
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>
63 * @param nIndex 1-based field index.
65 * @return 0-based column index
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;
72 protected:
73 ScDBRangeBase(ScDocument* pDoc, RefType eType);
74 ScDocument* getDoc() const { return mpDoc;}
76 /**
77 * Populate query options that are always the same for all database
78 * queries.
80 static void fillQueryOptions(ScQueryParamBase* pParam);
82 private:
83 ScDBRangeBase(); // disabled
85 ScDocument* mpDoc;
86 RefType meType;
89 class ScDBInternalRange : public ScDBRangeBase
91 public:
92 explicit ScDBInternalRange(ScDocument* pDoc, const ScRange& rRange);
93 virtual ~ScDBInternalRange();
95 const ScRange& getRange() const { return maRange;}
97 virtual SCCOL getColSize() const SAL_OVERRIDE;
98 virtual SCROW getRowSize() const SAL_OVERRIDE;
99 virtual SCSIZE getVisibleDataCellCount() const SAL_OVERRIDE;
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.
106 * @param nCol column position (0 to column size-1)
107 * @param nRow row position (0 to row size-1)
109 virtual OUString getString(SCCOL nCol, SCROW nRow) const SAL_OVERRIDE;
111 virtual SCCOL getFirstFieldColumn() const SAL_OVERRIDE;
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>
117 * @param nIndex 1-based field index.
119 * @return 0-based column index
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;
126 private:
127 ScRange maRange;
130 class ScDBExternalRange : public ScDBRangeBase
132 public:
133 explicit ScDBExternalRange(ScDocument* pDoc, const ScMatrixRef& pMat);
134 virtual ~ScDBExternalRange();
136 virtual SCCOL getColSize() const SAL_OVERRIDE;
137 virtual SCROW getRowSize() const SAL_OVERRIDE;
138 virtual SCSIZE getVisibleDataCellCount() const SAL_OVERRIDE;
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.
145 * @param nCol column position (0 to column size-1)
146 * @param nRow row position (0 to row size-1)
148 virtual OUString getString(SCCOL nCol, SCROW nRow) const SAL_OVERRIDE;
150 virtual SCCOL getFirstFieldColumn() const SAL_OVERRIDE;
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>
157 * @param nIndex 1-based field index.
159 * @return 0-based column index
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;
166 private:
167 const ScMatrixRef mpMatrix;
168 SCCOL mnCols;
169 SCROW mnRows;
172 #endif
174 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */