tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / include / svx / ClassificationField.hxx
bloba7402bf82883b113c6177eda4b4e98b1e8bac136
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 = u""_ustr)
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 ~ClassificationField() override;
79 std::unique_ptr<SvxFieldData> Clone() const override
81 return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
84 bool operator==(const SvxFieldData& rOther) const override
86 if (typeid(rOther) != typeid(*this))
87 return false;
89 const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther);
90 return (meType == rOtherField.meType &&
91 msDescription == rOtherField.msDescription &&
92 msFullClassName == rOtherField.msFullClassName &&
93 msIdentifier == rOtherField.msIdentifier);
97 } // end svx namespace
99 #endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
101 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */