Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/ClassificationField.hxx
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
11
#ifndef INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
12
#define INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
13
14
#include <sal/config.h>
15
#include <svx/svxdllapi.h>
16
#include <editeng/flditem.hxx>
17
#include <utility>
18
19
namespace svx {
20
21
enum class ClassificationType
22
{
23
    CATEGORY,
24
    MARKING,
25
    TEXT,
26
    INTELLECTUAL_PROPERTY_PART,
27
    PARAGRAPH,
28
};
29
30
class SVX_DLLPUBLIC ClassificationResult
31
{
32
public:
33
    ClassificationType meType;
34
    OUString msName;            //< Display text or 'Name' field (from example.xml).
35
    OUString msAbbreviatedName; //< Abbreviated name, displayed instead of Name.
36
    OUString msIdentifier;      //< The identifier of this entry (from example.xml).
37
38
    ClassificationResult(ClassificationType eType, OUString sName,
39
                         OUString sAbbreviatedName, OUString sIdentifier = u""_ustr)
40
0
        : meType(eType)
41
0
        , msName(std::move(sName))
42
0
        , msAbbreviatedName(std::move(sAbbreviatedName))
43
0
        , msIdentifier(std::move(sIdentifier))
44
0
    {
45
0
    }
46
47
    bool operator==(const ClassificationResult& rOther) const
48
0
    {
49
0
        return (meType == rOther.meType &&
50
0
                msName == rOther.msName &&
51
0
                msAbbreviatedName == rOther.msAbbreviatedName &&
52
0
                msIdentifier == rOther.msIdentifier);
53
0
    }
54
};
55
56
class SVX_DLLPUBLIC ClassificationField final : public SvxFieldData
57
{
58
public:
59
    ClassificationType meType;
60
    OUString msDescription;
61
    OUString msFullClassName;
62
    OUString msIdentifier;
63
64
    ClassificationField(ClassificationType eType, OUString sDescription, OUString sFullClassName, OUString sIdentifier)
65
0
        : meType(eType)
66
0
        , msDescription(std::move(sDescription))
67
0
        , msFullClassName(std::move(sFullClassName))
68
0
        , msIdentifier(std::move(sIdentifier))
69
0
    {}
70
71
    ~ClassificationField() override;
72
73
    std::unique_ptr<SvxFieldData> Clone() const override
74
0
    {
75
0
        return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
76
0
    }
77
78
    bool operator==(const SvxFieldData& rOther) const override
79
0
    {
80
0
        if (typeid(rOther) != typeid(*this))
81
0
            return false;
82
83
0
        const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther);
84
0
        return (meType == rOtherField.meType &&
85
0
                msDescription == rOtherField.msDescription &&
86
0
                msFullClassName == rOtherField.msFullClassName &&
87
0
                msIdentifier == rOtherField.msIdentifier);
88
0
    }
89
};
90
91
} // end svx namespace
92
93
#endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
94
95
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */