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> createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
75  virtual bool isRangeEqual(const ScRange& rRange) const = 0;
76 
77 protected:
79  ScDocument* getDoc() const { return mpDoc;}
80 
85  static void fillQueryOptions(ScQueryParamBase* pParam);
86 
87 private:
89 };
90 
92 {
93 public:
94  explicit ScDBInternalRange(ScDocument* pDoc, const ScRange& rRange);
95  virtual ~ScDBInternalRange() override;
96 
97  const ScRange& getRange() const { return maRange;}
98 
99  virtual SCCOL getColSize() const override;
100  virtual SCROW getRowSize() const override;
101  virtual SCSIZE getVisibleDataCellCount() const override;
102 
111  virtual OUString getString(SCCOL nCol, SCROW nRow) const override;
112 
113  virtual SCCOL getFirstFieldColumn() const override;
123  virtual SCCOL findFieldColumn(SCCOL nIndex) const override;
124  virtual SCCOL findFieldColumn(const OUString& rStr, FormulaError* pErr = nullptr) const override;
125  virtual std::unique_ptr<ScDBQueryParamBase> createQueryParam(const ScDBRangeBase* pQueryRef) const override;
126  virtual bool isRangeEqual(const ScRange& rRange) const override;
127 
128 private:
130 };
131 
133 {
134 public:
135  explicit ScDBExternalRange(ScDocument* pDoc, const ScMatrixRef& pMat);
136  virtual ~ScDBExternalRange() override;
137 
138  virtual SCCOL getColSize() const override;
139  virtual SCROW getRowSize() const override;
140  virtual SCSIZE getVisibleDataCellCount() const override;
141 
150  virtual OUString getString(SCCOL nCol, SCROW nRow) const override;
151 
152  virtual SCCOL getFirstFieldColumn() const override;
153 
163  virtual SCCOL findFieldColumn(SCCOL nIndex) const override;
164  virtual SCCOL findFieldColumn(const OUString& rStr, FormulaError* pErr = nullptr) const override;
165  virtual std::unique_ptr<ScDBQueryParamBase> createQueryParam(const ScDBRangeBase* pQueryRef) const override;
166  virtual bool isRangeEqual(const ScRange& rRange) const override;
167 
168 private:
172 };
173 
174 #endif
175 
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScDBInternalRange(ScDocument *pDoc, const ScRange &rRange)
Definition: doubleref.cxx:276
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:285
virtual SCCOL getFirstFieldColumn() const =0
sal_Int32 nIndex
const ScRange & getRange() const
Definition: doubleref.hxx:97
static void fillQueryOptions(ScQueryParamBase *pParam)
Populate query options that are always the same for all database queries.
Definition: doubleref.cxx:266
virtual SCCOL getColSize() const =0
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:458
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:295
ScDBRangeBase()=delete
const ScMatrixRef mpMatrix
Definition: doubleref.hxx:169
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:321
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:305
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:471
virtual SCROW getRowSize() const override
Definition: doubleref.cxx:290
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:254
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:413
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:385
virtual ~ScDBExternalRange() override
Definition: doubleref.cxx:399
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:363
ScDocument * getDoc() const
Definition: doubleref.hxx:79
FormulaError
sal_Int32 SCROW
Definition: types.hxx:18
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:431
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:436
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:316
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:258
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:403
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const =0
ScDocument * mpDoc
Definition: doubleref.hxx:88
virtual ~ScDBInternalRange() override
Definition: doubleref.cxx:281
ScDBExternalRange(ScDocument *pDoc, const ScMatrixRef &pMat)
Definition: doubleref.cxx:390
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:408
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
Definition: doubleref.cxx:423