LibreOffice Module sc (master)  1
doubleref.hxx
Go to the documentation of this file.
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 <sal/config.h>
24 
25 #include <memory>
26 
27 #include <address.hxx>
28 #include <types.hxx>
29 
30 class ScDocument;
31 struct ScDBQueryParamBase;
32 struct ScQueryParamBase;
33 enum class FormulaError : sal_uInt16;
34 
39 {
40 public:
41  ScDBRangeBase() = delete;
42 
43  virtual ~ScDBRangeBase() = 0;
44 
45  bool fillQueryEntries(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef) const;
46 
47  virtual SCCOL getColSize() const = 0;
48  virtual SCROW getRowSize() const = 0;
49  virtual SCSIZE getVisibleDataCellCount() const = 0;
50 
59  virtual OUString getString(SCCOL nCol, SCROW nRow) const = 0;
60 
61  virtual SCCOL getFirstFieldColumn() const = 0;
62 
72  virtual SCCOL findFieldColumn(SCCOL nIndex) const = 0;
73  virtual SCCOL findFieldColumn(const OUString& rStr, FormulaError* pErr = nullptr) const = 0;
74  virtual std::unique_ptr<ScDBQueryParamBase>
75  createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
76  virtual bool isRangeEqual(const ScRange& rRange) const = 0;
77 
78 protected:
80  ScDocument* getDoc() const { return mpDoc; }
81 
86  static void fillQueryOptions(ScQueryParamBase* pParam);
87 
88 private:
90 };
91 
92 class ScDBInternalRange final : public ScDBRangeBase
93 {
94 public:
95  explicit ScDBInternalRange(ScDocument* pDoc, const ScRange& rRange);
96  virtual ~ScDBInternalRange() override;
97 
98  const ScRange& getRange() const { return maRange; }
99 
100  virtual SCCOL getColSize() const override;
101  virtual SCROW getRowSize() const override;
102  virtual SCSIZE getVisibleDataCellCount() const override;
103 
112  virtual OUString getString(SCCOL nCol, SCROW nRow) const override;
113 
114  virtual SCCOL getFirstFieldColumn() const override;
124  virtual SCCOL findFieldColumn(SCCOL nIndex) const override;
125  virtual SCCOL findFieldColumn(const OUString& rStr,
126  FormulaError* pErr = nullptr) const override;
127  virtual std::unique_ptr<ScDBQueryParamBase>
128  createQueryParam(const ScDBRangeBase* pQueryRef) const override;
129  virtual bool isRangeEqual(const ScRange& rRange) const override;
130 
131 private:
133 };
134 
135 class ScDBExternalRange final : public ScDBRangeBase
136 {
137 public:
138  explicit ScDBExternalRange(ScDocument* pDoc, const ScMatrixRef& pMat);
139  virtual ~ScDBExternalRange() override;
140 
141  virtual SCCOL getColSize() const override;
142  virtual SCROW getRowSize() const override;
143  virtual SCSIZE getVisibleDataCellCount() const override;
144 
153  virtual OUString getString(SCCOL nCol, SCROW nRow) const override;
154 
155  virtual SCCOL getFirstFieldColumn() const override;
156 
166  virtual SCCOL findFieldColumn(SCCOL nIndex) const override;
167  virtual SCCOL findFieldColumn(const OUString& rStr,
168  FormulaError* pErr = nullptr) const override;
169  virtual std::unique_ptr<ScDBQueryParamBase>
170  createQueryParam(const ScDBRangeBase* pQueryRef) const override;
171  virtual bool isRangeEqual(const ScRange& rRange) const override;
172 
173 private:
177 };
178 
179 #endif
180 
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScDBInternalRange(ScDocument *pDoc, const ScRange &rRange)
Definition: doubleref.cxx:275
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:284
virtual SCCOL getFirstFieldColumn() const =0
sal_Int32 nIndex
const ScRange & getRange() const
Definition: doubleref.hxx:98
static void fillQueryOptions(ScQueryParamBase *pParam)
Populate query options that are always the same for all database queries.
Definition: doubleref.cxx:265
virtual SCCOL getColSize() const =0
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:457
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:294
ScDBRangeBase()=delete
const ScMatrixRef mpMatrix
Definition: doubleref.hxx:174
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:320
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:45
virtual SCSIZE getVisibleDataCellCount() const =0
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:26
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
Definition: doubleref.cxx:304
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:470
virtual SCROW getRowSize() const override
Definition: doubleref.cxx:289
sal_Int16 SCCOL
Definition: types.hxx:22
Base class for abstracting range data backends for database functions.
Definition: doubleref.hxx:38
virtual ~ScDBRangeBase()=0
Definition: doubleref.cxx:253
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:412
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:384
virtual ~ScDBExternalRange() override
Definition: doubleref.cxx:398
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:362
ScDocument * getDoc() const
Definition: doubleref.hxx:80
FormulaError
sal_Int32 SCROW
Definition: types.hxx:18
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:430
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:435
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:315
virtual SCCOL findFieldColumn(SCCOL nIndex) const =0
Get a 0-based column index that corresponds with the passed field index.
virtual SCROW getRowSize() const =0
bool fillQueryEntries(ScQueryParamBase *pParam, const ScDBRangeBase *pDBRef) const
Definition: doubleref.cxx:257
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:402
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const =0
ScDocument * mpDoc
Definition: doubleref.hxx:89
virtual ~ScDBInternalRange() override
Definition: doubleref.cxx:280
ScDBExternalRange(ScDocument *pDoc, const ScMatrixRef &pMat)
Definition: doubleref.cxx:389
virtual OUString getString(SCCOL nCol, SCROW nRow) const =0
Get a string value of a specified cell position.
virtual bool isRangeEqual(const ScRange &rRange) const =0
virtual SCROW getRowSize() const override
Definition: doubleref.cxx:407
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
Definition: doubleref.cxx:422