1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "lotfilter.hxx"
21 #include "lotimpop.hxx"
23 #include <sfx2/docfile.hxx>
24 #include <tools/urlobj.hxx>
26 #include "scerrors.hxx"
28 #include "filtopt.hxx"
31 FltError
ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium
& rMedium
, ScDocument
* pDocument
, rtl_TextEncoding eSrc
)
33 ScFilterOptions aFilterOpt
;
34 bool bWithWK3
= aFilterOpt
.GetWK3Flag();
36 SvStream
* pStream
= rMedium
.GetInStream();
45 pStream
->SetBufferSize( 32768 );
47 LotusContext aContext
;
49 ImportLotus
aLotusImport(aContext
, *pStream
, pDocument
, eSrc
);
52 eRet
= aLotusImport
.Read();
54 eRet
= 0xFFFFFFFF; // WK1 /WKS erzwingen
56 // ACHTUNG: QUICK-HACK fuer WK1 / WKS <-> WK3 / WK4
57 if( eRet
== 0xFFFFFFFF )
61 pStream
->SetBufferSize( 32768 );
63 eRet
= ScImportLotus123old(aContext
, *pStream
, pDocument
, eSrc
);
65 pStream
->SetBufferSize( 0 );
73 if (aContext
.pLotusRoot
->eFirstType
== Lotus_WK3
)
75 // versuchen *.FM3-File zu laden
76 INetURLObject
aURL( rMedium
.GetURLObject() );
77 aURL
.setExtension( "FM3" );
78 SfxMedium
aMedium( aURL
.GetMainURL(INetURLObject::NO_DECODE
), STREAM_STD_READ
);
79 pStream
= aMedium
.GetInStream();
82 if( aLotusImport
.Read( *pStream
) != eERR_OK
)
83 eRet
= SCWARN_IMPORT_WRONG_FM3
;
86 eRet
= SCWARN_IMPORT_OPEN_FM3
;
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */