summaryrefslogtreecommitdiff
path: root/sax/source/expatwrap/sax_expat.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sax/source/expatwrap/sax_expat.cxx')
-rw-r--r--sax/source/expatwrap/sax_expat.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index d9553113c759..e1f5161b7e3a 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#include <com/sun/star/io/XSeekable.hpp>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx>
@@ -135,6 +136,11 @@ OUString XmlChar2OUString( const XML_Char *p )
pThis->rDocumentLocator->getColumnNumber()\
) );\
}\
+ catch( com::sun::star::uno::RuntimeException &e ) {\
+ pThis->bExceptionWasThrown = sal_True; \
+ pThis->bRTExceptionWasThrown = sal_True; \
+ pImpl->rtexception = e; \
+ }\
}\
((void)0)
@@ -255,7 +261,9 @@ public: // module scope
// Exception cannot be thrown through the C-XmlParser (possible resource leaks),
// therefor the exception must be saved somewhere.
SAXParseException exception;
- sal_Bool bExceptionWasThrown;
+ RuntimeException rtexception;
+ sal_Bool bExceptionWasThrown;
+ sal_Bool bRTExceptionWasThrown;
Locale locale;
@@ -374,7 +382,8 @@ extern "C"
// LocatorImpl
//---------------------------------------------
class LocatorImpl :
- public WeakImplHelper1< XLocator >
+ public WeakImplHelper2< XLocator, com::sun::star::io::XSeekable >
+ // should use a different interface for stream positions!
{
public:
LocatorImpl( SaxExpatParser_Impl *p )
@@ -400,6 +409,20 @@ public: //XLocator
return m_pParser->getEntity().structSource.sSystemId;
}
+ // XSeekable (only for getPosition)
+
+ virtual void SAL_CALL seek( sal_Int64 ) throw()
+ {
+ }
+ virtual sal_Int64 SAL_CALL getPosition() throw()
+ {
+ return XML_GetCurrentByteIndex( m_pParser->getEntity().pParser );
+ }
+ virtual ::sal_Int64 SAL_CALL getLength() throw()
+ {
+ return 0;
+ }
+
private:
SaxExpatParser_Impl *m_pParser;
@@ -421,6 +444,7 @@ SaxExpatParser::SaxExpatParser( )
m_pImpl->rAttrList = Reference< XAttributeList > ( m_pImpl->pAttrList );
m_pImpl->bExceptionWasThrown = sal_False;
+ m_pImpl->bRTExceptionWasThrown = sal_False;
}
SaxExpatParser::~SaxExpatParser()
@@ -721,6 +745,9 @@ void SaxExpatParser_Impl::parse( )
if( ! bContinue || this->bExceptionWasThrown ) {
+ if ( this->bRTExceptionWasThrown )
+ throw rtexception;
+
// Error during parsing !
XML_Error xmlE = XML_GetErrorCode( getEntity().pParser );
OUString sSystemId = rDocumentLocator->getSystemId();