LibreOffice Module sc (master) 1
mtvcellfunc.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10#pragma once
11
12#include "mtvelements.hxx"
13#include "mtvfunctions.hxx"
14
15class ScFormulaCell;
16
17namespace sc {
18
19template<typename Func>
20void ProcessFormula(CellStoreType& rStore, Func& rFunc)
21{
23 ProcessElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
24}
25
26template<typename FuncElem>
27typename CellStoreType::iterator
29 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
30{
32 return ProcessElements1<
33 CellStoreType, formula_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
34}
35
40CellStoreType::iterator ProcessFormula(
41 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2,
42 std::function<void(size_t,ScFormulaCell*)> aFuncElem );
43
44template<typename FuncElem, typename FuncElse>
45typename CellStoreType::iterator
47 const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse)
48{
49 return ProcessElements1<
50 CellStoreType, formula_block, FuncElem, FuncElse>(it, rStore, nRow1, nRow2, rFuncElem, rFuncElse);
51}
52
53template<typename Func>
54CellStoreType::iterator
55ProcessEditText(const CellStoreType::iterator& itPos, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
56{
58 return ProcessElements1<CellStoreType, edittext_block, Func, FuncElseNoOp<size_t> >(
59 itPos, rStore, nRow1, nRow2, rFunc, aElse);
60}
61
62template<typename Func>
64 const CellStoreType& rStore, Func& rFunc)
65{
67 ParseElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
68}
69
70template<typename Func>
71typename CellStoreType::const_iterator
73 const CellStoreType::const_iterator& itPos, const CellStoreType& rStore,
74 SCROW nStart, SCROW nEnd, Func& rFunc)
75{
77 return ParseElements1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t> >(
78 itPos, rStore, nStart, nEnd, rFunc, aElse);
79}
80
81template<typename FuncElem, typename FuncElse>
82typename CellStoreType::const_iterator
84 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
85 SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse)
86{
89 FuncElem, FuncElse>(
90 itPos, rCells, nRow1, nRow2, rFuncElem, rFuncElse);
91}
92
93template<typename Func>
94typename CellStoreType::const_iterator
96 const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
97 SCROW nRow1, SCROW nRow2, Func& rFunc)
98{
102 Func, FuncElseNoOp<size_t> >(
103 itPos, rCells, nRow1, nRow2, rFunc, aElse);
104}
105
106template<typename Func>
107typename CellStoreType::const_iterator
109 const CellStoreType::const_iterator& itPos, const CellStoreType& rCells,
110 SCROW nRow1, SCROW nRow2, Func& rFunc)
111{
115 itPos, rCells, nRow1, nRow2, rFunc, aElse);
116}
117
118template<typename Func>
119void ProcessFormulaEditText(CellStoreType& rStore, Func& rFunc)
120{
121 // Walk backwards through the data - this helps when the FuncElem will be deleting
122 // stuff, so we don't continually move block data around.
124 ProcessElements2Reverse<CellStoreType, edittext_block, formula_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
125}
126
127template<typename Func>
128std::pair<CellStoreType::const_iterator, size_t>
129FindFormula(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
130{
131 typedef std::pair<size_t,bool> ElseRetType;
133 return FindElement1<CellStoreType, formula_block, Func, FuncElseNoOp<size_t, ElseRetType> >(rStore, nRow1, nRow2, rFunc, aElse);
134}
135
136template<typename Func>
137std::pair<CellStoreType::const_iterator, size_t>
138FindFormulaEditText(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc)
139{
140 return FindElement2<CellStoreType, edittext_block, formula_block, Func, Func>(rStore, nRow1, nRow2, rFunc, rFunc);
141}
142
143template<typename Func>
144void ProcessNote(CellNoteStoreType& rStore, Func& rFunc)
145{
147 ProcessElements1<CellNoteStoreType, cellnote_block, Func, FuncElseNoOp<size_t> >(rStore, rFunc, aElse);
148}
149
150template<typename Func>
151typename CellNoteStoreType::const_iterator
153 const CellNoteStoreType::const_iterator& itPos, const CellNoteStoreType& rStore,
154 SCROW nStart, SCROW nEnd, Func& rFunc)
155{
157 return ParseElements1<CellNoteStoreType, cellnote_block, Func, FuncElseNoOp<size_t> >(
158 itPos, rStore, nStart, nEnd, rFunc, aElse);
159}
160
161template<typename FuncElem>
162typename CellNoteStoreType::iterator
164 const CellNoteStoreType::iterator& it, CellNoteStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
165{
167 return ProcessElements1<
168 CellNoteStoreType, cellnote_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
169}
170
171template<typename FuncElem>
172typename BroadcasterStoreType::iterator
174 const BroadcasterStoreType::iterator& it, BroadcasterStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem)
175{
177 return ProcessElements1<
178 BroadcasterStoreType, broadcaster_block, FuncElem, FuncElseNoOp<size_t> >(it, rStore, nRow1, nRow2, rFuncElem, aElse);
179}
180
181template<typename Functor>
182typename SparklineStoreType::const_iterator
183ParseSparkline(const SparklineStoreType::const_iterator& itPos, const SparklineStoreType& rStore, SCROW nStart, SCROW nEnd, Functor& rFunctor)
184{
186 return ParseElements1<SparklineStoreType, sparkline_block, Functor, FuncElseNoOp<size_t> >(itPos, rStore, nStart, nEnd, rFunctor, aElse);
187}
188
189}
190
191/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
CAUTION! The following defines must be in the same namespace as the respective type.
Definition: broadcast.cxx:15
CellStoreType::const_iterator ParseAllNonEmpty(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
Definition: mtvcellfunc.hxx:95
SparklineStoreType::const_iterator ParseSparkline(const SparklineStoreType::const_iterator &itPos, const SparklineStoreType &rStore, SCROW nStart, SCROW nEnd, Functor &rFunctor)
CellNoteStoreType::const_iterator ParseNote(const CellNoteStoreType::const_iterator &itPos, const CellNoteStoreType &rStore, SCROW nStart, SCROW nEnd, Func &rFunc)
CellStoreType::iterator ProcessFormula(const CellStoreType::iterator &it, CellStoreType &rStore, SCROW nRow1, SCROW nRow2, std::function< void(size_t, ScFormulaCell *)> aFuncElem)
Process formula cells found within specified row range.
Definition: mtvcellfunc.cxx:12
std::pair< CellStoreType::const_iterator, size_t > FindFormula(const CellStoreType &rStore, SCROW nRow1, SCROW nRow2, Func &rFunc)
mdds::mtv::double_element_block numeric_block
Mapped standard element blocks (for convenience).
Definition: mtvelements.hxx:70
mdds::mtv::soa::multi_type_vector< CellNodeTraits > CellNoteStoreType
Cell note container.
mdds::mtv::soa::multi_type_vector< SparklineTraits > SparklineStoreType
Sparkline container.
mdds::mtv::noncopyable_managed_element_block< element_type_formula, ScFormulaCell > formula_block
Definition: mtvelements.hxx:67
StoreT::const_iterator ParseElements4(const typename StoreT::const_iterator &itPos, const StoreT &rStore, typename StoreT::size_type nStart, typename StoreT::size_type nEnd, FuncElem &rFuncElem, FuncElse &rFuncElse)
BroadcasterStoreType::iterator ProcessBroadcaster(const BroadcasterStoreType::iterator &it, BroadcasterStoreType &rStore, SCROW nRow1, SCROW nRow2, FuncElem &rFuncElem)
void ParseFormula(const CellStoreType &rStore, Func &rFunc)
Definition: mtvcellfunc.hxx:63
mdds::mtv::soa::multi_type_vector< CellStoreTraits > CellStoreType
Cell container.
mdds::mtv::noncopyable_managed_element_block< element_type_broadcaster, SvtBroadcaster > broadcaster_block
Definition: mtvelements.hxx:63
void ProcessFormulaEditText(CellStoreType &rStore, Func &rFunc)
CellStoreType::const_iterator ParseFormulaNumeric(const CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, Func &rFunc)
CellStoreType::const_iterator ParseAll(const typename CellStoreType::const_iterator &itPos, const CellStoreType &rCells, SCROW nRow1, SCROW nRow2, FuncElem &rFuncElem, FuncElse &rFuncElse)
Definition: mtvcellfunc.hxx:83
mdds::mtv::default_element_block< element_type_string, svl::SharedString > string_block
Definition: mtvelements.hxx:65
void ProcessElements1(StoreT &rStore, FuncElem &rFuncElem, FuncElse &rFuncElse)
mdds::mtv::noncopyable_managed_element_block< element_type_edittext, EditTextObject > edittext_block
Definition: mtvelements.hxx:66
std::pair< CellStoreType::const_iterator, size_t > FindFormulaEditText(const CellStoreType &rStore, SCROW nRow1, SCROW nRow2, Func &rFunc)
CellStoreType::iterator ProcessEditText(const CellStoreType::iterator &itPos, CellStoreType &rStore, SCROW nRow1, SCROW nRow2, Func &rFunc)
Definition: mtvcellfunc.hxx:55
mdds::mtv::noncopyable_managed_element_block< element_type_cellnote, ScPostIt > cellnote_block
Definition: mtvelements.hxx:62
mdds::mtv::soa::multi_type_vector< BroadcasterTraits > BroadcasterStoreType
Broadcaster storage container.
void ProcessNote(CellNoteStoreType &rStore, Func &rFunc)
StoreT::const_iterator ParseElements2(const typename StoreT::const_iterator &itPos, const StoreT &rStore, typename StoreT::size_type nStart, typename StoreT::size_type nEnd, FuncElem &rFuncElem, FuncElse &rFuncElse)
sal_Int32 SCROW
Definition: types.hxx:17