Kaydet (Commit) 48fd0d45 authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Miklos Vajna

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/49722Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst bd22f1be
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment