fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / core / tool / recursionhelper.cxx
blob7d7a32cbc7729244eb0d103bab0128212da479bd
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 #include "recursionhelper.hxx"
12 void ScRecursionHelper::Init()
14 nRecursionCount = 0;
15 bInRecursionReturn = bDoingRecursion = bInIterationReturn = false;
16 aInsertPos = GetIterationEnd();
17 ResetIteration();
20 void ScRecursionHelper::ResetIteration()
22 aLastIterationStart = GetIterationEnd();
23 nIteration = 0;
24 bConverging = false;
27 ScRecursionHelper::ScRecursionHelper()
29 Init();
32 void ScRecursionHelper::SetInRecursionReturn( bool b )
34 // Do not use IsInRecursionReturn() here, it decouples iteration.
35 if (b && !bInRecursionReturn)
36 aInsertPos = aRecursionFormulas.begin();
37 bInRecursionReturn = b;
40 void ScRecursionHelper::Insert(
41 ScFormulaCell* p, bool bOldRunning, const ScFormulaResult & rRes )
43 aRecursionFormulas.insert( aInsertPos, ScFormulaRecursionEntry( p,
44 bOldRunning, rRes));
47 void ScRecursionHelper::SetInIterationReturn( bool b )
49 // An iteration return is always coupled to a recursion return.
50 SetInRecursionReturn( b);
51 bInIterationReturn = b;
54 void ScRecursionHelper::StartIteration()
56 SetInIterationReturn( false);
57 nIteration = 1;
58 bConverging = false;
59 aLastIterationStart = GetIterationStart();
62 void ScRecursionHelper::ResumeIteration()
64 SetInIterationReturn( false);
65 aLastIterationStart = GetIterationStart();
68 void ScRecursionHelper::IncIteration()
70 ++nIteration;
73 void ScRecursionHelper::EndIteration()
75 aRecursionFormulas.erase( GetIterationStart(), GetIterationEnd());
76 ResetIteration();
79 ScFormulaRecursionList::iterator ScRecursionHelper::GetIterationStart()
81 return aRecursionFormulas.begin();
84 ScFormulaRecursionList::iterator ScRecursionHelper::GetIterationEnd()
86 return aRecursionFormulas.end();
89 void ScRecursionHelper::Clear()
91 aRecursionFormulas.clear();
92 while (!aRecursionInIterationStack.empty())
93 aRecursionInIterationStack.pop();
94 Init();
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */