diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-02-14 07:35:44 -0500 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-02-21 16:53:54 +0100 |
commit | 292e9861adba78303eb43bbb84fae57f2bb5d15b (patch) | |
tree | bc2797580743452c6c4bba514cdb26e31dcbdf78 | |
parent | ac36e5b90787338c5ebdbd942ad3b12b6831af3f (diff) |
tdf#115569 don't sign or validate text in tables
Both undoing signatures and updating the metafield
are causing seg-faults. Clearly more work is needed
to support paragraph signing within tables, so
disabled for now.
Change-Id: Ia20c8b07069689b0e8b7d11a634a2a48ef1f0fa3
Reviewed-on: https://gerrit.libreoffice.org/49722
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
(cherry picked from commit 48fd0d45288bd8501f14c993cf613fe7743fabcd)
Reviewed-on: https://gerrit.libreoffice.org/50045
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index d679a4105acd..1ec98d87bb0f 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -480,12 +480,20 @@ bool lcl_DoUpdateParagraphSignatureField(SwDoc* pDoc, pDoc->GetIDocumentUndoRedo().DoUndo(isUndoEnabled); }); - uno::Reference<css::text::XTextRange> xText(xField, uno::UNO_QUERY); - const OUString curText = xText->getString(); - if (curText != sDisplayText) + try + { + uno::Reference<css::text::XTextRange> xText(xField, uno::UNO_QUERY); + const OUString curText = xText->getString(); + if (curText != sDisplayText) + { + xText->setString(sDisplayText); + return true; + } + } + catch (const uno::Exception& ex) { - xText->setString(sDisplayText); - return true; + // We failed; avoid crashing. + SAL_WARN("sw.uno", "Failed to update paragraph signature: " << ex); } return false; @@ -1734,6 +1742,10 @@ void SwEditShell::SignParagraph() if (!pNode) return; + // Table text signing is not supported. + if (pNode->FindTableNode() != nullptr) + return; + // 1. Get the text (without fields). const uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode); const OString utf8Text = lcl_getParagraphBodyText(xParagraph); @@ -1808,7 +1820,12 @@ void SwEditShell::ValidateCurrentParagraphSignatures(bool updateDontRemove) SetParagraphSignatureValidation(bOldValidationFlag); }); - lcl_ValidateParagraphSignatures(GetDoc(), SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode), updateDontRemove); + // Table text signing is not supported. + if (pNode->FindTableNode() != nullptr) + return; + + uno::Reference<text::XTextContent> xParentText = SwXParagraph::CreateXParagraph(*pNode->GetDoc(), pNode); + lcl_ValidateParagraphSignatures(GetDoc(), xParentText, updateDontRemove); } void SwEditShell::ValidateAllParagraphSignatures(bool updateDontRemove) |