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#include <utility>
18
19namespace svx {
20
22{
24 MARKING,
25 TEXT,
28};
29
31{
32public:
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).
37
39 OUString sAbbreviatedName, OUString sIdentifier = "")
40 : meType(eType)
41 , msName(std::move(sName))
42 , msAbbreviatedName(std::move(sAbbreviatedName))
43 , msIdentifier(std::move(sIdentifier))
44 {
45 }
46
48 OUString const & getDisplayText() const
49 {
50 return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName;
51 }
52
53 bool operator==(const ClassificationResult& rOther) const
54 {
55 return (meType == rOther.meType &&
56 msName == rOther.msName &&
57 msAbbreviatedName == rOther.msAbbreviatedName &&
58 msIdentifier == rOther.msIdentifier);
59 }
60};
61
63{
64public:
66 OUString msDescription;
68 OUString msIdentifier;
69
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))
75 {}
76
77 std::unique_ptr<SvxFieldData> Clone() const override
78 {
79 return std::make_unique<ClassificationField>(meType, msDescription, msFullClassName, msIdentifier);
80 }
81
82 bool operator==(const SvxFieldData& rOther) const override
83 {
84 if (typeid(rOther) != typeid(*this))
85 return false;
86
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);
92 }
93};
94
95} // end svx namespace
96
97#endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX
98
99/* 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 sDescription, OUString sFullClassName, OUString sIdentifier)
OUString const & getDisplayText() const
Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name.
ClassificationResult(ClassificationType eType, OUString sName, OUString sAbbreviatedName, OUString sIdentifier="")
bool operator==(const ClassificationResult &rOther) const
DocumentType eType
OUString sName
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
OUString msName
TEXT
RedlineType meType