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 #ifndef __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_ 25 #define __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_ 26 27 #include <com/sun/star/xml/sax/XDocumentHandler.hpp> 28 #include <threadhelp/threadhelpbase.hxx> 29 #include <xml/xmlnamespaces.hxx> 30 #include <rtl/ustring.hxx> 31 #include <vcl/menu.hxx> 32 #include <cppuhelper/implbase1.hxx> 33 34 #include <stack> 35 #include <framework/fwedllapi.h> 36 37 //_________________________________________________________________________________________________________________ 38 // namespace 39 //_________________________________________________________________________________________________________________ 40 41 namespace framework 42 { 43 44 class FWE_DLLPUBLIC SaxNamespaceFilter : public ThreadHelpBase, // Struct for right initialization of mutex member! Must be first of baseclasses. 45 public ::cppu::WeakImplHelper1< ::com::sun::star::xml::sax::XDocumentHandler > 46 { 47 public: 48 SaxNamespaceFilter( ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >& rSax1DocumentHandler ); 49 virtual ~SaxNamespaceFilter(); 50 51 // XDocumentHandler 52 virtual void SAL_CALL startDocument(void) 53 throw ( ::com::sun::star::xml::sax::SAXException, 54 ::com::sun::star::uno::RuntimeException ); 55 56 virtual void SAL_CALL endDocument(void) 57 throw( ::com::sun::star::xml::sax::SAXException, 58 ::com::sun::star::uno::RuntimeException ); 59 60 virtual void SAL_CALL startElement( 61 const rtl::OUString& aName, 62 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > &xAttribs) 63 throw( ::com::sun::star::xml::sax::SAXException, 64 ::com::sun::star::uno::RuntimeException ); 65 66 virtual void SAL_CALL endElement(const rtl::OUString& aName) 67 throw( ::com::sun::star::xml::sax::SAXException, 68 ::com::sun::star::uno::RuntimeException ); 69 70 virtual void SAL_CALL characters(const rtl::OUString& aChars) 71 throw( ::com::sun::star::xml::sax::SAXException, 72 ::com::sun::star::uno::RuntimeException ); 73 74 virtual void SAL_CALL ignorableWhitespace(const rtl::OUString& aWhitespaces) 75 throw( ::com::sun::star::xml::sax::SAXException, 76 ::com::sun::star::uno::RuntimeException ); 77 78 virtual void SAL_CALL processingInstruction(const rtl::OUString& aTarget, 79 const rtl::OUString& aData) 80 throw( ::com::sun::star::xml::sax::SAXException, 81 ::com::sun::star::uno::RuntimeException ); 82 83 virtual void SAL_CALL setDocumentLocator( 84 const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > &xLocator) 85 throw( ::com::sun::star::xml::sax::SAXException, 86 ::com::sun::star::uno::RuntimeException ); 87 88 protected: 89 typedef ::std::stack< XMLNamespaces > NamespaceStack; 90 91 ::rtl::OUString getErrorLineString(); 92 93 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > m_xLocator; 94 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler> xDocumentHandler; 95 NamespaceStack m_aNamespaceStack; 96 sal_Int32 m_nDepth; 97 }; 98 99 } 100 101 #endif // __FRAMEWORK_SERVICES_SAXNAMESPACEFILTER_HXX_ 102