Kaydet (Commit) 7c698f0b authored tarafından Rachit Gupta's avatar Rachit Gupta Kaydeden (comit) Jan Holesovsky

Created std::vector to store learnmore URLs.

For now, we have to parse the HTML and display the images as the
result XML does not contain the header and footer URLs.

Change-Id: Ie95a75e218bc3da12802c971ea744fb38951e574
üst cd1fae31
...@@ -36,9 +36,11 @@ throw ( xml::sax::SAXException, RuntimeException, std::exception ) ...@@ -36,9 +36,11 @@ throw ( xml::sax::SAXException, RuntimeException, std::exception )
} }
void SAL_CALL void SAL_CALL
PersonasDocHandler::characters( const OUString & ) PersonasDocHandler::characters( const OUString & aChars)
throw ( xml::sax::SAXException, RuntimeException, std::exception ) throw ( xml::sax::SAXException, RuntimeException, std::exception )
{ {
if( m_bLearnmoreTag )
m_vLearnmoreURLs.push_back( aChars );
} }
void SAL_CALL void SAL_CALL
...@@ -63,21 +65,19 @@ PersonasDocHandler::setDocumentLocator( ...@@ -63,21 +65,19 @@ PersonasDocHandler::setDocumentLocator(
void SAL_CALL void SAL_CALL
PersonasDocHandler::startElement( const OUString& aName, PersonasDocHandler::startElement( const OUString& aName,
const Reference< xml::sax::XAttributeList > & xAttribs ) const Reference< xml::sax::XAttributeList > & )
throw ( xml::sax::SAXException, throw ( xml::sax::SAXException,
RuntimeException, std::exception ) RuntimeException, std::exception )
{ {
SAL_DEBUG("startElement: " << aName << "\n"); if ( aName == "learnmore" )
for (sal_Int16 i = 0; i < xAttribs->getLength(); ++i) m_bLearnmoreTag = true;
{ else
SAL_DEBUG("\t\tAttribute Name: " << xAttribs->getNameByIndex(i) << "\tAttribute Value: " << xAttribs->getValueByIndex(i) << "\n"); m_bLearnmoreTag = false;
}
} }
void SAL_CALL PersonasDocHandler::endElement( const OUString & aName ) void SAL_CALL PersonasDocHandler::endElement( const OUString & )
throw ( xml::sax::SAXException, RuntimeException, std::exception ) throw ( xml::sax::SAXException, RuntimeException, std::exception )
{ {
SAL_DEBUG("endElement: " << aName << "\n");
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,20 +20,15 @@ ...@@ -20,20 +20,15 @@
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/sax/XParser.hpp> #include <com/sun/star/xml/sax/XParser.hpp>
#include <vector>
class PersonasDocHandler : public ::cppu::WeakImplHelper1< css::xml::sax::XDocumentHandler > class PersonasDocHandler : public ::cppu::WeakImplHelper1< css::xml::sax::XDocumentHandler >
{ {
private: private:
OUString m_sHeaderURL; std::vector<OUString> m_vLearnmoreURLs;
OUString m_sFooterURL; bool m_bLearnmoreTag;
OUString m_sTextColor;
OUString m_sAccentColor;
public: public:
PersonasDocHandler(){} PersonasDocHandler(){ m_bLearnmoreTag = false; }
OUString getHeaderURL() { return m_sHeaderURL; }
OUString getFooterURL() { return m_sFooterURL; }
OUString getTextColor() { return m_sTextColor; }
OUString getAccentColor() { return m_sAccentColor; }
// XDocumentHandler // XDocumentHandler
virtual void SAL_CALL startDocument() virtual void SAL_CALL startDocument()
throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE; throw ( css::xml::sax::SAXException, css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment