Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / TableFillingAndNavigationTools.hxx
blobea9a309f0a2b07cd0dbee47b54cf3bb3ef4419b3
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 */
11 #ifndef TABLEFILLINGANDNAVIGATIONTOOLS_HXX
12 #define TABLEFILLINGANDNAVIGATIONTOOLS_HXX
14 #include "address.hxx"
15 #include "rangelst.hxx"
17 #include "docsh.hxx"
18 #include "document.hxx"
19 #include "docfunc.hxx"
20 #include "formulacell.hxx"
22 #include <list>
24 class FormulaTemplate
26 private:
27 OUString mTemplate;
28 ScDocument* mDocument;
29 ScAddress::Details mAddressDetails;
30 public:
31 FormulaTemplate(ScDocument* aDocument, ScAddress::Details aAddressDetails);
33 void setTemplate(OUString aTemplate);
34 void setTemplate(const char* aTemplate);
35 OUString& getTemplate();
36 void applyRange(OUString aVariable, ScRange aRange);
37 void applyRangeList(OUString aVariable, ScRangeList aRangeList);
38 void applyAddress(OUString aVariable, ScAddress aAddress);
39 void applyString(OUString aVariable, OUString aValue);
40 void applyNumber(OUString aVariable, sal_Int32 aValue);
43 class AddressWalker
45 public:
46 std::list<ScAddress> mAddressStack;
48 ScAddress mCurrentAddress;
49 ScAddress mMinimumAddress;
50 ScAddress mMaximumAddress;
51 bool mTrackRange;
53 AddressWalker(ScAddress aInitialAddress, bool aTrackRange = true);
55 ScAddress current(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
56 void reset();
57 void resetColumn();
58 void resetRow();
59 void nextColumn();
60 void nextRow();
61 void push(SCCOL aRelativeCol = 0, SCROW aRelativeRow = 0, SCTAB aRelativeTab = 0);
62 void pop();
65 class AddressWalkerWriter : public AddressWalker
67 public:
68 ScDocShell* mpDocShell;
69 ScDocument* mpDocument;
70 formula::FormulaGrammar::Grammar meGrammar;
72 AddressWalkerWriter(ScAddress aInitialAddress, ScDocShell* pDocShell, ScDocument* pDocument,
73 formula::FormulaGrammar::Grammar eGrammar );
75 void writeFormula(OUString aFormula);
76 void writeString(OUString aString);
77 void writeString(const char* aCharArray);
78 void writeBoldString(OUString aString);
79 void writeValue(double aValue);
82 class DataCellIterator
84 private:
85 ScRange mInputRange;
86 bool mByColumn;
87 SCCOL mCol;
88 SCROW mRow;
90 public:
91 DataCellIterator(ScRange aInputRange, bool aByColumn);
92 virtual ~DataCellIterator();
94 virtual bool hasNext();
95 virtual ScAddress get();
96 virtual void next();
97 virtual ScAddress getRelative(int aDelta);
100 class DataRangeIterator
102 protected:
103 ScRange mInputRange;
104 sal_Int32 mIndex;
106 public:
107 DataRangeIterator(ScRange aInputRange);
108 virtual ~DataRangeIterator();
110 virtual bool hasNext() = 0;
111 virtual ScRange get() = 0;
112 virtual void next() = 0;
113 virtual void reset() = 0;
114 virtual sal_Int32 index();
116 virtual DataCellIterator iterateCells() = 0;
119 class DataRangeByColumnIterator : public DataRangeIterator
121 protected:
122 SCCOL mCol;
124 public:
125 DataRangeByColumnIterator(ScRange aInputRange);
127 virtual bool hasNext();
128 virtual void next();
129 virtual ScRange get();
130 virtual void reset();
131 virtual DataCellIterator iterateCells();
134 class DataRangeByRowIterator : public DataRangeIterator
136 protected:
137 SCROW mRow;
139 public:
140 DataRangeByRowIterator(ScRange aInputRange);
142 virtual bool hasNext();
143 virtual void next();
144 virtual ScRange get();
145 virtual void reset();
146 virtual DataCellIterator iterateCells();
149 #endif
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */