summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-11-17 12:06:13 +0900
committerTomaž Vajngerl <quikee@gmail.com>2017-11-17 10:14:22 +0100
commit18bc47d6e0eedd4b2e4dc977ae445d60b41eb122 (patch)
treed6ed8bd5b0eda9a8c8311dd91f5a0eef1dc8f329
parentef5fc3adfd73ea0a12fbc07083a9e37b2d02798b (diff)
TSCP: convert the class. ID to name, fix class. change on save
Change-Id: Ic829ebeb488f41f3189170e6fdeebd80b28ae8c5 Reviewed-on: https://gerrit.libreoffice.org/44855 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r--sw/source/core/edit/edfcol.cxx21
1 files changed, 14 insertions, 7 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 59f9183340a4..cccf2ab539a2 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2028,16 +2028,21 @@ bool SwEditShell::RemoveParagraphMetadataFieldAtCursor(const bool bBackspaceNotD
return false;
}
-OUString lcl_GetParagraphClassification(sfx::ClassificationKeyCreator const & rKeyCreator, const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
+OUString lcl_GetParagraphClassification(SfxClassificationHelper & rHelper, sfx::ClassificationKeyCreator const & rKeyCreator,
+ const uno::Reference<frame::XModel>& xModel, const uno::Reference<text::XTextContent>& xParagraph)
{
-
- uno::Reference<text::XTextField> xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryNameKey());
- if (!xTextField.is())
- xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryIdentifierKey());
-
+ uno::Reference<text::XTextField> xTextField;
+ xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryIdentifierKey());
if (xTextField.is())
{
const std::pair<OUString, OUString> rdfValuePair = lcl_getRDF(xModel, xTextField, ParagraphClassificationValueRDFName);
+ return rHelper.GetBACNameForIdentifier(rdfValuePair.second);
+ }
+
+ xTextField = lcl_FindParagraphClassificationField(xModel, xParagraph, rKeyCreator.makeCategoryNameKey());
+ if (xTextField.is())
+ {
+ const std::pair<OUString, OUString> rdfValuePair = lcl_getRDF(xModel, xTextField, ParagraphClassificationNameRDFName);
return rdfValuePair.second;
}
@@ -2068,7 +2073,8 @@ OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor)
while (xParagraphs->hasMoreElements())
{
uno::Reference<text::XTextContent> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY);
- sHighestClass = aHelper.GetHigherClass(sHighestClass, lcl_GetParagraphClassification(aKeyCreator, xModel, xParagraph));
+ OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, aKeyCreator, xModel, xParagraph);
+ sHighestClass = aHelper.GetHigherClass(sHighestClass, sCurrentClass);
}
return sHighestClass;
@@ -2106,6 +2112,7 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass()
if (sfx::getCreationOriginProperty(xPropertyContainer, aKeyCreator) == sfx::ClassificationCreationOrigin::MANUAL)
{
aHelper.SetBACName(sHighestClass, eHighestClassType);
+ ApplyAdvancedClassification(CollectAdvancedClassification());
}
else
{