LibreOffice Module sc (master) 1
TableFillingAndNavigationTools.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 */
10
11#pragma once
12
13#include <address.hxx>
14#include <rangelst.hxx>
15
16#include <map>
17#include <vector>
18
20{
21private:
22 OUString mTemplate;
24 bool mbUse3D;
25
26 typedef std::map<OUString, ScRange> RangeReplacementMap;
27 typedef std::map<OUString, ScAddress> AddressReplacementMap;
28
31
32public:
34
35 void setTemplate(const OUString& aTemplate);
36 void setTemplate(const char* aTemplate);
37 const OUString& getTemplate();
38
39 void autoReplaceRange(const OUString& aVariable, const ScRange& rRange);
40 void autoReplaceAddress(const OUString& aVariable, ScAddress const & aAddress);
41 void autoReplaceUses3D(bool bUse3D) { mbUse3D = bUse3D; }
42
43 void applyRange(std::u16string_view aVariable, const ScRange& aRange, bool b3D = true);
44 void applyRangeList(std::u16string_view aVariable, const ScRangeList& aRangeList, sal_Unicode cDelimiter );
45 void applyAddress(std::u16string_view aVariable, const ScAddress& aAddress, bool b3D = true);
46 void applyString(std::u16string_view aVariable, std::u16string_view aValue);
47 void applyNumber(std::u16string_view aVariable, sal_Int32 aValue);
48};
49
51{
52public:
53 std::vector<ScAddress> mAddressStack;
54
58
59 AddressWalker(const ScAddress& aInitialAddress);
60
61 ScAddress current(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
62
63 void reset();
64 void resetColumn();
65 void resetRow();
66 void nextColumn();
67 void nextRow();
68 void newLine();
69 void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
70};
71
73{
77
78public:
79 AddressWalkerWriter(const ScAddress& aInitialAddress, ScDocShell* pDocShell, ScDocument& rDocument,
81
82 void writeFormula(const OUString& aFormula);
83 void writeFormulas(const std::vector<OUString>& rFormulas);
84 void writeMatrixFormula(const OUString& aFormula, SCCOL nCols = 1, SCROW nRows = 1);
85 void writeString(const OUString& aString);
86 void writeString(const char* aCharArray);
87 void writeBoldString(const OUString& aString);
88 void writeValue(double aValue);
89};
90
92{
93private:
98
99public:
100 DataCellIterator(const ScRange& aInputRange, bool aByColumn);
101
102 bool hasNext() const;
103 ScAddress get();
104 void next();
105 ScAddress getRelative(int aDelta);
106};
107
109{
110protected:
112 sal_Int32 mIndex;
113
114public:
115 DataRangeIterator(const ScRange& aInputRange);
116 virtual ~DataRangeIterator();
117
118 virtual bool hasNext() = 0;
119 virtual ScRange get() = 0;
120 virtual size_t size() = 0;
121 virtual void next() = 0;
122 virtual void reset() = 0;
123
124 sal_Int32 index();
125
127};
128
130{
132
133public:
134 DataRangeByColumnIterator(const ScRange& aInputRange);
135
136 virtual bool hasNext() override;
137 virtual void next() override;
138 virtual ScRange get() override;
139 virtual size_t size() override;
140 virtual void reset() override;
141 virtual DataCellIterator iterateCells() override;
142};
143
145{
147
148public:
149 DataRangeByRowIterator(const ScRange& aInputRange);
150
151 virtual bool hasNext() override;
152 virtual void next() override;
153 virtual ScRange get() override;
154 virtual size_t size() override;
155 virtual void reset() override;
156 virtual DataCellIterator iterateCells() override;
157};
158
159/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
formula::FormulaGrammar::Grammar meGrammar
void writeMatrixFormula(const OUString &aFormula, SCCOL nCols=1, SCROW nRows=1)
AddressWalkerWriter(const ScAddress &aInitialAddress, ScDocShell *pDocShell, ScDocument &rDocument, formula::FormulaGrammar::Grammar eGrammar)
void writeFormula(const OUString &aFormula)
void writeBoldString(const OUString &aString)
void writeString(const OUString &aString)
void writeFormulas(const std::vector< OUString > &rFormulas)
AddressWalker(const ScAddress &aInitialAddress)
ScAddress current(SCCOL aRelativeCol=0, SCROW aRelativeRow=0, SCTAB aRelativeTab=0)
void push(SCCOL aRelativeCol=0, SCROW aRelativeRow=0, SCTAB aRelativeTab=0)
std::vector< ScAddress > mAddressStack
ScAddress getRelative(int aDelta)
DataCellIterator(const ScRange &aInputRange, bool aByColumn)
DataRangeByColumnIterator(const ScRange &aInputRange)
virtual DataCellIterator iterateCells() override
virtual DataCellIterator iterateCells() override
DataRangeByRowIterator(const ScRange &aInputRange)
virtual void reset()=0
virtual size_t size()=0
virtual ScRange get()=0
DataRangeIterator(const ScRange &aInputRange)
virtual DataCellIterator iterateCells()=0
virtual bool hasNext()=0
virtual void next()=0
void setTemplate(const OUString &aTemplate)
void applyRangeList(std::u16string_view aVariable, const ScRangeList &aRangeList, sal_Unicode cDelimiter)
void applyRange(std::u16string_view aVariable, const ScRange &aRange, bool b3D=true)
void applyAddress(std::u16string_view aVariable, const ScAddress &aAddress, bool b3D=true)
void autoReplaceAddress(const OUString &aVariable, ScAddress const &aAddress)
AddressReplacementMap mAddressReplacementMap
std::map< OUString, ScAddress > AddressReplacementMap
void applyNumber(std::u16string_view aVariable, sal_Int32 aValue)
void applyString(std::u16string_view aVariable, std::u16string_view aValue)
void autoReplaceRange(const OUString &aVariable, const ScRange &rRange)
std::map< OUString, ScRange > RangeReplacementMap
RangeReplacementMap mRangeReplacementMap
const sal_Unicode cDelimiter
Definition: tpusrlst.cxx:45
sal_uInt16 sal_Unicode
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17