Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / filter / lotus / lotus.cxx
blobeb6621a0100e1feea5ce3ce0b8f9568fe25b55e8
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "lotimpop.hxx"
22 #include <sfx2/docfile.hxx>
23 #include <tools/urlobj.hxx>
25 #include "scerrors.hxx"
26 #include "root.hxx"
27 #include "filtopt.hxx"
28 #include "ftools.hxx"
30 //------------------------------------------------------------------------
32 extern FltError ScImportLotus123old( SvStream&, ScDocument*, rtl_TextEncoding eSrc );
33 // alter Krempel in filter.cxx!
35 FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, rtl_TextEncoding eSrc )
37 ScFilterOptions aFilterOpt;
38 sal_Bool bWithWK3 = aFilterOpt.GetWK3Flag();
40 SvStream* pStream = rMedium.GetInStream();
42 if( !pStream )
43 return eERR_OPEN;
45 FltError eRet;
47 pStream->Seek( 0UL );
49 pStream->SetBufferSize( 32768 );
51 ImportLotus aLotusImport( *pStream, pDocument, eSrc );
53 if( bWithWK3 )
54 eRet = aLotusImport.Read();
55 else
56 eRet = 0xFFFFFFFF; // WK1 /WKS erzwingen
58 // ACHTUNG: QUICK-HACK fuer WK1 / WKS <-> WK3 / WK4
59 if( eRet == 0xFFFFFFFF )
61 pStream->Seek( 0UL );
63 pStream->SetBufferSize( 32768 );
65 eRet = ScImportLotus123old( *pStream, pDocument, eSrc );
67 pStream->SetBufferSize( 0 );
69 return eRet;
72 if( eRet != eERR_OK )
73 return eRet;
75 if( pLotusRoot->eFirstType == Lotus_WK3 )
76 {// versuchen *.FM3-File zu laden
77 INetURLObject aURL( rMedium.GetURLObject() );
78 aURL.setExtension( "FM3" );
79 SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ );
80 pStream = aMedium.GetInStream();
81 if ( pStream )
83 if( aLotusImport.Read( *pStream ) != eERR_OK )
84 eRet = SCWARN_IMPORT_WRONG_FM3;
86 else
87 eRet = SCWARN_IMPORT_OPEN_FM3;
90 return eRet;
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */