1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 #include "lotimpop.hxx"
32 #include <sfx2/docfile.hxx>
33 #include <tools/urlobj.hxx>
35 #include "scerrors.hxx"
37 #include "filtopt.hxx"
40 //------------------------------------------------------------------------
42 extern FltError
ScImportLotus123old( SvStream
&, ScDocument
*, CharSet eSrc
);
43 // alter Krempel in filter.cxx!
45 FltError
ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium
& rMedium
, ScDocument
* pDocument
, CharSet eSrc
)
47 ScFilterOptions aFilterOpt
;
48 BOOL bWithWK3
= aFilterOpt
.GetWK3Flag();
50 SvStream
* pStream
= rMedium
.GetInStream();
59 pStream
->SetBufferSize( 32768 );
61 ImportLotus
aLotusImport( *pStream
, pDocument
, eSrc
);
64 eRet
= aLotusImport
.Read();
66 eRet
= 0xFFFFFFFF; // WK1 /WKS erzwingen
68 // ACHTUNG: QUICK-HACK fuer WK1 / WKS <-> WK3 / WK4
69 if( eRet
== 0xFFFFFFFF )
73 pStream
->SetBufferSize( 32768 );
75 eRet
= ScImportLotus123old( *pStream
, pDocument
, eSrc
);
77 pStream
->SetBufferSize( 0 );
85 if( pLotusRoot
->eFirstType
== Lotus_WK3
)
86 {// versuchen *.FM3-File zu laden
87 INetURLObject
aURL( rMedium
.GetURLObject() );
88 aURL
.setExtension( CREATE_STRING( "FM3" ) );
89 SfxMedium
aMedium( aURL
.GetMainURL(INetURLObject::NO_DECODE
), STREAM_STD_READ
, TRUE
);
90 pStream
= aMedium
.GetInStream();
93 if( aLotusImport
.Read( *pStream
) != eERR_OK
)
94 eRet
= SCWARN_IMPORT_WRONG_FM3
;
97 eRet
= SCWARN_IMPORT_OPEN_FM3
;