Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/unotools/source/misc/defaultencoding.cxx
Line
Count
Source
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
#include <sal/config.h>
11
12
#include <unotools/configmgr.hxx>
13
#include <unotools/defaultencoding.hxx>
14
#include <officecfg/Office/Linguistic.hxx>
15
#include <officecfg/Setup.hxx>
16
#include <officecfg/System.hxx>
17
18
OUString utl_getLocaleForGlobalDefaultEncoding()
19
16.6k
{
20
16.6k
    if (comphelper::IsFuzzing())
21
16.6k
        return u"en-US"_ustr;
22
    // First try document default language
23
0
    OUString result(officecfg::Office::Linguistic::General::DefaultLocale::get());
24
    // Fallback to LO locale
25
0
    if (result.isEmpty())
26
0
        result = officecfg::Setup::L10N::ooSetupSystemLocale::get();
27
    // Fallback to system locale
28
0
    if (result.isEmpty())
29
0
        result = officecfg::System::L10N::Locale::get();
30
0
    return result;
31
16.6k
}
32
33
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */