From 267c6f2ac71f92999e969232431ba04678e7437e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 07:54:39 +0200 Subject: Adding upstream version 4:24.2.0. Signed-off-by: Daniel Baumann --- sc/inc/mtvcellfunc.hxx | 191 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 sc/inc/mtvcellfunc.hxx (limited to 'sc/inc/mtvcellfunc.hxx') diff --git a/sc/inc/mtvcellfunc.hxx b/sc/inc/mtvcellfunc.hxx new file mode 100644 index 0000000000..89e41fb915 --- /dev/null +++ b/sc/inc/mtvcellfunc.hxx @@ -0,0 +1,191 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "mtvelements.hxx" +#include "mtvfunctions.hxx" + +class ScFormulaCell; + +namespace sc { + +template +void ProcessFormula(CellStoreType& rStore, Func& rFunc) +{ + FuncElseNoOp aElse; + ProcessElements1 >(rStore, rFunc, aElse); +} + +template +typename CellStoreType::iterator +ProcessFormula( + const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem) +{ + FuncElseNoOp aElse; + return ProcessElements1< + CellStoreType, formula_block, FuncElem, FuncElseNoOp >(it, rStore, nRow1, nRow2, rFuncElem, aElse); +} + +/** + * Process formula cells found within specified row range. This function + * allows modifications of the states of the formula function objects. + */ +CellStoreType::iterator ProcessFormula( + const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, + std::function aFuncElem ); + +template +typename CellStoreType::iterator +ProcessFormula( + const CellStoreType::iterator& it, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse) +{ + return ProcessElements1< + CellStoreType, formula_block, FuncElem, FuncElse>(it, rStore, nRow1, nRow2, rFuncElem, rFuncElse); +} + +template +CellStoreType::iterator +ProcessEditText(const CellStoreType::iterator& itPos, CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc) +{ + FuncElseNoOp aElse; + return ProcessElements1 >( + itPos, rStore, nRow1, nRow2, rFunc, aElse); +} + +template +void ParseFormula( + const CellStoreType& rStore, Func& rFunc) +{ + FuncElseNoOp aElse; + ParseElements1 >(rStore, rFunc, aElse); +} + +template +typename CellStoreType::const_iterator +ParseFormula( + const CellStoreType::const_iterator& itPos, const CellStoreType& rStore, + SCROW nStart, SCROW nEnd, Func& rFunc) +{ + FuncElseNoOp aElse; + return ParseElements1 >( + itPos, rStore, nStart, nEnd, rFunc, aElse); +} + +template +typename CellStoreType::const_iterator +ParseAll( + const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells, + SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem, FuncElse& rFuncElse) +{ + return ParseElements4( + itPos, rCells, nRow1, nRow2, rFuncElem, rFuncElse); +} + +template +typename CellStoreType::const_iterator +ParseAllNonEmpty( + const typename CellStoreType::const_iterator& itPos, const CellStoreType& rCells, + SCROW nRow1, SCROW nRow2, Func& rFunc) +{ + FuncElseNoOp aElse; + return ParseElements4 >( + itPos, rCells, nRow1, nRow2, rFunc, aElse); +} + +template +typename CellStoreType::const_iterator +ParseFormulaNumeric( + const CellStoreType::const_iterator& itPos, const CellStoreType& rCells, + SCROW nRow1, SCROW nRow2, Func& rFunc) +{ + FuncElseNoOp aElse; + return ParseElements2 >( + itPos, rCells, nRow1, nRow2, rFunc, aElse); +} + +template +void ProcessFormulaEditText(CellStoreType& rStore, Func& rFunc) +{ + // Walk backwards through the data - this helps when the FuncElem will be deleting + // stuff, so we don't continually move block data around. + FuncElseNoOp aElse; + ProcessElements2Reverse >(rStore, rFunc, aElse); +} + +template +std::pair +FindFormula(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc) +{ + typedef std::pair ElseRetType; + FuncElseNoOp aElse; + return FindElement1 >(rStore, nRow1, nRow2, rFunc, aElse); +} + +template +std::pair +FindFormulaEditText(const CellStoreType& rStore, SCROW nRow1, SCROW nRow2, Func& rFunc) +{ + return FindElement2(rStore, nRow1, nRow2, rFunc, rFunc); +} + +template +void ProcessNote(CellNoteStoreType& rStore, Func& rFunc) +{ + FuncElseNoOp aElse; + ProcessElements1 >(rStore, rFunc, aElse); +} + +template +typename CellNoteStoreType::const_iterator +ParseNote( + const CellNoteStoreType::const_iterator& itPos, const CellNoteStoreType& rStore, + SCROW nStart, SCROW nEnd, Func& rFunc) +{ + FuncElseNoOp aElse; + return ParseElements1 >( + itPos, rStore, nStart, nEnd, rFunc, aElse); +} + +template +typename CellNoteStoreType::iterator +ProcessNote( + const CellNoteStoreType::iterator& it, CellNoteStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem) +{ + FuncElseNoOp aElse; + return ProcessElements1< + CellNoteStoreType, cellnote_block, FuncElem, FuncElseNoOp >(it, rStore, nRow1, nRow2, rFuncElem, aElse); +} + +template +typename BroadcasterStoreType::iterator +ProcessBroadcaster( + const BroadcasterStoreType::iterator& it, BroadcasterStoreType& rStore, SCROW nRow1, SCROW nRow2, FuncElem& rFuncElem) +{ + FuncElseNoOp aElse; + return ProcessElements1< + BroadcasterStoreType, broadcaster_block, FuncElem, FuncElseNoOp >(it, rStore, nRow1, nRow2, rFuncElem, aElse); +} + +template +typename SparklineStoreType::const_iterator +ParseSparkline(const SparklineStoreType::const_iterator& itPos, const SparklineStoreType& rStore, SCROW nStart, SCROW nEnd, Functor& rFunctor) +{ + FuncElseNoOp aElse; + return ParseElements1 >(itPos, rStore, nStart, nEnd, rFunctor, aElse); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3