diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-10-03 05:53:28 -0400 |
---|---|---|
committer | Ashod Nakashian <ashnakash@gmail.com> | 2019-01-03 19:12:07 +0100 |
commit | 5d6102ce297f12a81e1d21b4ffc9df1d97d0b847 (patch) | |
tree | ceccb733e926c69d9ef75fe078c6f28ba6a3e2b4 /sw/source/core/edit/edfcol.cxx | |
parent | dd2972d4c323afddc1eca90c88fe6240f40685dd (diff) |
sw: paragraph-sign: process signatures in one pass on loading
This combines the metadata field restoration logic with
validation/update of said field in one pass upon loading docs.
This cuts down overheads and makes the code more readable.
In addition, now that paragraph signature validation is quite
cheap (separate commits), esp. when no signatures exist, we
validate and update signatures (where applicable) when fields
are updated.
Change-Id: I4adcea579c591f9be457ed742d2cf54fa308163d
Reviewed-on: https://gerrit.libreoffice.org/63008
Tested-by: Jenkins
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sw/source/core/edit/edfcol.cxx')
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index bd057fb90c66..5a76f8ab99d9 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -1902,7 +1902,7 @@ static uno::Reference<text::XTextField> lcl_GetParagraphMetadataFieldAtIndex(con return xTextField; } -void SwEditShell::RestoreMetadataFields() +void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() { SwDocShell* pDocShell = GetDoc()->GetDocShell(); if (!pDocShell || !IsParagraphSignatureValidationEnabled()) @@ -2028,6 +2028,7 @@ void SwEditShell::RestoreMetadataFields() } } + lcl_ValidateParagraphSignatures(GetDoc(), xParagraph, true); // Validate and Update signatures. } catch (const std::exception&) { @@ -2118,7 +2119,7 @@ static OUString lcl_GetHighestClassificationParagraphClass(SwPaM* pCursor) while (xParagraphs->hasMoreElements()) { uno::Reference<text::XTextContent> xParagraph(xParagraphs->nextElement(), uno::UNO_QUERY); - OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, aKeyCreator, xModel, xParagraph); + const OUString sCurrentClass = lcl_GetParagraphClassification(aHelper, aKeyCreator, xModel, xParagraph); sHighestClass = aHelper.GetHigherClass(sHighestClass, sCurrentClass); } @@ -2131,7 +2132,7 @@ void SwEditShell::ClassifyDocPerHighestParagraphClass() if (!pDocShell) return; - // bail out as early as possible if we don't have paragraph classification + // Bail out as early as possible if we don't have paragraph classification. if (!SwRDFHelper::hasMetadataGraph(pDocShell->GetBaseModel(), MetaNS)) return; |