summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-03-20 10:43:57 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-03-20 11:35:24 +0100
commit19802872052aaed9d3deff02b882b2043239a406 (patch)
treee0f323e8a99c53e99fc62dcc1eec520cb4de34eb /xmloff
parentc426df5086785807972c1a8d2788567f2842a395 (diff)
fdo#60769 implement odf export of multi-paragraph comment ranges
Change-Id: Ifb850438586eb6589fde79d10ed9eef727368f42
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/text/txtparae.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 44f7e4d4c115..cf8dcc8fbc7e 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2194,7 +2194,6 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
static const OUString sMeta("InContentMetadata");
static const OUString sFieldMarkName("__FieldMark_");
bool bPrevCharIsSpace = bPrvChrIsSpc;
- bool bAnnotationStarted = false;
/* This is used for exporting to strict OpenDocument 1.2, in which case traditional
* bookmarks are used instead of fieldmarks. */
@@ -2218,11 +2217,17 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else if( sType.equals(sTextField))
{
- if (bAnnotationStarted)
+ Reference< ::com::sun::star::text::XFormField > xFormField;
+ try
{
- bAnnotationStarted = false;
+ xFormField.set(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
}
- else
+ catch( const uno::Exception& )
+ {
+ SAL_WARN("xmloff", "unexpected bookmark exception");
+ }
+
+ if (!xFormField.is() || xFormField->getFieldType() != ODF_COMMENTRANGE)
{
exportTextField( xTxtRange, bAutoStyles, bIsProgress );
bPrevCharIsSpace = false;
@@ -2287,10 +2292,9 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
else if (sType.equals(sTextFieldStart))
{
Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
- if (xFormField->getFieldType() == ODF_COMMENTRANGE)
+ if (xFormField.is() && xFormField->getFieldType() == ODF_COMMENTRANGE)
{
exportTextField( xTxtRange, bAutoStyles, bIsProgress );
- bAnnotationStarted = true;
continue;
}
@@ -2354,7 +2358,8 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else if (sType.equals(sTextFieldEnd))
{
- if (bAnnotationStarted)
+ Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
+ if (xFormField.is() && xFormField->getFieldType() == ODF_COMMENTRANGE)
{
Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
const OUString& rName = xBookmark->getName();
@@ -2374,7 +2379,6 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else
{
- Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
if (xFormField.is())
{
OUString sName;