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 _RTFEXPORTFILTER_HXX_ 25 #define _RTFEXPORTFILTER_HXX_ 26 27 #include <com/sun/star/document/XFilter.hpp> 28 #include <com/sun/star/document/XExporter.hpp> 29 #include <com/sun/star/uno/XComponentContext.hpp> 30 #include <cppuhelper/implbase2.hxx> 31 #include <tools/stream.hxx> 32 #include <shellio.hxx> 33 34 // This is just here so that we don't have to copy&paste its string format methods 35 class RtfWriter : public Writer 36 { 37 protected: WriteStream()38 sal_uLong WriteStream() { return 0; } 39 }; 40 41 /// The physical access to the RTF document (for writing). 42 class RtfExportFilter : public cppu::WeakImplHelper2 43 < 44 com::sun::star::document::XFilter, 45 com::sun::star::document::XExporter 46 > 47 { 48 protected: 49 ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; 50 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xSrcDoc; 51 SvStream* m_pStream; 52 public: 53 RtfExportFilter( const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xMSF ); 54 virtual ~RtfExportFilter(); 55 56 // XFilter 57 virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor ) 58 throw (::com::sun::star::uno::RuntimeException); 59 virtual void SAL_CALL cancel( ) 60 throw (::com::sun::star::uno::RuntimeException); 61 62 // XExporter 63 virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) 64 throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 65 66 RtfWriter m_aWriter; 67 }; 68 69 ::rtl::OUString RtfExport_getImplementationName(); 70 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL RtfExport_getSupportedServiceNames() 71 throw(); 72 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL RtfExport_createInstance( 73 const ::com::sun::star::uno::Reference< 74 com::sun::star::lang::XMultiServiceFactory > &xMSF) 75 throw( ::com::sun::star::uno::Exception ); 76 77 #define IMPL_NAME_RTFEXPORT "com.sun.star.comp.Writer.RtfExport" 78 79 #endif // _RTFEXPORTFILTER_HXX_ 80 /* vi:set shiftwidth=4 expandtab: */ 81