merge the formfield patch from ooo-build
[ooovba.git] / applied_patches / 0056-wpsimport-writerperfect.diff
blobcb9d6261fbaf1831fba837bb72b9baa8e3e71ff3
1 --- writerperfect/prj/build.lst.old 2009-04-02 10:49:34.000000000 +0000
2 +++ writerperfect/prj/build.lst 2009-04-06 16:41:41.000000000 +0000
3 @@ -1,6 +1,7 @@
4 -wp writerperfect : LIBWPD:libwpd sot comphelper xmloff NULL
5 +wp writerperfect : LIBWPS:libwps LIBWPD:libwpd sot comphelper xmloff NULL
6 wp writerperfect usr1 - all wp_mkout NULL
7 wp writerperfect\source\stream nmake - all wp_stream NULL
8 wp writerperfect\source\filter nmake - all wp_filter NULL
9 wp writerperfect\source\wpdimp nmake - all wp_wpdimp NULL
10 -wp writerperfect\util nmake - all wp_util wp_wpdimp wp_filter wp_stream NULL
11 +wp writerperfect\source\wpsimp nmake - all wp_wpsimp NULL
12 +wp writerperfect\util nmake - all wp_util wp_wpsimp wp_wpdimp wp_filter wp_stream NULL
13 --- writerperfect/prj/d.lst.old 2009-04-02 10:49:34.000000000 +0000
14 +++ writerperfect/prj/d.lst 2009-04-06 16:41:41.000000000 +0000
15 @@ -1,4 +1,4 @@
16 -..\%__SRC%\lib\libwpft*.so %_DEST%\lib%_EXT%
17 -..\%__SRC%\bin\wpft*.dll %_DEST%\lib%_EXT%
18 +..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%
19 +..\%__SRC%\bin\*.dll %_DEST%\lib%_EXT%
20 ..\%__SRC%\bin\wpftgo.dll %_DEST%\bin%_EXT%\wpftgo.dll
21 ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
22 --- writerperfect/source/filter/DocumentCollector.cxx.old 2009-04-02 10:49:34.000000000 +0000
23 +++ writerperfect/source/filter/DocumentCollector.cxx 2009-04-06 16:41:41.000000000 +0000
24 @@ -58,7 +58,7 @@ _WriterDocumentState::_WriterDocumentSta
28 -DocumentCollector::DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
29 +DocumentCollector::DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
30 mpInput(pInput),
31 mpHandler(pHandler),
32 mbUsed(false),
33 --- writerperfect/source/filter/DocumentCollector.hxx.old 2009-04-02 10:49:34.000000000 +0000
34 +++ writerperfect/source/filter/DocumentCollector.hxx 2009-04-06 16:41:41.000000000 +0000
35 @@ -35,6 +35,7 @@
36 #if defined _MSC_VER
37 #pragma warning( push, 1 )
38 #endif
39 +#include <libwps/libwps.h>
40 #include <libwpd/libwpd.h>
41 #if defined _MSC_VER
42 #pragma warning( pop )
43 @@ -82,7 +83,7 @@ struct ltstr
44 class DocumentCollector : public WPXHLListenerImpl
46 public:
47 - DocumentCollector(WPXInputStream *pInput, DocumentHandler *pHandler);
48 + DocumentCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
49 virtual ~DocumentCollector();
50 bool filter();
52 @@ -133,7 +134,7 @@ public:
53 virtual void closeTableCell();
54 virtual void insertCoveredTableCell(const WPXPropertyList &propList);
55 virtual void closeTable();
56 - virtual bool parseSourceDocument(WPXInputStream &input) = 0;
57 + virtual bool parseSourceDocument(WPSInputStream &input) = 0;
59 protected:
60 void _resetDocumentState();
61 @@ -147,7 +148,7 @@ private:
62 void _openListLevel(TagOpenElement *pListLevelOpenElement);
63 void _closeListLevel(const char *szListType);
65 - WPXInputStream *mpInput;
66 + WPSInputStream *mpInput;
67 DocumentHandler *mpHandler;
68 bool mbUsed; // whether or not it has been before (you can only use me once!)
70 --- writerperfect/source/filter/DocumentHandler.cxx.old 2009-04-02 10:49:34.000000000 +0000
71 +++ writerperfect/source/filter/DocumentHandler.cxx 2009-04-06 16:41:41.000000000 +0000
72 @@ -42,19 +42,19 @@ DocumentHandler::DocumentHandler(Referen
74 void DocumentHandler::startDocument()
76 - WRITER_DEBUG_MSG(("DocumentHandler::startDocument"));
77 + WRITER_DEBUG_MSG(("DocumentHandler::startDocument\n"));
78 mxHandler->startDocument();
81 void DocumentHandler::endDocument()
83 - WRITER_DEBUG_MSG(("DocumentHandler::endDocument"));
84 + WRITER_DEBUG_MSG(("DocumentHandler::endDocument\n"));
85 mxHandler->endDocument();
88 void DocumentHandler::startElement(const char *psName, const WPXPropertyList &xPropList)
90 - WRITER_DEBUG_MSG(("DocumentHandler::startElement"));
91 + WRITER_DEBUG_MSG(("DocumentHandler::startElement\n"));
92 SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
93 Reference < XAttributeList > xAttrList(pAttrList);
94 WPXPropertyList::Iter i(xPropList);
95 @@ -71,13 +71,13 @@ void DocumentHandler::startElement(const
97 void DocumentHandler::endElement(const char *psName)
99 - WRITER_DEBUG_MSG(("DocumentHandler::endElement"));
100 + WRITER_DEBUG_MSG(("DocumentHandler::endElement\n"));
101 mxHandler->endElement(OUString::createFromAscii(psName));
104 void DocumentHandler::characters(const WPXString &sCharacters)
106 - WRITER_DEBUG_MSG(("DocumentHandler::characters"));
107 + WRITER_DEBUG_MSG(("DocumentHandler::characters\n"));
108 OUString sCharU16(sCharacters.cstr(), strlen(sCharacters.cstr()), RTL_TEXTENCODING_UTF8);
109 mxHandler->characters(sCharU16);
111 --- writerperfect/source/filter/SectionStyle.cxx.old 2009-04-02 10:49:34.000000000 +0000
112 +++ writerperfect/source/filter/SectionStyle.cxx 2009-04-06 16:41:41.000000000 +0000
113 @@ -33,7 +33,7 @@
115 #ifdef _MSC_VER
116 double rint(double x);
117 -#endif /* _WIN32 */
118 +#endif /* _MSC_VER */
120 SectionStyle::SectionStyle(const WPXPropertyList &xPropList,
121 const WPXPropertyListVector &xColumns,
122 --- writerperfect/source/filter/makefile.mk.old 2009-04-02 10:49:34.000000000 +0000
123 +++ writerperfect/source/filter/makefile.mk 2009-04-06 16:41:41.000000000 +0000
124 @@ -7,12 +7,16 @@ ENABLE_EXCEPTIONS=true
125 .INCLUDE : settings.mk
127 .IF "$(SYSTEM_LIBWPD)" == "YES"
128 -INCPRE+=$(LIBWPD_CFLAGS) -I..
129 -.ELSE
130 -# broken but ... necessary, internal include shafted ...
131 -INCPRE+=-I..
132 +INCPRE+=$(LIBWPD_CFLAGS)
133 +.ENDIF
135 +.IF "$(SYSTEM_LIBWPS)" == "YES"
136 +INCPRE+=$(LIBWPS_CFLAGS)
137 .ENDIF
139 +# broken but ... necessary, internal include shafted ...
140 +INCPRE+= -I..
142 SLOFILES= \
143 $(SLO)$/DocumentElement.obj \
144 $(SLO)$/FontStyle.obj \
145 --- writerperfect/source/stream/WPXSvStream.cxx.old 2009-04-02 10:49:34.000000000 +0000
146 +++ writerperfect/source/stream/WPXSvStream.cxx 2009-04-06 16:41:41.000000000 +0000
147 @@ -9,7 +9,7 @@ using namespace ::com::sun::star::uno;
148 using namespace ::com::sun::star::io;
150 WPXSvInputStream::WPXSvInputStream( Reference< XInputStream > xStream ) :
151 - WPXInputStream(true),
152 + WPSInputStream(),
153 mxChildStorage(),
154 mxChildStream(),
155 mxStream(xStream),
156 --- writerperfect/source/stream/WPXSvStream.h.old 2009-04-02 10:49:34.000000000 +0000
157 +++ writerperfect/source/stream/WPXSvStream.h 2009-04-06 16:41:41.000000000 +0000
158 @@ -12,12 +12,13 @@
159 #if defined _MSC_VER
160 #pragma warning( push, 1 )
161 #endif
162 +#include <libwps/WPSStream.h>
163 #include <libwpd/WPXStream.h>
164 #if defined _MSC_VER
165 #pragma warning( pop )
166 #endif
168 -class WPXSvInputStream : public WPXInputStream
169 +class WPXSvInputStream : public WPSInputStream
171 public:
172 WPXSvInputStream( ::com::sun::star::uno::Reference<
173 --- writerperfect/source/stream/makefile.mk.old 2009-04-02 10:49:34.000000000 +0000
174 +++ writerperfect/source/stream/makefile.mk 2009-04-06 16:41:41.000000000 +0000
175 @@ -10,6 +10,12 @@ ENABLE_EXCEPTIONS=true
176 INCPRE+=$(LIBWPD_CFLAGS)
177 .ENDIF
179 +.IF "$(SYSTEM_LIBWPS)" == "YES"
180 +INCPRE+=$(LIBWPS_CFLAGS)
181 +.ELSE
182 +INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
183 +.ENDIF
185 # broken but ... necessary, internal include shafted ...
186 INCPRE+= -I..
188 --- writerperfect/source/wpdimp/WordPerfectCollector.cxx.old 2009-04-02 10:49:34.000000000 +0000
189 +++ writerperfect/source/wpdimp/WordPerfectCollector.cxx 2009-04-06 16:41:41.000000000 +0000
190 @@ -30,11 +30,12 @@
191 #pragma warning( push, 1 )
192 #endif
193 #include "WordPerfectCollector.hxx"
194 +#include <libwpd/WPDocument.h>
195 #if defined _MSC_VER
196 #pragma warning( pop )
197 #endif
199 -WordPerfectCollector::WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler) :
200 +WordPerfectCollector::WordPerfectCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
201 DocumentCollector(pInput, pHandler)
204 @@ -43,7 +44,7 @@ WordPerfectCollector::~WordPerfectCollec
208 -bool WordPerfectCollector::parseSourceDocument(WPXInputStream &input)
209 +bool WordPerfectCollector::parseSourceDocument(WPSInputStream &input)
211 WPDResult result = WPDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
212 if (result != WPD_OK)
213 --- writerperfect/source/wpdimp/WordPerfectCollector.hxx.old 2009-04-02 10:49:34.000000000 +0000
214 +++ writerperfect/source/wpdimp/WordPerfectCollector.hxx 2009-04-06 16:41:41.000000000 +0000
215 @@ -34,8 +34,8 @@
216 class WordPerfectCollector : public DocumentCollector
218 public:
219 - WordPerfectCollector(WPXInputStream *pInput, DocumentHandler *pHandler);
220 + WordPerfectCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
221 virtual ~WordPerfectCollector();
222 - bool parseSourceDocument(WPXInputStream &pInput);
223 + bool parseSourceDocument(WPSInputStream &pInput);
225 #endif
226 --- writerperfect/source/wpdimp/makefile.mk.old 2009-04-02 10:49:34.000000000 +0000
227 +++ writerperfect/source/wpdimp/makefile.mk 2009-04-06 16:41:41.000000000 +0000
228 @@ -7,12 +7,16 @@ ENABLE_EXCEPTIONS=true
229 .INCLUDE : settings.mk
231 .IF "$(SYSTEM_LIBWPD)" == "YES"
232 -INCPRE+=$(LIBWPD_CFLAGS) -I..
233 -.ELSE
234 -# broken but ... necessary, internal include shafted ...
235 -INCPRE+=-I..
236 +INCPRE+=$(LIBWPD_CFLAGS)
237 +.ENDIF
239 +.IF "$(SYSTEM_LIBWPS)" == "YES"
240 +INCPRE+=$(LIBWPS_CFLAGS)
241 .ENDIF
243 +# broken but ... necessary, internal include shafted ...
244 +INCPRE+= -I..
246 SLOFILES= \
247 $(SLO)$/WordPerfectCollector.obj \
248 $(SLO)$/WordPerfectImportFilter.obj \
249 --- writerperfect/source/wpsimp/MSWorksCollector.cxx.old 1970-01-01 00:00:00.000000000 +0000
250 +++ writerperfect/source/wpsimp/MSWorksCollector.cxx 2009-04-06 16:41:41.000000000 +0000
251 @@ -0,0 +1,48 @@
252 +/* MSWorksCollector: Collects sections and runs of text from a
253 + * wordperfect file (and styles to go along with them) and writes them
254 + * to a Writer target document
256 + * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
258 + * This program is free software; you can redistribute it and/or
259 + * modify it under the terms of the GNU Lesser General Public
260 + * License as published by the Free Software Foundation; either
261 + * version 2 of the License, or (at your option) any later version.
263 + * This program is distributed in the hope that it will be useful,
264 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
265 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
266 + * Library General Public License for more details.
268 + * You should have received a copy of the GNU Library General Public
269 + * License along with this library; if not, write to the Free Software
270 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
272 + * For further information visit http://libwpd.sourceforge.net
274 + */
276 +/* "This product is not manufactured, approved, or supported by
277 + * Corel Corporation or Corel Corporation Limited."
278 + */
280 +#include "MSWorksCollector.hxx"
281 +#include <libwps/WPSDocument.h>
283 +MSWorksCollector::MSWorksCollector(WPSInputStream *pInput, DocumentHandler *pHandler) :
284 + DocumentCollector(pInput, pHandler)
288 +MSWorksCollector::~MSWorksCollector()
292 +bool MSWorksCollector::parseSourceDocument(WPSInputStream &input)
294 + WPSResult result = WPSDocument::parse(&input, static_cast<WPXHLListenerImpl *>(this));
295 + if (result != WPS_OK)
296 + return false;
298 + return true;
300 --- writerperfect/source/wpsimp/MSWorksCollector.hxx.old 1970-01-01 00:00:00.000000000 +0000
301 +++ writerperfect/source/wpsimp/MSWorksCollector.hxx 2009-04-06 16:41:41.000000000 +0000
302 @@ -0,0 +1,41 @@
303 +/* MSWorksCollector: Collects sections and runs of text from a
304 + * wordperfect file (and styles to go along with them) and writes them
305 + * to a Writer target document
307 + * Copyright (C) 2006 Fridrich Strba (fridrich.strba@bluewin.ch)
309 + * This program is free software; you can redistribute it and/or
310 + * modify it under the terms of the GNU Lesser General Public
311 + * License as published by the Free Software Foundation; either
312 + * version 2 of the License, or (at your option) any later version.
314 + * This program is distributed in the hope that it will be useful,
315 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
316 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
317 + * Library General Public License for more details.
319 + * You should have received a copy of the GNU Library General Public
320 + * License along with this library; if not, write to the Free Software
321 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
323 + * For further information visit http://libwpd.sourceforge.net
325 + */
327 +/* "This product is not manufactured, approved, or supported by
328 + * Corel Corporation or Corel Corporation Limited."
329 + */
331 +#ifndef _MSWORKSCOLLECTOR_HXX
332 +#define _MSWORKSCOLLECTOR_HXX
334 +#include "filter/DocumentCollector.hxx"
336 +class MSWorksCollector : public DocumentCollector
338 +public:
339 + MSWorksCollector(WPSInputStream *pInput, DocumentHandler *pHandler);
340 + virtual ~MSWorksCollector();
341 + bool parseSourceDocument(WPSInputStream &input);
343 +#endif
344 --- writerperfect/source/wpsimp/MSWorksImportFilter.cxx.old 1970-01-01 00:00:00.000000000 +0000
345 +++ writerperfect/source/wpsimp/MSWorksImportFilter.cxx 2009-04-06 16:41:41.000000000 +0000
346 @@ -0,0 +1,303 @@
347 +/* MSWorksImportFilter: Sets up the filter, and calls DocumentCollector
348 + * to do the actual filtering
350 + * Copyright (C) 2000 by Sun Microsystems, Inc.
351 + * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com)
352 + * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
353 + * Copyright (C) 2004 Fridrich Strba <fridrich.strba@bluewin.ch>
354 + *
355 + * This program is free software; you can redistribute it and/or
356 + * modify it under the terms of the GNU General Public License
357 + * as published by the Free Software Foundation; either version 2
358 + * of the License, or (at your option) any later version.
359 + *
360 + * This program is distributed in the hope that it will be useful,
361 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
362 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
363 + * GNU General Public License for more details.
364 + *
365 + * You should have received a copy of the GNU General Public License
366 + * along with this program; if not, write to the Free Software
367 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
368 + * 02111-1307, USA.
370 + * Contributor(s): Martin Gallwey (gallwey@sun.com)
372 + */
373 +/* "This product is not manufactured, approved, or supported by
374 + * Corel Corporation or Corel Corporation Limited."
375 + */
377 +#ifndef _OSL_DIAGNOSE_H_
378 +#include <osl/diagnose.h>
379 +#endif
380 +#ifndef _RTL_TENCINFO_H_
381 +#include <rtl/tencinfo.h>
382 +#endif
383 +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
384 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
385 +#endif
386 +#ifndef _COM_SUN_STAR_IO_XINPUTSTREAM_HPP_
387 +#include <com/sun/star/io/XInputStream.hpp>
388 +#endif
389 +#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
390 +#include <com/sun/star/xml/sax/XAttributeList.hpp>
391 +#endif
392 +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
393 +#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
394 +#endif
395 +#ifndef _COM_SUN_STAR_XML_SAX_INPUTSOURCE_HPP_
396 +#include <com/sun/star/xml/sax/InputSource.hpp>
397 +#endif
398 +#ifndef _COM_SUN_STAR_XML_SAX_XPARSER_HPP_
399 +#include <com/sun/star/xml/sax/XParser.hpp>
400 +#endif
402 +#ifndef _COM_SUN_STAR_UCB_XCOMMANDENVIRONMENT_HPP
403 +#include <com/sun/star/ucb/XCommandEnvironment.hpp>
404 +#endif
406 +#ifndef _ATTRLIST_HPP_
407 +#include <xmloff/attrlist.hxx>
408 +#endif
409 +#ifndef _XMLKYWD_HPP
410 +#include <xmloff/xmlkywd.hxx>
411 +#endif
413 +#ifndef _UCBHELPER_CONTENT_HXX
414 +#include <ucbhelper/content.hxx>
415 +#endif
417 +#include "filter/FilterInternal.hxx"
418 +#include "filter/DocumentHandler.hxx"
419 +#include "filter/DocumentCollector.hxx"
420 +#include "stream/WPXSvStream.h"
422 +#include <libwps/WPSDocument.h>
423 +#include "MSWorksImportFilter.hxx"
424 +#include "MSWorksCollector.hxx"
426 +// using namespace ::rtl;
427 +using rtl::OString;
428 +using rtl::OUString;
429 +using com::sun::star::uno::Sequence;
430 +using com::sun::star::uno::Reference;
431 +using com::sun::star::uno::Any;
432 +using com::sun::star::uno::UNO_QUERY;
433 +using com::sun::star::uno::XInterface;
434 +using com::sun::star::uno::Exception;
435 +using com::sun::star::uno::RuntimeException;
436 +using com::sun::star::lang::XMultiServiceFactory;
437 +using com::sun::star::beans::PropertyValue;
438 +using com::sun::star::document::XFilter;
439 +using com::sun::star::document::XExtendedFilterDetection;
440 +using com::sun::star::ucb::XCommandEnvironment;
442 +using com::sun::star::io::XInputStream;
443 +using com::sun::star::document::XImporter;
444 +using com::sun::star::xml::sax::InputSource;
445 +using com::sun::star::xml::sax::XAttributeList;
446 +using com::sun::star::xml::sax::XDocumentHandler;
447 +using com::sun::star::xml::sax::XParser;
449 +void callHandler(Reference < XDocumentHandler > xDocHandler);
451 +sal_Bool SAL_CALL MSWorksImportFilter::importImpl( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
452 + throw (RuntimeException)
454 + WRITER_DEBUG_MSG(("MSWorksImportFilter::importImpl: Got here!\n"));
456 + sal_Int32 nLength = aDescriptor.getLength();
457 + const PropertyValue * pValue = aDescriptor.getConstArray();
458 + OUString sURL;
459 + Reference < XInputStream > xInputStream;
460 + for ( sal_Int32 i = 0 ; i < nLength; i++)
462 + if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
463 + pValue[i].Value >>= xInputStream;
464 + else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
465 + pValue[i].Value >>= sURL;
467 + if ( !xInputStream.is() )
469 + OSL_ASSERT( 0 );
470 + return sal_False;
472 + OString sFileName;
473 + sFileName = OUStringToOString(sURL, RTL_TEXTENCODING_INFO_ASCII);
475 + // An XML import service: what we push sax messages to..
476 + OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.XMLImporter" ) );
477 + Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
479 + // The XImporter sets up an empty target document for XDocumentHandler to write to..
480 + Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
481 + xImporter->setTargetDocument(mxDoc);
483 + // OO Document Handler: abstract class to handle document SAX messages, concrete implementation here
484 + // writes to in-memory target doc
485 + DocumentHandler xHandler(xInternalHandler);
487 + WPXSvInputStream input( xInputStream );
489 + MSWorksCollector collector(&input, &xHandler);
490 + collector.filter();
492 + return true;
495 +sal_Bool SAL_CALL MSWorksImportFilter::filter( const Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
496 + throw (RuntimeException)
498 + WRITER_DEBUG_MSG(("MSWorksImportFilter::filter: Got here!\n"));
499 + return importImpl ( aDescriptor );
501 +void SAL_CALL MSWorksImportFilter::cancel( )
502 + throw (RuntimeException)
504 + WRITER_DEBUG_MSG(("MSWorksImportFilter::cancel: Got here!\n"));
507 +// XImporter
508 +void SAL_CALL MSWorksImportFilter::setTargetDocument( const Reference< ::com::sun::star::lang::XComponent >& xDoc )
509 + throw (::com::sun::star::lang::IllegalArgumentException, RuntimeException)
511 + WRITER_DEBUG_MSG(("MSWorksImportFilter::getTargetDocument: Got here!\n"));
512 + meType = FILTER_IMPORT;
513 + mxDoc = xDoc;
516 +// XExtendedFilterDetection
517 +OUString SAL_CALL MSWorksImportFilter::detect( com::sun::star::uno::Sequence< PropertyValue >& Descriptor )
518 + throw( com::sun::star::uno::RuntimeException )
520 + WRITER_DEBUG_MSG(("MSWorksImportFilter::detect: Got here!\n"));
522 + WPSConfidence confidence = WPS_CONFIDENCE_NONE;
523 + OUString sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "" ) );
524 + sal_Int32 nLength = Descriptor.getLength();
525 + sal_Int32 location = nLength;
526 + OUString sURL;
527 + const PropertyValue * pValue = Descriptor.getConstArray();
528 + Reference < XInputStream > xInputStream;
529 + for ( sal_Int32 i = 0 ; i < nLength; i++)
531 + if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "TypeName" ) ) )
532 + location=i;
533 + else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "InputStream" ) ) )
534 + pValue[i].Value >>= xInputStream;
535 + else if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "URL" ) ) )
536 + pValue[i].Value >>= sURL;
539 + Reference< com::sun::star::ucb::XCommandEnvironment > xEnv;
540 + if (!xInputStream.is())
542 + try
544 + ::ucbhelper::Content aContent(sURL, xEnv);
545 + xInputStream = aContent.openStream();
547 + catch ( ... )
549 + return ::rtl::OUString();
552 + if (!xInputStream.is())
553 + return ::rtl::OUString();
556 + WPXSvInputStream input( xInputStream );
558 + if (input.atEOS())
559 + return ::rtl::OUString();
561 + confidence = WPSDocument::isFileFormatSupported(&input, false);
563 + if ((confidence == WPS_CONFIDENCE_EXCELLENT) || (confidence == WPS_CONFIDENCE_GOOD))
564 + sTypeName = OUString( RTL_CONSTASCII_USTRINGPARAM ( "writer_MS_Works_Document" ) );
566 + if (sTypeName.getLength())
568 + if ( location == Descriptor.getLength() )
570 + Descriptor.realloc(nLength+1);
571 + Descriptor[location].Name = ::rtl::OUString::createFromAscii( "TypeName" );
574 + Descriptor[location].Value <<=sTypeName;
577 + return sTypeName;
581 +// XInitialization
582 +void SAL_CALL MSWorksImportFilter::initialize( const Sequence< Any >& aArguments )
583 + throw (Exception, RuntimeException)
585 + WRITER_DEBUG_MSG(("MSWorksImportFilter::initialize: Got here!\n"));
586 + Sequence < PropertyValue > aAnySeq;
587 + sal_Int32 nLength = aArguments.getLength();
588 + if ( nLength && ( aArguments[0] >>= aAnySeq ) )
590 + const PropertyValue * pValue = aAnySeq.getConstArray();
591 + nLength = aAnySeq.getLength();
592 + for ( sal_Int32 i = 0 ; i < nLength; i++)
594 + if ( pValue[i].Name.equalsAsciiL ( RTL_CONSTASCII_STRINGPARAM ( "Type" ) ) )
596 + pValue[i].Value >>= msFilterName;
597 + break;
602 +OUString MSWorksImportFilter_getImplementationName ()
603 + throw (RuntimeException)
605 + return OUString ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Writer.MSWorksImportFilter" ) );
608 +#define SERVICE_NAME1 "com.sun.star.document.ImportFilter"
609 +#define SERVICE_NAME2 "com.sun.star.document.ExtendedTypeDetection"
610 +sal_Bool SAL_CALL MSWorksImportFilter_supportsService( const OUString& ServiceName )
611 + throw (RuntimeException)
613 + return (ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME1 ) ) ||
614 + ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME2 ) ) );
616 +Sequence< OUString > SAL_CALL MSWorksImportFilter_getSupportedServiceNames( )
617 + throw (RuntimeException)
619 + Sequence < OUString > aRet(2);
620 + OUString* pArray = aRet.getArray();
621 + pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME1 ) );
622 + pArray[1] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME2 ) );
623 + return aRet;
625 +#undef SERVICE_NAME2
626 +#undef SERVICE_NAME1
628 +Reference< XInterface > SAL_CALL MSWorksImportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
629 + throw( Exception )
631 + return (cppu::OWeakObject*) new MSWorksImportFilter( rSMgr );
634 +// XServiceInfo
635 +OUString SAL_CALL MSWorksImportFilter::getImplementationName( )
636 + throw (RuntimeException)
638 + return MSWorksImportFilter_getImplementationName();
640 +sal_Bool SAL_CALL MSWorksImportFilter::supportsService( const OUString& rServiceName )
641 + throw (RuntimeException)
643 + return MSWorksImportFilter_supportsService( rServiceName );
645 +Sequence< OUString > SAL_CALL MSWorksImportFilter::getSupportedServiceNames( )
646 + throw (RuntimeException)
648 + return MSWorksImportFilter_getSupportedServiceNames();
650 --- writerperfect/source/wpsimp/MSWorksImportFilter.hxx.old 1970-01-01 00:00:00.000000000 +0000
651 +++ writerperfect/source/wpsimp/MSWorksImportFilter.hxx 2009-04-06 16:41:41.000000000 +0000
652 @@ -0,0 +1,129 @@
653 +/*
654 + * Copyright (C) 2000 by Sun Microsystems, Inc.
655 + * Copyright (C) 2002-2004 William Lachance (wlach@interlog.com)
656 + * Copyright (C) 2004 Net Integration Technologies (http://www.net-itech.com)
657 + * Copyright (C) 2004 Fridrich Strba <fridrich.strba@bluewin.ch>
658 + *
659 + * This program is free software; you can redistribute it and/or
660 + * modify it under the terms of the GNU General Public License
661 + * as published by the Free Software Foundation; either version 2
662 + * of the License, or (at your option) any later version.
663 + *
664 + * This program is distributed in the hope that it will be useful,
665 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
666 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
667 + * GNU General Public License for more details.
668 + *
669 + * You should have received a copy of the GNU General Public License
670 + * along with this program; if not, write to the Free Software
671 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
672 + * 02111-1307, USA.
674 + * Contributor(s): Martin Gallwey (gallwey@sun.com)
676 + */
678 +/* "This product is not manufactured, approved, or supported by
679 + * Corel Corporation or Corel Corporation Limited."
680 + */
681 +#ifndef _WORDPERFECTIMPORTFILTER_HXX
682 +#define _WORDPERFECTIMPORTFILTER_HXX
684 +#ifndef _COM_SUN_STAR_DOCUMENT_XFILTER_HPP_
685 +#include <com/sun/star/document/XFilter.hpp>
686 +#endif
687 +#ifndef _COM_SUN_STAR_DOCUMENT_XIMPORTER_HPP_
688 +#include <com/sun/star/document/XImporter.hpp>
689 +#endif
690 +#ifndef _COM_SUN_STAR_DOCUMENT_XEXTENDEDFILTERDETECTION_HPP_
691 +#include <com/sun/star/document/XExtendedFilterDetection.hpp>
692 +#endif
693 +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_
694 +#include <com/sun/star/lang/XInitialization.hpp>
695 +#endif
696 +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
697 +#include <com/sun/star/lang/XServiceInfo.hpp>
698 +#endif
699 +#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
700 +#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
701 +#endif
702 +#ifndef _CPPUHELPER_IMPLBASE5_HXX_
703 +#include <cppuhelper/implbase5.hxx>
704 +#endif
706 +enum FilterType
708 + FILTER_IMPORT,
709 + FILTER_EXPORT
711 +/* This component will be instantiated for both import or export. Whether it calls
712 + * setSourceDocument or setTargetDocument determines which Impl function the filter
713 + * member calls */
714 +class MSWorksImportFilter : public cppu::WeakImplHelper5
716 + com::sun::star::document::XFilter,
717 + com::sun::star::document::XImporter,
718 + com::sun::star::document::XExtendedFilterDetection,
719 + com::sun::star::lang::XInitialization,
720 + com::sun::star::lang::XServiceInfo
723 +protected:
724 + // oo.org declares
725 + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
726 + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > mxDoc;
727 + ::rtl::OUString msFilterName;
728 + ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > mxHandler;
730 + FilterType meType;
732 + sal_Bool SAL_CALL importImpl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
733 + throw (::com::sun::star::uno::RuntimeException);
735 +public:
736 + MSWorksImportFilter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF)
737 + : mxMSF( rxMSF ) {}
738 + virtual ~MSWorksImportFilter() {}
740 + // XFilter
741 + virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aDescriptor )
742 + throw (::com::sun::star::uno::RuntimeException);
743 + virtual void SAL_CALL cancel( )
744 + throw (::com::sun::star::uno::RuntimeException);
746 + // XImporter
747 + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
748 + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
750 + //XExtendedFilterDetection
751 + virtual ::rtl::OUString SAL_CALL detect( com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& Descriptor )
752 + throw( com::sun::star::uno::RuntimeException );
754 + // XInitialization
755 + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
756 + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
758 + // XServiceInfo
759 + virtual ::rtl::OUString SAL_CALL getImplementationName( )
760 + throw (::com::sun::star::uno::RuntimeException);
761 + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
762 + throw (::com::sun::star::uno::RuntimeException);
763 + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
764 + throw (::com::sun::star::uno::RuntimeException);
768 +::rtl::OUString MSWorksImportFilter_getImplementationName()
769 + throw ( ::com::sun::star::uno::RuntimeException );
771 +sal_Bool SAL_CALL MSWorksImportFilter_supportsService( const ::rtl::OUString& ServiceName )
772 + throw ( ::com::sun::star::uno::RuntimeException );
774 +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL MSWorksImportFilter_getSupportedServiceNames( )
775 + throw ( ::com::sun::star::uno::RuntimeException );
777 +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
778 +SAL_CALL MSWorksImportFilter_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
779 + throw ( ::com::sun::star::uno::Exception );
781 +#endif
782 --- writerperfect/source/wpsimp/makefile.mk.old 1970-01-01 00:00:00.000000000 +0000
783 +++ writerperfect/source/wpsimp/makefile.mk 2009-04-06 16:41:41.000000000 +0000
784 @@ -0,0 +1,29 @@
785 +PRJ=..$/..
787 +PRJNAME=writerperfect
788 +TARGET=wpsimp
789 +ENABLE_EXCEPTIONS=true
791 +.INCLUDE : settings.mk
793 +.IF "$(SYSTEM_LIBWPD)" == "YES"
794 +INCPRE+=$(LIBWPD_CFLAGS)
795 +.ELSE
796 +INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwpd
797 +.ENDIF
799 +.IF "$(SYSTEM_LIBWPS)" == "YES"
800 +INCPRE+=$(LIBWPS_CFLAGS)
801 +.ELSE
802 +INCPRE+=$(SOLARVER)$/$(UPD)$/$(INPATH)$/inc$/libwps
803 +.ENDIF
805 +# broken but ... necessary, internal include shafted ...
806 +INCPRE+= -I..
808 +SLOFILES= \
809 + $(SLO)$/MSWorksCollector.obj \
810 + $(SLO)$/MSWorksImportFilter.obj \
811 + $(SLO)$/msworks_genericfilter.obj
813 +.INCLUDE : target.mk
814 --- writerperfect/source/wpsimp/msworks_genericfilter.cxx.old 1970-01-01 00:00:00.000000000 +0000
815 +++ writerperfect/source/wpsimp/msworks_genericfilter.cxx 2009-04-06 16:41:41.000000000 +0000
816 @@ -0,0 +1,101 @@
817 +/* genericfilter: mostly generic code for registering the filter
819 + * Portions of this code Copyright 2000 by Sun Microsystems, Inc.
820 + * Rest is Copyright (C) 2002 William Lachance (wlach@interlog.com)
821 + *
822 + * This program is free software; you can redistribute it and/or
823 + * modify it under the terms of the GNU General Public License
824 + * as published by the Free Software Foundation; either version 2
825 + * of the License, or (at your option) any later version.
826 + *
827 + * This program is distributed in the hope that it will be useful,
828 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
829 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
830 + * GNU General Public License for more details.
831 + *
832 + * You should have received a copy of the GNU General Public License
833 + * along with this program; if not, write to the Free Software
834 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
835 + * 02111-1307, USA.
836 + */
838 +/* "This product is not manufactured, approved, or supported by
839 + * Corel Corporation or Corel Corporation Limited."
840 + */
841 +#include <stdio.h>
843 +#include <osl/mutex.hxx>
844 +#include <osl/thread.h>
845 +#include <cppuhelper/factory.hxx>
847 +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
848 +#include <com/sun/star/lang/XSingleServiceFactory.hpp>
849 +#endif
851 +#include "MSWorksImportFilter.hxx"
853 +using namespace ::rtl;
854 +using namespace ::cppu;
855 +using namespace ::com::sun::star::uno;
856 +using namespace ::com::sun::star::lang;
857 +using namespace ::com::sun::star::registry;
859 +extern "C"
861 +//==================================================================================================
862 +void SAL_CALL component_getImplementationEnvironment(
863 + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
865 + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
867 +//==================================================================================================
868 +sal_Bool SAL_CALL component_writeInfo(
869 + void * /* pServiceManager */, void * pRegistryKey )
871 + if (pRegistryKey)
873 + try
875 + sal_Int32 nPos = 0;
876 + Reference< XRegistryKey > xNewKey(
877 + reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( MSWorksImportFilter_getImplementationName() ) );
878 + xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
880 + const Sequence< OUString > & rSNL = MSWorksImportFilter_getSupportedServiceNames();
881 + const OUString * pArray = rSNL.getConstArray();
882 + for ( nPos = rSNL.getLength(); nPos--; )
883 + xNewKey->createKey( pArray[nPos] );
885 + return sal_True;
887 + catch (InvalidRegistryException &)
889 + OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
892 + return sal_False;
894 +//==================================================================================================
895 +void * SAL_CALL component_getFactory(
896 + const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
898 + void * pRet = 0;
900 + OUString implName = OUString::createFromAscii( pImplName );
901 + if ( pServiceManager && implName.equals(MSWorksImportFilter_getImplementationName()) )
903 + Reference< XSingleServiceFactory > xFactory( createSingleFactory(
904 + reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
905 + OUString::createFromAscii( pImplName ),
906 + MSWorksImportFilter_createInstance, MSWorksImportFilter_getSupportedServiceNames() ) );
908 + if (xFactory.is())
910 + xFactory->acquire();
911 + pRet = xFactory.get();
915 + return pRet;
918 --- writerperfect/util/makefile.mk.old 2009-04-02 10:49:34.000000000 +0000
919 +++ writerperfect/util/makefile.mk 2009-04-06 16:41:41.000000000 +0000
920 @@ -4,18 +4,26 @@ TARGET=writerperfect
922 .INCLUDE : settings.mk
924 -.IF "$(GUI)"=="UNX"
926 +.IF "$(GUI)"=="UNX" || "$(GUI)$(COM)"=="WNTGCC"
928 .IF "$(SYSTEM_LIBWPD)" == "YES"
929 LIBWPD=$(LIBWPD_LIBS)
930 .ELSE
931 LIBWPD=-lwpdlib
932 .ENDIF
934 +.IF "$(SYSTEM_LIBWPS)" == "YES"
935 +LIBWPS=$(LIBWPS_LIBS)
936 .ELSE
937 -.IF "$(GUI)$(COM)"=="WNTGCC"
938 -LIBWPD=-lwpdlib
939 -.ELSE
940 - LIBWPD=$(LIBPRE) wpdlib.lib
941 +LIBWPS=-lwpslib
942 .ENDIF
944 +.ELSE
946 +LIBWPD=$(LIBPRE) wpdlib.lib
947 +LIBWPS=$(LIBPRE) wpslib.lib
949 .ENDIF
951 LIB1TARGET= $(SLB)$/wpft.lib
952 @@ -45,4 +53,33 @@ SHL1LIBS = $(LIB1TARGET)
953 SHL1VERSIONMAP=wpft.map
954 DEF1NAME=$(SHL1TARGET)
957 +LIB2TARGET= $(SLB)$/msworks.lib
958 +LIB2FILES= \
959 + $(SLB)$/stream.lib \
960 + $(SLB)$/filter.lib \
961 + $(SLB)$/wpsimp.lib
962 +SHL2LIBS=$(LIB2TARGET)
963 +SHL2STDLIBS+= \
964 + $(SVLLIB) \
965 + $(SOTLIB) \
966 + $(SO2LIB) \
967 + $(SVTOOLLIB) \
968 + $(UNOTOOLSLIB) \
969 + $(TOOLSLIB) \
970 + $(COMPHELPERLIB) \
971 + $(UCBHELPERLIB) \
972 + $(CPPUHELPERLIB) \
973 + $(CPPULIB) \
974 + $(SALLIB) \
975 + $(XMLOFFLIB) \
976 + $(LIBWPS) \
977 + $(LIBWPD)
979 +SHL2TARGET = msworks$(DLLPOSTFIX)
980 +SHL2IMPLIB = i$(SHL2TARGET)
981 +SHL2LIBS = $(LIB2TARGET)
982 +SHL2VERSIONMAP=msworks.map
983 +DEF2NAME=$(SHL2TARGET)
985 .INCLUDE : target.mk
986 --- writerperfect/util/msworks.map.old 1970-01-01 00:00:00.000000000 +0000
987 +++ writerperfect/util/msworks.map 2009-04-06 16:41:41.000000000 +0000
988 @@ -0,0 +1,8 @@
989 +WPFT_1_0 {
990 + global:
991 + component_getImplementationEnvironment;
992 + component_writeInfo;
993 + component_getFactory;
994 + local:
995 + *;