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 _RTFFILTER_HXX
25 #define _RTFFILTER_HXX
26 
27 #include <com/sun/star/document/XFilter.hpp>
28 #include <com/sun/star/document/XImporter.hpp>
29 #include <com/sun/star/document/XExporter.hpp>
30 #include <com/sun/star/lang/XInitialization.hpp>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
33 #include <cppuhelper/implbase5.hxx>
34 #include <WriterFilterDllApi.hxx>
35 
36 class WRITERFILTER_DLLPUBLIC RtfFilter : public cppu::WeakImplHelper5
37 <
38     com::sun::star::document::XFilter,
39     com::sun::star::document::XImporter,
40     com::sun::star::document::XExporter,
41     com::sun::star::lang::XInitialization,
42     com::sun::star::lang::XServiceInfo
43 >
44 {
45 
46 protected:
47     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
48     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSrcDoc, m_xDstDoc;
49     ::rtl::OUString m_sFilterName;
50     ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > m_xHandler;
51 
52 
53 public:
54    RtfFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext);
55    virtual ~RtfFilter();
56 
57     // XFilter
58     virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
59         throw (::com::sun::star::uno::RuntimeException);
60     virtual void SAL_CALL cancel(  )
61         throw (::com::sun::star::uno::RuntimeException);
62 
63     // XImporter
64     virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
65 	    throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
66 
67     // XExporter
68     virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
69         throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
70 
71     // XInitialization
72     virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
73         throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
74 
75     // XServiceInfo
76     virtual ::rtl::OUString SAL_CALL getImplementationName(  )
77         throw (::com::sun::star::uno::RuntimeException);
78     virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
79         throw (::com::sun::star::uno::RuntimeException);
80     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
81         throw (::com::sun::star::uno::RuntimeException);
82 
83 };
84 
85 
86 ::rtl::OUString RtfFilter_getImplementationName()
87     throw ( ::com::sun::star::uno::RuntimeException );
88 
89 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfFilter_getSupportedServiceNames(  )
90     throw ( ::com::sun::star::uno::RuntimeException );
91 
92 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfFilter_createInstance(
93                                                                         const ::com::sun::star::uno::Reference<
94                                                                         ::com::sun::star::uno::XComponentContext > &xContext)
95     throw( ::com::sun::star::uno::Exception );
96 #endif
97 
98