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 #ifndef RPT_IMPORTDOCUMENTHANDLER_HXX_INCLUDED 24 #define RPT_IMPORTDOCUMENTHANDLER_HXX_INCLUDED 25 26 #include "sal/config.h" 27 #include "com/sun/star/uno/XComponentContext.hpp" 28 #include <cppuhelper/implbase3.hxx> 29 #include "com/sun/star/xml/sax/XDocumentHandler.hpp" 30 #include <com/sun/star/lang/XInitialization.hpp> 31 #include <com/sun/star/lang/XServiceInfo.hpp> 32 #include <com/sun/star/lang/XTypeProvider.hpp> 33 #include <com/sun/star/chart2/XChartDocument.hpp> 34 #include "com/sun/star/chart2/data/XDatabaseDataProvider.hpp" 35 #include <comphelper/uno3.hxx> 36 #include <memory> 37 38 class SvXMLTokenMap; 39 namespace rptxml 40 { 41 typedef ::cppu::WeakAggImplHelper3< ::com::sun::star::xml::sax::XDocumentHandler 42 , ::com::sun::star::lang::XInitialization 43 , ::com::sun::star::lang::XServiceInfo> ImportDocumentHandler_BASE; 44 45 class ImportDocumentHandler : public ImportDocumentHandler_BASE 46 { 47 public: 48 // XServiceInfo - static versions 49 static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); 50 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); 51 static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL 52 create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); 53 public: 54 explicit ImportDocumentHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); 55 56 private: 57 // XServiceInfo 58 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 59 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 60 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 61 62 DECLARE_XINTERFACE( ) 63 DECLARE_XTYPEPROVIDER( ) 64 65 // ::com::sun::star::xml::sax::XDocumentHandler: 66 virtual void SAL_CALL startDocument() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 67 virtual void SAL_CALL endDocument() throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 68 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::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 69 virtual void SAL_CALL endElement(const ::rtl::OUString & aName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 70 virtual void SAL_CALL characters(const ::rtl::OUString & aChars) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 71 virtual void SAL_CALL ignorableWhitespace(const ::rtl::OUString & aWhitespaces) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 72 virtual void SAL_CALL processingInstruction(const ::rtl::OUString & aTarget, const ::rtl::OUString & aData) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 73 virtual void SAL_CALL setDocumentLocator(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator > & xLocator) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::xml::sax::SAXException); 74 75 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 76 77 private: 78 ImportDocumentHandler(ImportDocumentHandler &); // not defined 79 void operator =(ImportDocumentHandler &); // not defined 80 81 virtual ~ImportDocumentHandler(); 82 83 ::osl::Mutex m_aMutex; 84 bool m_bImportedChart; 85 ::std::vector< ::rtl::OUString> m_aMasterFields; 86 ::std::vector< ::rtl::OUString> m_aDetailFields; 87 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aArguments; 88 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; 89 ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xDelegatee; 90 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > m_xProxy; 91 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XTypeProvider > m_xTypeProvider; 92 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XServiceInfo > m_xServiceInfo; 93 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > m_xModel; 94 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider > m_xDatabaseDataProvider; 95 96 ::std::auto_ptr<SvXMLTokenMap> m_pReportElemTokenMap; 97 }; 98 // ----------------------------------------------------------------------------- 99 } // namespace rptxml 100 // ----------------------------------------------------------------------------- 101 #endif // RPT_IMPORTDOCUMENTHANDLER_HXX_INCLUDED 102