Bump version to 6.4-15
[LibreOffice.git] / include / svx / ClassificationField.hxx
blobf742e5dda4eddbb4249bc8fd9d100ae7904fece0
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>
18 namespace svx {
20 enum class ClassificationType
22 CATEGORY,
23 MARKING,
24 TEXT,
25 INTELLECTUAL_PROPERTY_PART,
26 PARAGRAPH,
29 class SVX_DLLPUBLIC ClassificationResult
31 public:
32 ClassificationType meType;
33 OUString msName; //< Display text or 'Name' field (from example.xml).
34 OUString msAbbreviatedName; //< Abbreviated name, displayed instead of Name.
35 OUString msIdentifier; //< The identifier of this entry (from example.xml).
37 ClassificationResult(ClassificationType eType, const OUString& sName,
38 const OUString& sAbbreviatedName, const OUString& sIdentifier = "")
39 : meType(eType)
40 , msName(sName)
41 , msAbbreviatedName(sAbbreviatedName)
42 , msIdentifier(sIdentifier)
46 /// Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name.
47 OUString const & getDisplayText() const
49 return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName;
52 bool operator==(const ClassificationResult& rOther) const
54 return (meType == rOther.meType &&
55 msName == rOther.msName &&
56 msAbbreviatedName == rOther.msAbbreviatedName &&
57 msIdentifier == rOther.msIdentifier);
61 class SVX_DLLPUBLIC ClassificationField final : public SvxFieldData
63 public:
64 ClassificationType const meType;
65 OUString const msDescription;
66 OUString const msFullClassName;
67 OUString const msIdentifier;
69 ClassificationField(ClassificationType eType, OUString const & sDescription, OUString const & sFullClassName, OUString const & sIdentifier)
70 : SvxFieldData()
71 , meType(eType)
72 , msDescription(sDescription)
73 , msFullClassName(sFullClassName)
74 , msIdentifier(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: */