1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
11 #ifndef TABLEFILLINGANDNAVIGATIONTOOLS_HXX
12 #define TABLEFILLINGANDNAVIGATIONTOOLS_HXX
14 #include "address.hxx"
15 #include "rangelst.hxx"
18 #include "document.hxx"
19 #include "docfunc.hxx"
20 #include "formulacell.hxx"
28 ScDocument
* mDocument
;
29 ScAddress::Details mAddressDetails
;
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
);
46 std::list
<ScAddress
> mAddressStack
;
48 ScAddress mCurrentAddress
;
49 ScAddress mMinimumAddress
;
50 ScAddress mMaximumAddress
;
53 AddressWalker(ScAddress aInitialAddress
, bool aTrackRange
= true);
55 ScAddress
current(SCCOL aRelativeCol
= 0, SCROW aRelativeRow
= 0, SCTAB aRelativeTab
= 0);
61 void push(SCCOL aRelativeCol
= 0, SCROW aRelativeRow
= 0, SCTAB aRelativeTab
= 0);
65 class AddressWalkerWriter
: public AddressWalker
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
91 DataCellIterator(ScRange aInputRange
, bool aByColumn
);
92 virtual ~DataCellIterator();
94 virtual bool hasNext();
95 virtual ScAddress
get();
97 virtual ScAddress
getRelative(int aDelta
);
100 class DataRangeIterator
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
125 DataRangeByColumnIterator(ScRange aInputRange
);
127 virtual bool hasNext();
129 virtual ScRange
get();
130 virtual void reset();
131 virtual DataCellIterator
iterateCells();
134 class DataRangeByRowIterator
: public DataRangeIterator
140 DataRangeByRowIterator(ScRange aInputRange
);
142 virtual bool hasNext();
144 virtual ScRange
get();
145 virtual void reset();
146 virtual DataCellIterator
iterateCells();
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */