Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef EBOOKIMPORTFILTER_HXX
11 : #define EBOOKIMPORTFILTER_HXX
12 :
13 : #include <com/sun/star/document/XFilter.hpp>
14 : #include <com/sun/star/document/XImporter.hpp>
15 : #include <com/sun/star/document/XExtendedFilterDetection.hpp>
16 : #include <com/sun/star/lang/XInitialization.hpp>
17 : #include <com/sun/star/lang/XServiceInfo.hpp>
18 : #include <com/sun/star/uno/XComponentContext.hpp>
19 : #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
20 : #include <cppuhelper/implbase5.hxx>
21 :
22 : /* This component will be instantiated for both import or export. Whether it calls
23 : * setSourceDocument or setTargetDocument determines which Impl function the filter
24 : * member calls */
25 : class EBookImportFilter : public cppu::WeakImplHelper5
26 : <
27 : com::sun::star::document::XFilter,
28 : com::sun::star::document::XImporter,
29 : com::sun::star::document::XExtendedFilterDetection,
30 : com::sun::star::lang::XInitialization,
31 : com::sun::star::lang::XServiceInfo
32 : >
33 : {
34 : protected:
35 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxContext;
36 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
37 : OUString msFilterName;
38 : ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
39 :
40 : sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
41 : throw (::com::sun::star::uno::RuntimeException);
42 :
43 : public:
44 29 : EBookImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext )
45 29 : : mxContext( rxContext ) {}
46 58 : virtual ~EBookImportFilter() {}
47 :
48 : // XFilter
49 : virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
50 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
51 : virtual void SAL_CALL cancel( )
52 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
53 :
54 : // XImporter
55 : virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
56 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
57 :
58 : //XExtendedFilterDetection
59 : virtual OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
60 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
61 :
62 : // XInitialization
63 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
64 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
65 :
66 : // XServiceInfo
67 : virtual OUString SAL_CALL getImplementationName( )
68 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
69 : virtual sal_Bool SAL_CALL supportsService( const OUString &ServiceName )
70 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
71 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
72 : throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 :
74 : };
75 :
76 : OUString EBookImportFilter_getImplementationName()
77 : throw ( ::com::sun::star::uno::RuntimeException );
78 :
79 : ::com::sun::star::uno::Sequence< OUString > SAL_CALL EBookImportFilter_getSupportedServiceNames( )
80 : throw ( ::com::sun::star::uno::RuntimeException );
81 :
82 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
83 : SAL_CALL EBookImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rContext)
84 : throw ( ::com::sun::star::uno::Exception );
85 :
86 : #endif
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|