summaryrefslogtreecommitdiff
path: root/xmloff/source/text
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-03-20 10:39:08 +0100
committerNoel Power <noel.power@suse.com>2013-03-20 15:06:26 +0000
commit473cd59a71706ada01f8be68c7dfd008ca9bb716 (patch)
treec34538f9d9585f5df9e144b08ae69085723d6ca7 /xmloff/source/text
parent0bebb6b7ee44db2554a74a77ffaffb304a7d9b3b (diff)
fdo#60769 implement odf export of multi-paragraph comment ranges
(cherry picked from commits 287c254d5ebf9b58ca63a8c271e523adf0d34b82 and 1fba17854b2be4fdbe436f44da3ae57a1f75a27c) Conflicts: sw/qa/extras/odfexport/odfexport.cxx Change-Id: Ifb850438586eb6589fde79d10ed9eef727368f42 Reviewed-on: https://gerrit.libreoffice.org/2873 Reviewed-by: Noel Power <noel.power@suse.com> Tested-by: Noel Power <noel.power@suse.com>
Diffstat (limited to 'xmloff/source/text')
-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 96cb8428c5f0..36f7f0c3cdf9 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -2198,7 +2198,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. */
@@ -2222,11 +2221,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;
@@ -2291,10 +2296,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;
}
@@ -2358,7 +2362,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();
@@ -2378,7 +2383,6 @@ void XMLTextParagraphExport::exportTextRangeEnumeration(
}
else
{
- Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY);
if (xFormField.is())
{
OUString sName;