diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-07-20 15:05:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-07-20 15:20:50 +0200 |
commit | 672ca6077ff9f65f29e0d7521149595f4eaf7a63 (patch) | |
tree | 093c62d4c66f8fdffba6168a5dd67589d491a8ed /xmloff | |
parent | b11e923a50ca532016fc0802e1d2dfa53efa0679 (diff) |
office:annotation-end export
Change-Id: Idd815f2d10e67ae9cf91f06b6b4c92a0ebe2e856
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/inc/xmloff/xmltoken.hxx | 1 | ||||
-rw-r--r-- | xmloff/source/core/xmltoken.cxx | 1 | ||||
-rw-r--r-- | xmloff/source/text/txtflde.cxx | 4 | ||||
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 34 |
4 files changed, 36 insertions, 4 deletions
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx index 73dcd95a6cda..c4113ca7aa9f 100644 --- a/xmloff/inc/xmloff/xmltoken.hxx +++ b/xmloff/inc/xmloff/xmltoken.hxx @@ -244,6 +244,7 @@ namespace xmloff { namespace token { XML_ANIMATION_STOP_INSIDE, XML_ANIMATIONS, XML_ANNOTATION, + XML_ANNOTATION_END, XML_ANNOTATIONS, XML_ANNOTE, XML_APPEAR, diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 14c3fb1d959e..f7d8f2814806 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -248,6 +248,7 @@ namespace xmloff { namespace token { TOKEN( "animation-stop-inside", XML_ANIMATION_STOP_INSIDE ), TOKEN( "animations", XML_ANIMATIONS ), TOKEN( "annotation", XML_ANNOTATION ), + TOKEN( "annotation-end", XML_ANNOTATION_END ), TOKEN( "annotations", XML_ANNOTATIONS ), TOKEN( "annote", XML_ANNOTE ), TOKEN( "appear", XML_APPEAR ), diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx index bc78c34669de..c649b9714df8 100644 --- a/xmloff/source/text/txtflde.cxx +++ b/xmloff/source/text/txtflde.cxx @@ -1737,6 +1737,10 @@ void XMLTextFieldExport::ExportFieldHelper( "Unexpected presentation for annotation field"); // annotation element + content + OUString aName; + rPropSet->getPropertyValue(sPropertyName) >>= aName; + if (!aName.isEmpty()) + GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, aName); SvXMLElementExport aElem(GetExport(), XML_NAMESPACE_OFFICE, XML_ANNOTATION, sal_False, sal_True); diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 04b008cd993b..392f4917ac15 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2181,6 +2181,7 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { static OUString sMeta("InContentMetadata"); 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. */ @@ -2204,8 +2205,15 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( } else if( sType.equals(sTextField)) { - exportTextField( xTxtRange, bAutoStyles, bIsProgress ); - bPrevCharIsSpace = false; + if (bAnnotationStarted) + { + bAnnotationStarted = false; + } + else + { + exportTextField( xTxtRange, bAutoStyles, bIsProgress ); + bPrevCharIsSpace = false; + } } else if( sType.equals( sFrame ) ) { @@ -2265,6 +2273,14 @@ 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) + { + exportTextField( xTxtRange, bAutoStyles, bIsProgress ); + bAnnotationStarted = true; + continue; + } + /* As of now, textmarks are a proposed extension to the OpenDocument standard. */ if ( GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { @@ -2273,7 +2289,6 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName()); } - Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); if (xFormField.is()) { GetExport().AddAttribute(XML_NAMESPACE_FIELD, XML_TYPE, xFormField->getFieldType()); @@ -2288,7 +2303,6 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( /* The OpenDocument standard does not include support for TextMarks for now, so use bookmarks instead. */ else { - Reference< ::com::sun::star::text::XFormField > xFormField(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); if (xFormField.is()) { Reference< ::com::sun::star::container::XNameAccess > xParameters(xFormField->getParameters(), UNO_QUERY); @@ -2322,6 +2336,18 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( } else if (sType.equals(sTextFieldEnd)) { + if (bAnnotationStarted) + { + Reference<XNamed> xBookmark(xPropSet->getPropertyValue(sBookmark), UNO_QUERY); + const OUString& rName = xBookmark->getName(); + if (!rName.isEmpty()) + GetExport().AddAttribute(XML_NAMESPACE_OFFICE, XML_NAME, rName); + SvXMLElementExport aElem( GetExport(), !bAutoStyles, + XML_NAMESPACE_OFFICE, XML_ANNOTATION_END, + sal_False, sal_False ); + continue; + } + if ( GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { SvXMLElementExport aElem( GetExport(), !bAutoStyles, |