android: Update app-specific/MIME type icons
[LibreOffice.git] / include / svx / ClassificationField.hxx
blobe2b5a71ab7756679f5748e62523e4d3276a61e4c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #ifndef INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
12 #define INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
14 #include <sal/config.h>
15 #include <svx/svxdllapi.h>
16 #include <editeng/flditem.hxx>
17 #include <utility>
19 namespace svx {
21 enum class ClassificationType
23 CATEGORY,
24 MARKING,
25 TEXT,
26 INTELLECTUAL_PROPERTY_PART,
27 PARAGRAPH,
30 class SVX_DLLPUBLIC ClassificationResult
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).
38 ClassificationResult(ClassificationType eType, OUString sName,
39 OUString sAbbreviatedName, OUString sIdentifier = "")
40 : meType(eType)
41 , msName(std::move(sName))
42 , msAbbreviatedName(std::move(sAbbreviatedName))
43 , msIdentifier(std::move(sIdentifier))
47 /// Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name.
48 OUString const & getDisplayText() const
50 return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName;
53 bool operator==(const ClassificationResult& rOther) const
55 return (meType == rOther.meType &&
56 msName == rOther.msName &&
57 msAbbreviatedName == rOther.msAbbreviatedName &&
58 msIdentifier == rOther.msIdentifier);
62 class SVX_DLLPUBLIC ClassificationField final : public SvxFieldData
64 public:
65 ClassificationType meType;
66 OUString msDescription;
67 OUString msFullClassName;
68 OUString msIdentifier;
70 ClassificationField(ClassificationType eType, OUString sDescription, OUString sFullClassName, OUString sIdentifier)
71 : meType(eType)
72 , msDescription(std::move(sDescription))
73 , msFullClassName(std::move(sFullClassName))
74 , msIdentifier(std::move(sIdentifier))
77 std::unique_ptr<SvxFieldData> Clone() const override
79 return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
82 bool operator==(const SvxFieldData& rOther) const override
84 if (typeid(rOther) != typeid(*this))
85 return false;
87 const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther);
88 return (meType == rOtherField.meType &&
89 msDescription == rOtherField.msDescription &&
90 msFullClassName == rOtherField.msFullClassName &&
91 msIdentifier == rOtherField.msIdentifier);
95 } // end svx namespace
97 #endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */