merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / lwpfilter.hxx
blob135597cd92f7207c97c1f7bd7d89536684dac8c9
1 /*************************************************************************
3 * The Contents of this file are made available subject to the terms of
4 * either of the following licenses
6 * - GNU Lesser General Public License Version 2.1
7 * - Sun Industry Standards Source License Version 1.1
9 * Sun Microsystems Inc., October, 2000
11 * GNU Lesser General Public License Version 2.1
12 * =============================================
13 * Copyright 2000 by Sun Microsystems, Inc.
14 * 901 San Antonio Road, Palo Alto, CA 94303, USA
16 * This library is free software; you can redistribute it and/or
17 * modify it under the terms of the GNU Lesser General Public
18 * License version 2.1, as published by the Free Software Foundation.
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 * MA 02111-1307 USA
31 * Sun Industry Standards Source License Version 1.1
32 * =================================================
33 * The contents of this file are subject to the Sun Industry Standards
34 * Source License Version 1.1 (the "License"); You may not use this file
35 * except in compliance with the License. You may obtain a copy of the
36 * License at http://www.openoffice.org/license.html.
38 * Software provided under this License is provided on an "AS IS" basis,
39 * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
40 * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
41 * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
42 * See the License for the specific provisions governing your rights and
43 * obligations concerning the Software.
45 * The Initial Developer of the Original Code is: IBM Corporation
47 * Copyright: 2008 by IBM Corporation
49 * All Rights Reserved.
51 * Contributor(s): _______________________________________
54 ************************************************************************/
55 /*************************************************************************
56 * @file
57 * Circle object.
58 ************************************************************************/
59 /*************************************************************************
60 * Change History
61 * 2005-01-17 create this file.
62 ************************************************************************/
63 #ifndef _LWPFILTER_HXX
64 #define _LWPFILTER_HXX
66 #include <cppuhelper/implbase1.hxx>
67 #include <cppuhelper/implbase4.hxx>
68 #include <cppuhelper/factory.hxx>
70 #include <com/sun/star/document/XFilter.hpp>
71 #include <com/sun/star/document/XImporter.hpp>
72 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
73 #include <com/sun/star/xml/sax/SAXException.hpp>
74 #include <com/sun/star/lang/XServiceInfo.hpp>
75 #include <com/sun/star/io/XInputStream.hpp>
76 #include <com/sun/star/document/XExtendedFilterDetection.hpp>
77 #include <com/sun/star/text/XTextDocument.hpp>
78 #include <tools/stream.hxx>
80 using namespace ::rtl;
81 using namespace ::cppu;
82 using namespace ::com::sun::star::lang;
83 using namespace ::com::sun::star::io;
84 using namespace ::com::sun::star::registry;
85 using namespace ::com::sun::star::document;
86 using namespace ::com::sun::star::beans;
87 using namespace ::com::sun::star::xml::sax;
88 using namespace ::com::sun::star::uno;
89 using namespace ::com::sun::star::text;
90 using namespace ::com::sun::star;
92 #define EXTERN_C extern "C"
94 /**
95 * @brief
96 * Implements the XFilter interface.
97 * This is not the entry for the filter, but a proto of LwpFilterImportFilter.
99 class LWPFilterReader : public WeakImplHelper1< XFilter >
101 public:
102 LWPFilterReader();
103 ~LWPFilterReader();
105 public:
107 * @descr loading the file. It's call be SfxObejctShell::ImportFrom.
108 * @param aDescriptor the parameters include file URL or XInputStream obejct, from which the filter can
109 * get which file to import.
111 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor )
112 throw( RuntimeException );
115 * @descr stop loading the file.
117 virtual void SAL_CALL cancel() throw (com::sun::star::uno::RuntimeException);
120 * @descr get the XDocumentHandler interface.
122 void setDocumentHandler( uno::Reference< XDocumentHandler >& xHandler )
124 m_DocumentHandler = xHandler;
127 private:
128 uno::Reference< XDocumentHandler > m_DocumentHandler;
132 * @brief
133 * Main entry for the xml filter framework.
134 * It's called by SfxObjectShell::ImportFrom.
136 class LWPFilterImportFilter : public WeakImplHelper4< XFilter, XImporter, XServiceInfo, XExtendedFilterDetection >
138 public:
139 LWPFilterImportFilter( const uno::Reference< XMultiServiceFactory >& xFact );
140 ~LWPFilterImportFilter();
142 public:
143 static Sequence< OUString > getSupportedServiceNames_Static( void ) throw();
145 static OUString getImplementationName_Static() throw();
146 public:
148 * @descr see LWPFilterReader::filter.
150 virtual sal_Bool SAL_CALL filter( const Sequence< PropertyValue >& aDescriptor )
151 throw( RuntimeException );
154 * @descr see LWPFilterReader::cancel.
156 virtual void SAL_CALL cancel() throw (com::sun::star::uno::RuntimeException);
158 // XImporter
159 virtual void SAL_CALL setTargetDocument( const uno::Reference< XComponent >& xDoc)
160 throw( IllegalArgumentException, RuntimeException );
162 // XServiceInfo
163 OUString SAL_CALL getImplementationName() throw ();
165 Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw ();
167 sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw ();
170 * @descr function of interface XExtendedFilterDetection. If this interface is registed, it will be called whenever
171 * a file is to be loaded.
173 virtual ::rtl::OUString SAL_CALL detect( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& Descriptor ) throw (::com::sun::star::uno::RuntimeException);
175 public:
176 uno::Reference< XFilter > rFilter;
177 uno::Reference< XImporter > rImporter;
180 int ReadWordproFile(String& strName,uno::Reference<XDocumentHandler>& XDoc);
181 //test code
182 int ReadWordproFile(SvStream* pStream, uno::Reference<XDocumentHandler>& XDoc);
184 #endif