diff options
author | Ashod Nakashian <ashodnakashian@yahoo.com> | 2017-10-31 21:42:24 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2017-11-03 12:06:39 +0100 |
commit | 7bd8f9ed9559a745f3ed59161d282b199edd69a7 (patch) | |
tree | 2aacd1114083d10fbbe8d3717a61943d02ad7da5 /sw | |
parent | 4bba85e04cda1cb5769114be5ad771de55d56d14 (diff) |
TSCP: Paragraph signature RDF namespace now urn:bails
And remove PARAGRAPH entries from ClassificationResults
to restore adding the parens correctly.
Change-Id: Id0f07758e4daad8d0736800e211e35e9c7e026cf
Reviewed-on: https://gerrit.libreoffice.org/44145
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 2e0fa19c32e7..fe2700004fe5 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -95,11 +95,11 @@ namespace { static const OUString MetaFilename("tscp/bails.rdf"); static const OUString MetaNS("urn:bails"); -static const OUString ParagraphSignatureRDFName = "loext:paragraph:signature"; -static const OUString ParagraphSignatureDateRDFName = "loext:paragraph:signature:date"; -static const OUString ParagraphSignatureUsageRDFName = "loext:paragraph:signature:usage"; -static const OUString ParagraphClassificationNameRDFName = "loext:paragraph:classification:name"; -static const OUString ParagraphClassificationValueRDFName = "loext:paragraph:classification:value"; +static const OUString ParagraphSignatureRDFName = "urn:bails:loext:paragraph:signature"; +static const OUString ParagraphSignatureDateRDFName = "urn:bails:loext:paragraph:signature:date"; +static const OUString ParagraphSignatureUsageRDFName = "urn:bails:loext:paragraph:signature:usage"; +static const OUString ParagraphClassificationNameRDFName = "urn:bails:loext:paragraph:classification:name"; +static const OUString ParagraphClassificationValueRDFName = "urn:bails:loext:paragraph:classification:value"; static const OUString MetadataFieldServiceName = "com.sun.star.text.textfield.MetadataField"; static const OUString DocInfoServiceName = "com.sun.star.text.TextField.DocInfo.Custom"; @@ -724,7 +724,7 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes case svx::ClassificationType::CATEGORY: { - OUString sKey = aCreator.makeCategoryKey(); + OUString sKey = aCreator.makeCategoryNameKey(); insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); } @@ -857,7 +857,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectAdvancedClassificatio if (!aValue.isEmpty()) aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank }); } - else if (aCreator.isCategoryKey(aName)) + else if (aCreator.isCategoryNameKey(aName) || aCreator.isCategoryIdentifierKey(aName)) { const OUString aValue = lcl_getProperty(xPropertyContainer, aName); if (!aValue.isEmpty()) @@ -1000,15 +1000,18 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe // Since we always insert at the start of the paragraph, // need to insert in reverse order. std::reverse(aResults.begin(), aResults.end()); + // Ignore "PARAGRAPH" types + aResults.erase(std::remove_if(aResults.begin(), + aResults.end(), + [&](const svx::ClassificationResult& rResult)-> bool + { return rResult.meType == svx::ClassificationType::PARAGRAPH; }), + aResults.end()); + for (size_t nIndex = 0; nIndex < aResults.size(); ++nIndex) { const svx::ClassificationResult& rResult = aResults[nIndex]; - // Ignore "PARAGRAPH" types - if (rResult.meType == svx::ClassificationType::PARAGRAPH) - continue; - const bool isLast = nIndex == 0; const bool isFirst = nIndex == aResults.size() - 1; OUString sKey; @@ -1022,7 +1025,10 @@ void SwEditShell::ApplyParagraphClassification(std::vector<svx::ClassificationRe case svx::ClassificationType::CATEGORY: { - sKey = aKeyCreator.makeCategoryKey(); + if (rResult.msIdentifier.isEmpty()) + sKey = aKeyCreator.makeCategoryNameKey(); + else + sKey = aKeyCreator.makeCategoryIdentifierKey(); } break; @@ -1098,7 +1104,7 @@ std::vector<svx::ClassificationResult> SwEditShell::CollectParagraphClassificati { aResult.push_back({ svx::ClassificationType::TEXT, aValue, sBlank, sBlank }); } - else if (aKeyCreator.isCategoryKey(aName)) + else if (aKeyCreator.isCategoryNameKey(aName) || aKeyCreator.isCategoryIdentifierKey(aName)) { aResult.push_back({ svx::ClassificationType::CATEGORY, aValue, sBlank, sBlank }); } |