LCOV - code coverage report
Current view: top level - sc/qa/unit/helper - sorthelper.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 18 18 100.0 %
Date: 2015-06-13 12:38:46 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          12 :     SortTypeSetter(bool bSortRefUpdate)
      24          12 :     {
      25          12 :         mbSortRefUpdate = changeTo(bSortRefUpdate);
      26          12 :     }
      27          25 :     static bool changeTo(bool bSortRefUpdate)
      28             :     {
      29          25 :         ScInputOptions aInputOptions = SC_MOD()->GetInputOptions();
      30          25 :         bool bRet = aInputOptions.GetSortRefUpdate();
      31          25 :         aInputOptions.SetSortRefUpdate(bSortRefUpdate);
      32          25 :         SC_MOD()->SetInputOptions(aInputOptions);
      33          25 :         return bRet;
      34             :     }
      35          12 :     virtual ~SortTypeSetter()
      36          12 :     {
      37          12 :         changeTo(mbSortRefUpdate);
      38          12 :     }
      39             : };
      40             : 
      41           3 : class SortRefNoUpdateSetter : private SortTypeSetter
      42             : {
      43             : public:
      44           3 :     SortRefNoUpdateSetter() : SortTypeSetter(false) {}
      45             : };
      46             : 
      47           8 : class SortRefUpdateSetter : private SortTypeSetter
      48             : {
      49             : public:
      50           8 :     SortRefUpdateSetter() : SortTypeSetter(true) {}
      51             : };
      52             : 
      53             : #endif
      54             : 
      55             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11