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/.
12 // Unfortunately requires linkage to sc/ internals so
13 // can't live in qahelper itself.
14 #include <inputopt.hxx>
18 * Temporarily set the sorting type.
20 class SortTypeSetter
{
23 explicit SortTypeSetter(bool bSortRefUpdate
)
25 mbSortRefUpdate
= changeTo(bSortRefUpdate
);
27 static bool changeTo(bool bSortRefUpdate
)
29 ScModule
* mod
= ScModule::get();
30 ScInputOptions aInputOptions
= mod
->GetInputOptions();
31 bool bRet
= aInputOptions
.GetSortRefUpdate();
32 aInputOptions
.SetSortRefUpdate(bSortRefUpdate
);
33 mod
->SetInputOptions(aInputOptions
);
36 virtual ~SortTypeSetter() COVERITY_NOEXCEPT_FALSE
38 changeTo(mbSortRefUpdate
);
42 class SortRefNoUpdateSetter
: private SortTypeSetter
45 SortRefNoUpdateSetter() : SortTypeSetter(false) {}
48 class SortRefUpdateSetter
: private SortTypeSetter
51 SortRefUpdateSetter() : SortTypeSetter(true) {}
54 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */