1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
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>
20 enum class ClassificationType
25 INTELLECTUAL_PROPERTY_PART
,
29 class SVX_DLLPUBLIC ClassificationResult
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
= "")
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
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
)
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))
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: */