1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
23 #define INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
24 
25 #include <svgio/svgiodllapi.h>
26 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
27 #include <svgio/svgreader/svgdocument.hxx>
28 
29 //////////////////////////////////////////////////////////////////////////////
30 // predefines
31 
32 namespace svgio { namespace svgreader { class SvgCharacterNode; }}
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
36 namespace svgio
37 {
38     namespace svgreader
39     {
40         class SvgDocHdl : public cppu::WeakImplHelper1< com::sun::star::xml::sax::XDocumentHandler >
41         {
42         private:
43             // the complete SVG Document
44             SvgDocument                     maDocument;
45 
46             // current node for parsing
47             SvgNode*                        mpTarget;
48 
49             // text collector string stack for css styles
50             std::vector< rtl::OUString >    maCssContents;
51 
52         public:
53             SvgDocHdl(const rtl::OUString& rAbsolutePath);
54             ~SvgDocHdl();
55 
56             // Methods XDocumentHandler
57             virtual void SAL_CALL startDocument(  ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
58             virtual void SAL_CALL endDocument(  ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
59             virtual void SAL_CALL startElement( const ::rtl::OUString& aName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttribs ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
60             virtual void SAL_CALL endElement( const ::rtl::OUString& aName ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
61             virtual void SAL_CALL characters( const ::rtl::OUString& aChars ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
62             virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString& aWhitespaces ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
63             virtual void SAL_CALL processingInstruction( const ::rtl::OUString& aTarget, const ::rtl::OUString& aData ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
64             virtual void SAL_CALL setDocumentLocator( const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator ) throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
65 
getSvgDocument() const66             const SvgDocument& getSvgDocument() const { return maDocument; }
67         };
68     } // end of namespace svgreader
69 } // end of namespace svgio
70 
71 //////////////////////////////////////////////////////////////////////////////
72 
73 #endif //INCLUDED_SVGIO_SVGREADER_SVGDOCUMENTHANDLER_HXX
74 
75 // eof
76