Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "lotimpop.hxx"
30 : :
31 : : #include <sfx2/docfile.hxx>
32 : : #include <tools/urlobj.hxx>
33 : :
34 : : #include "scerrors.hxx"
35 : : #include "root.hxx"
36 : : #include "filtopt.hxx"
37 : : #include "ftools.hxx"
38 : :
39 : : //------------------------------------------------------------------------
40 : :
41 : : extern FltError ScImportLotus123old( SvStream&, ScDocument*, CharSet eSrc );
42 : : // alter Krempel in filter.cxx!
43 : :
44 : 0 : FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, CharSet eSrc )
45 : : {
46 [ # # ]: 0 : ScFilterOptions aFilterOpt;
47 : 0 : sal_Bool bWithWK3 = aFilterOpt.GetWK3Flag();
48 : :
49 [ # # ]: 0 : SvStream* pStream = rMedium.GetInStream();
50 : :
51 [ # # ]: 0 : if( !pStream )
52 : 0 : return eERR_OPEN;
53 : :
54 : : FltError eRet;
55 : :
56 [ # # ]: 0 : pStream->Seek( 0UL );
57 : :
58 [ # # ]: 0 : pStream->SetBufferSize( 32768 );
59 : :
60 [ # # ]: 0 : ImportLotus aLotusImport( *pStream, pDocument, eSrc );
61 : :
62 [ # # ]: 0 : if( bWithWK3 )
63 [ # # ]: 0 : eRet = aLotusImport.Read();
64 : : else
65 : 0 : eRet = 0xFFFFFFFF; // WK1 /WKS erzwingen
66 : :
67 : : // ACHTUNG: QUICK-HACK fuer WK1 / WKS <-> WK3 / WK4
68 [ # # ]: 0 : if( eRet == 0xFFFFFFFF )
69 : : {
70 [ # # ]: 0 : pStream->Seek( 0UL );
71 : :
72 [ # # ]: 0 : pStream->SetBufferSize( 32768 );
73 : :
74 [ # # ]: 0 : eRet = ScImportLotus123old( *pStream, pDocument, eSrc );
75 : :
76 [ # # ]: 0 : pStream->SetBufferSize( 0 );
77 : :
78 : 0 : return eRet;
79 : : }
80 : :
81 [ # # ]: 0 : if( eRet != eERR_OK )
82 : 0 : return eRet;
83 : :
84 [ # # ]: 0 : if( pLotusRoot->eFirstType == Lotus_WK3 )
85 : : {// versuchen *.FM3-File zu laden
86 [ # # ][ # # ]: 0 : INetURLObject aURL( rMedium.GetURLObject() );
87 [ # # ][ # # ]: 0 : aURL.setExtension( CREATE_STRING( "FM3" ) );
[ # # ][ # # ]
88 [ # # ][ # # ]: 0 : SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ );
[ # # ][ # # ]
89 [ # # ]: 0 : pStream = aMedium.GetInStream();
90 [ # # ]: 0 : if ( pStream )
91 : : {
92 [ # # ][ # # ]: 0 : if( aLotusImport.Read( *pStream ) != eERR_OK )
93 : 0 : eRet = SCWARN_IMPORT_WRONG_FM3;
94 : : }
95 : : else
96 [ # # ][ # # ]: 0 : eRet = SCWARN_IMPORT_OPEN_FM3;
97 : : }
98 : :
99 [ # # ][ # # ]: 0 : return eRet;
100 [ + - ][ + - ]: 24 : }
101 : :
102 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|