diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2017-10-30 14:25:23 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-11-03 11:16:25 +0100 |
commit | 25a26b66b398d127842369e06c3ef95fe901e305 (patch) | |
tree | 4ed12732e4d478d68f8591212893e341a87aa6c4 /include/svx | |
parent | 2ecd194d091fd33c2554bfff960985b2bd5e654e (diff) |
TSCP: flesh out ClassificationResult
Change-Id: Ie6ee33cc21f6f27ae1d58a0e47f367b0539e4378
Reviewed-on: https://gerrit.libreoffice.org/44117
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'include/svx')
-rw-r--r-- | include/svx/ClassificationField.hxx | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/include/svx/ClassificationField.hxx b/include/svx/ClassificationField.hxx index 4d4588c68177..32f783eb1896 100644 --- a/include/svx/ClassificationField.hxx +++ b/include/svx/ClassificationField.hxx @@ -26,6 +26,38 @@ enum class ClassificationType PARAGRAPH, }; +class SVX_DLLPUBLIC ClassificationResult +{ +public: + ClassificationType meType; + OUString msName; //< Display text or 'Name' field (from example.xml). + OUString msAbbreviatedName; //< Abbreviated name, displayed instead of Name. + OUString msIdentifier; //< The identifier of this entry (from example.xml). + + ClassificationResult(ClassificationType eType, const OUString& sName, + const OUString& sAbbreviatedName = "", const OUString& sIdentifier = "") + : meType(eType) + , msName(sName) + , msAbbreviatedName(sAbbreviatedName) + , msIdentifier(sIdentifier) + { + } + + /// Returns the text to display, which is the Abbreviated Name, if provided, otherwise Name. + OUString getDisplayText() const + { + return !msAbbreviatedName.isEmpty() ? msAbbreviatedName : msName; + } + + bool operator==(const ClassificationResult& rOther) const + { + return (meType == rOther.meType && + msName == rOther.msName && + msAbbreviatedName == rOther.msAbbreviatedName && + msIdentifier == rOther.msIdentifier); + } +}; + class SVX_DLLPUBLIC ClassificationField : public SvxFieldData { public: @@ -60,14 +92,6 @@ public: } }; -struct SVX_DLLPUBLIC ClassificationResult -{ - ClassificationType meType; - OUString msString; //< Display text or 'Name' field (from example.xml). - OUString msAbbreviatedString; //< Abbreviated name, displayed instead of msString. - OUString msIdentifier; //< The identifier of this entry (from example.xml). -}; - } // end svx namespace #endif // INCLUDED_SVX_CLASSIFICATIONFIELD_HXX |