diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-14 09:25:06 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-14 09:44:50 +0100 |
commit | 7834dd22938c9052e962473dc6f5efd1b7b2e0a5 (patch) | |
tree | 8fbfcb564b37a4980e864b2c37c79e1178a4ba62 /xmlsecurity | |
parent | 87f52aeec107544cea1db48809a8da6d00e3e5d2 (diff) |
xmlsecurity: implement XInitialization for OOXMLSecParser
addSignature() can't be called without this, as later it'll try to
examine the keeped SAX events, which are expected to be remembered by
the next handler.
Change-Id: Id6677fff791cc65e514e43fba169fc2f71a69e33
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/helper/ooxmlsecparser.cxx | 30 | ||||
-rw-r--r-- | xmlsecurity/source/helper/ooxmlsecparser.hxx | 1 |
2 files changed, 26 insertions, 5 deletions
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx index 4966fd60e5d3..6c5e1ab3b341 100644 --- a/xmlsecurity/source/helper/ooxmlsecparser.cxx +++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx @@ -24,10 +24,14 @@ OOXMLSecParser::~OOXMLSecParser() void SAL_CALL OOXMLSecParser::startDocument() throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (m_xNextHandler.is()) + m_xNextHandler->startDocument(); } void SAL_CALL OOXMLSecParser::endDocument() throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (m_xNextHandler.is()) + m_xNextHandler->endDocument(); } void SAL_CALL OOXMLSecParser::startElement(const OUString& rName, const uno::Reference<xml::sax::XAttributeList>& xAttribs) @@ -39,7 +43,7 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception) if (rName == "Signature") { - //m_pXSecController->addSignature(); + m_pXSecController->addSignature(); if (!aId.isEmpty()) m_pXSecController->setId(aId); } @@ -55,6 +59,9 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception) m_aDigestValue.clear(); m_bInDigestValue = true; } + + if (m_xNextHandler.is()) + m_xNextHandler->startElement(rName, xAttribs); } void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) @@ -65,28 +72,41 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax: m_pXSecController->setDigestValue(m_aDigestValue); else if (rName == "DigestValue") m_bInDigestValue = false; + + if (m_xNextHandler.is()) + m_xNextHandler->endElement(rName); } void SAL_CALL OOXMLSecParser::characters(const OUString& rChars) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { if (m_bInDigestValue) m_aDigestValue += rChars; + + if (m_xNextHandler.is()) + m_xNextHandler->characters(rChars); } -void SAL_CALL OOXMLSecParser::ignorableWhitespace(const OUString& /*rWhitespace*/) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) +void SAL_CALL OOXMLSecParser::ignorableWhitespace(const OUString& rWhitespace) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (m_xNextHandler.is()) + m_xNextHandler->ignorableWhitespace(rWhitespace); } -void SAL_CALL OOXMLSecParser::processingInstruction(const OUString& /*rTarget*/, const OUString& /*rData*/) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) +void SAL_CALL OOXMLSecParser::processingInstruction(const OUString& rTarget, const OUString& rData) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (m_xNextHandler.is()) + m_xNextHandler->processingInstruction(rTarget, rData); } -void SAL_CALL OOXMLSecParser::setDocumentLocator(const uno::Reference<xml::sax::XLocator>& /*xLocator*/) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) +void SAL_CALL OOXMLSecParser::setDocumentLocator(const uno::Reference<xml::sax::XLocator>& xLocator) throw (xml::sax::SAXException, uno::RuntimeException, std::exception) { + if (m_xNextHandler.is()) + m_xNextHandler->setDocumentLocator(xLocator); } -void SAL_CALL OOXMLSecParser::initialize(const uno::Sequence<uno::Any>& /*rArguments*/) throw (uno::Exception, uno::RuntimeException, std::exception) +void SAL_CALL OOXMLSecParser::initialize(const uno::Sequence<uno::Any>& rArguments) throw (uno::Exception, uno::RuntimeException, std::exception) { + rArguments[0] >>= m_xNextHandler; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx b/xmlsecurity/source/helper/ooxmlsecparser.hxx index 40fb7b3de09a..b561862fc6b4 100644 --- a/xmlsecurity/source/helper/ooxmlsecparser.hxx +++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx @@ -27,6 +27,7 @@ class OOXMLSecParser: public cppu::WeakImplHelper > { XSecController* m_pXSecController; + css::uno::Reference<css::xml::sax::XDocumentHandler> m_xNextHandler; bool m_bInDigestValue; OUString m_aDigestValue; |