summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sax/fastattribs.hxx1
-rw-r--r--sax/source/tools/fastattribs.cxx8
-rw-r--r--sc/source/filter/xml/xmlrowi.cxx10
-rw-r--r--xmloff/source/core/xmlimp.cxx24
4 files changed, 30 insertions, 13 deletions
diff --git a/include/sax/fastattribs.hxx b/include/sax/fastattribs.hxx
index 70ddc4c8bb85..c813fcf6944d 100644
--- a/include/sax/fastattribs.hxx
+++ b/include/sax/fastattribs.hxx
@@ -164,6 +164,7 @@ public:
};
const FastAttributeIter begin() const { return FastAttributeIter(*this, 0); }
const FastAttributeIter end() const { return FastAttributeIter(*this, maAttributeTokens.size()); }
+ const FastAttributeIter find( sal_Int32 nToken ) const;
private:
sal_Char *mpChunk; ///< buffer to store all attribute values - null terminated strings
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 985293ff0caf..564f71d27b81 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -230,6 +230,14 @@ Sequence< FastAttribute > FastAttributeList::getFastAttributes( )
return aSeq;
}
+const FastAttributeList::FastAttributeIter FastAttributeList::find( sal_Int32 nToken ) const
+{
+ for (size_t i = 0; i < maAttributeTokens.size(); ++i)
+ if( maAttributeTokens[i] == nToken )
+ return FastAttributeIter(*this, i);
+ return end();
+}
+
sal_Int32 FastTokenHandlerBase::getTokenFromChars(
const css::uno::Reference< css::xml::sax::XFastTokenHandler > &xTokenHandler,
FastTokenHandlerBase *pTokenHandler,
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index ab5fdf5eefa2..8903287504ac 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -227,11 +227,13 @@ ScXMLTableRowsContext::ScXMLTableRowsContext( ScXMLImport& rImport,
{
nGroupStartRow = rImport.GetTables().GetCurrentRow();
++nGroupStartRow;
- if ( xAttrList.is() &&
- xAttrList->hasAttribute( XML_ELEMENT( TABLE, XML_DISPLAY ) ) )
+ if ( xAttrList.is() )
{
- bGroupDisplay = IsXMLToken( xAttrList->getValue(
- XML_ELEMENT( TABLE, XML_DISPLAY ) ), XML_TRUE );
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( xAttrList.get() );
+ auto &aIter( pAttribList->find( XML_ELEMENT( TABLE, XML_DISPLAY ) ) );
+ if( aIter != pAttribList->end() )
+ bGroupDisplay = IsXMLToken( aIter.toCString(), XML_TRUE );
}
}
}
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index 5d9d1de5123e..92836d1af191 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -788,17 +788,23 @@ void SAL_CALL SvXMLImport::setDocumentLocator( const uno::Reference< xml::sax::X
void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
const uno::Reference< xml::sax::XFastAttributeList > & Attribs)
{
- if ( Attribs.is() && Attribs->hasAttribute( XML_ELEMENT( OFFICE, XML_VERSION ) ) )
+ if ( Attribs.is() )
{
- mpImpl->aODFVersion = Attribs->getValue( XML_ELEMENT( OFFICE, XML_VERSION ) );
-
- // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
- if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ sax_fastparser::FastAttributeList *pAttribList =
+ static_cast< sax_fastparser::FastAttributeList *>( Attribs.get() );
+ auto &aIter( pAttribList->find( XML_ELEMENT( OFFICE, XML_VERSION ) ) );
+ if( aIter != pAttribList->end() )
{
- throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
- uno::Reference< uno::XInterface >(),
- uno::makeAny(
- packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
+ mpImpl->aODFVersion = aIter.toString();
+
+ // the ODF version in content.xml and manifest.xml must be the same starting from ODF1.2
+ if ( mpImpl->mStreamName == "content.xml" && !IsODFVersionConsistent( mpImpl->aODFVersion ) )
+ {
+ throw xml::sax::SAXException("Inconsistent ODF versions in content.xml and manifest.xml!",
+ uno::Reference< uno::XInterface >(),
+ uno::makeAny(
+ packages::zip::ZipIOException("Inconsistent ODF versions in content.xml and manifest.xml!" ) ) );
+ }
}
}