Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / mtvcellfunc.hxx
blob195e6449007a4eef5f247f00df732d88ed4f14b4
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/.
8 */
10 #ifndef INCLUDED_SC_INC_MTVCELLFUNC_HXX
11 #define INCLUDED_SC_INC_MTVCELLFUNC_HXX
13 #include "mtvelements.hxx"
14 #include "mtvfunctions.hxx"
16 #include <functional>
18 class ScFormulaCell;
20 namespace sc {
22 template<typename Func>
23 void ProcessFormula(CellStoreType& rStore, Func& rFunc)
25 FuncElseNoOp<size_t> aElse;
26 ProcessElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
29 template<typename FuncElem>
30 typename CellStoreType::iterator
31 ProcessFormula(
32 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
34 FuncElseNoOp<size_t> aElse;
35 return ProcessElements1<
36 CellStoreType, formula_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
39 /**
40 * Process formula cells found within specified row range. This function
41 * allows modifications of the states of the formula function objects.
43 CellStoreType::iterator ProcessFormula(
44 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2,
45 std::function<void(size_t,ScFormulaCell*)> aFuncElem );
47 template<typename FuncElem, typename FuncElse>
48 typename CellStoreType::iterator
49 ProcessFormula(
50 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse)
52 return ProcessElements1<
53 CellStoreType, formula_block, FuncElem, FuncElse>(it, rStore, nRow1, nRow2, rFuncElem, rFuncElse);
56 template<typename Func>
57 CellStoreType::iterator
58 ProcessEditText(const CellStoreType::iterator& itPos, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
60 FuncElseNoOp<size_t> aElse;
61 return ProcessElements1<CellStoreType, edittext_block, Func, FuncElseNoOp<size_t> >(
62 itPos, rStore, nRow1, nRow2, rFunc, aElse);
65 template<typename Func>
66 void ParseFormula(
67 const CellStoreType& rStore, Func& rFunc)
69 FuncElseNoOp<size_t> aElse;
70 ParseElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
73 template<typename Func>
74 typename CellStoreType::const_iterator
75 ParseFormula(
76 const CellStoreType::const_iterator& itPos, const CellStoreType& rStore,
77 SCROW nStart, SCROW nEnd, Func& rFunc)
79 FuncElseNoOp<size_t> aElse;
80 return ParseElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(
81 itPos, rStore, nStart, nEnd, rFunc, aElse);
84 template<typename FuncElem, typename FuncElse>
85 typename CellStoreType::const_iterator
86 ParseAll(
87 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
88 SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse)
90 return ParseElements4<CellStoreType,
91 numeric_block, string_block, edittext_block, formula_block,
92 FuncElem, FuncElse>(
93 itPos, rCells, nRow1, nRow2, rFuncElem, rFuncElse);
96 template<typename Func>
97 typename CellStoreType::const_iterator
98 ParseAllNonEmpty(
99 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
100 SCROW nRow1, SCROW nRow2, Func& rFunc)
102 FuncElseNoOp<size_t> aElse;
103 return ParseElements4<CellStoreType,
104 numeric_block, string_block, edittext_block, formula_block,
105 Func, FuncElseNoOp<size_t> >(
106 itPos, rCells, nRow1, nRow2, rFunc, aElse);
109 template<typename Func>
110 typename CellStoreType::const_iterator
111 ParseFormulaNumeric(
112 const CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
113 SCROW nRow1, SCROW nRow2, Func& rFunc)
115 FuncElseNoOp<size_t> aElse;
116 return ParseElements2<CellStoreType,
117 numeric_block, formula_block, Func, FuncElseNoOp<size_t> >(
118 itPos, rCells, nRow1, nRow2, rFunc, aElse);
121 template<typename Func>
122 void ProcessFormulaEditText(CellStoreType& rStore, Func& rFunc)
124 FuncElseNoOp<size_t> aElse;
125 ProcessElements2<CellStoreType, edittext_block, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
128 template<typename Func>
129 std::pair<CellStoreType::const_iterator, size_t>
130 FindFormula(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
132 typedef std::pair<size_t,bool> ElseRetType;
133 FuncElseNoOp<size_t, ElseRetType> aElse;
134 return FindElement1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t, ElseRetType> >(rStore, nRow1, nRow2, rFunc, aElse);
137 template<typename Func>
138 std::pair<CellStoreType::const_iterator, size_t>
139 FindFormulaEditText(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
141 return FindElement2<CellStoreType, edittext_block, formula_block, Func, Func>(rStore, nRow1, nRow2, rFunc, rFunc);
144 template<typename Func>
145 void ProcessNote(CellNoteStoreType& rStore, Func& rFunc)
147 FuncElseNoOp<size_t> aElse;
148 ProcessElements1<CellNoteStoreType, cellnote_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
151 template<typename Func>
152 typename CellNoteStoreType::const_iterator
153 ParseNote(
154 const CellNoteStoreType::const_iterator& itPos, const CellNoteStoreType& rStore,
155 SCROW nStart, SCROW nEnd, Func& rFunc)
157 FuncElseNoOp<size_t> aElse;
158 return ParseElements1<CellNoteStoreType, cellnote_block, Func, FuncElseNoOp<size_t> >(
159 itPos, rStore, nStart, nEnd, rFunc, aElse);
162 template<typename FuncElem>
163 typename CellNoteStoreType::iterator
164 ProcessNote(
165 const CellNoteStoreType::iterator& it, CellNoteStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
167 FuncElseNoOp<size_t> aElse;
168 return ProcessElements1<
169 CellNoteStoreType, cellnote_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
172 template<typename FuncElem>
173 typename BroadcasterStoreType::iterator
174 ProcessBroadcaster(
175 const BroadcasterStoreType::iterator& it, BroadcasterStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
177 FuncElseNoOp<size_t> aElse;
178 return ProcessElements1<
179 BroadcasterStoreType, broadcaster_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
184 #endif
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */