Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / inc / mtvcellfunc.hxx
blobc54d02ebd339b9e9451435ded9ef898e34d579f7
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 SC_MTVCELLFUNC_HXX
11 #define SC_MTVCELLFUNC_HXX
13 #include "mtvelements.hxx"
14 #include "mtvfunctions.hxx"
16 namespace sc {
18 template<typename _Func>
19 void ProcessFormula(CellStoreType& rStore, _Func& rFunc)
21 FuncElseNoOp<size_t> aElse;
22 ProcessElements1<CellStoreType, formula_block, _Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
25 template<typename _FuncElem>
26 typename CellStoreType::iterator
27 ProcessFormula(
28 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _FuncElem& rFuncElem)
30 FuncElseNoOp<size_t> aElse;
31 return ProcessElements1<
32 CellStoreType, formula_block, _FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
35 template<typename _FuncElem, typename _FuncElse>
36 typename CellStoreType::iterator
37 ProcessFormula(
38 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _FuncElem& rFuncElem, _FuncElse& rFuncElse)
40 return ProcessElements1<
41 CellStoreType, formula_block, _FuncElem, _FuncElse>(it, rStore, nRow1, nRow2, rFuncElem, rFuncElse);
44 template<typename _Func>
45 typename CellStoreType::iterator
46 ProcessFormulaNumeric(
47 const CellStoreType::iterator& itPos, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _Func& rFunc)
49 FuncElseNoOp<size_t> aElse;
50 return ProcessElements2<
51 CellStoreType, numeric_block, formula_block, _Func, FuncElseNoOp<size_t> >(
52 itPos, rStore, nRow1, nRow2, rFunc, aElse);
55 template<typename _Func>
56 void ProcessEditText(CellStoreType& rStore, _Func& rFunc)
58 FuncElseNoOp<size_t> aElse;
59 ProcessElements1<CellStoreType, edittext_block, _Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
62 template<typename _Func>
63 CellStoreType::iterator
64 ProcessEditText(const CellStoreType::iterator& itPos, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _Func& rFunc)
66 FuncElseNoOp<size_t> aElse;
67 return ProcessElements1<CellStoreType, edittext_block, _Func, FuncElseNoOp<size_t> >(
68 itPos, rStore, nRow1, nRow2, rFunc, aElse);
71 template<typename _Func>
72 void ParseFormula(
73 const CellStoreType& rStore, _Func& rFunc)
75 FuncElseNoOp<size_t> aElse;
76 ParseElements1<CellStoreType, formula_block, _Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
79 template<typename _Func>
80 typename CellStoreType::const_iterator
81 ParseFormula(
82 const CellStoreType::const_iterator& itPos, const CellStoreType& rStore,
83 SCROW nStart, SCROW nEnd, _Func& rFunc)
85 FuncElseNoOp<size_t> aElse;
86 return ParseElements1<CellStoreType, formula_block, _Func, FuncElseNoOp<size_t> >(
87 itPos, rStore, nStart, nEnd, rFunc, aElse);
90 template<typename _FuncElem, typename _FuncElse>
91 typename CellStoreType::const_iterator
92 ParseAll(
93 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
94 SCROW nRow1, SCROW nRow2, _FuncElem& rFuncElem, _FuncElse& rFuncElse)
96 return ParseElements4<CellStoreType,
97 numeric_block, string_block, edittext_block, formula_block,
98 _FuncElem, _FuncElse>(
99 itPos, rCells, nRow1, nRow2, rFuncElem, rFuncElse);
102 template<typename _Func>
103 typename CellStoreType::const_iterator
104 ParseAllNonEmpty(
105 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
106 SCROW nRow1, SCROW nRow2, _Func& rFunc)
108 FuncElseNoOp<size_t> aElse;
109 return ParseElements4<CellStoreType,
110 numeric_block, string_block, edittext_block, formula_block,
111 _Func, FuncElseNoOp<size_t> >(
112 itPos, rCells, nRow1, nRow2, rFunc, aElse);
115 template<typename _FuncElem, typename _FuncElse>
116 typename CellStoreType::const_iterator
117 ParseAllNonEmpty(
118 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
119 SCROW nRow1, SCROW nRow2, _FuncElem& rFuncElem, _FuncElse& rFuncElse)
121 return ParseElements4<CellStoreType,
122 numeric_block, string_block, edittext_block, formula_block,
123 _FuncElem, _FuncElse>(
124 itPos, rCells, nRow1, nRow2, rFuncElem, rFuncElse);
127 template<typename _Func>
128 typename CellStoreType::const_iterator
129 ParseFormulaNumeric(
130 const CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
131 SCROW nRow1, SCROW nRow2, _Func& rFunc)
133 FuncElseNoOp<size_t> aElse;
134 return ParseElements2<CellStoreType,
135 numeric_block, formula_block, _Func, FuncElseNoOp<size_t> >(
136 itPos, rCells, nRow1, nRow2, rFunc, aElse);
139 template<typename _Func>
140 void ProcessFormulaEditText(CellStoreType& rStore, _Func& rFunc)
142 FuncElseNoOp<size_t> aElse;
143 ProcessElements2<CellStoreType, edittext_block, formula_block, _Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
146 template<typename _Func>
147 std::pair<CellStoreType::const_iterator, size_t>
148 FindFormula(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _Func& rFunc)
150 typedef std::pair<size_t,bool> ElseRetType;
151 FuncElseNoOp<size_t, ElseRetType> aElse;
152 return FindElement1<CellStoreType, formula_block, _Func, FuncElseNoOp<size_t, ElseRetType> >(rStore, nRow1, nRow2, rFunc, aElse);
155 template<typename _Func>
156 std::pair<CellStoreType::const_iterator, size_t>
157 FindFormulaEditText(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, _Func& rFunc)
159 return FindElement2<CellStoreType, edittext_block, formula_block, _Func, _Func>(rStore, nRow1, nRow2, rFunc, rFunc);
164 #endif
166 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */