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 
18 namespace svx {
19 
21 {
22  CATEGORY,
23  MARKING,
24  TEXT,
26  PARAGRAPH,
27 };
28 
30 {
31 public:
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 {
63 public:
65  OUString msDescription;
66  OUString msFullClassName;
67  OUString msIdentifier;
68 
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)
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: */
OUString msName
OUString const & getDisplayText() const
Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name...
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
DocumentType eType
OUString sName
ClassificationResult(ClassificationType eType, const OUString &sName, const OUString &sAbbreviatedName, const OUString &sIdentifier="")
std::unique_ptr< SvxFieldData > Clone() const override
ClassificationField(ClassificationType eType, OUString const &sDescription, OUString const &sFullClassName, OUString const &sIdentifier)
bool operator==(const SvxFieldData &rOther) const override
bool operator==(const ClassificationResult &rOther) const