LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/lotus - lotus.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 31 54.8 %
Date: 2012-12-27 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #include "lotimpop.hxx"
      21             : 
      22             : #include <sfx2/docfile.hxx>
      23             : #include <tools/urlobj.hxx>
      24             : 
      25             : #include "scerrors.hxx"
      26             : #include "root.hxx"
      27             : #include "filtopt.hxx"
      28             : #include "ftools.hxx"
      29             : 
      30             : //------------------------------------------------------------------------
      31             : 
      32             : extern FltError ScImportLotus123old( SvStream&, ScDocument*, CharSet eSrc );
      33             :         // alter Krempel in filter.cxx!
      34             : 
      35           1 : FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, CharSet eSrc )
      36             : {
      37           1 :         ScFilterOptions aFilterOpt;
      38           1 :     sal_Bool bWithWK3 = aFilterOpt.GetWK3Flag();
      39             : 
      40           1 :     SvStream*           pStream = rMedium.GetInStream();
      41             : 
      42           1 :     if( !pStream )
      43           0 :         return eERR_OPEN;
      44             : 
      45             :     FltError            eRet;
      46             : 
      47           1 :     pStream->Seek( 0UL );
      48             : 
      49           1 :     pStream->SetBufferSize( 32768 );
      50             : 
      51           1 :     ImportLotus         aLotusImport( *pStream, pDocument, eSrc );
      52             : 
      53           1 :     if( bWithWK3 )
      54           0 :         eRet = aLotusImport.Read();
      55             :     else
      56           1 :         eRet = 0xFFFFFFFF;  // WK1 /WKS erzwingen
      57             : 
      58             :     // ACHTUNG: QUICK-HACK fuer WK1 / WKS  <->  WK3 / WK4
      59           1 :     if( eRet == 0xFFFFFFFF )
      60             :     {
      61           1 :         pStream->Seek( 0UL );
      62             : 
      63           1 :         pStream->SetBufferSize( 32768 );
      64             : 
      65           1 :         eRet = ScImportLotus123old( *pStream, pDocument, eSrc );
      66             : 
      67           1 :         pStream->SetBufferSize( 0 );
      68             : 
      69           1 :         return eRet;
      70             :     }
      71             : 
      72           0 :     if( eRet != eERR_OK )
      73           0 :         return eRet;
      74             : 
      75           0 :     if( pLotusRoot->eFirstType == Lotus_WK3 )
      76             :     {// versuchen *.FM3-File zu laden
      77           0 :         INetURLObject aURL( rMedium.GetURLObject() );
      78           0 :         aURL.setExtension( CREATE_STRING( "FM3" ) );
      79           0 :         SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ );
      80           0 :         pStream = aMedium.GetInStream();
      81           0 :         if ( pStream )
      82             :         {
      83           0 :             if( aLotusImport.Read( *pStream ) != eERR_OK )
      84           0 :                 eRet = SCWARN_IMPORT_WRONG_FM3;
      85             :         }
      86             :         else
      87           0 :             eRet = SCWARN_IMPORT_OPEN_FM3;
      88             :     }
      89             : 
      90           0 :     return eRet;
      91           9 : }
      92             : 
      93             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10