diff options
author | Michael Stahl <mstahl@redhat.com> | 2012-06-05 13:51:09 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-05 14:01:26 +0200 |
commit | 4190e9351e69730f0097e6cdf4dad2fafa10577e (patch) | |
tree | 04a482ef0d242eac89351a5df6181dd8b32fab81 /xmloff | |
parent | cf6c32b7c4a5f7d182ae082aaf391553d6c1891a (diff) |
fdo#30711: fix some problems in 7a1c5e54:
The elements are exported without checking for bAutoStyles, and the Any
conversion is overly verbose.
Change-Id: Iebb52c8cd2638424dd48d28ec5a12c10a41f6cbf
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/txtparae.cxx | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index e7b370b561bb..04b008cd993b 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -2295,16 +2295,15 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( if (xParameters.is() && xParameters->hasByName("Name")) { const Any aValue = xParameters->getByName("Name"); - const Type aValueType = aValue.getValueType(); - if (aValueType == ::getCppuType((OUString*)0)) + OUString sValue; + if (aValue >>= sValue) { - OUString sValue; - aValue >>= sValue; GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, sValue); } } - GetExport().StartElement(XML_NAMESPACE_TEXT, XML_BOOKMARK_START, sal_False); - GetExport().EndElement(XML_NAMESPACE_TEXT, XML_BOOKMARK_START, sal_False); + SvXMLElementExport aElem( GetExport(), !bAutoStyles, + XML_NAMESPACE_TEXT, XML_BOOKMARK_START, + sal_False, sal_False ); const OUString sFieldType = xFormField->getFieldType(); if (sFieldType == ODF_FORMTEXT) { @@ -2319,19 +2318,15 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( openFieldMark = NONE; } } - else - { - GetExport().StartElement(XML_NAMESPACE_TEXT, XML_BOOKMARK_START, sal_False); - GetExport().EndElement(XML_NAMESPACE_TEXT, XML_BOOKMARK_START, sal_False); - } } } else if (sType.equals(sTextFieldEnd)) { if ( GetExport().getDefaultVersion() > SvtSaveOptions::ODFVER_012 ) { - GetExport().StartElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False); - GetExport().EndElement(XML_NAMESPACE_FIELD, XML_FIELDMARK_END, sal_False); + SvXMLElementExport aElem( GetExport(), !bAutoStyles, + XML_NAMESPACE_FIELD, XML_FIELDMARK_END, + sal_False, sal_False ); } else { @@ -2342,17 +2337,16 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( if (xParameters.is() && xParameters->hasByName("Name")) { const Any aValue = xParameters->getByName("Name"); - const Type aValueType = aValue.getValueType(); - if (aValueType == ::getCppuType((OUString*)0)) + OUString sValue; + if (aValue >>= sValue) { - OUString sValue; - aValue >>= sValue; GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, sValue); } } } - GetExport().StartElement(XML_NAMESPACE_TEXT, XML_BOOKMARK_END, sal_False); - GetExport().EndElement(XML_NAMESPACE_TEXT,XML_BOOKMARK_END, sal_False); + SvXMLElementExport aElem( GetExport(), !bAutoStyles, + XML_NAMESPACE_TEXT, XML_BOOKMARK_END, + sal_False, sal_False ); } } else if (sType.equals(sTextFieldStartEnd)) @@ -2383,8 +2377,9 @@ void XMLTextParagraphExport::exportTextRangeEnumeration( { GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_NAME, xBookmark->getName()); } - GetExport().StartElement(XML_NAMESPACE_TEXT, XML_BOOKMARK, sal_False); - GetExport().EndElement(XML_NAMESPACE_TEXT, XML_BOOKMARK, sal_False); + SvXMLElementExport aElem( GetExport(), !bAutoStyles, + XML_NAMESPACE_TEXT, XML_BOOKMARK, + sal_False, sal_False ); } } else if (sType.equals(sSoftPageBreak)) @@ -3348,15 +3343,11 @@ void XMLTextParagraphExport::exportTextRange( SvXMLElementExport aElement( GetExport(), !sStyle.isEmpty(), XML_NAMESPACE_TEXT, XML_SPAN, sal_False, sal_False ); - if (openFieldMark == TEXT) - { - GetExport().StartElement( XML_NAMESPACE_TEXT, XML_TEXT_INPUT, sal_False ); - } + + SvXMLElementExport aElem2( GetExport(), TEXT == openFieldMark, + XML_NAMESPACE_TEXT, XML_TEXT_INPUT, + sal_False, sal_False ); exportText( aText, rPrevCharIsSpace ); - if (openFieldMark == TEXT) - { - GetExport().EndElement( XML_NAMESPACE_TEXT, XML_TEXT_INPUT, sal_False ); - } openFieldMark = NONE; } } |