1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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"
18 * Temporarily set the sorting type.
20 class SortTypeSetter
{
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
);
35 virtual ~SortTypeSetter()
37 changeTo(mbSortRefUpdate
);
41 class SortRefNoUpdateSetter
: private SortTypeSetter
44 SortRefNoUpdateSetter() : SortTypeSetter(false) {}
47 class SortRefUpdateSetter
: private SortTypeSetter
50 SortRefUpdateSetter() : SortTypeSetter(true) {}
55 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */