LCOV - code coverage report
Current view: top level - sc/qa/unit/helper - sorthelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 18 18 100.0 %
Date: 2014-11-03 Functions: 7 10 70.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             : 
      10             : #ifndef INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX
      11             : #define INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX
      12             : 
      13             : // Unfortunately requires linkage to sc/ internals so
      14             : // can't live in qahelper itself.
      15             : #include "inputopt.hxx"
      16             : 
      17             : /**
      18             :  * Temporarily set the sorting type.
      19             :  */
      20             : class SortTypeSetter {
      21             :     bool mbSortRefUpdate;
      22             : public:
      23          20 :     SortTypeSetter(bool bSortRefUpdate)
      24          20 :     {
      25          20 :         mbSortRefUpdate = changeTo(bSortRefUpdate);
      26          20 :     }
      27          42 :     bool changeTo(bool bSortRefUpdate)
      28             :     {
      29          42 :         ScInputOptions aInputOptions = SC_MOD()->GetInputOptions();
      30          42 :         bool bRet = aInputOptions.GetSortRefUpdate();
      31          42 :         aInputOptions.SetSortRefUpdate(bSortRefUpdate);
      32          42 :         SC_MOD()->SetInputOptions(aInputOptions);
      33          42 :         return bRet;
      34             :     }
      35          20 :     virtual ~SortTypeSetter()
      36          20 :     {
      37          20 :         changeTo(mbSortRefUpdate);
      38          20 :     }
      39             : };
      40             : 
      41           2 : class SortRefNoUpdateSetter : private SortTypeSetter
      42             : {
      43             : public:
      44           2 :     SortRefNoUpdateSetter() : SortTypeSetter(false) {}
      45             : };
      46             : 
      47          16 : class SortRefUpdateSetter : private SortTypeSetter
      48             : {
      49             : public:
      50          16 :     SortRefUpdateSetter() : SortTypeSetter(true) {}
      51             : };
      52             : 
      53             : #endif
      54             : 
      55             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10