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#pragma once
21
22#include <sal/config.h>
23
24#include <memory>
25
26#include <address.hxx>
27#include <types.hxx>
28
29class ScDocument;
31struct ScQueryParamBase;
32enum class FormulaError : sal_uInt16;
33
38{
39public:
40 ScDBRangeBase() = delete;
41
42 virtual ~ScDBRangeBase() = 0;
43
44 bool fillQueryEntries(ScQueryParamBase* pParam, const ScDBRangeBase* pDBRef) const;
45
46 virtual SCCOL getColSize() const = 0;
47 virtual SCROW getRowSize() const = 0;
48 virtual SCSIZE getVisibleDataCellCount() const = 0;
49
58 virtual OUString getString(SCCOL nCol, SCROW nRow) const = 0;
59
60 virtual SCCOL getFirstFieldColumn() const = 0;
61
71 virtual SCCOL findFieldColumn(SCCOL nIndex) const = 0;
72 virtual SCCOL findFieldColumn(const OUString& rStr, FormulaError* pErr = nullptr) const = 0;
73 virtual std::unique_ptr<ScDBQueryParamBase>
74 createQueryParam(const ScDBRangeBase* pQueryRef) const = 0;
75 virtual bool isRangeEqual(const ScRange& rRange) const = 0;
76
77protected:
79 ScDocument* getDoc() const { return mpDoc; }
80
85 static void fillQueryOptions(ScQueryParamBase* pParam);
86
87private:
89};
90
91class ScDBInternalRange final : public ScDBRangeBase
92{
93public:
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,
125 FormulaError* pErr = nullptr) const override;
126 virtual std::unique_ptr<ScDBQueryParamBase>
127 createQueryParam(const ScDBRangeBase* pQueryRef) const override;
128 virtual bool isRangeEqual(const ScRange& rRange) const override;
129
130private:
132};
133
135{
136public:
137 explicit ScDBExternalRange(ScDocument* pDoc, ScMatrixRef pMat);
138 virtual ~ScDBExternalRange() override;
139
140 virtual SCCOL getColSize() const override;
141 virtual SCROW getRowSize() const override;
142 virtual SCSIZE getVisibleDataCellCount() const override;
143
152 virtual OUString getString(SCCOL nCol, SCROW nRow) const override;
153
154 virtual SCCOL getFirstFieldColumn() const override;
155
165 virtual SCCOL findFieldColumn(SCCOL nIndex) const override;
166 virtual SCCOL findFieldColumn(const OUString& rStr,
167 FormulaError* pErr = nullptr) const override;
168 virtual std::unique_ptr<ScDBQueryParamBase>
169 createQueryParam(const ScDBRangeBase* pQueryRef) const override;
170 virtual bool isRangeEqual(const ScRange& rRange) const override;
171
172private:
176};
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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:44
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:434
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:411
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:401
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:456
const ScMatrixRef mpMatrix
Definition: doubleref.hxx:173
ScDBExternalRange(ScDocument *pDoc, ScMatrixRef pMat)
Definition: doubleref.cxx:388
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:469
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
Definition: doubleref.cxx:421
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:429
virtual SCROW getRowSize() const override
Definition: doubleref.cxx:406
virtual ~ScDBExternalRange() override
Definition: doubleref.cxx:397
const ScRange & getRange() const
Definition: doubleref.hxx:97
virtual SCCOL findFieldColumn(SCCOL nIndex) const override
Get a 0-based column index that corresponds with the passed field index.
Definition: doubleref.cxx:319
virtual SCROW getRowSize() const override
Definition: doubleref.cxx:290
virtual SCSIZE getVisibleDataCellCount() const override
Definition: doubleref.cxx:295
virtual SCCOL getFirstFieldColumn() const override
Definition: doubleref.cxx:314
virtual SCCOL getColSize() const override
Definition: doubleref.cxx:285
ScDBInternalRange(ScDocument *pDoc, const ScRange &rRange)
Definition: doubleref.cxx:276
virtual OUString getString(SCCOL nCol, SCROW nRow) const override
Get a string value of a specified cell position.
Definition: doubleref.cxx:305
virtual ~ScDBInternalRange() override
Definition: doubleref.cxx:281
virtual bool isRangeEqual(const ScRange &rRange) const override
Definition: doubleref.cxx:383
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const override
Definition: doubleref.cxx:361
Base class for abstracting range data backends for database functions.
Definition: doubleref.hxx:38
virtual SCCOL findFieldColumn(const OUString &rStr, FormulaError *pErr=nullptr) const =0
virtual OUString getString(SCCOL nCol, SCROW nRow) const =0
Get a string value of a specified cell position.
static void fillQueryOptions(ScQueryParamBase *pParam)
Populate query options that are always the same for all database queries.
Definition: doubleref.cxx:266
virtual bool isRangeEqual(const ScRange &rRange) const =0
bool fillQueryEntries(ScQueryParamBase *pParam, const ScDBRangeBase *pDBRef) const
Definition: doubleref.cxx:258
virtual ~ScDBRangeBase()=0
Definition: doubleref.cxx:254
virtual SCSIZE getVisibleDataCellCount() const =0
virtual SCCOL findFieldColumn(SCCOL nIndex) const =0
Get a 0-based column index that corresponds with the passed field index.
ScDocument * getDoc() const
Definition: doubleref.hxx:79
ScDBRangeBase()=delete
virtual SCROW getRowSize() const =0
virtual SCCOL getColSize() const =0
virtual SCCOL getFirstFieldColumn() const =0
ScDocument * mpDoc
Definition: doubleref.hxx:88
virtual std::unique_ptr< ScDBQueryParamBase > createQueryParam(const ScDBRangeBase *pQueryRef) const =0
FormulaError
sal_Int32 nIndex
sal_Int16 SCCOL
Definition: types.hxx:21
::boost::intrusive_ptr< ScMatrix > ScMatrixRef
Definition: types.hxx:25
sal_Int32 SCROW
Definition: types.hxx:17