LibreOffice Module svx (master) 1
ClassificationField.hxx
Go to the documentation of this file.
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
18namespace svx {
19
21{
23 MARKING,
24 TEXT,
27};
28
30{
31public:
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).
36
38 const OUString& sAbbreviatedName, const OUString& sIdentifier = "")
39 : meType(eType)
40 , msName(sName)
41 , msAbbreviatedName(sAbbreviatedName)
42 , msIdentifier(sIdentifier)
43 {
44 }
45
47 OUString const & getDisplayText() const
48 {
49 return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName;
50 }
51
52 bool operator==(const ClassificationResult& rOther) const
53 {
54 return (meType == rOther.meType &&
55 msName == rOther.msName &&
56 msAbbreviatedName == rOther.msAbbreviatedName &&
57 msIdentifier == rOther.msIdentifier);
58 }
59};
60
62{
63public:
65 OUString msDescription;
67 OUString msIdentifier;
68
69 ClassificationField(ClassificationType eType, OUString const & sDescription, OUString const & sFullClassName, OUString const & sIdentifier)
70 : meType(eType)
71 , msDescription(sDescription)
72 , msFullClassName(sFullClassName)
73 , msIdentifier(sIdentifier)
74 {}
75
76 std::unique_ptr<SvxFieldData> Clone() const override
77 {
78 return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
79 }
80
81 bool operator==(const SvxFieldData& rOther) const override
82 {
83 if (typeid(rOther) != typeid(*this))
84 return false;
85
86 const ClassificationField& rOtherField = static_cast<const ClassificationField&>(rOther);
87 return (meType == rOtherField.meType &&
88 msDescription == rOtherField.msDescription &&
89 msFullClassName == rOtherField.msFullClassName &&
90 msIdentifier == rOtherField.msIdentifier);
91 }
92};
93
94} // end svx namespace
95
96#endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
97
98/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const SvxFieldData &rOther) const override
std::unique_ptr< SvxFieldData > Clone() const override
ClassificationField(ClassificationType eType, OUString const &sDescription, OUString const &sFullClassName, OUString const &sIdentifier)
ClassificationResult(ClassificationType eType, const OUString &sName, const OUString &sAbbreviatedName, const OUString &sIdentifier="")
OUString const & getDisplayText() const
Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name.
bool operator==(const ClassificationResult &rOther) const
DocumentType eType
OUString sName
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
OUString msName
TEXT
RedlineType meType