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 
23 
24 #include <cppuhelper/implbase1.hxx>
25 
26 #include <com/sun/star/xml/sax/XAttributeList.hpp>
27 #include <com/sun/star/xml/sax/SAXException.hpp>
28 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
29 #include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
30 #include <com/sun/star/xml/sax/XParser.hpp>
31 
32 #include <com/sun/star/lang/NoSupportException.hpp>
33 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
34 namespace css = ::com::sun::star;
35 namespace dp_registry
36 {
37 namespace backend
38 {
39 namespace sfwk
40 {
41 
42 typedef ::cppu::WeakImplHelper1< css::xml::sax::XDocumentHandler > t_DocHandlerImpl;
43 
44 class ParcelDescDocHandler : public t_DocHandlerImpl
45 {
46 private:
47     bool m_bIsParsed;
48     ::rtl::OUString m_sLang;
49     sal_Int32 skipIndex;
50 public:
ParcelDescDocHandler()51     ParcelDescDocHandler():m_bIsParsed( false ), skipIndex( 0 ){}
getParcelLanguage()52     ::rtl::OUString getParcelLanguage() { return m_sLang; }
isParsed()53     bool isParsed() { return m_bIsParsed; }
54     // XDocumentHandler
55     virtual void SAL_CALL startDocument()
56         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
57 
58     virtual void SAL_CALL endDocument()
59         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
60 
61     virtual void SAL_CALL startElement( const ::rtl::OUString& aName,
62         const css::uno::Reference< css::xml::sax::XAttributeList > & xAttribs )
63         throw ( css::xml::sax::SAXException,
64             css::uno::RuntimeException );
65 
66     virtual void SAL_CALL endElement( const ::rtl::OUString & aName )
67         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
68 
69     virtual void SAL_CALL characters( const ::rtl::OUString & aChars )
70         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
71 
72     virtual void SAL_CALL ignorableWhitespace( const ::rtl::OUString & aWhitespaces )
73         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
74 
75     virtual void SAL_CALL processingInstruction(
76         const ::rtl::OUString & aTarget, const ::rtl::OUString & aData )
77         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
78 
79     virtual void SAL_CALL setDocumentLocator(
80         const css::uno::Reference< css::xml::sax::XLocator >& xLocator )
81         throw ( css::xml::sax::SAXException, css::uno::RuntimeException );
82 };
83 }
84 }
85 }
86