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 INCLUDED_SC_SOURCE_UI_INC_TABLEFILLINGANDNAVIGATIONTOOLS_HXX
12 #define INCLUDED_SC_SOURCE_UI_INC_TABLEFILLINGANDNAVIGATIONTOOLS_HXX
14 #include "address.hxx"
15 #include "rangelst.hxx"
18 #include "document.hxx"
19 #include "docfunc.hxx"
20 #include "formulacell.hxx"
30 typedef std::map
<OUString
, ScRange
> RangeReplacementMap
;
31 typedef std::map
<OUString
, ScAddress
> AddressReplacementMap
;
33 AddressReplacementMap mAddressReplacementMap
;
34 RangeReplacementMap mRangeReplacementMap
;
37 FormulaTemplate(ScDocument
* pDoc
);
39 void setTemplate(const OUString
& aTemplate
);
40 void setTemplate(const char* aTemplate
);
41 const OUString
& getTemplate();
43 void autoReplaceRange(const OUString
& aVariable
, const ScRange
& rRange
);
44 void autoReplaceAddress(const OUString
& aVariable
, ScAddress aAddress
);
46 void applyRange(const OUString
& aVariable
, const ScRange
& aRange
, bool b3D
= true);
47 void applyRangeList(const OUString
& aVariable
, const ScRangeList
& aRangeList
, bool b3D
= true);
48 void applyAddress(const OUString
& aVariable
, const ScAddress
& aAddress
, bool b3D
= true);
49 void applyString(const OUString
& aVariable
, const OUString
& aValue
);
50 void applyNumber(const OUString
& aVariable
, sal_Int32 aValue
);
56 std::list
<ScAddress
> mAddressStack
;
58 ScAddress mCurrentAddress
;
59 ScAddress mMinimumAddress
;
60 ScAddress mMaximumAddress
;
63 AddressWalker(ScAddress aInitialAddress
, bool aTrackRange
= true);
65 ScAddress
current(SCCOL aRelativeCol
= 0, SCROW aRelativeRow
= 0, SCTAB aRelativeTab
= 0);
73 void push(SCCOL aRelativeCol
= 0, SCROW aRelativeRow
= 0, SCTAB aRelativeTab
= 0);
76 class AddressWalkerWriter
: public AddressWalker
79 ScDocShell
* mpDocShell
;
80 ScDocument
* mpDocument
;
81 formula::FormulaGrammar::Grammar meGrammar
;
83 AddressWalkerWriter(ScAddress aInitialAddress
, ScDocShell
* pDocShell
, ScDocument
* pDocument
,
84 formula::FormulaGrammar::Grammar eGrammar
);
86 void writeFormula(const OUString
& aFormula
);
87 void writeMatrixFormula(const OUString
& aFormula
);
88 void writeString(const OUString
& aString
);
89 void writeString(const char* aCharArray
);
90 void writeBoldString(const OUString
& aString
);
91 void writeValue(double aValue
);
94 class DataCellIterator
103 DataCellIterator(ScRange aInputRange
, bool aByColumn
);
104 virtual ~DataCellIterator();
109 ScAddress
getRelative(int aDelta
);
112 class DataRangeIterator
119 DataRangeIterator(ScRange aInputRange
);
120 virtual ~DataRangeIterator();
122 virtual bool hasNext() = 0;
123 virtual ScRange
get() = 0;
124 virtual void next() = 0;
125 virtual void reset() = 0;
128 virtual DataCellIterator
iterateCells() = 0;
131 class DataRangeByColumnIterator
: public DataRangeIterator
137 DataRangeByColumnIterator(ScRange aInputRange
);
139 virtual bool hasNext() SAL_OVERRIDE
;
140 virtual void next() SAL_OVERRIDE
;
141 virtual ScRange
get() SAL_OVERRIDE
;
142 virtual void reset() SAL_OVERRIDE
;
143 virtual DataCellIterator
iterateCells() SAL_OVERRIDE
;
146 class DataRangeByRowIterator
: public DataRangeIterator
152 DataRangeByRowIterator(ScRange aInputRange
);
154 virtual bool hasNext() SAL_OVERRIDE
;
155 virtual void next() SAL_OVERRIDE
;
156 virtual ScRange
get() SAL_OVERRIDE
;
157 virtual void reset() SAL_OVERRIDE
;
158 virtual DataCellIterator
iterateCells() SAL_OVERRIDE
;
163 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */