Coverage Report

Created: 2026-08-14 10:22

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/xmloff/source/style/prstylecond.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
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <rtl/ustring.hxx>
21
#include <prstylecond.hxx>
22
#include <xmloff/xmltoken.hxx>
23
24
using namespace ::xmloff::token;
25
26
// note: keep this in sync with the list of conditions in sw/source/uibase/chrdlg/ccoll.cxx
27
28
namespace {
29
30
struct ConditionMap
31
{
32
        char const* aInternal;
33
        XMLTokenEnum nExternal;
34
        int          aValue;
35
};
36
37
}
38
39
const ConditionMap g_ConditionMap[] =
40
{
41
    { "TableHeader",            XML_TABLE_HEADER,   -1 },
42
    { "Table",                  XML_TABLE,          -1 },
43
    { "Frame",                  XML_TEXT_BOX,       -1 }, // FIXME - Not in ODF spec
44
    { "Section",                XML_SECTION,        -1 },
45
    { "Footnote",               XML_FOOTNOTE,       -1 },
46
    { "Endnote",                XML_ENDNOTE,        -1 },
47
    { "Header",                 XML_HEADER,         -1 },
48
    { "Footer",                 XML_FOOTER,         -1 },
49
    { "OutlineLevel1",          XML_OUTLINE_LEVEL,   1 },
50
    { "OutlineLevel2",          XML_OUTLINE_LEVEL,   2 },
51
    { "OutlineLevel3",          XML_OUTLINE_LEVEL,   3 },
52
    { "OutlineLevel4",          XML_OUTLINE_LEVEL,   4 },
53
    { "OutlineLevel5",          XML_OUTLINE_LEVEL,   5 },
54
    { "OutlineLevel6",          XML_OUTLINE_LEVEL,   6 },
55
    { "OutlineLevel7",          XML_OUTLINE_LEVEL,   7 },
56
    { "OutlineLevel8",          XML_OUTLINE_LEVEL,   8 },
57
    { "OutlineLevel9",          XML_OUTLINE_LEVEL,   9 },
58
    { "OutlineLevel10",         XML_OUTLINE_LEVEL,  10 },
59
    { "NumberingLevel1",        XML_LIST_LEVEL,      1 },
60
    { "NumberingLevel2",        XML_LIST_LEVEL,      2 },
61
    { "NumberingLevel3",        XML_LIST_LEVEL,      3 },
62
    { "NumberingLevel4",        XML_LIST_LEVEL,      4 },
63
    { "NumberingLevel5",        XML_LIST_LEVEL,      5 },
64
    { "NumberingLevel6",        XML_LIST_LEVEL,      6 },
65
    { "NumberingLevel7",        XML_LIST_LEVEL,      7 },
66
    { "NumberingLevel8",        XML_LIST_LEVEL,      8 },
67
    { "NumberingLevel9",        XML_LIST_LEVEL,      9 },
68
    { "NumberingLevel10",       XML_LIST_LEVEL,     10 }
69
};
70
71
OUString GetParaStyleCondExternal( std::u16string_view internal)
72
0
{
73
0
    for (const auto& rCondition : g_ConditionMap)
74
0
    {
75
0
        if (o3tl::equalsAscii(internal, rCondition.aInternal ))
76
0
        {
77
0
            OUString aResult = GetXMLToken( rCondition.nExternal ) +
78
0
                    "()";
79
0
            if (rCondition.aValue != -1)
80
0
            {
81
0
                aResult += "=" +
82
0
                    OUString::number( rCondition.aValue );
83
0
            }
84
0
            return aResult;
85
0
        }
86
0
    }
87
0
    assert(!"GetParaStyleCondExternal: model has unknown style condition");
88
0
    return OUString();
89
0
}
90
91
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */