LCOV - code coverage report
Current view: top level - sc/inc - recursionhelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 20 0.0 %
Date: 2014-04-14 Functions: 0 18 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_RECURSIONHELPER_HXX
      21             : #define INCLUDED_RECURSIONHELPER_HXX
      22             : 
      23             : #include "formularesult.hxx"
      24             : 
      25             : #include <list>
      26             : #include <stack>
      27             : 
      28             : class ScFormulaCell;
      29             : 
      30           0 : struct ScFormulaRecursionEntry
      31             : {
      32             :     ScFormulaCell*  pCell;
      33             :     bool            bOldRunning;
      34             :     ScFormulaResult aPreviousResult;
      35           0 :     ScFormulaRecursionEntry(
      36             :         ScFormulaCell* p, bool bR, const ScFormulaResult & rRes ) :
      37           0 :         pCell(p), bOldRunning(bR), aPreviousResult( rRes)
      38             :     {
      39           0 :     }
      40             : };
      41             : 
      42             : typedef ::std::list< ScFormulaRecursionEntry > ScFormulaRecursionList;
      43             : 
      44           0 : class ScRecursionHelper
      45             : {
      46             :     typedef ::std::stack< ScFormulaCell* >  ScRecursionInIterationStack;
      47             :     ScFormulaRecursionList              aRecursionFormulas;
      48             :     ScFormulaRecursionList::iterator    aInsertPos;
      49             :     ScFormulaRecursionList::iterator    aLastIterationStart;
      50             :     ScRecursionInIterationStack         aRecursionInIterationStack;
      51             :     sal_uInt16                              nRecursionCount;
      52             :     sal_uInt16                              nIteration;
      53             :     bool                                bInRecursionReturn;
      54             :     bool                                bDoingRecursion;
      55             :     bool                                bInIterationReturn;
      56             :     bool                                bConverging;
      57             : 
      58             :     void Init();
      59             :     void ResetIteration();
      60             : 
      61             : public:
      62             : 
      63             :     ScRecursionHelper();
      64           0 :     sal_uInt16  GetRecursionCount() const       { return nRecursionCount; }
      65           0 :     void    IncRecursionCount()             { ++nRecursionCount; }
      66           0 :     void    DecRecursionCount()             { --nRecursionCount; }
      67             :     /// A pure recursion return, no iteration.
      68           0 :     bool    IsInRecursionReturn() const     { return bInRecursionReturn &&
      69           0 :         !bInIterationReturn; }
      70             :     void SetInRecursionReturn( bool b );
      71           0 :     bool    IsDoingRecursion() const        { return bDoingRecursion; }
      72           0 :     void    SetDoingRecursion( bool b )     { bDoingRecursion = b; }
      73             : 
      74             :     void Insert( ScFormulaCell* p, bool bOldRunning, const ScFormulaResult & rRes );
      75             : 
      76           0 :     bool    IsInIterationReturn() const     { return bInIterationReturn; }
      77             :     void SetInIterationReturn( bool b );
      78           0 :     bool    IsDoingIteration() const        { return nIteration > 0; }
      79           0 :     sal_uInt16  GetIteration() const            { return nIteration; }
      80           0 :     bool &  GetConvergingReference()        { return bConverging; }
      81             :     void StartIteration();
      82             :     void ResumeIteration();
      83             :     void IncIteration();
      84             :     void EndIteration();
      85             : 
      86           0 :     ScFormulaRecursionList::iterator GetLastIterationStart() { return aLastIterationStart; }
      87             :     ScFormulaRecursionList::iterator GetIterationStart();
      88             :     ScFormulaRecursionList::iterator GetIterationEnd();
      89             :     /** Any return, recursion or iteration, iteration is always coupled with
      90             :         recursion. */
      91           0 :     bool    IsInReturn() const              { return bInRecursionReturn; }
      92             :     const ScFormulaRecursionList&   GetList() const { return aRecursionFormulas; }
      93           0 :     ScFormulaRecursionList&         GetList()       { return aRecursionFormulas; }
      94           0 :     ScRecursionInIterationStack&    GetRecursionInIterationStack()  { return aRecursionInIterationStack; }
      95             : 
      96             :     void Clear();
      97             : };
      98             : 
      99             : #endif // INCLUDED_RECURSIONHELPER_HXX
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10