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"
33 //------------------------------------------------------------------------
35 #include "document.hxx"
37 #include "scerrors.hxx"
39 #include "lotimpop.hxx"
40 #include "lotattr.hxx"
41 #include "fprogressbar.hxx"
47 FltError
ImportLotus::Read()
51 S_START
, // analyse first BOF
52 S_WK1
, // in WK1-Stream
53 S_WK3
, // in WK3-Section
56 S_END
// Import finished
62 UINT32 nNextRec
= 0UL;
63 FltError eRet
= eERR_OK
;
64 // ScFormulaCell *pLastFormCell;
71 pIn
->Seek( nNextRec
);
73 // Progressbar starten
74 ScfStreamProgressBar
aPrgrsBar( *pIn
, pD
->GetDocumentShell() );
76 while( eAkt
!= S_END
)
78 *pIn
>> nOp
>> nRecLen
;
83 nNextRec
+= nRecLen
+ 4;
87 // -----------------------------------------------------------
88 case S_START
: // S_START
91 eRet
= SCERR_IMPORT_UNKNOWN_WK
;
99 switch( pLotusRoot
->eFirstType
)
101 case Lotus_WK1
: eAkt
= S_WK1
; break;
102 case Lotus_WK3
: eAkt
= S_WK3
; break;
103 case Lotus_WK4
: eAkt
= S_WK4
; break;
104 case Lotus_FM3
: eAkt
= S_FM3
; break;
106 eRet
= SCERR_IMPORT_UNKNOWN_WK
;
112 eAkt
= S_END
; // hier kommt wat fuer <= WK1 hinne!
117 // -----------------------------------------------------------
120 // -----------------------------------------------------------
130 case 0x0002: // PASSWORD
131 eRet
= eERR_FILEPASSWD
;
135 case 0x0007: // COLUMNWIDTH
136 Columnwidth( nRecLen
);
139 case 0x0008: // HIDDENCOLUMN
140 Hiddencolumn( nRecLen
);
143 case 0x0009: // USERRANGE
147 case 0x0013: // FORMAT
150 case 0x0014: // ERRCELL
154 case 0x0015: // NACELL
158 case 0x0016: // LABELCELL
162 case 0x0017: // NUMBERCELL
166 case 0x0018: // SMALLNUMCELL
170 case 0x0019: // FORMULACELL
171 Formulacell( nRecLen
);
174 case 0x001b: // extended attributes
179 case 2007: // ROW PRESENTATION
180 RowPresentation( nRecLen
);
183 case 14000: // NAMED SHEET
190 // -----------------------------------------------------------
193 // -----------------------------------------------------------
196 // -----------------------------------------------------------
199 DBG_ERROR( "*ImportLotus::Read(): State unbekannt!" );
204 DBG_ASSERT( nNextRec
>= pIn
->Tell(),
205 "*ImportLotus::Read(): Etwas zu gierig..." );
207 pIn
->Seek( nNextRec
);
208 aPrgrsBar
.Progress();
211 // duemmliche Namen eliminieren
212 SCTAB nTabs
= pD
->GetTableCount();
216 String
aRef( RTL_CONSTASCII_USTRINGPARAM( "temp" ) );
221 pD
->GetName( 0, aBaseName
);
222 aBaseName
.Erase( aBaseName
.Len() - 1 );
224 for( nCnt
= 1 ; nCnt
< nTabs
; nCnt
++ )
226 DBG_ASSERT( pD
->HasTable( nCnt
),
227 "-ImportLotus::Read(): Wo ist meine Tabelle?!" );
228 pD
->GetName( nCnt
, aTabName
);
229 if( aTabName
== aRef
)
231 aTabName
= aBaseName
;
232 pD
->CreateValidTabName( aTabName
);
233 pD
->RenameTab( nCnt
, aTabName
);
244 FltError
ImportLotus::Read( SvStream
& rIn
)
251 UINT32 nNextRec
= 0UL;
252 FltError eRet
= eERR_OK
;
257 pIn
->Seek( nNextRec
);
259 // Progressbar starten
260 ScfStreamProgressBar
aPrgrsBar( *pIn
, pD
->GetDocumentShell() );
264 *pIn
>> nOp
>> nRecLen
;
270 nNextRec
+= nRecLen
+ 4;
275 if( nRecLen
!= 26 || !BofFm3() )
284 DBG_ASSERT( nTab
== 0,
285 "-ImportLotus::Read( SvStream& ): Zweimal EOF nicht erlaubt" );
289 case 174: // FONT_FACE
293 case 176: // FONT_TYPE
297 case 177: // FONT_YSIZE
303 pLotusRoot
->pAttrTable
->Apply( ( SCTAB
) nExtTab
);
311 DBG_ASSERT( nNextRec
>= pIn
->Tell(),
312 "*ImportLotus::Read(): Etwas zu gierig..." );
313 pIn
->Seek( nNextRec
);
314 aPrgrsBar
.Progress();
318 pLotusRoot
->pAttrTable
->Apply( ( SCTAB
) nExtTab
);