summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-18 11:16:38 +0100
committerMichael Stahl <mstahl@redhat.com>2013-02-18 22:26:37 +0000
commit3d9911a925607ed58002c6c9488507bd5a818975 (patch)
treedb64a8ce25153a9ffa345bebf489531ec21ca7d7
parent806403f366f5cdfbb73438dd4004ed6c8fbd696d (diff)
fdo#60710 SwXTextPortionEnumeration: filter out fields from the undo stack
The UNO API provides the annotation field associated to a comment range fieldmark when the fieldmark starts. To achieve this, it looks up the annotation field by name, but it failed to ignore the fields which are present only because the undo stack still holds a reference to them, making the ODF export filter fail to export the document. (cherry picked from commit f6a02947896e19160c137032a7fc2e56277656af) Change-Id: Ia3b738a1eca7ed9981e1963b3d70ea8e3dbe8db8 Reviewed-on: https://gerrit.libreoffice.org/2231 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/unocore/unoportenum.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 6849d0310779..d05b8f5b0d6a 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -330,7 +330,8 @@ static const SwFmtFld* lcl_getFieldByName(SwDoc* pDoc, const OUString& rName)
SwIterator<SwFmtFld, SwFieldType> aIter(*pCurType);
for (const SwFmtFld* pCurFldFmt = aIter.First(); pCurFldFmt; pCurFldFmt = aIter.Next())
{
- if (pCurFldFmt->GetFld()->GetTyp()->Which() != RES_POSTITFLD)
+ // Ignore the field if it's not an annotation or it doesn't have an anchor.
+ if (pCurFldFmt->GetFld()->GetTyp()->Which() != RES_POSTITFLD || !pCurFldFmt->GetTxtFld())
continue;
const SwPostItField* pField = dynamic_cast<const SwPostItField*>(pCurFldFmt->GetFld());