bump product version to 5.0.4.1
[LibreOffice.git] / sc / qa / unit / helper / sorthelper.hxx
blob2e811072764835fdd8b9b6631dbcbfc23098c84b
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 #ifndef INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX
11 #define INCLUDED_SC_QA_SORT_HELPER_QAHELPER_HXX
13 // Unfortunately requires linkage to sc/ internals so
14 // can't live in qahelper itself.
15 #include "inputopt.hxx"
17 /**
18 * Temporarily set the sorting type.
20 class SortTypeSetter {
21 bool mbSortRefUpdate;
22 public:
23 SortTypeSetter(bool bSortRefUpdate)
25 mbSortRefUpdate = changeTo(bSortRefUpdate);
27 static bool changeTo(bool bSortRefUpdate)
29 ScInputOptions aInputOptions = SC_MOD()->GetInputOptions();
30 bool bRet = aInputOptions.GetSortRefUpdate();
31 aInputOptions.SetSortRefUpdate(bSortRefUpdate);
32 SC_MOD()->SetInputOptions(aInputOptions);
33 return bRet;
35 virtual ~SortTypeSetter()
37 changeTo(mbSortRefUpdate);
41 class SortRefNoUpdateSetter : private SortTypeSetter
43 public:
44 SortRefNoUpdateSetter() : SortTypeSetter(false) {}
47 class SortRefUpdateSetter : private SortTypeSetter
49 public:
50 SortRefUpdateSetter() : SortTypeSetter(true) {}
53 #endif
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */