1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: lotread.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 //------------------------------------------------------------------------
38 #include "document.hxx"
40 #include "scerrors.hxx"
42 #include "lotimpop.hxx"
43 #include "lotattr.hxx"
44 #include "fprogressbar.hxx"
50 FltError
ImportLotus::Read()
54 S_START
, // analyse first BOF
55 S_WK1
, // in WK1-Stream
56 S_WK3
, // in WK3-Section
59 S_END
// Import finished
65 UINT32 nNextRec
= 0UL;
66 FltError eRet
= eERR_OK
;
67 // ScFormulaCell *pLastFormCell;
74 pIn
->Seek( nNextRec
);
76 // Progressbar starten
77 ScfStreamProgressBar
aPrgrsBar( *pIn
, pD
->GetDocumentShell() );
79 while( eAkt
!= S_END
)
81 *pIn
>> nOp
>> nRecLen
;
86 nNextRec
+= nRecLen
+ 4;
90 // -----------------------------------------------------------
91 case S_START
: // S_START
94 eRet
= SCERR_IMPORT_UNKNOWN_WK
;
102 switch( pLotusRoot
->eFirstType
)
104 case Lotus_WK1
: eAkt
= S_WK1
; break;
105 case Lotus_WK3
: eAkt
= S_WK3
; break;
106 case Lotus_WK4
: eAkt
= S_WK4
; break;
107 case Lotus_FM3
: eAkt
= S_FM3
; break;
109 eRet
= SCERR_IMPORT_UNKNOWN_WK
;
115 eAkt
= S_END
; // hier kommt wat fuer <= WK1 hinne!
120 // -----------------------------------------------------------
123 // -----------------------------------------------------------
133 case 0x0002: // PASSWORD
134 eRet
= eERR_FILEPASSWD
;
138 case 0x0007: // COLUMNWIDTH
139 Columnwidth( nRecLen
);
142 case 0x0008: // HIDDENCOLUMN
143 Hiddencolumn( nRecLen
);
146 case 0x0009: // USERRANGE
150 case 0x0013: // FORMAT
153 case 0x0014: // ERRCELL
157 case 0x0015: // NACELL
161 case 0x0016: // LABELCELL
165 case 0x0017: // NUMBERCELL
169 case 0x0018: // SMALLNUMCELL
173 case 0x0019: // FORMULACELL
174 Formulacell( nRecLen
);
177 case 0x001b: // extended attributes
182 case 2007: // ROW PRESENTATION
183 RowPresentation( nRecLen
);
186 case 14000: // NAMED SHEET
193 // -----------------------------------------------------------
196 // -----------------------------------------------------------
199 // -----------------------------------------------------------
202 DBG_ERROR( "*ImportLotus::Read(): State unbekannt!" );
207 DBG_ASSERT( nNextRec
>= pIn
->Tell(),
208 "*ImportLotus::Read(): Etwas zu gierig..." );
210 pIn
->Seek( nNextRec
);
211 aPrgrsBar
.Progress();
214 // duemmliche Namen eliminieren
215 SCTAB nTabs
= pD
->GetTableCount();
219 String
aRef( RTL_CONSTASCII_USTRINGPARAM( "temp" ) );
224 pD
->GetName( 0, aBaseName
);
225 aBaseName
.Erase( aBaseName
.Len() - 1 );
227 for( nCnt
= 1 ; nCnt
< nTabs
; nCnt
++ )
229 DBG_ASSERT( pD
->HasTable( nCnt
),
230 "-ImportLotus::Read(): Wo ist meine Tabelle?!" );
231 pD
->GetName( nCnt
, aTabName
);
232 if( aTabName
== aRef
)
234 aTabName
= aBaseName
;
235 pD
->CreateValidTabName( aTabName
);
236 pD
->RenameTab( nCnt
, aTabName
);
247 FltError
ImportLotus::Read( SvStream
& rIn
)
254 UINT32 nNextRec
= 0UL;
255 FltError eRet
= eERR_OK
;
260 pIn
->Seek( nNextRec
);
262 // Progressbar starten
263 ScfStreamProgressBar
aPrgrsBar( *pIn
, pD
->GetDocumentShell() );
267 *pIn
>> nOp
>> nRecLen
;
273 nNextRec
+= nRecLen
+ 4;
278 if( nRecLen
!= 26 || !BofFm3() )
287 DBG_ASSERT( nTab
== 0,
288 "-ImportLotus::Read( SvStream& ): Zweimal EOF nicht erlaubt" );
292 case 174: // FONT_FACE
296 case 176: // FONT_TYPE
300 case 177: // FONT_YSIZE
306 pLotusRoot
->pAttrTable
->Apply( ( SCTAB
) nExtTab
);
314 DBG_ASSERT( nNextRec
>= pIn
->Tell(),
315 "*ImportLotus::Read(): Etwas zu gierig..." );
316 pIn
->Seek( nNextRec
);
317 aPrgrsBar
.Progress();
321 pLotusRoot
->pAttrTable
->Apply( ( SCTAB
) nExtTab
);