1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 #include <sal/config.h>
12 #include <com/sun/star/lang/IllegalArgumentException.hpp>
14 #include <officecfg/Office/Common.hxx>
15 #include <officecfg/Setup.hxx>
17 #include <o3tl/string_view.hxx>
18 #include <sal/log.hxx>
19 #include <unotools/configmgr.hxx>
20 #include <unotools/VersionConfig.hxx>
24 bool isProductVersionUpgraded()
26 static const bool bUpgraded
= []() {
27 OUString sSetupVersion
= utl::ConfigManager::getProductVersion();
28 sal_Int32 iCurrent
= o3tl::toInt32(o3tl::getToken(sSetupVersion
, 0, '.')) * 10
29 + o3tl::toInt32(o3tl::getToken(sSetupVersion
, 1, '.'));
31 = officecfg::Setup::Product::ooSetupLastVersion::get().value_or("0.0");
32 sal_Int32 iLast
= o3tl::toInt32(o3tl::getToken(sLastVersion
, 0, '.')) * 10
33 + o3tl::toInt32(o3tl::getToken(sLastVersion
, 1, '.'));
39 auto batch(comphelper::ConfigurationChanges::create());
40 officecfg::Setup::Product::ooSetupLastVersion::set(sSetupVersion
, batch
);
41 // tdf#35568: an upgrade must repeat the first run routine
42 officecfg::Office::Common::Misc::FirstRun::set(true, batch
);
45 catch (css::lang::IllegalArgumentException
&)
46 { //If the value was readOnly.
47 SAL_WARN("desktop.updater", "Updating property ooSetupLastVersion to version "
49 << " failed (read-only property?)");
59 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */