summaryrefslogtreecommitdiff
path: root/sc/source/filter/lotus
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/filter/lotus')
-rw-r--r--sc/source/filter/lotus/expop.cxx412
-rw-r--r--sc/source/filter/lotus/export.cxx58
-rw-r--r--sc/source/filter/lotus/filter.cxx248
-rw-r--r--sc/source/filter/lotus/lotattr.cxx299
-rw-r--r--sc/source/filter/lotus/lotform.cxx2074
-rw-r--r--sc/source/filter/lotus/lotimpop.cxx473
-rw-r--r--sc/source/filter/lotus/lotread.cxx324
-rw-r--r--sc/source/filter/lotus/lotus.cxx102
-rw-r--r--sc/source/filter/lotus/makefile.mk69
-rw-r--r--sc/source/filter/lotus/memory.cxx139
-rw-r--r--sc/source/filter/lotus/op.cxx684
-rw-r--r--sc/source/filter/lotus/optab.cxx248
-rw-r--r--sc/source/filter/lotus/tool.cxx651
13 files changed, 5781 insertions, 0 deletions
diff --git a/sc/source/filter/lotus/expop.cxx b/sc/source/filter/lotus/expop.cxx
new file mode 100644
index 000000000000..7ecc9127b49d
--- /dev/null
+++ b/sc/source/filter/lotus/expop.cxx
@@ -0,0 +1,412 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+//------------------------------------------------------------------------
+
+#include <tools/debug.hxx>
+
+#include "dociter.hxx"
+#include "cell.hxx"
+#include "document.hxx"
+
+#include "exp_op.hxx"
+
+#if ENABLE_LOTUS123_EXPORT
+const USHORT ExportWK1::WK1MAXCOL = 255;
+const USHORT ExportWK1::WK1MAXROW = 8191;
+
+BYTE ExportWK1::GenFormByte( const ScPatternAttr& /*aAttr*/ )
+{
+ return 0xFF;
+}
+
+
+inline void ExportWK1::Bof()
+{ // (0x00)
+ aOut << ( USHORT ) 0x00 << ( USHORT ) 2 << ( USHORT ) 0x0406; // Version 1-2-3/2, Symhony/1.1
+}
+
+
+inline void ExportWK1::Eof()
+{ // (0x01)
+ aOut << ( USHORT ) 0x01 << ( USHORT ) 0;
+}
+
+
+inline void ExportWK1::Calcmode()
+{ // (0x02)
+ // Calculationmode = automatic
+ aOut << ( USHORT ) 0x02 << ( USHORT ) 1 << ( BYTE ) 0xFF;
+}
+
+
+inline void ExportWK1::Calcorder()
+{ // (0x03)
+ // order = natural
+ aOut << ( USHORT ) 0x03 << ( USHORT ) 1 << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Split()
+{ // (0x04)
+ // not split
+ aOut << ( USHORT ) 0x04 << ( USHORT ) 1 << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Sync()
+{ // (0x05)
+ // not synchronized
+ aOut << ( USHORT ) 0x05 << ( USHORT ) 1 << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Dimensions()
+{ // (0x06)
+ SCCOL nEndCol;
+ SCROW nEndRow;
+ aOut << ( USHORT ) 0x06 << ( USHORT ) 8 << ( USHORT ) 0 << ( USHORT ) 0; // Starting Col/Row
+ pD->GetPrintArea( 0, nEndCol, nEndRow );
+#if SC_ROWLIMIT_MORE_THAN_64K
+#error row limit 64k
+#endif
+ USHORT nCol = static_cast<USHORT>(nEndCol);
+ USHORT nRow = static_cast<USHORT>(nEndRow);
+ DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Dimensions(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Dimensions(): Row > WK1MAXROW" );
+ aOut << nCol << nRow; // Ending Col/Row
+}
+
+
+inline void ExportWK1::Window1()
+{ // (0x07)
+ aOut << ( USHORT ) 0x07 << ( USHORT ) 32
+ << ( USHORT ) 0 << ( USHORT ) 0 // Cursor Col/Row
+ << ( BYTE ) 0xFF // Format: protected, special, default
+ << ( BYTE ) 0 // Dummy
+ << ( USHORT ) 9 // Default column width
+ << ( USHORT ) 8 << ( USHORT ) 14// Number of cols/rows on screen
+ << ( USHORT ) 0 << ( USHORT ) 0 // Left col / top row
+ // Rest aus Doku-Beispiel
+ << ( USHORT ) 0 << ( USHORT ) 0 // Number of title cols / rows
+ << ( USHORT ) 0 << ( USHORT ) 0 // Left title col / top title row
+ << ( USHORT ) 0x0004 << ( USHORT ) 0x0004// Top-left col / row
+ << ( USHORT ) 0x0048 // Number of cols in window
+ << ( USHORT ) 0x00; // Dummy
+}
+
+
+inline void ExportWK1::Colw()
+{ // (0x08)
+ // ACHTUNG: muss nach Window1 und vor hidden cols record kommen!
+ USHORT nWidth;
+ BYTE nWidthSpaces;
+ for( USHORT nCol = 0 ; nCol < 256 ; nCol++ )
+ {
+ nWidth = pD->GetColWidth( static_cast<SCCOL>(nCol), 0 );
+ nWidthSpaces = ( BYTE ) ( nWidth / TWIPS_PER_CHAR );
+ aOut << ( USHORT ) 0x08 << ( USHORT ) 3 << nCol << nWidthSpaces;
+ }
+}
+
+
+void ExportWK1::Blank( const USHORT nCol, const USHORT nRow, const ScPatternAttr& aAttr )
+{ // (0x0C)
+ // PREC: nCol <= WK1MAXCOL, nRow <= WK1MAXROW
+ DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Blank(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Blank(): Row > WK1MAXROW" );
+
+ aOut << ( USHORT ) 0x0C << ( USHORT ) 5 << GenFormByte( aAttr ) << nCol << nRow;
+}
+
+
+void ExportWK1::Number( const USHORT nCol, const USHORT nRow, const double fWert, const ScPatternAttr &aAttr )
+{ // (0x0E)
+ // PREC: nCol <= WK1MAXCOL, nRow <= WK1MAXROW
+ DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Number(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Number(): Row > WK1MAXROW" );
+
+ aOut << ( USHORT ) 0x0E << ( USHORT ) 13 << GenFormByte( aAttr ) << nCol << nRow << fWert;
+}
+
+
+void ExportWK1::Label( const USHORT nCol, const USHORT nRow, const String& rStr, const ScPatternAttr& aAttr )
+{ // (0x0F)
+ // PREC: nCol <= WK1MAXCOL, nRow <= WK1MAXROW
+ DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Label(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Label(): Row > WK1MAXROW" );
+
+ ByteString aStr( rStr, eZielChar );
+
+ USHORT nLaenge = 7; // Anzahl Bytes vor String+Nullbyte am Ende + Alignment-Char
+
+ xub_StrLen nAnz = aStr.Len();
+
+
+ if( nAnz > 240 ) // max. 240 Zeichen im String
+ nAnz = 240;
+
+ nLaenge = nLaenge + ( USHORT ) nAnz; // + Stringlaenge
+
+ aOut << ( USHORT ) 0x0F << nLaenge << GenFormByte( aAttr ) << nCol << nRow << ( sal_Char ) '\'';
+ // ACHTUNG: ZUNAECHST NUR LEFT ALIGNMENT
+
+ aOut.Write( aStr.GetBuffer(), nAnz );
+
+ aOut << ( BYTE ) 0x00; // ...und Nullterminator anhaengen
+}
+
+
+void ExportWK1::Formula( const USHORT nCol, const USHORT nRow, const ScFormulaCell* pFC, const ScPatternAttr& aAttr )
+{ // (0x10)
+ // PREC: nCol <= WK1MAXCOL, nRow <= WK1MAXROW
+ DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Formula(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Formula(): Row > WK1MAXROW" );
+
+ USHORT nLaenge = 15; // Bytes bis Formel
+ double fErgebnis;
+
+ // zunaechst nur Dummy-Angaben (Formel := Ergebnis der Berechnung )
+ nLaenge += 9+1;
+
+ fErgebnis = ( ( ScFormulaCell* ) pFC )->GetValue();
+
+ aOut << ( USHORT ) 0x10 << ( USHORT ) nLaenge
+ << GenFormByte( aAttr ) << nCol << nRow
+ << fErgebnis
+ << ( USHORT ) 9+1 // Dummy-Formula-Size
+ << ( BYTE ) 0x00 // constant, floating point
+ << fErgebnis
+ << ( BYTE ) 0x03; // return
+}
+
+
+inline void ExportWK1::Protect()
+{ // (0x24)
+ //Global protection off
+ aOut << ( USHORT ) 0x24 << ( USHORT ) 1 << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Footer()
+{ // (0x25)
+ // zunaechst nur leerer C-String
+ aOut << ( USHORT ) 0x25 << ( USHORT ) 242 << ( sal_Char ) '\''; // linksbuendiger leerer String
+ for( short nLauf = 0 ; nLauf < 241 ; nLauf++ )
+ aOut << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Header()
+{ // (0x26)
+ // zunaechst nur leerer C-String
+ aOut << ( USHORT ) 0x26 << ( USHORT ) 242 << ( sal_Char ) '\''; // linksbuendiger leerer String
+ for( short nLauf = 0 ; nLauf < 241 ; nLauf++ )
+ aOut << ( BYTE ) 0x00;
+}
+
+
+inline void ExportWK1::Margins()
+{ // (0x28)
+ aOut << ( USHORT ) 0x28 << ( USHORT ) 10
+ << ( USHORT ) 4 << ( USHORT ) 76 // Left/right margin
+ << ( USHORT ) 66 // Page length
+ << ( USHORT ) 2 << ( USHORT ) 2; // Top/Bottom margin
+}
+
+
+inline void ExportWK1::Labelfmt()
+{ // (0x29)
+ // Global label alignment = left
+ aOut << ( USHORT ) 0x29 << ( USHORT ) 1 << ( BYTE ) 0x27;
+}
+
+
+inline void ExportWK1::Calccount()
+{ // (0x2F)
+ // Iteration count = 16 (oder so aehnlich)
+ aOut << ( USHORT ) 0x2F << ( USHORT ) 1 << ( BYTE ) 16;
+}
+
+
+inline void ExportWK1::Cursorw12()
+{ // (0x31)
+ // Cursor location in window 1
+ aOut << ( USHORT ) 0x31 << ( USHORT ) 1 << ( BYTE ) 1;
+}
+
+
+void ExportWK1::WKString( const USHORT /*nCol*/, const USHORT /*nRow*/, const ScFormulaCell* /*pFC*/, const ScPatternAttr& /*aAttr*/ )
+{ // (0x33)
+ // PREC: nCol <= WK1MAXCOL, nRow <= WK1MAXROW
+/* DBG_ASSERT( nCol <= WK1MAXCOL, "ExportWK1::Label(): Col > WK1MAXCOL" );
+ DBG_ASSERT( nRow <= WK1MAXROW, "ExportWK1::Label(): Row > WK1MAXROW" );
+
+ String aStr;
+ ( ( ScFormulaCell * ) pFC )->GetString( aStr ); // Formeltext zunaechst so belassen
+
+ USHORT nLaenge = 6; // Anzahl Bytes vor String+Nullbyte am Ende
+
+ USHORT nAnz = aStr.Len();
+
+ if( nAnz > 240 ) // max. 240 Zeichen im String
+ nAnz = 240;
+
+ nLaenge += nAnz; // + Stringlaenge
+
+ aOut << ( USHORT ) 0x33 << nLaenge
+ << GenFormByte( aAttr ) << nCol << nRow;
+
+ // Zeichenweise String ausgeben
+ for( USHORT nLauf = 0 ; nLauf < nAnz ; nLauf++ )
+ aOut << aStr[ nLauf ];
+
+ aOut << ( BYTE ) 0x00; // ...und Nullterminator anhaengen
+*/
+ }
+
+
+inline void ExportWK1::Snrange()
+{ // (0x47)
+ //aOut << ( USHORT ) 0x47 << ( USHORT ) x
+/* ScRangeName *pRanges = pD->GetRangeName();
+ ScRangeData *pData;
+ String aName;
+
+ USHORT nAnz = pRanges->GetCount();
+
+ for( USHORT nLauf = 0 ; nLauf < nAnz ; nLauf++ )
+ {
+ pData = pRanges[ nLauf ];
+
+ }
+*/
+}
+
+
+inline void ExportWK1::Hidcol()
+{ // (0x64)
+ sal_uInt32 nHide = 0x00000000; // ...niemand ist versteckt
+
+ aOut << ( USHORT ) 0x64 << ( USHORT ) 32;
+
+ for( int nLauf = 0 ; nLauf < 8 ; nLauf++ )
+ aOut << nHide; // 8 * 32 Bits = 256
+}
+
+
+inline void ExportWK1::Cpi()
+{ // (0x96)
+ //aOut << ( USHORT ) 0x96 << ( USHORT ) x;
+}
+
+
+FltError ExportWK1::Write()
+{
+ Bof();
+ //Dimensions();
+ //Cpi();
+ //Calccount();
+ //Calcmode();
+ //Calcorder();
+ //Split();
+ //Sync();
+ //Window1();
+ Colw();
+ //Hidcol();
+ //Cursorw12();
+ //Snrange();
+ //Protect();
+ //Footer();
+ //Header();
+ //Margins();
+ //Labelfmt();
+
+ // Zellen-Bemachung
+ ScDocumentIterator aIter( pD, 0, 0 );
+ ScBaseCell* pCell;
+ USHORT nCol, nRow;
+ SCTAB nTab;
+ const ScPatternAttr* pPatAttr;
+
+ if( aIter.GetFirst() )
+ do
+ { // ueber alle Zellen der ersten Tabelle iterieren
+ pPatAttr = aIter.GetPattern();
+ pCell = aIter.GetCell();
+ SCCOL nScCol;
+ SCROW nScRow;
+ aIter.GetPos( nScCol, nScRow, nTab );
+#if SC_ROWLIMIT_MORE_THAN_64K
+#error row limit 64k
+#endif
+ nCol = static_cast<USHORT>(nScCol);
+ nRow = static_cast<USHORT>(nScRow);
+
+ switch( pCell->GetCellType() )
+ {
+ case CELLTYPE_VALUE:
+ {
+ double fVal;
+ fVal = ( ( ScValueCell * ) pCell)->GetValue();
+ Number( nCol, nRow, fVal, *pPatAttr );
+ }
+ break;
+ case CELLTYPE_STRING:
+ {
+ String aStr;
+ ( ( ScStringCell * ) pCell)->GetString( aStr );
+ Label( nCol, nRow, aStr, *pPatAttr );
+ }
+ break;
+ case CELLTYPE_FORMULA:
+ {
+ Formula( nCol, nRow, ( ScFormulaCell * ) pCell, *pPatAttr );
+ WKString( nCol, nRow, ( ScFormulaCell * ) pCell, *pPatAttr );
+ }
+ break;
+ case CELLTYPE_NOTE:
+ case CELLTYPE_NONE:
+ break;
+ default:
+ DBG_ASSERT( FALSE, "ExportWK1::Write(): unbekannter Celltype!" );
+ }
+ }
+ while( aIter.GetNext() );
+
+ Eof();
+
+ return eERR_OK;
+}
+#endif
+
+
diff --git a/sc/source/filter/lotus/export.cxx b/sc/source/filter/lotus/export.cxx
new file mode 100644
index 000000000000..a9be45e24f23
--- /dev/null
+++ b/sc/source/filter/lotus/export.cxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+
+#include "scerrors.hxx"
+#include "exp_op.hxx"
+
+#if ENABLE_LOTUS123_EXPORT
+FltError ScFormatFilterPluginImpl::ScExportLotus123( SvStream& aStream, ScDocument* pDoc, ExportFormatLotus eFormat, CharSet eDest )
+{
+ switch( eFormat )
+ {
+ case ExpWK1:
+ {
+ ExportWK1 aWKFile( aStream, pDoc, eDest );
+ aWKFile.Write();
+ }
+ break;
+ case ExpWK3:
+ return eERR_NI;
+ default:
+ return eERR_NI;
+ }
+
+ return eERR_OK;
+}
+#endif
+
+
diff --git a/sc/source/filter/lotus/filter.cxx b/sc/source/filter/lotus/filter.cxx
new file mode 100644
index 000000000000..3a6e39b7d818
--- /dev/null
+++ b/sc/source/filter/lotus/filter.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+// Das geht: Versionserkennung WKS, WK1 und WK3
+// ...Rest steht in op.cpp
+
+//------------------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <string.h>
+#include <map>
+
+#include "filter.hxx"
+#include "document.hxx"
+#include "compiler.hxx"
+#include "scerrors.hxx"
+
+#include "root.hxx"
+#include "lotrange.hxx"
+#include "optab.h"
+#include "scmem.h"
+#include "decl.h"
+#include "tool.h"
+
+#include "fprogressbar.hxx"
+
+#include "op.h"
+
+// Konstanten ------------------------------------------------------------
+const UINT16 nBOF = 0x0000;
+
+
+
+// externe Variablen -----------------------------------------------------
+extern WKTYP eTyp; // Typ der gerade in bearbeitung befindlichen Datei
+WKTYP eTyp;
+
+extern BOOL bEOF; // zeigt Ende der Datei
+BOOL bEOF;
+
+extern CharSet eCharNach; // Zeichenkonvertierung von->nach
+CharSet eCharNach;
+
+extern CharSet eCharVon;
+CharSet eCharVon;
+
+extern ScDocument* pDoc; // Aufhaenger zum Dokumentzugriff
+ScDocument* pDoc;
+
+
+extern sal_Char* pPuffer; // -> memory.cxx
+extern sal_Char* pDummy1; // -> memory.cxx
+
+extern OPCODE_FKT pOpFkt[ FKT_LIMIT ];
+ // -> optab.cxx, Tabelle moeglicher Opcodes
+extern OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ];
+ // -> optab.cxx, Table of possible Opcodes
+
+extern long nDateiLaenge; // -> datei.cpp, ...der gerade offenen Datei
+
+LOTUS_ROOT* pLotusRoot = NULL;
+
+
+std::map<UINT16, ScPatternAttr> aLotusPatternPool;
+
+static FltError
+generate_Opcodes( SvStream& aStream, ScDocument& rDoc,
+ ScfStreamProgressBar& aPrgrsBar, WKTYP eType )
+{
+ OPCODE_FKT *pOps;
+ int nOps;
+
+ switch(eType)
+ {
+ case eWK_1:
+ case eWK_2:
+ pOps = pOpFkt;
+ nOps = FKT_LIMIT;
+ break;
+ case eWK123:
+ pOps = pOpFkt123;
+ nOps = FKT_LIMIT123;
+ break;
+ case eWK3: return eERR_NI;
+ case eWK_Error: return eERR_FORMAT;
+ default: return eERR_UNKN_WK;
+ }
+
+ // #i76299# seems that SvStream::IsEof() does not work correctly
+ aStream.Seek( STREAM_SEEK_TO_END );
+ sal_Size nStrmSize = aStream.Tell();
+ aStream.Seek( STREAM_SEEK_TO_BEGIN );
+ while( !bEOF && !aStream.IsEof() && (aStream.Tell() < nStrmSize) )
+ {
+ UINT16 nOpcode, nLength;
+
+ aStream >> nOpcode >> nLength;
+ aPrgrsBar.Progress();
+ if( nOpcode == LOTUS_EOF )
+ bEOF = TRUE;
+
+ else if( nOpcode == LOTUS_FILEPASSWD )
+ return eERR_FILEPASSWD;
+
+ else if( nOpcode < nOps )
+ pOps[ nOpcode ] ( aStream, nLength );
+
+ else if( eType == eWK123 &&
+ nOpcode == LOTUS_PATTERN )
+ {
+ // This is really ugly - needs re-factoring ...
+ aStream.SeekRel(nLength);
+ aStream >> nOpcode >> nLength;
+ if ( nOpcode == 0x29a)
+ {
+ aStream.SeekRel(nLength);
+ aStream >> nOpcode >> nLength;
+ if ( nOpcode == 0x804 )
+ {
+ aStream.SeekRel(nLength);
+ OP_ApplyPatternArea123(aStream);
+ }
+ else
+ aStream.SeekRel(nLength);
+ }
+ else
+ aStream.SeekRel(nLength);
+ }
+ else
+ aStream.SeekRel( nLength );
+ }
+
+ MemDelete();
+
+ rDoc.CalcAfterLoad();
+
+ return eERR_OK;
+}
+
+WKTYP ScanVersion( SvStream& aStream )
+{
+ // PREC: pWKDatei: Zeiger auf offene Datei
+ // POST: return: Typ der Datei
+ UINT16 nOpcode, nVersNr, nRecLen;
+
+ // erstes Byte muss wegen BOF zwingend 0 sein!
+ aStream >> nOpcode;
+ if( nOpcode != nBOF )
+ return eWK_UNKNOWN;
+
+ aStream >> nRecLen >> nVersNr;
+
+ if( aStream.IsEof() )
+ return eWK_Error;
+
+ switch( nVersNr )
+ {
+ case 0x0404:
+ if( nRecLen == 2 )
+ return eWK_1;
+ else
+ return eWK_UNKNOWN;
+
+ case 0x0406:
+ if( nRecLen == 2 )
+ return eWK_2;
+ else
+ return eWK_UNKNOWN;
+
+ case 0x1000:
+ aStream >> nVersNr;
+ if( aStream.IsEof() ) return eWK_Error;
+ if( nVersNr == 0x0004 && nRecLen == 26 )
+ { // 4 Bytes von 26 gelesen->22 ueberlesen
+ aStream.Read( pDummy1, 22 );
+ return eWK3;
+ }
+ break;
+ case 0x1003:
+ if( nRecLen == 0x1a )
+ return eWK123;
+ else
+ return eWK_UNKNOWN;
+ case 0x1005:
+ if( nRecLen == 0x1a )
+ return eWK123;
+ else
+ return eWK_UNKNOWN;
+ }
+
+ return eWK_UNKNOWN;
+}
+
+FltError ScImportLotus123old( SvStream& aStream, ScDocument* pDocument, CharSet eSrc )
+{
+ aStream.Seek( 0UL );
+
+ // Zeiger auf Dokument global machen
+ pDoc = pDocument;
+
+ bEOF = FALSE;
+
+ eCharVon = eSrc;
+
+ // Speicher besorgen
+ if( !MemNew() )
+ return eERR_NOMEM;
+
+ InitPage(); // Seitenformat initialisieren (nur Tab 0!)
+
+ // Progressbar starten
+ ScfStreamProgressBar aPrgrsBar( aStream, pDocument->GetDocumentShell() );
+
+ // Datei-Typ ermitteln
+ eTyp = ScanVersion( aStream );
+
+ aLotusPatternPool.clear();
+
+ return generate_Opcodes( aStream, *pDoc, aPrgrsBar, eTyp );
+}
+
+
diff --git a/sc/source/filter/lotus/lotattr.cxx b/sc/source/filter/lotus/lotattr.cxx
new file mode 100644
index 000000000000..6a05585cf326
--- /dev/null
+++ b/sc/source/filter/lotus/lotattr.cxx
@@ -0,0 +1,299 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+//------------------------------------------------------------------------
+
+#include "scitems.hxx"
+#include <svx/algitem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/brshitem.hxx>
+
+#include "document.hxx"
+#include "patattr.hxx"
+#include "docpool.hxx"
+#include "attrib.hxx"
+
+#include "lotattr.hxx"
+#include "lotfntbf.hxx"
+#include "root.hxx"
+
+
+
+void LotAttrCache::LotusToScBorderLine( UINT8 nLine, SvxBorderLine& aBL )
+{
+ static const UINT16 pPara[ 4 ][ 3 ] =
+ {
+ { 0,0,0 },
+ { DEF_LINE_WIDTH_1, 0, 0 },
+ { DEF_LINE_WIDTH_2, 0, 0 },
+ { DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1, DEF_LINE_WIDTH_1 }
+ };
+
+ nLine &= 0x03;
+
+ if( nLine )
+ {
+ aBL.SetOutWidth( pPara[ nLine ][ 0 ] );
+ aBL.SetInWidth( pPara[ nLine ][ 1 ] );
+ aBL.SetDistance( pPara[ nLine ][ 2 ] );
+ }
+}
+
+
+const SvxColorItem& LotAttrCache::GetColorItem( const UINT8 nLotIndex ) const
+{
+ DBG_ASSERT( nLotIndex > 0 && nLotIndex < 7,
+ "-LotAttrCache::GetColorItem(): so nicht!" );
+
+ return *ppColorItems[ nLotIndex - 1 ];
+}
+
+
+const Color& LotAttrCache::GetColor( const UINT8 nLotIndex ) const
+{
+ // Farbe <-> Index passt fuer Background, nicht aber fuer Fonts (0 <-> 7)!
+ DBG_ASSERT( nLotIndex < 8, "*LotAttrCache::GetColor(): Index > 7!" );
+ return pColTab[ nLotIndex ];
+}
+
+
+LotAttrCache::LotAttrCache( void )
+{
+ pDocPool = pLotusRoot->pDoc->GetPool();
+
+ pColTab = new Color [ 8 ];
+ pColTab[ 0 ] = Color( COL_WHITE );
+ pColTab[ 1 ] = Color( COL_LIGHTBLUE );
+ pColTab[ 2 ] = Color( COL_LIGHTGREEN );
+ pColTab[ 3 ] = Color( COL_LIGHTCYAN );
+ pColTab[ 4 ] = Color( COL_LIGHTRED );
+ pColTab[ 5 ] = Color( COL_LIGHTMAGENTA );
+ pColTab[ 6 ] = Color( COL_YELLOW );
+ pColTab[ 7 ] = Color( COL_BLACK );
+
+ ppColorItems[ 0 ] = new SvxColorItem( GetColor( 1 ), ATTR_FONT_COLOR ); // 1
+ ppColorItems[ 1 ] = new SvxColorItem( GetColor( 2 ), ATTR_FONT_COLOR );
+ ppColorItems[ 2 ] = new SvxColorItem( GetColor( 3 ), ATTR_FONT_COLOR );
+ ppColorItems[ 3 ] = new SvxColorItem( GetColor( 4 ), ATTR_FONT_COLOR );
+ ppColorItems[ 4 ] = new SvxColorItem( GetColor( 5 ), ATTR_FONT_COLOR );
+ ppColorItems[ 5 ] = new SvxColorItem( GetColor( 6 ), ATTR_FONT_COLOR ); // 6
+
+ pBlack = new SvxColorItem( Color( COL_BLACK ), ATTR_FONT_COLOR );
+ pWhite = new SvxColorItem( Color( COL_WHITE ), ATTR_FONT_COLOR );
+}
+
+
+LotAttrCache::~LotAttrCache()
+{
+ ENTRY* pAkt = ( ENTRY* ) List::First();
+
+ while( pAkt )
+ {
+ delete pAkt;
+ pAkt = ( ENTRY* ) List::Next();
+ }
+
+ for( UINT16 nCnt = 0 ; nCnt < 6 ; nCnt++ )
+ delete ppColorItems[ nCnt ];
+
+ delete pBlack;
+ delete pWhite;
+
+ delete[] pColTab;
+}
+
+
+const ScPatternAttr& LotAttrCache::GetPattAttr( const LotAttrWK3& rAttr )
+{
+ UINT32 nRefHash;
+ ENTRY* pAkt = ( ENTRY* ) List::First();
+
+ MakeHash( rAttr, nRefHash );
+
+ while( pAkt )
+ {
+ if( *pAkt == nRefHash )
+ return *pAkt->pPattAttr;
+
+ pAkt = ( ENTRY* ) List::Next();
+ }
+
+ // neues PatternAttribute erzeugen
+ ScPatternAttr* pNewPatt = new ScPatternAttr( pDocPool );
+ SfxItemSet& rItemSet = pNewPatt->GetItemSet();
+ pAkt = new ENTRY( pNewPatt );
+
+ pAkt->nHash0 = nRefHash;
+
+ pLotusRoot->pFontBuff->Fill( rAttr.nFont, rItemSet );
+
+ UINT8 nLine = rAttr.nLineStyle;
+ if( nLine )
+ {
+ SvxBoxItem aBox( ATTR_BORDER );
+ SvxBorderLine aTop, aLeft, aBottom, aRight;
+
+ LotusToScBorderLine( nLine, aLeft );
+ nLine >>= 2;
+ LotusToScBorderLine( nLine, aRight );
+ nLine >>= 2;
+ LotusToScBorderLine( nLine, aTop );
+ nLine >>= 2;
+ LotusToScBorderLine( nLine, aBottom );
+
+ aBox.SetLine( &aTop, BOX_LINE_TOP );
+ aBox.SetLine( &aLeft, BOX_LINE_LEFT );
+ aBox.SetLine( &aBottom, BOX_LINE_BOTTOM );
+ aBox.SetLine( &aRight, BOX_LINE_RIGHT );
+
+ rItemSet.Put( aBox );
+ }
+
+ UINT8 nFontCol = rAttr.nFontCol & 0x07;
+ if( nFontCol )
+ {
+ // nFontCol > 0
+ if( nFontCol < 7 )
+ rItemSet.Put( GetColorItem( nFontCol ) );
+ else
+ rItemSet.Put( *pWhite );
+ }
+
+ UINT8 nBack = rAttr.nBack & 0x1F;
+ if( nBack )
+ rItemSet.Put( SvxBrushItem( GetColor( nBack & 0x07 ), ATTR_BACKGROUND ) );
+
+ if( rAttr.nBack & 0x80 )
+ {
+ SvxHorJustifyItem aHorJustify(SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY );
+ rItemSet.Put( aHorJustify );
+ }
+
+ List::Insert( pAkt, LIST_APPEND );
+
+ return *pNewPatt;
+ }
+
+
+LotAttrCol::~LotAttrCol()
+{
+ Clear();
+}
+
+
+void LotAttrCol::SetAttr( const SCROW nRow, const ScPatternAttr& rAttr )
+{
+ DBG_ASSERT( ValidRow(nRow), "*LotAttrCol::SetAttr(): ... und rums?!" );
+
+ ENTRY* pAkt = ( ENTRY* ) List::Last();
+
+ if( pAkt )
+ {
+ if( ( pAkt->nLastRow == nRow - 1 ) && ( &rAttr == pAkt->pPattAttr ) )
+ pAkt->nLastRow = nRow;
+ else
+ {
+ pAkt = new ENTRY;
+
+ pAkt->pPattAttr = &rAttr;
+ pAkt->nFirstRow = pAkt->nLastRow = nRow;
+ List::Insert( pAkt, LIST_APPEND );
+ }
+ }
+ else
+ { // erster Eintrag
+ pAkt = new ENTRY;
+ pAkt->pPattAttr = &rAttr;
+ pAkt->nFirstRow = pAkt->nLastRow = nRow;
+ List::Insert( pAkt, LIST_APPEND );
+ }
+}
+
+
+void LotAttrCol::Apply( const SCCOL nColNum, const SCTAB nTabNum, const BOOL /*bClear*/ )
+{
+ ScDocument* pDoc = pLotusRoot->pDoc;
+ ENTRY* pAkt = ( ENTRY* ) List::First();
+
+ while( pAkt )
+ {
+ pDoc->ApplyPatternAreaTab( nColNum, pAkt->nFirstRow, nColNum, pAkt->nLastRow,
+ nTabNum, *pAkt->pPattAttr );
+
+ pAkt = ( ENTRY* ) List::Next();
+ }
+}
+
+
+void LotAttrCol::Clear( void )
+{
+ ENTRY* pAkt = ( ENTRY* ) List::First();
+
+ while( pAkt )
+ {
+ delete pAkt;
+ pAkt = ( ENTRY* ) List::Next();
+ }
+}
+
+
+LotAttrTable::LotAttrTable( void )
+{
+}
+
+
+LotAttrTable::~LotAttrTable()
+{
+}
+
+
+void LotAttrTable::SetAttr( const SCCOL nColFirst, const SCCOL nColLast, const SCROW nRow,
+ const LotAttrWK3& rAttr )
+{
+ const ScPatternAttr& rPattAttr = aAttrCache.GetPattAttr( rAttr );
+ SCCOL nColCnt;
+
+ for( nColCnt = nColFirst ; nColCnt <= nColLast ; nColCnt++ )
+ pCols[ nColCnt ].SetAttr( nRow, rPattAttr );
+}
+
+
+void LotAttrTable::Apply( const SCTAB nTabNum )
+{
+ SCCOL nColCnt;
+ for( nColCnt = 0 ; nColCnt <= MAXCOL ; nColCnt++ )
+ pCols[ nColCnt ].Apply( nColCnt, nTabNum ); // macht auch gleich ein Clear() am Ende
+}
+
+
+
+
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
new file mode 100644
index 000000000000..e39891568e33
--- /dev/null
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -0,0 +1,2074 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+//------------------------------------------------------------------------
+
+#include "decl.h"
+#include "lotform.hxx"
+#include "compiler.hxx"
+#include "lotrange.hxx"
+#include "namebuff.hxx"
+#include "root.hxx"
+#include "ftools.hxx"
+#include "tool.h"
+
+#include <math.h>
+
+extern WKTYP eTyp;
+
+static const sal_Char* GetAddInName( const UINT8 nIndex );
+
+static DefTokenId lcl_KnownAddIn( const ByteString& sTest );
+
+//extern double decipher_Number123( UINT32 nValue );
+
+
+void LotusToSc::DoFunc( DefTokenId eOc, BYTE nAnz, const sal_Char* pExtString )
+{
+ TokenId eParam[ 256 ];
+ INT32 nLauf;
+ TokenId nMerk0, nMerk1;
+
+ BOOL bAddIn = FALSE;
+ BOOL bNeg = FALSE;
+
+ DBG_ASSERT( nAnz < 128, "-LotusToSc::DoFunc(): Neee! -so viel kann ich nicht!" );
+
+ if( eOc == ocNoName )
+ {
+ ByteString t;
+ if( pExtString )
+ {
+ const ByteString s( "@<<@123>>" );
+
+ t = pExtString;
+
+ xub_StrLen n = t.Search( s );
+ if( n != STRING_NOTFOUND )
+ t.Erase( 0, n + s.Len() );
+
+ t.EraseTrailingChars( '(' );
+
+ eOc = lcl_KnownAddIn( t );
+
+ if( eOc == ocNoName )
+ t.Insert( "L123_", 0 );
+ }
+ else
+ t = "#UNKNOWN FUNC NAME#";
+
+ if( eOc == ocNoName )
+ {
+ bAddIn = TRUE;
+ nMerk0 = aPool.Store( eOc, String( t, eSrcChar ) );
+
+ aPool << nMerk0;
+ }
+ }
+
+ for( nLauf = 0 ; nLauf < nAnz ; nLauf++ )
+ aStack >> eParam[ nLauf ];
+
+ // Spezialfaelle...
+ switch( eOc )
+ {
+ case ocIndex:
+ DBG_ASSERT( nAnz > 2, "+LotusToSc::DoFunc(): ocIndex braucht mind. 2 Parameter!" );
+ nMerk0 = eParam[ 0 ];
+ eParam[ 0 ] = eParam[ 1 ];
+ eParam[ 1 ] = nMerk0;
+ IncToken( eParam[ 0 ] );
+ IncToken( eParam[ 1 ] );
+ break;
+ case ocIRR:
+ {
+ DBG_ASSERT( nAnz == 2, "+LotusToSc::DoFunc(): ocIRR hat nur 2 Parameter!" );
+ nMerk0 = eParam[ 0 ];
+ eParam[ 0 ] = eParam[ 1 ];
+ eParam[ 1 ] = nMerk0;
+ }
+ break;
+ case ocGetYear:
+ {
+ nMerk0 = aPool.Store( 1900.0 );
+ aPool << ocOpen;
+ }
+ break;
+ case ocChose:
+ {// 1. Parameter ++
+ IncToken( eParam[ nAnz - 1 ] );
+ }
+ break;
+ case ocFind:
+ case ocHLookup:
+ case ocVLookup:
+ {// letzten Parameter ++
+ IncToken( eParam[ 0 ] );
+ }
+ break;
+ case ocMid:
+ case ocReplace:
+ {// 2. Parameter ++
+ IncToken( eParam[ nAnz - 2 ] );
+ }
+ break;
+ case ocZins:
+ {
+ // neue Anzahl = 4!
+ DBG_ASSERT( nAnz == 3,
+ "*LotusToSc::DoFunc(): ZINS() hat 3 Parameter!" );
+ nAnz = 4;
+ eParam[ 3 ] = eParam[ 0 ]; // 3. -> 1.
+ eParam[ 0 ] = eParam[ 2 ]; // 1. -> 4.
+ NegToken( eParam[ 1 ] ); // 2. -> -2. (+ 2. -> 3.)
+ eParam[ 2 ] = n0Token; // -> 2. als Default
+ }
+ break;
+ default:;
+ }
+ // ................
+
+
+ if( !bAddIn )
+ aPool << eOc;
+
+ aPool << ocOpen;
+
+ if( nAnz > 0 )
+ {
+ INT16 nNull = -1; // gibt einen auszulassenden Parameter an
+ // ACHTUNG: 0 ist der letzte Parameter, nAnz-1 der erste
+
+ INT16 nLast = nAnz - 1;
+
+ if( eOc == ocRMZ )
+ { // Extrawurst ocRMZ letzter Parameter negiert!
+ // zusaetzlich: 1. -> 3., 3. -> 2., 2. -> 1.
+ DBG_ASSERT( nAnz == 3,
+ "+LotusToSc::DoFunc(): ocRMZ hat genau 3 Parameter!" );
+ aPool << eParam[ 1 ] << ocSep << eParam[ 0 ] << ocSep
+ << ocNegSub << eParam[ 2 ];
+ }
+ else
+ { // Normalfall
+ // [Parameter{;Parameter}]
+ aPool << eParam[ nLast ];
+
+ for( nLauf = nLast - 1 ; nLauf >= 0 ; nLauf-- )
+ {
+ if( nLauf != nNull )
+ aPool << ocSep << eParam[ nLauf ];
+ }
+ }
+ }
+
+
+ // Spezialfaelle...
+ if( eOc == ocGetYear )
+ {
+ aPool << ocClose << ocSub << nMerk0;
+ }
+ else if( eOc == ocFixed )
+ {
+ aPool << ocSep << ocTrue << ocOpen << ocClose;
+ }
+ else if( eOc == ocFind )
+ {
+ nMerk1 = aPool.Store();
+ DecToken( nMerk1 );
+ aPool << nMerk1;
+ }
+
+ aPool << ocClose;
+
+ // ................
+
+ aPool >> aStack;
+
+ if( bNeg )
+ {
+ aPool << ocOpen << ocSub << aStack << ocClose;
+ aPool >> aStack;
+ }
+}
+
+
+void LotusToSc::LotusRelToScRel( UINT16 nCol, UINT16 nRow, ScSingleRefData& rSRD )
+{
+ // Col-Bemachung
+ if( nCol & 0x8000 )
+ {
+ rSRD.SetColRel( TRUE );
+ if( nCol & 0x0080 )
+ nCol |= 0xFF00;
+ else
+ nCol &= 0x00FF;
+ // #i36252# first cast unsigned 16-bit to signed 16-bit, and then to SCsCOL
+ rSRD.nRelCol = static_cast< SCsCOL >( static_cast< sal_Int16 >( nCol ) );
+ }
+ else
+ {
+ rSRD.SetColRel( FALSE );
+ rSRD.nCol = static_cast< SCsCOL >( nCol & 0x00FF );
+ }
+
+ // Row-Bemachung
+ if( nRow & 0x8000 )
+ {
+ rSRD.SetRowRel( TRUE );
+ // vorzeichenrichtige Erweiterung
+ switch( eTyp )
+ {
+ // 5432 1098 7654 3210
+ // 8421 8421 8421 8421
+ // xxx xxxx xxxx
+ case eWK_1:
+ if( nRow & 0x0400 )
+ nRow |= 0xF800;
+ else
+ nRow &= 0x07FF;
+ break;
+ // 8421 8421 8421 8421
+ // x xxxx xxxx xxxx
+ case eWK_2:
+ if( nRow & 0x1000 )
+ nRow |= 0xE000;
+ else
+ nRow &= 0x1FFF;
+ break;
+ default:
+ DBG_ERROR( "*LotusToSc::LotusRelToScRel(): etwas vergessen...?" );
+ }
+ }
+ else
+ {
+ rSRD.SetRowRel( FALSE );
+ switch( eTyp )
+ {
+ // 5432 1098 7654 3210
+ // 8421 8421 8421 8421
+ // xxx xxxx xxxx
+ case eWK_1:
+ nRow &= 0x07FF;
+ break;
+ // 8421 8421 8421 8421
+ // xx xxxx xxxx xxxx
+ case eWK_2:
+ nRow &= 0x3FFF;
+ break;
+ default:
+ DBG_ERROR( "*LotusToSc::LotusRelToScRel(): etwas vergessen...?" );
+ }
+ }
+
+ if( rSRD.IsRowRel() )
+ // #i36252# first cast unsigned 16-bit to signed 16-bit, and then to SCsROW
+ rSRD.nRelRow = static_cast< SCsROW >( static_cast< sal_Int16 >( nRow ) );
+ else
+ rSRD.nRow = static_cast< SCsROW >( nRow );
+
+ if( rSRD.IsRowRel() || rSRD.IsColRel() )
+ rSRD.CalcAbsIfRel( aEingPos );
+}
+
+
+void LotusToSc::ReadSRD( ScSingleRefData& rSRD, BYTE nRelBit )
+{
+ BYTE nTab, nCol;
+ UINT16 nRow;
+
+ Read( nRow );
+ Read( nTab );
+ Read( nCol );
+
+ BOOL b3D = ( static_cast< SCTAB >( nTab ) != aEingPos.Tab() );
+
+ rSRD.SetColRel( ( nRelBit & 0x01 ) != 0 );
+ rSRD.nCol = static_cast< SCsCOL >( nCol );
+
+ rSRD.SetRowRel( ( nRelBit & 0x02 ) != 0 );
+ rSRD.nRow = static_cast< SCsROW >( nRow );
+
+ rSRD.SetTabRel( ( ( nRelBit & 0x04) != 0 ) || !b3D );
+ rSRD.nTab = static_cast< SCsTAB >( nTab );
+
+ rSRD.SetFlag3D( b3D );
+
+ rSRD.CalcRelFromAbs( aEingPos );
+}
+
+
+void LotusToSc::IncToken( TokenId &rParam )
+{
+ aPool << ocOpen << rParam << nAddToken;
+ rParam = aPool.Store();
+}
+
+
+void LotusToSc::DecToken( TokenId &rParam )
+{
+ aPool << ocOpen << rParam << nSubToken;
+ rParam = aPool.Store();
+}
+
+
+void LotusToSc::NegToken( TokenId &rParam )
+{
+ aPool << ocNegSub << ocOpen << rParam << ocClose;
+ rParam = aPool.Store();
+}
+
+
+void LotusToSc::Reset( const ScAddress& rEingPos )
+{
+ LotusConverterBase::Reset( rEingPos );
+
+ TokenId nEins = aPool.Store( 1.0 );
+
+ aPool << ocClose << ocAdd << nEins;
+ nAddToken = aPool.Store();
+
+ aPool << ocClose << ocSub << nEins;
+ nSubToken = aPool.Store();
+
+ n0Token = aPool.Store( 0.0 );
+}
+
+
+LotusToSc::LotusToSc( SvStream &rStream, CharSet e, BOOL b ) :
+ LotusConverterBase( rStream, 128 )
+{
+ eSrcChar = e;
+ bWK3 = FALSE;
+ bWK123 = b;
+}
+
+
+typedef FUNC_TYPE ( FuncType1 ) ( BYTE );
+typedef DefTokenId ( FuncType2 ) ( BYTE );
+
+
+ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, INT32& rRest,
+ const FORMULA_TYPE /*eFT*/ )
+{
+ BYTE nOc;
+ BYTE nAnz;
+ BYTE nRelBits;
+ UINT16 nStrLen;
+ UINT16 nRngIndex;
+ FUNC_TYPE eType = FT_NOP;
+ TokenId nMerk0;
+ DefTokenId eOc;
+ const sal_Char* pExtName = 0;
+ RangeNameBufferWK3& rRangeNameBufferWK3 = *pLotusRoot->pRngNmBffWK3;
+
+ ScComplexRefData aCRD;
+ aCRD.InitFlags();
+ ScSingleRefData& rR = aCRD.Ref1;
+
+ LR_ID nId;
+ TokenId nNewId;
+
+ LotusRangeList& rRangeList = *pLotusRoot->pRangeNames;
+
+ FuncType1* pIndexToType;
+ FuncType2* pIndexToToken;
+
+ if( bWK3 )
+ { // for > WK3
+ pIndexToType = IndexToTypeWK123;
+ pIndexToToken = IndexToTokenWK123;
+ }
+ else if( bWK123 )
+ {
+ pIndexToType = IndexToTypeWK123;
+ pIndexToToken = IndexToTokenWK123;
+ }
+ else
+ {
+ pIndexToType = IndexToType;
+ pIndexToToken = IndexToToken;
+
+ rR.SetTabRel( TRUE );
+ rR.nTab = aEingPos.Tab();
+ rR.nRelTab = 0;
+ rR.SetFlag3D( FALSE );
+ }
+
+ aCRD.Ref2 = rR;
+
+ nBytesLeft = rRest;
+
+ while( eType ) // != FT_Return (==0)
+ {
+ Read( nOc );
+
+ if( nBytesLeft < 0 )
+ {
+ rpErg = aPool[ aStack.Get() ];
+ return ConvErrCount;
+ }
+
+ eType = ( pIndexToType )( nOc );
+ eOc = ( pIndexToToken)( nOc );
+ if( eOc == ocNoName )
+ pExtName = GetAddInName( nOc );
+
+ switch( eType )
+ {
+ case FT_Return:
+ if( bWK3 || bWK123 )
+ nBytesLeft = 0; // wird ab WK3 nicht benutzt
+
+ rRest = nBytesLeft;
+ break;
+ case FT_NotImpl:
+ case FT_FuncFix0: DoFunc( eOc, 0, pExtName ); break;
+ case FT_FuncFix1: DoFunc( eOc, 1, pExtName ); break;
+ case FT_FuncFix2: DoFunc( eOc, 2, pExtName ); break;
+ case FT_FuncFix3: DoFunc( eOc, 3, pExtName ); break;
+ case FT_FuncFix4: DoFunc( eOc, 4, pExtName ); break;
+ case FT_FuncVar:
+ Read( nAnz );
+ DoFunc( eOc, nAnz, pExtName );
+ break;
+ case FT_Neg:
+ aPool << ocOpen << ocNegSub << aStack << ocClose;
+ aPool >> aStack;
+ break;
+ case FT_Op:
+ aStack >> nMerk0;
+ aPool << aStack << eOc << nMerk0;
+ aPool >> aStack;
+ break;
+ case FT_ConstFloat:
+ {
+ double fDouble;
+ Read( fDouble );
+ aStack << aPool.Store( fDouble );
+ }
+ break;
+ case FT_Variable:
+ {
+ UINT16 nCol, nRow;
+ Read( nCol );
+ Read( nRow );
+
+ LotusRelToScRel( nCol, nRow, rR );
+
+ if( bWK3 )
+ nNewId = aPool.Store( rR );
+ else
+ {
+ nId = rRangeList.GetIndex( rR.nCol, rR.nRow );
+
+ if( nId == ID_FAIL )
+ // kein Range dazu
+ nNewId = aPool.Store( rR );
+ else
+ nNewId = aPool.Store( ( UINT16 ) nId );
+ }
+
+ aStack << nNewId;
+ }
+ break;
+ case FT_Range:
+ {
+ UINT16 nColS, nRowS, nColE, nRowE;
+ Read( nColS );
+ Read( nRowS );
+ Read( nColE );
+ Read( nRowE );
+
+ LotusRelToScRel( nColS, nRowS, rR );
+ LotusRelToScRel( nColE, nRowE, aCRD.Ref2 );
+
+ if( bWK3 )
+ nNewId = aPool.Store( aCRD );
+ else
+ {
+ nId = rRangeList.GetIndex(
+ rR.nCol, rR.nRow, aCRD.Ref2.nCol, aCRD.Ref2.nRow );
+
+ if( nId == ID_FAIL )
+ // kein Range dazu
+ nNewId = aPool.Store( aCRD );
+ else
+ nNewId = aPool.Store( ( UINT16 ) nId );
+ }
+
+ aStack << nNewId;
+ }
+ break;
+ case FT_Braces:
+ aPool << ocOpen << aStack << ocClose;
+ aPool >> aStack;
+ break;
+ case FT_ConstInt:
+ {
+ INT16 nVal;
+ Read( nVal );
+ aStack << aPool.Store( ( double ) nVal );
+ }
+ break;
+ case FT_ConstString:
+ {
+ String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
+
+ aStack << aPool.Store( aTmp );
+ }
+ break;
+ case FT_NOP:
+ break;
+ // ------------------------------------------ fuer > WK3 -
+ case FT_Cref:
+ Read( nRelBits );
+ ReadSRD( rR, nRelBits );
+ aStack << aPool.Store( rR );
+ break;
+ case FT_Rref:
+ Read( nRelBits );
+ ReadCRD( aCRD, nRelBits );
+ aStack << aPool.Store( aCRD );
+ break;
+ case FT_Nrref:
+ {
+ String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
+ if( rRangeNameBufferWK3.FindRel( aTmp, nRngIndex ) )
+ aStack << aPool.Store( nRngIndex );
+ else
+ {
+ String aText( RTL_CONSTASCII_USTRINGPARAM( "NRREF " ) );
+ aText += aTmp;
+ aStack << aPool.Store( aText );
+ }
+ }
+ break;
+ case FT_Absnref:
+ {
+ String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) );
+ if( rRangeNameBufferWK3.FindAbs( aTmp, nRngIndex ) )
+ aStack << aPool.Store( nRngIndex );
+ else
+ {
+ String aText( RTL_CONSTASCII_USTRINGPARAM( "ABSNREF " ) );
+ aText += aTmp;
+ aStack << aPool.Store( aText );
+ }
+ }
+ break;
+ case FT_Erref:
+ Ignore( 4 );
+ aPool << ocBad;
+ aPool >> aStack;
+ break;
+ case FT_Ecref:
+ Ignore( 5 );
+ aPool << ocBad;
+ aPool >> aStack;
+ break;
+ case FT_Econstant:
+ Ignore( 10 );
+ aPool << ocBad;
+ aPool >> aStack;
+ break;
+ case FT_Splfunc:
+ {
+ Read( nAnz );
+ Read( nStrLen );
+
+ if( nStrLen )
+ {
+// String t( ReadString( aIn, nStrLen, eSrcChar ) );
+ sal_Char* p = new sal_Char[ nStrLen + 1 ];
+ aIn.Read( p, nStrLen );
+ p[ nStrLen ] = 0x00;
+
+ DoFunc( ocNoName, nAnz, p );
+
+ delete[] p;
+ }
+ else
+ DoFunc( ocNoName, nAnz, NULL );
+ }
+ break;
+ case FT_Const10Float:
+ if ( bWK123 )
+ {
+ double fValue;
+ Read( fValue );
+ aStack << aPool.Store( fValue );
+ }
+ else aStack << aPool.Store( ScfTools::ReadLongDouble( aIn ) );
+ break;
+ case FT_Snum:
+ if ( bWK123 )
+ {
+ UINT32 nValue;
+
+ Read( nValue );
+ double fValue = Snum32ToDouble( nValue );
+ aStack << aPool.Store( fValue );
+ }
+ else
+ {
+ INT16 nVal;
+ Read( nVal );
+ aStack << aPool.Store( SnumToDouble( nVal ) );
+ }
+ break;
+ default:
+ DBG_ERROR( "*LotusToSc::Convert(): unbekannter enum!" );
+ }
+ }
+
+ rpErg = aPool[ aStack.Get() ];
+
+ DBG_ASSERT( nBytesLeft >= 0, "*LotusToSc::Convert(): zuviel verarbeitet!");
+ DBG_ASSERT( nBytesLeft <= 0, "*LotusToSc::Convert(): wat is mit'm Rest?" );
+
+ if( rRest )
+ aIn.SeekRel( nBytesLeft ); // eventuellen Rest/Ueberlauf korrigieren
+
+ rRest = 0;
+
+ return ConvOK;
+}
+
+
+FUNC_TYPE LotusToSc::IndexToType( BYTE nIndex )
+{
+ static const FUNC_TYPE pType[ 256 ] =
+ { // Code Bezeichnung
+ FT_ConstFloat, // 0 8-Byte-IEEE-Float
+ FT_Variable, // 1 Variable
+ FT_Range, // 2 Bereich
+ FT_Return, // 3 return
+ FT_Braces, // 4 Klammer
+ FT_ConstInt, // 5 2-Byte-Integer
+ FT_ConstString, // 6 ASCII-String
+ FT_NOP, // 7 NOP
+ FT_Neg, // 8 Negation
+ FT_Op, // 9 Addition
+ FT_Op, // 10 Subtraktion
+ FT_Op, // 11 Multiplikation
+ FT_Op, // 12 Division
+ FT_Op, // 13 Potenzierung
+ FT_Op, // 14 Gleichheit
+ FT_Op, // 15 Ungleich
+ FT_Op, // 16 Kleiner-gleich
+ FT_Op, // 17 Groesser-gleich
+ FT_Op, // 18 Kleiner
+ FT_Op, // 19 Groesser
+ FT_Op, // 20 And (logisch)
+ FT_Op, // 21 Or (logisch)
+ FT_FuncFix1, // 22 Not (logisch)
+ FT_NOP, // 23 unaeres Plus
+ FT_NotImpl, // 24
+ FT_NotImpl, // 25
+ FT_NotImpl, // 26
+ FT_NotImpl, // 27
+ FT_NotImpl, // 28
+ FT_NotImpl, // 29
+ FT_NotImpl, // 30
+ FT_FuncFix0, // 31 Not applicable
+ FT_FuncFix0, // 32 Error
+ FT_FuncFix1, // 33 Betrag ABS()
+ FT_FuncFix1, // 34 Ganzzahl INT()
+ FT_FuncFix1, // 35 Quadratwurzel
+ FT_FuncFix1, // 36 Zehnerlogarithmus
+ FT_FuncFix1, // 37 Natuerlicher Logarithmus
+ FT_FuncFix0, // 38 PI
+ FT_FuncFix1, // 39 Sinus
+ FT_FuncFix1, // 40 Cosinus
+ FT_FuncFix1, // 41 Tangens
+ FT_FuncFix2, // 42 Arcus-Tangens 2 (4.Quadrant) <----- richtig? -
+ FT_FuncFix1, // 43 Arcus-Tangens (2.Quadrant)
+ FT_FuncFix1, // 44 Arcus-Sinus
+ FT_FuncFix1, // 45 Arcus-Cosinus
+ FT_FuncFix1, // 46 Exponentialfunktion
+ FT_FuncFix2, // 47 Modulo
+ FT_FuncVar, // 48 Auswahl
+ FT_FuncFix1, // 49 Is not applicable?
+ FT_FuncFix1, // 50 Is Error?
+ FT_FuncFix0, // 51 FALSE
+ FT_FuncFix0, // 52 TRUE
+ FT_FuncFix0, // 53 Zufallszahl
+ FT_FuncFix3, // 54 Datum
+ FT_FuncFix0, // 55 Heute
+ FT_FuncFix3, // 56 Payment
+ FT_FuncFix3, // 57 Present Value
+ FT_FuncFix3, // 58 Future Value
+ FT_FuncFix3, // 59 If ... then ... else ...
+ FT_FuncFix1, // 60 Tag des Monats
+ FT_FuncFix1, // 61 Monat
+ FT_FuncFix1, // 62 Jahr
+ FT_FuncFix2, // 63 Runden
+ FT_FuncFix3, // 64 Zeit
+ FT_FuncFix1, // 65 Stunde
+ FT_FuncFix1, // 66 Minute
+ FT_FuncFix1, // 67 Sekunde
+ FT_FuncFix1, // 68 Ist Zahl?
+ FT_FuncFix1, // 69 Ist Text?
+ FT_FuncFix1, // 70 Len()
+ FT_FuncFix1, // 71 Val()
+ FT_FuncFix2, // 72 String()
+ FT_FuncFix3, // 73 Mid()
+ FT_FuncFix1, // 74 Char()
+ FT_FuncFix1, // 75 Ascii()
+ FT_FuncFix3, // 76 Find()
+ FT_FuncFix1, // 77 Datevalue
+ FT_FuncFix1, // 78 Timevalue
+ FT_FuncFix1, // 79 Cellpointer
+ FT_FuncVar, // 80 Sum()
+ FT_FuncVar, // 81 Avg()
+ FT_FuncVar, // 82 Cnt()
+ FT_FuncVar, // 83 Min()
+ FT_FuncVar, // 84 Max()
+ FT_FuncFix3, // 85 Vlookup()
+ FT_FuncFix2, // 86 Npv()
+ FT_FuncVar, // 87 Var()
+ FT_FuncVar, // 88 Std()
+ FT_FuncFix2, // 89 Irr()
+ FT_FuncFix3, // 90 Hlookup()
+ FT_FuncFix3, // 91 ?
+ FT_FuncFix3, // 92 ?
+ FT_FuncFix3, // 93 ?
+ FT_FuncFix3, // 94 ?
+ FT_FuncFix3, // 95 ?
+ FT_FuncFix3, // 96 ?
+ FT_FuncFix3, // 97 ?
+ FT_FuncFix3, // 98 Index() <- richtig? -
+ FT_FuncFix1, // 99 Cols()
+ FT_FuncFix1, // 100 Rows()
+ FT_FuncFix2, // 101 Repeat()
+ FT_FuncFix1, // 102 Upper()
+ FT_FuncFix1, // 103 Lower()
+ FT_FuncFix2, // 104 Left()
+ FT_FuncFix2, // 105 Right()
+ FT_FuncFix4, // 106 Replace()
+ FT_FuncFix1, // 107 Proper()
+ FT_FuncFix2, // 108 Cell()
+ FT_FuncFix1, // 109 Trim()
+ FT_FuncFix1, // 110 Clean()
+ FT_FuncFix1, // 111 F()
+ FT_FuncFix1, // 112 Wert() (oder W()?)
+ FT_FuncFix2, // 113 Exact()
+ FT_NotImpl, // 114 Call()
+ FT_FuncFix1, // 115 @@()
+ FT_FuncFix3, // 116 Rate()
+ FT_FuncFix1, // 117 Term()
+ FT_FuncFix1, // 118 Cterm()
+ FT_FuncFix3, // 119 Sln()
+ FT_FuncFix4, // 120 Syd(), Soy()
+ FT_FuncFix4, // 121 Ddb()
+ FT_NotImpl, // 122
+ FT_NotImpl, // 123
+ FT_NotImpl, // 124
+ FT_NotImpl, // 125
+ FT_NotImpl, // 126
+ FT_NotImpl, // 127
+ FT_NotImpl, // 128
+ FT_NotImpl, // 129
+ FT_NotImpl, // 130
+ FT_NotImpl, // 131
+ FT_NotImpl, // 132
+ FT_NotImpl, // 133
+ FT_NotImpl, // 134
+ FT_NotImpl, // 135
+ FT_NotImpl, // 136
+ FT_NotImpl, // 137
+ FT_NotImpl, // 138
+ FT_NotImpl, // 139
+ FT_NotImpl, // 140
+ FT_NotImpl, // 141
+ FT_NotImpl, // 142
+ FT_NotImpl, // 143
+ FT_NotImpl, // 144
+ FT_NotImpl, // 145
+ FT_NotImpl, // 146
+ FT_NotImpl, // 147
+ FT_NotImpl, // 148
+ FT_NotImpl, // 149
+ FT_NotImpl, // 150
+ FT_NotImpl, // 151
+ FT_NotImpl, // 152
+ FT_NotImpl, // 153
+ FT_NotImpl, // 154
+ FT_NotImpl, // 155
+ FT_FuncVar, // 156 ?
+ FT_NotImpl, // 157
+ FT_NotImpl, // 158
+ FT_NotImpl, // 159
+ FT_NotImpl, // 160
+ FT_NotImpl, // 161
+ FT_NotImpl, // 162
+ FT_NotImpl, // 163
+ FT_NotImpl, // 164
+ FT_NotImpl, // 165
+ FT_NotImpl, // 166
+ FT_NotImpl, // 167
+ FT_NotImpl, // 168
+ FT_NotImpl, // 169
+ FT_NotImpl, // 170
+ FT_NotImpl, // 171
+ FT_NotImpl, // 172
+ FT_NotImpl, // 173
+ FT_NotImpl, // 174
+ FT_NotImpl, // 175
+ FT_NotImpl, // 176
+ FT_NotImpl, // 177
+ FT_NotImpl, // 178
+ FT_NotImpl, // 179
+ FT_NotImpl, // 180
+ FT_NotImpl, // 181
+ FT_NotImpl, // 182
+ FT_NotImpl, // 183
+ FT_NotImpl, // 184
+ FT_NotImpl, // 185
+ FT_NotImpl, // 186
+ FT_NotImpl, // 187
+ FT_NotImpl, // 188
+ FT_NotImpl, // 189
+ FT_NotImpl, // 190
+ FT_NotImpl, // 191
+ FT_NotImpl, // 192
+ FT_NotImpl, // 193
+ FT_NotImpl, // 194
+ FT_NotImpl, // 195
+ FT_NotImpl, // 196
+ FT_NotImpl, // 197
+ FT_NotImpl, // 198
+ FT_NotImpl, // 199
+ FT_NotImpl, // 200
+ FT_NotImpl, // 201
+ FT_NotImpl, // 202
+ FT_NotImpl, // 203
+ FT_NotImpl, // 204
+ FT_NotImpl, // 205
+ FT_FuncVar, // 206 ?
+ FT_NotImpl, // 207
+ FT_NotImpl, // 208
+ FT_NotImpl, // 209
+ FT_NotImpl, // 210
+ FT_NotImpl, // 211
+ FT_NotImpl, // 212
+ FT_NotImpl, // 213
+ FT_NotImpl, // 214
+ FT_NotImpl, // 215
+ FT_NotImpl, // 216
+ FT_NotImpl, // 217
+ FT_NotImpl, // 218
+ FT_NotImpl, // 219
+ FT_NotImpl, // 220
+ FT_NotImpl, // 221
+ FT_NotImpl, // 222
+ FT_NotImpl, // 223
+ FT_NotImpl, // 224
+ FT_NotImpl, // 225
+ FT_NotImpl, // 226
+ FT_NotImpl, // 227
+ FT_NotImpl, // 228
+ FT_NotImpl, // 229
+ FT_NotImpl, // 230
+ FT_NotImpl, // 231
+ FT_NotImpl, // 232
+ FT_NotImpl, // 233
+ FT_NotImpl, // 234
+ FT_NotImpl, // 235
+ FT_NotImpl, // 236
+ FT_NotImpl, // 237
+ FT_NotImpl, // 238
+ FT_NotImpl, // 239
+ FT_NotImpl, // 240
+ FT_NotImpl, // 241
+ FT_NotImpl, // 242
+ FT_NotImpl, // 243
+ FT_NotImpl, // 244
+ FT_NotImpl, // 245
+ FT_NotImpl, // 246
+ FT_NotImpl, // 247
+ FT_NotImpl, // 248
+ FT_NotImpl, // 249
+ FT_NotImpl, // 250
+ FT_NotImpl, // 251
+ FT_NotImpl, // 252
+ FT_NotImpl, // 253
+ FT_NotImpl, // 254
+ FT_FuncVar, // 255 ?
+ };
+ return pType[ nIndex ];
+}
+
+
+DefTokenId LotusToSc::IndexToToken( BYTE nIndex )
+{
+ static const DefTokenId pToken[ 256 ] =
+ { // Code Bezeichnung
+ ocPush, // 0 8-Byte-IEEE-Float
+ ocPush, // 1 Variable
+ ocPush, // 2 Bereich
+ ocPush, // 3 return
+ ocPush, // 4 Klammer
+ ocPush, // 5 2-Byte-Integer
+ ocPush, // 6 ASCII-String
+ ocPush, // 7 NOP
+ ocNegSub, // 8 Negation
+ ocAdd, // 9 Addition
+ ocSub, // 10 Subtraktion
+ ocMul, // 11 Multiplikation
+ ocDiv, // 12 Division
+ ocPow, // 13 Potenzierung
+ ocEqual, // 14 Gleichheit
+ ocNotEqual, // 15 Ungleich
+ ocLessEqual, // 16 Kleiner-gleich
+ ocGreaterEqual, // 17 Groesser-gleich
+ ocLess, // 18 Kleiner
+ ocGreater, // 19 Groesser
+ ocAnd, // 20 And (logisch)
+ ocOr, // 21 Or (logisch)
+ ocNot, // 22 Not (logisch)
+ ocPush, // 23 unaeres Plus
+ ocNoName, // 24
+ ocNoName, // 25
+ ocNoName, // 26
+ ocNoName, // 27
+ ocNoName, // 28
+ ocNoName, // 29
+ ocNoName, // 30
+ ocNotAvail, // 31 Not available
+ ocNoName, // 32 Error
+ ocAbs, // 33 Betrag ABS()
+ ocInt, // 34 Ganzzahl INT()
+ ocSqrt, // 35 Quadratwurzel
+ ocLog10, // 36 Zehnerlogarithmus
+ ocLn, // 37 Natuerlicher Logarithmus
+ ocPi, // 38 PI
+ ocSin, // 39 Sinus
+ ocCos, // 40 Cosinus
+ ocTan, // 41 Tangens
+ ocArcTan2, // 42 Arcus-Tangens 2 (4.Quadrant)
+ ocArcTan, // 43 Arcus-Tangens (2.Quadrant)
+ ocArcSin, // 44 Arcus-Sinus
+ ocArcCos, // 45 Arcus-Cosinus
+ ocExp, // 46 Exponentialfunktion
+ ocMod, // 47 Modulo
+ ocChose, // 48 Auswahl
+ ocIsNA, // 49 Is not available?
+ ocIsError, // 50 Is Error?
+ ocFalse, // 51 FALSE
+ ocTrue, // 52 TRUE
+ ocRandom, // 53 Zufallszahl
+ ocGetDate, // 54 Datum
+ ocGetActDate, // 55 Heute
+ ocRMZ, // 56 Payment
+ ocBW, // 57 Present Value
+ ocZW, // 58 Future Value
+ ocIf, // 59 If ... then ... else ...
+ ocGetDay, // 60 Tag des Monats
+ ocGetMonth, // 61 Monat
+ ocGetYear, // 62 Jahr
+ ocRound, // 63 Runden
+ ocGetTime, // 64 Zeit
+ ocGetHour, // 65 Stunde
+ ocGetMin, // 66 Minute
+ ocGetSec, // 67 Sekunde
+ ocIsValue, // 68 Ist Zahl?
+ ocIsString, // 69 Ist Text?
+ ocLen, // 70 Len()
+ ocValue, // 71 Val()
+ ocFixed, // 72 String() ocFixed ersatzweise + Spezialfall
+ ocMid, // 73 Mid()
+ ocChar, // 74 Char()
+ ocCode, // 75 Ascii()
+ ocFind, // 76 Find()
+ ocGetDateValue, // 77 Datevalue
+ ocGetTimeValue, // 78 Timevalue
+ ocNoName, // 79 Cellpointer
+ ocSum, // 80 Sum()
+ ocAverage, // 81 Avg()
+ ocCount, // 82 Cnt()
+ ocMin, // 83 Min()
+ ocMax, // 84 Max()
+ ocVLookup, // 85 Vlookup()
+ ocNPV, // 86 Npv()
+ ocVar, // 87 Var()
+ ocNormDist, // 88 Std()
+ ocIRR, // 89 Irr()
+ ocHLookup, // 90 Hlookup()
+ ocDBSum, // 91 XlfDsum
+ ocDBAverage, // 92 XlfDaverage
+ ocDBCount, // 93 XlfDcount
+ ocDBMin, // 94 XlfDmin
+ ocDBMax, // 95 XlfDmax
+ ocDBVar, // 96 XlfDvar
+ ocDBStdDev, // 97 XlfDstdev
+ ocIndex, // 98 Index()
+ ocColumns, // 99 Cols()
+ ocRows, // 100 Rows()
+ ocRept, // 101 Repeat()
+ ocUpper, // 102 Upper()
+ ocLower, // 103 Lower()
+ ocLeft, // 104 Left()
+ ocRight, // 105 Right()
+ ocReplace, // 106 Replace()
+ ocPropper, // 107 Proper()
+ ocNoName, // 108 Cell()
+ ocTrim, // 109 Trim()
+ ocClean, // 110 Clean()
+ ocFalse, // 111 F()
+ ocTrue, // 112 W()
+ ocExact, // 113 Exact()
+ ocNoName, // 114 Call()
+ ocIndirect, // 115 @@()
+ ocZins, // 116 Rate()
+ ocNoName, // 117 Term()
+ ocNoName, // 118 Cterm()
+ ocLIA, // 119 Sln()
+ ocDIA, // 120 Syd(), Soy()
+ ocGDA, // 121 Ddb()
+ ocNoName, // 122
+ ocNoName, // 123
+ ocNoName, // 124
+ ocNoName, // 125
+ ocNoName, // 126
+ ocNoName, // 127
+ ocNoName, // 128
+ ocNoName, // 129
+ ocNoName, // 130
+ ocNoName, // 131
+ ocNoName, // 132
+ ocNoName, // 133
+ ocNoName, // 134
+ ocNoName, // 135
+ ocNoName, // 136
+ ocNoName, // 137
+ ocNoName, // 138
+ ocNoName, // 139
+ ocNoName, // 140
+ ocNoName, // 141
+ ocNoName, // 142
+ ocNoName, // 143
+ ocNoName, // 144
+ ocNoName, // 145
+ ocNoName, // 146
+ ocNoName, // 147
+ ocNoName, // 148
+ ocNoName, // 149
+ ocNoName, // 150
+ ocNoName, // 151
+ ocNoName, // 152
+ ocNoName, // 153
+ ocNoName, // 154
+ ocNoName, // 155
+ ocNoName, // 156 ?
+ ocNoName, // 157
+ ocNoName, // 158
+ ocNoName, // 159
+ ocNoName, // 160
+ ocNoName, // 161
+ ocNoName, // 162
+ ocNoName, // 163
+ ocNoName, // 164
+ ocNoName, // 165
+ ocNoName, // 166
+ ocNoName, // 167
+ ocNoName, // 168
+ ocNoName, // 169
+ ocNoName, // 170
+ ocNoName, // 171
+ ocNoName, // 172
+ ocNoName, // 173
+ ocNoName, // 174
+ ocNoName, // 175
+ ocNoName, // 176
+ ocNoName, // 177
+ ocNoName, // 178
+ ocNoName, // 179
+ ocNoName, // 180
+ ocNoName, // 181
+ ocNoName, // 182
+ ocNoName, // 183
+ ocNoName, // 184
+ ocNoName, // 185
+ ocNoName, // 186
+ ocNoName, // 187
+ ocNoName, // 188
+ ocNoName, // 189
+ ocNoName, // 190
+ ocNoName, // 191
+ ocNoName, // 192
+ ocNoName, // 193
+ ocNoName, // 194
+ ocNoName, // 195
+ ocNoName, // 196
+ ocNoName, // 197
+ ocNoName, // 198
+ ocNoName, // 199
+ ocNoName, // 200
+ ocNoName, // 201
+ ocNoName, // 202
+ ocNoName, // 203
+ ocNoName, // 204
+ ocNoName, // 205
+ ocNoName, // 206 ?
+ ocNoName, // 207
+ ocNoName, // 208
+ ocNoName, // 209
+ ocNoName, // 210
+ ocNoName, // 211
+ ocNoName, // 212
+ ocNoName, // 213
+ ocNoName, // 214
+ ocNoName, // 215
+ ocNoName, // 216
+ ocNoName, // 217
+ ocNoName, // 218
+ ocNoName, // 219
+ ocNoName, // 220
+ ocNoName, // 221
+ ocNoName, // 222
+ ocNoName, // 223
+ ocNoName, // 224
+ ocNoName, // 225
+ ocNoName, // 226
+ ocNoName, // 227
+ ocNoName, // 228
+ ocNoName, // 229
+ ocNoName, // 230
+ ocNoName, // 231
+ ocNoName, // 232
+ ocNoName, // 233
+ ocNoName, // 234
+ ocNoName, // 235
+ ocNoName, // 236
+ ocNoName, // 237
+ ocNoName, // 238
+ ocNoName, // 239
+ ocNoName, // 240
+ ocNoName, // 241
+ ocNoName, // 242
+ ocNoName, // 243
+ ocNoName, // 244
+ ocNoName, // 245
+ ocNoName, // 246
+ ocNoName, // 247
+ ocNoName, // 248
+ ocNoName, // 249
+ ocNoName, // 250
+ ocNoName, // 251
+ ocNoName, // 252
+ ocNoName, // 253
+ ocNoName, // 254
+ ocNoName // 255 ?
+ };
+
+ return pToken[ nIndex ];
+}
+
+
+FUNC_TYPE LotusToSc::IndexToTypeWK123( BYTE nIndex )
+{
+ static const FUNC_TYPE pType[ 256 ] =
+ { // Code Bezeichnung
+ FT_Const10Float, // 0 8-Byte-IEEE-Long-Number
+ FT_Cref, // 1 Cell Reference
+ FT_Rref, // 2 Area Reference
+ FT_Return, // 3 return
+ FT_Braces, // 4 Klammer
+ FT_Snum, // 5 Short-Number
+ FT_ConstString, // 6 ASCII-String
+ FT_Nrref, // 7 Named range reference
+ FT_Absnref, // 8 Absolut named range
+ FT_Erref, // 9 Err range reference
+ FT_Ecref, // 10 Err cell reference
+ FT_Econstant, // 11 Err constant
+ FT_NotImpl, // 12
+ FT_NotImpl, // 13
+ FT_Neg, // 14 Negation
+ FT_Op, // 15 Addition
+ FT_Op, // 16 Subtraktion
+ FT_Op, // 17 Multiplikation
+ FT_Op, // 18 Division
+ FT_Op, // 19 Potenzierung
+ FT_Op, // 20 Gleichheit
+ FT_Op, // 21 Ungleich
+ FT_Op, // 22 Kleiner-gleich
+ FT_Op, // 23 Groesser-gleich
+ FT_Op, // 24 Kleiner
+ FT_Op, // 25 Groesser
+ FT_Op, // 26 And (logisch)
+ FT_Op, // 27 Or (logisch)
+ FT_FuncFix1, // 28 Not (logisch)
+ FT_NOP, // 29 unaeres Plus
+ FT_Op, // 30 Concatenation
+ FT_FuncFix0, // 31 Not applicable
+ FT_FuncFix0, // 32 Error
+ FT_FuncFix1, // 33 Betrag ABS()
+ FT_FuncFix1, // 34 Ganzzahl INT()
+ FT_FuncFix1, // 35 Quadratwurzel
+ FT_FuncFix1, // 36 Zehnerlogarithmus
+ FT_FuncFix1, // 37 Natuerlicher Logarithmus
+ FT_FuncFix0, // 38 PI
+ FT_FuncFix1, // 39 Sinus
+ FT_FuncFix1, // 40 Cosinus
+ FT_FuncFix1, // 41 Tangens
+ FT_FuncFix2, // 42 Arcus-Tangens 2 (4.Quadrant)
+ FT_FuncFix1, // 43 Arcus-Tangens (2.Quadrant)
+ FT_FuncFix1, // 44 Arcus-Sinus
+ FT_FuncFix1, // 45 Arcus-Cosinus
+ FT_FuncFix1, // 46 Exponentialfunktion
+ FT_FuncFix2, // 47 Modulo
+ FT_FuncVar, // 48 Auswahl
+ FT_FuncFix1, // 49 Is not applicable?
+ FT_FuncFix1, // 50 Is Error?
+ FT_FuncFix0, // 51 FALSE
+ FT_FuncFix0, // 52 TRUE
+ FT_FuncFix0, // 53 Zufallszahl
+ FT_FuncFix3, // 54 Datum
+ FT_FuncFix0, // 55 Heute
+ FT_FuncFix3, // 56 Payment
+ FT_FuncFix3, // 57 Present Value
+ FT_FuncFix3, // 58 Future Value
+ FT_FuncFix3, // 59 If ... then ... else ...
+ FT_FuncFix1, // 60 Tag des Monats
+ FT_FuncFix1, // 61 Monat
+ FT_FuncFix1, // 62 Jahr
+ FT_FuncFix2, // 63 Runden
+ FT_FuncFix3, // 64 Zeit
+ FT_FuncFix1, // 65 Stunde
+ FT_FuncFix1, // 66 Minute
+ FT_FuncFix1, // 67 Sekunde
+ FT_FuncFix1, // 68 Ist Zahl?
+ FT_FuncFix1, // 69 Ist Text?
+ FT_FuncFix1, // 70 Len()
+ FT_FuncFix1, // 71 Val()
+ FT_FuncFix2, // 72 String()
+ FT_FuncFix3, // 73 Mid()
+ FT_FuncFix1, // 74 Char()
+ FT_FuncFix1, // 75 Ascii()
+ FT_FuncFix3, // 76 Find()
+ FT_FuncFix1, // 77 Datevalue
+ FT_FuncFix1, // 78 Timevalue
+ FT_FuncFix1, // 79 Cellpointer
+ FT_FuncVar, // 80 Sum()
+ FT_FuncVar, // 81 Avg()
+ FT_FuncVar, // 82 Cnt()
+ FT_FuncVar, // 83 Min()
+ FT_FuncVar, // 84 Max()
+ FT_FuncFix3, // 85 Vlookup()
+ FT_FuncFix2, // 86 Npv()
+ FT_FuncVar, // 87 Var()
+ FT_FuncVar, // 88 Std()
+ FT_FuncFix2, // 89 Irr()
+ FT_FuncFix3, // 90 Hlookup()
+ FT_FuncVar, // 91 Dsum <-------- neu! -
+ FT_FuncVar, // 92 Davg <-------- neu! -
+ FT_FuncVar, // 93 Dcnt <-------- neu! -
+ FT_FuncVar, // 94 Dmin <-------- neu! -
+ FT_FuncVar, // 95 Dmax <-------- neu! -
+ FT_FuncVar, // 96 Dvar <-------- neu! -
+ FT_FuncVar, // 97 Dstd <-------- neu! -
+ FT_FuncVar, // 98 Index() <-------- change! -
+ FT_FuncFix1, // 99 Cols() <-------- neu! -
+ FT_FuncFix1, // 100 Rows() <-------- neu! -
+ FT_FuncFix2, // 101 Repeat() <-------- neu! -
+ FT_FuncFix1, // 102 Upper() <-------- neu! -
+ FT_FuncFix1, // 103 Lower() <-------- neu! -
+ FT_FuncFix2, // 104 Left() <-------- neu! -
+ FT_FuncFix2, // 105 Right() <-------- neu! -
+ FT_FuncFix4, // 106 Replace() <-------- neu! -
+ FT_FuncFix1, // 107 Proper() <-------- neu! -
+ FT_FuncFix2, // 108 Cell() <-------- neu! -
+ FT_FuncFix1, // 109 Trim() <-------- neu! -
+ FT_FuncFix1, // 110 Clean() <-------- neu! -
+ FT_FuncFix1, // 111 S() <--------- change in Bez. -
+ FT_FuncFix1, // 112 N() <--------- change in Bez. -
+ FT_FuncFix2, // 113 Exact() <-------- neu! -
+ FT_NotImpl, // 114 App <--------- change in Bez. -
+ FT_FuncFix1, // 115 @@() <-------- neu! -
+ FT_FuncFix3, // 116 Rate() <-------- neu! -
+ FT_FuncFix3, // 117 Term() <--------- change in Anz.
+ FT_FuncFix3, // 118 Cterm() <--------- change in Anz.
+ FT_FuncFix3, // 119 Sln() <-------- neu! -
+ FT_FuncFix4, // 120 Syd() <-------- neu! -
+ FT_FuncFix4, // 121 Ddb() <-------- neu! -
+ FT_Splfunc, // 122 Splfunc <-------- neu! -
+ FT_FuncFix1, // 123 Sheets <-------- neu! -
+ FT_FuncFix1, // 124 Info <-------- neu! -
+ FT_FuncVar, // 125 Sumproduct <-------- neu! -
+ FT_FuncFix1, // 126 Isrange <-------- neu! -
+ FT_FuncVar, // 127 Dget <-------- neu! -
+ FT_FuncVar, // 128 Dquery <-------- neu! -
+ FT_FuncFix4, // 129 Coord <-------- neu! -
+ FT_NOP, // 130 Reserved (internal) <-------- neu! -
+ FT_FuncFix0, // 131 Today <-------- neu! -
+ FT_FuncVar, // 132 Vdb <-------- neu! -
+ FT_FuncVar, // 133 Dvars <-------- neu! -
+ FT_FuncVar, // 134 Dstds <-------- neu! -
+ FT_FuncVar, // 135 Vars <-------- neu! -
+ FT_FuncVar, // 136 Stds <-------- neu! -
+ FT_FuncFix2, // 137 D360 <-------- neu! -
+ FT_NOP, // 138 Reserved (internal) <-------- neu! -
+ FT_FuncFix0, // 139 Isapp <-------- neu! - Anzahl ? -
+ FT_FuncVar, // 140 Isaaf <-------- neu! - Anzahl ? -
+ FT_FuncFix1, // 141 Weekday <-------- neu! -
+ FT_FuncFix3, // 142 Datedif <-------- neu! -
+ FT_FuncVar, // 143 Rank <-------- neu! -
+ FT_FuncFix2, // 144 Numberstring <-------- neu! -
+ FT_FuncFix1, // 145 Datestring <-------- neu! -
+ FT_FuncFix1, // 146 Decimal <-------- neu! -
+ FT_FuncFix1, // 147 Hex <-------- neu! -
+ FT_FuncFix4, // 148 Db <-------- neu! -
+ FT_FuncFix4, // 149 Pmti <-------- neu! -
+ FT_FuncFix4, // 150 Spi <-------- neu! -
+ FT_FuncFix1, // 151 Fullp <-------- neu! -
+ FT_FuncFix1, // 152 Halfp <-------- neu! -
+ FT_FuncVar, // 153 Pureavg <-------- neu! -
+ FT_FuncVar, // 154 Purecount <-------- neu! -
+ FT_FuncVar, // 155 Puremax <-------- neu! -
+ FT_FuncVar, // 156 Puremin <-------- neu! -
+ FT_FuncVar, // 157 Purestd <-------- neu! -
+ FT_FuncVar, // 158 Purevar <-------- neu! -
+ FT_FuncVar, // 159 Purestds <-------- neu! -
+ FT_FuncVar, // 160 Purevars <-------- neu! -
+ FT_FuncFix3, // 161 Pmt2 <-------- neu! -
+ FT_FuncFix3, // 162 Pv2 <-------- neu! -
+ FT_FuncFix3, // 163 Fv2 <-------- neu! -
+ FT_FuncFix3, // 164 Term2 <-------- neu! -
+ FT_NotImpl, // 165 --- <-------- neu! - Anzahl ? -
+ FT_FuncFix2, // 166 D360 (US-Version)
+ FT_NotImpl, // 167
+ FT_NotImpl, // 168
+ FT_NotImpl, // 169
+ FT_NotImpl, // 170
+ FT_NotImpl, // 171
+ FT_NotImpl, // 172
+ FT_NotImpl, // 173
+ FT_NotImpl, // 174
+ FT_NotImpl, // 175
+ FT_NotImpl, // 176
+ FT_NotImpl, // 177
+ FT_NotImpl, // 178
+ FT_NotImpl, // 179
+ FT_NotImpl, // 180
+ FT_NotImpl, // 181
+ FT_NotImpl, // 182
+ FT_NotImpl, // 183
+ FT_NotImpl, // 184
+ FT_NotImpl, // 185
+ FT_FuncVar, // 186 Solver <-------- neu! -
+ FT_NotImpl, // 187
+ FT_NotImpl, // 188
+ FT_NotImpl, // 189
+ FT_NotImpl, // 190
+ FT_NotImpl, // 191
+ FT_NotImpl, // 192
+ FT_NotImpl, // 193
+ FT_NotImpl, // 194
+ FT_NotImpl, // 195
+ FT_NotImpl, // 196
+ FT_NotImpl, // 197
+ FT_NotImpl, // 198
+ FT_NotImpl, // 199
+ FT_NotImpl, // 200
+ FT_NotImpl, // 201
+ FT_NotImpl, // 202
+ FT_NotImpl, // 203
+ FT_NotImpl, // 204
+ FT_NotImpl, // 205
+ FT_NotImpl, // 206
+ FT_NotImpl, // 207
+ FT_NotImpl, // 208
+ FT_NotImpl, // 209
+ FT_NotImpl, // 210
+ FT_NotImpl, // 211
+ FT_NotImpl, // 212
+ FT_NotImpl, // 213
+ FT_NotImpl, // 214
+ FT_NotImpl, // 215
+ FT_NotImpl, // 216
+ FT_NotImpl, // 217
+ FT_NotImpl, // 218
+ FT_NotImpl, // 219
+ FT_NotImpl, // 220
+ FT_NotImpl, // 221
+ FT_NotImpl, // 222
+ FT_NotImpl, // 223
+ FT_NotImpl, // 224
+ FT_NotImpl, // 225
+ FT_NotImpl, // 226
+ FT_NotImpl, // 227
+ FT_NotImpl, // 228
+ FT_NotImpl, // 229
+ FT_NotImpl, // 230
+ FT_NotImpl, // 231
+ FT_NotImpl, // 232
+ FT_NotImpl, // 233
+ FT_NotImpl, // 234
+ FT_NotImpl, // 235
+ FT_NotImpl, // 236
+ FT_NotImpl, // 237
+ FT_NotImpl, // 238
+ FT_NotImpl, // 239
+ FT_NotImpl, // 240
+ FT_NotImpl, // 241
+ FT_NotImpl, // 242
+ FT_NotImpl, // 243
+ FT_NotImpl, // 244
+ FT_NotImpl, // 245
+ FT_NotImpl, // 246
+ FT_NotImpl, // 247
+ FT_NotImpl, // 248
+ FT_NotImpl, // 249
+ FT_NotImpl, // 250
+ FT_NotImpl, // 251
+ FT_NotImpl, // 252
+ FT_NotImpl, // 253
+ FT_NotImpl, // 254
+ FT_NotImpl, // 255
+ };
+ return pType[ nIndex ];
+}
+
+
+DefTokenId LotusToSc::IndexToTokenWK123( BYTE nIndex )
+{
+ static const DefTokenId pToken[ 256 ] =
+ { // Code Bezeichnung
+ ocPush, // 0 8-Byte-IEEE-Long-Numbers
+ ocPush, // 1 Variable
+ ocPush, // 2 Bereich
+ ocPush, // 3 return
+ ocPush, // 4 Klammer
+ ocPush, // 5 Numbers
+ ocPush, // 6 ASCII-String
+ ocPush, // 7 Named range reference
+ ocPush, // 8 Absolut named range
+ ocPush, // 9 Err range reference
+ ocPush, // 10 Err cell reference
+ ocPush, // 11 Err constant
+ ocPush, // 12
+ ocPush, // 13
+ ocNegSub, // 14 Negation
+ ocAdd, // 15 Addition
+ ocSub, // 16 Subtraktion
+ ocMul, // 17 Multiplikation
+ ocDiv, // 18 Division
+ ocPow, // 19 Potenzierung
+ ocEqual, // 20 Gleichheit
+ ocNotEqual, // 21 Ungleich
+ ocLessEqual, // 22 Kleiner-gleich
+ ocGreaterEqual, // 23 Groesser-gleich
+ ocLess, // 24 Kleiner
+ ocGreater, // 25 Groesser
+ ocAnd, // 26 And (logisch)
+ ocOr, // 27 Or (logisch)
+ ocNot, // 28 Not (logisch)
+ ocPush, // 29 unaeres Plus
+ ocAmpersand, // 30 Concatenation
+ ocNotAvail, // 31 Not available
+ ocNoName, // 32 Error
+ ocAbs, // 33 Betrag ABS()
+ ocInt, // 34 Ganzzahl INT()
+ ocSqrt, // 35 Quadratwurzel
+ ocLog10, // 36 Zehnerlogarithmus
+ ocLn, // 37 Natuerlicher Logarithmus
+ ocPi, // 38 PI
+ ocSin, // 39 Sinus
+ ocCos, // 40 Cosinus
+ ocTan, // 41 Tangens
+ ocArcTan2, // 42 Arcus-Tangens 2 (4.Quadrant)
+ ocArcTan, // 43 Arcus-Tangens (2.Quadrant)
+ ocArcSin, // 44 Arcus-Sinus
+ ocArcCos, // 45 Arcus-Cosinus
+ ocExp, // 46 Exponentialfunktion
+ ocMod, // 47 Modulo
+ ocChose, // 48 Auswahl
+ ocIsNA, // 49 Is not available?
+ ocIsError, // 50 Is Error?
+ ocFalse, // 51 FALSE
+ ocTrue, // 52 TRUE
+ ocRandom, // 53 Zufallszahl
+ ocGetDate, // 54 Datum
+ ocGetActDate, // 55 Heute
+ ocRMZ, // 56 Payment
+ ocBW, // 57 Present Value
+ ocZW, // 58 Future Value
+ ocIf, // 59 If ... then ... else ...
+ ocGetDay, // 60 Tag des Monats
+ ocGetMonth, // 61 Monat
+ ocGetYear, // 62 Jahr
+ ocRound, // 63 Runden
+ ocGetTime, // 64 Zeit
+ ocGetHour, // 65 Stunde
+ ocGetMin, // 66 Minute
+ ocGetSec, // 67 Sekunde
+ ocIsValue, // 68 Ist Zahl?
+ ocIsString, // 69 Ist Text?
+ ocLen, // 70 Len()
+ ocValue, // 71 Val()
+ ocFixed, // 72 String() ocFixed ersatzweise + Spezialfall
+ ocMid, // 73 Mid()
+ ocChar, // 74 Char()
+ ocCode, // 75 Ascii()
+ ocFind, // 76 Find()
+ ocGetDateValue, // 77 Datevalue
+ ocGetTimeValue, // 78 Timevalue
+ ocNoName, // 79 Cellpointer
+ ocSum, // 80 Sum()
+ ocAverage, // 81 Avg()
+ ocCount, // 82 Cnt()
+ ocMin, // 83 Min()
+ ocMax, // 84 Max()
+ ocVLookup, // 85 Vlookup()
+ ocNPV, // 86 Npv()
+ ocVar, // 87 Var()
+ ocStDev, // 88 Std()
+ ocIRR, // 89 Irr()
+ ocHLookup, // 90 Hlookup()
+ ocDBSum, // 91 XlfDsum
+ ocDBAverage, // 92 XlfDaverage
+ ocDBCount, // 93 XlfDcount
+ ocDBMin, // 94 XlfDmin
+ ocDBMax, // 95 XlfDmax
+ ocDBVar, // 96 XlfDvar
+ ocDBStdDev, // 97 XlfDstdev
+ ocIndex, // 98 Index()
+ ocColumns, // 99 Cols()
+ ocRows, // 100 Rows()
+ ocRept, // 101 Repeat()
+ ocUpper, // 102 Upper()
+ ocLower, // 103 Lower()
+ ocLeft, // 104 Left()
+ ocRight, // 105 Right()
+ ocReplace, // 106 Replace()
+ ocPropper, // 107 Proper()
+ ocNoName, // 108 Cell()
+ ocTrim, // 109 Trim()
+ ocClean, // 110 Clean()
+ ocNoName, // 111 F() (Excel: T()?)
+ ocNoName, // 112 W()
+ ocExact, // 113 Exact()
+ ocNoName, // 114 Call()
+ ocIndirect, // 115 @@()
+ ocZins, // 116 Rate()
+ ocNoName, // 117 Term()
+ ocNoName, // 118 Cterm()
+ ocLIA, // 119 Sln()
+ ocDIA, // 120 Syd(), Soy()
+ ocGDA, // 121 Ddb()
+ ocNoName, // 122 Splfunc
+ ocNoName, // 123 Sheets
+ ocNoName, // 124 Info
+ ocSumProduct, // 125 Sumproduct
+ ocNoName, // 126 Isrange
+ ocDBGet, // 127 Dget
+ ocNoName, // 128 Dquery
+ ocNoName, // 129 Coord
+ ocNoName, // 130 Reserved (internal)
+ ocGetActDate, // 131 Today
+ ocNoName, // 132 Vdb
+ ocDBVarP, // 133 Dvars
+ ocDBStdDevP, // 134 Dstds
+ ocVarP, // 135 Vars
+ ocStDevP, // 136 Stds
+ ocGetDiffDate360, // 137 D360
+ ocNoName, // 138 Reserved (internal)
+ ocNoName, // 139 Isapp
+ ocNoName, // 140 Isaaf
+ ocGetDayOfWeek, // 141 Weekday
+ ocGetDiffDate, // 142 Datedif
+ ocRank, // 143 Rank
+ ocNoName, // 144 Numberstring
+ ocNoName, // 145 Datestring
+ ocNoName, // 146 Decimal
+ ocNoName, // 147 Hex
+ ocNoName, // 148 Db
+ ocNoName, // 149 Pmti
+ ocNoName, // 150 Spi
+ ocNoName, // 151 Fullp
+ ocNoName, // 152 Halfp
+ ocNoName, // 153 Pureavg
+ ocCount2, // 154 Purecount
+ ocNoName, // 155 Puremax
+ ocNoName, // 156 Puremin
+ ocNoName, // 157 Purestd
+ ocNoName, // 158 Purevar
+ ocNoName, // 159 Purestds
+ ocNoName, // 160 Purevars
+ ocNoName, // 161 Pmt2
+ ocNoName, // 162 Pv2
+ ocNoName, // 163 Fv2
+ ocNoName, // 164 Term2
+ ocNoName, // 165 --- <-------- neu! - Anzahl ? -
+ ocGetDiffDate360, // 166 D360 (US-Version, ersatzweise wie ander D360-Funktion)
+ ocNoName, // 167
+ ocNoName, // 168
+ ocNoName, // 169
+ ocNoName, // 170
+ ocNoName, // 171
+ ocNoName, // 172
+ ocNoName, // 173
+ ocNoName, // 174
+ ocNoName, // 175
+ ocNoName, // 176
+ ocNoName, // 177
+ ocNoName, // 178
+ ocNoName, // 179
+ ocNoName, // 180
+ ocNoName, // 181
+ ocNoName, // 182
+ ocNoName, // 183
+ ocNoName, // 184
+ ocNoName, // 185
+ ocNoName, // 186
+ ocNoName, // 187
+ ocNoName, // 188
+ ocNoName, // 189
+ ocNoName, // 190
+ ocNoName, // 191
+ ocNoName, // 192
+ ocNoName, // 193
+ ocNoName, // 194
+ ocNoName, // 195
+ ocNoName, // 196
+ ocNoName, // 197
+ ocNoName, // 198
+ ocNoName, // 199
+ ocNoName, // 200
+ ocNoName, // 201
+ ocNoName, // 202
+ ocNoName, // 203
+ ocNoName, // 204
+ ocNoName, // 205
+ ocNoName, // 206 ?
+ ocNoName, // 207
+ ocNoName, // 208
+ ocNoName, // 209
+ ocNoName, // 210
+ ocNoName, // 211
+ ocNoName, // 212
+ ocNoName, // 213
+ ocNoName, // 214
+ ocNoName, // 215
+ ocNoName, // 216
+ ocNoName, // 217
+ ocNoName, // 218
+ ocNoName, // 219
+ ocNoName, // 220
+ ocNoName, // 221
+ ocNoName, // 222
+ ocNoName, // 223
+ ocNoName, // 224
+ ocNoName, // 225
+ ocNoName, // 226
+ ocNoName, // 227
+ ocNoName, // 228
+ ocNoName, // 229
+ ocNoName, // 230
+ ocNoName, // 231
+ ocNoName, // 232
+ ocNoName, // 233
+ ocNoName, // 234
+ ocNoName, // 235
+ ocNoName, // 236
+ ocNoName, // 237
+ ocNoName, // 238
+ ocNoName, // 239
+ ocNoName, // 240
+ ocNoName, // 241
+ ocNoName, // 242
+ ocNoName, // 243
+ ocNoName, // 244
+ ocNoName, // 245
+ ocNoName, // 246
+ ocNoName, // 247
+ ocNoName, // 248
+ ocNoName, // 249
+ ocNoName, // 250
+ ocNoName, // 251
+ ocNoName, // 252
+ ocNoName, // 253
+ ocNoName, // 254
+ ocNoName // 255 ?
+ };
+
+ return pToken[ nIndex ];
+}
+
+
+
+
+const sal_Char* GetAddInName( const UINT8 n )
+{
+ static const sal_Char* pNames[ 256 ] =
+ {
+ NULL, // 0 8-Byte-IEEE-Float
+ NULL, // 1 Variable
+ NULL, // 2 Bereich
+ NULL, // 3 return
+ NULL, // 4 Klammer
+ NULL, // 5 2-Byte-Integer
+ NULL, // 6 ASCII-String
+ NULL, // 7 Named range reference
+ NULL, // 8 Absolut named range
+ NULL, // 9 Err range reference
+ NULL, // 10 Err cell reference
+ NULL, // 11 Err constant
+ NULL, // 12
+ NULL, // 13
+ NULL, // 14 Negation
+ NULL, // 15 Addition
+ NULL, // 16 Subtraktion
+ NULL, // 17 Multiplikation
+ NULL, // 18 Division
+ NULL, // 19 Potenzierung
+ NULL, // 20 Gleichheit
+ NULL, // 21 Ungleich
+ NULL, // 22 Kleiner-gleich
+ NULL, // 23 Groesser-gleich
+ NULL, // 24 Kleiner
+ NULL, // 25 Groesser
+ NULL, // 26 And (logisch)
+ NULL, // 27 Or (logisch)
+ NULL, // 28 Not (logisch)
+ NULL, // 29 unaeres Plus
+ NULL, // 30 Concatenation
+ NULL, // 31 Not applicable
+ NULL, // 32 Error
+ NULL, // 33 Betrag ABS()
+ NULL, // 34 Ganzzahl INT()
+ NULL, // 35 Quadratwurzel
+ NULL, // 36 Zehnerlogarithmus
+ NULL, // 37 Natuerlicher Logarithmus
+ NULL, // 38 PI
+ NULL, // 39 Sinus
+ NULL, // 40 Cosinus
+ NULL, // 41 Tangens
+ NULL, // 42 Arcus-Tangens 2 (4.Quadrant)
+ NULL, // 43 Arcus-Tangens (2.Quadrant)
+ NULL, // 44 Arcus-Sinus
+ NULL, // 45 Arcus-Cosinus
+ NULL, // 46 Exponentialfunktion
+ NULL, // 47 Modulo
+ NULL, // 48 Auswahl
+ NULL, // 49 Is not applicable?
+ NULL, // 50 Is Error?
+ NULL, // 51 FALSE
+ NULL, // 52 TRUE
+ NULL, // 53 Zufallszahl
+ NULL, // 54 Datum
+ NULL, // 55 Heute
+ NULL, // 56 Payment
+ NULL, // 57 Present Value
+ NULL, // 58 Future Value
+ NULL, // 59 If ... then ... else ...
+ NULL, // 60 Tag des Monats
+ NULL, // 61 Monat
+ NULL, // 62 Jahr
+ NULL, // 63 Runden
+ NULL, // 64 Zeit
+ NULL, // 65 Stunde
+ NULL, // 66 Minute
+ NULL, // 67 Sekunde
+ NULL, // 68 Ist Zahl?
+ NULL, // 69 Ist Text?
+ NULL, // 70 Len()
+ NULL, // 71 Val()
+ NULL, // 72 String() ocFixed ersatzweise + Spezialfall
+ NULL, // 73 Mid()
+ NULL, // 74 Char()
+ NULL, // 75 Ascii()
+ NULL, // 76 Find()
+ NULL, // 77 Datevalue
+ NULL, // 78 Timevalue
+ "ZELLZEIGER", // 79 Cellpointer
+ NULL, // 80 Sum()
+ NULL, // 81 Avg()
+ NULL, // 82 Cnt()
+ NULL, // 83 Min()
+ NULL, // 84 Max()
+ NULL, // 85 Vlookup()
+ NULL, // 86 Npv()
+ NULL, // 87 Var()
+ NULL, // 88 Std()
+ NULL, // 89 Irr()
+ NULL, // 90 Hlookup()
+ NULL, // 91 XlfDsum
+ NULL, // 92 XlfDaverage
+ NULL, // 93 XlfDcount
+ NULL, // 94 XlfDmin
+ NULL, // 95 XlfDmax
+ NULL, // 96 XlfDvar
+ NULL, // 97 XlfDstdev
+ NULL, // 98 Index()
+ NULL, // 99 Cols()
+ NULL, // 100 Rows()
+ NULL, // 101 Repeat()
+ NULL, // 102 Upper()
+ NULL, // 103 Lower()
+ NULL, // 104 Left()
+ NULL, // 105 Right()
+ NULL, // 106 Replace()
+ NULL, // 107 Proper()
+ "ZELLE", // 108 Cell()
+ NULL, // 109 Trim()
+ NULL, // 110 Clean()
+ "F", // 111 F() (Excel: T()?)
+ "W", // 112 W()
+ NULL, // 113 Exact()
+ NULL, // 114 Call()
+ NULL, // 115 @@()
+ NULL, // 116 Rate()
+ "ANN", // 117 Term()
+ NULL, // 118 Cterm()
+ NULL, // 119 Sln()
+ NULL, // 120 Syd(), Soy()
+ NULL, // 121 Ddb()
+ "SplFunc", // 122 Splfunc
+ "BLAETTER", // 123 Sheets
+ "INFO", // 124 Info
+ NULL, // 125 Sumproduct
+ "ISTBEREICH", // 126 Isrange
+ NULL, // 127 Dget
+ "DABFRAGE", // 128 Dquery
+ "KOORD", // 129 Coord
+ NULL, // 130 Reserved (internal)
+ NULL, // 131 Today
+ NULL, // 132 Vdb
+ NULL, // 133 Dvars
+ NULL, // 134 Dstds
+ NULL, // 135 Vars
+ NULL, // 136 Stds
+ NULL, // 137 D360
+ NULL, // 138 Reserved (internal)
+ NULL, // 139 Isapp
+ "ISTDEFZUS", // 140 Isaaf
+ NULL, // 141 Weekday
+ NULL, // 142 Datedif
+ NULL, // 143 Rank
+ NULL, // 144 Numberstring
+ "DATUMFOLGE", // 145 Datestring
+ "DEZIMAL", // 146 Decimal
+ "HEX", // 147 Hex
+ NULL, // 148 Db
+ NULL, // 149 Pmti
+ NULL, // 150 Spi
+ NULL, // 151 Fullp
+ NULL, // 152 Halfp
+ "PURMITTELWERT", // 153 Pureavg
+ "PURANZAHL", // 154 Purecount
+ "PURMAX", // 155 Puremax
+ "PURMIN", // 156 Puremin
+ "PURSTDABW", // 157 Purestd
+ "PURVAR", // 158 Purevar
+ "PURSTDABWP", // 159 Purestds
+ "PURVARP", // 160 Purevars
+ NULL, // 161 Pmt2
+ NULL, // 162 Pv2
+ NULL, // 163 Fv2
+ NULL, // 164 Term2
+ NULL, // 165 --- <-------- neu! - Anzahl ? -
+ NULL, // 166 D360 (US-Version, ersatzweise wie ander D360-Funktion)
+ NULL, // 167
+ NULL, // 168
+ NULL, // 169
+ NULL, // 170
+ NULL, // 171
+ NULL, // 172
+ NULL, // 173
+ NULL, // 174
+ NULL, // 175
+ NULL, // 176
+ NULL, // 177
+ NULL, // 178
+ NULL, // 179
+ NULL, // 180
+ NULL, // 181
+ NULL, // 182
+ NULL, // 183
+ NULL, // 184
+ NULL, // 185
+ NULL, // 186
+ NULL, // 187
+ NULL, // 188
+ NULL, // 189
+ NULL, // 190
+ NULL, // 191
+ NULL, // 192
+ NULL, // 193
+ NULL, // 194
+ NULL, // 195
+ NULL, // 196
+ NULL, // 197
+ NULL, // 198
+ NULL, // 199
+ NULL, // 200
+ NULL, // 201
+ NULL, // 202
+ NULL, // 203
+ NULL, // 204
+ NULL, // 205
+ NULL, // 206 ?
+ NULL, // 207
+ NULL, // 208
+ NULL, // 209
+ NULL, // 210
+ NULL, // 211
+ NULL, // 212
+ NULL, // 213
+ NULL, // 214
+ NULL, // 215
+ NULL, // 216
+ NULL, // 217
+ NULL, // 218
+ NULL, // 219
+ NULL, // 220
+ NULL, // 221
+ NULL, // 222
+ NULL, // 223
+ NULL, // 224
+ NULL, // 225
+ NULL, // 226
+ NULL, // 227
+ NULL, // 228
+ NULL, // 229
+ NULL, // 230
+ NULL, // 231
+ NULL, // 232
+ NULL, // 233
+ NULL, // 234
+ NULL, // 235
+ NULL, // 236
+ NULL, // 237
+ NULL, // 238
+ NULL, // 239
+ NULL, // 240
+ NULL, // 241
+ NULL, // 242
+ NULL, // 243
+ NULL, // 244
+ NULL, // 245
+ NULL, // 246
+ NULL, // 247
+ NULL, // 248
+ NULL, // 249
+ NULL, // 250
+ NULL, // 251
+ NULL, // 252
+ NULL, // 253
+ NULL, // 254
+ NULL // 255 ?
+ };
+
+ return pNames[ n ];
+}
+
+
+DefTokenId lcl_KnownAddIn( const ByteString& sTest )
+{
+ DefTokenId eId = ocNoName;
+
+ if( sTest == "FACT" )
+ eId = ocFact;
+ else if(sTest== "ISEMPTY")
+ eId=ocIsEmpty;
+ else if(sTest== "DEGTORAD")
+ eId=ocRad;
+ else if(sTest== "RADTODEG")
+ eId=ocDeg;
+ else if(sTest== "SIGN")
+ eId=ocPlusMinus;
+ else if(sTest== "ACOSH")
+ eId=ocArcCosHyp;
+ else if(sTest== "ACOTH")
+ eId=ocArcCotHyp;
+ else if(sTest== "ASINH")
+ eId=ocArcSinHyp;
+ else if(sTest== "ATANH")
+ eId=ocArcTanHyp;
+ else if(sTest== "COSH")
+ eId=ocCosHyp;
+ else if(sTest== "COTH")
+ eId=ocCotHyp;
+ else if(sTest== "SINH")
+ eId=ocSinHyp;
+ else if(sTest== "TANH")
+ eId=ocTanHyp;
+ else if(sTest== "EVEN")
+ eId=ocIsEven;
+ else if(sTest== "ODD")
+ eId=ocIsOdd;
+ else if(sTest== "ACOT")
+ eId=ocArcCot;
+ else if(sTest== "COT")
+ eId=ocCot;
+ else if(sTest== "ACOT")
+ eId=ocArcCot;
+ else if(sTest== "TRUNC")
+ eId=ocTrunc;
+ else if(sTest== "GEOMEAN")
+ eId=ocGeoMean;
+ else if(sTest== "HARMEAN")
+ eId=ocHarMean;
+ else if(sTest== "CORREL")
+ eId=ocCorrel;
+ else if(sTest== "MEDIAN")
+ eId=ocMedian;
+ else if(sTest== "COV")
+ eId=ocCovar;
+ else if(sTest== "SKEWNESS")
+ eId=ocSchiefe;
+ else if(sTest== "CHITEST")
+ eId=ocChiTest;
+ else if(sTest== "FTEST")
+ eId=ocFTest;
+ else if(sTest== "AVEDEV")
+ eId=ocAveDev;
+ else if(sTest== "PRODUCT")
+ eId=ocProduct;
+ else if(sTest== "PERMUT")
+ eId=ocVariationen;
+ else if(sTest== "GAMMALN")
+ eId=ocGammaLn;
+ else if(sTest== "POISSON")
+ eId=ocPoissonDist;
+ else if(sTest== "NORMAL")
+ eId=ocNormDist;
+ else if(sTest== "CRITBINOMIAL")
+ eId=ocKritBinom;
+ return eId;
+
+
+}
+
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
new file mode 100644
index 000000000000..2f6f81b7279c
--- /dev/null
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -0,0 +1,473 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#include "lotimpop.hxx"
+#include <vos/mutex.hxx>
+
+#include "attrib.hxx"
+#include "document.hxx"
+#include "rangenam.hxx"
+#include "cell.hxx"
+#include "patattr.hxx"
+#include "docpool.hxx"
+#include "compiler.hxx"
+#include "global.hxx"
+
+#include "root.hxx"
+#include "lotfntbf.hxx"
+#include "lotform.hxx"
+#include "tool.h"
+#include "namebuff.hxx"
+#include "lotrange.hxx"
+#include "lotattr.hxx"
+
+
+static NAMESPACE_VOS( OMutex ) aLotImpSemaphore;
+
+
+ImportLotus::ImportLotus( SvStream& aStream, ScDocument* pDoc, CharSet eQ ) :
+ ImportTyp( pDoc, eQ ),
+ pIn( &aStream ),
+ aConv( *pIn, eQ, FALSE )
+{
+ // good point to start locking of import lotus
+ aLotImpSemaphore.acquire();
+
+ pLotusRoot = new LOTUS_ROOT;
+ pLotusRoot->pDoc = pDoc;
+ pLotusRoot->pRangeNames = new LotusRangeList;
+ pLotusRoot->pScRangeName = pDoc->GetRangeName();
+ pLotusRoot->eCharsetQ = eQ;
+ pLotusRoot->eFirstType = Lotus_X;
+ pLotusRoot->eActType = Lotus_X;
+ pLotusRoot->pRngNmBffWK3 = new RangeNameBufferWK3;
+ pFontBuff = pLotusRoot->pFontBuff = new LotusFontBuffer;
+ pLotusRoot->pAttrTable = new LotAttrTable;
+}
+
+
+ImportLotus::~ImportLotus()
+{
+ delete pLotusRoot->pRangeNames;
+ delete pLotusRoot->pRngNmBffWK3;
+ delete pFontBuff;
+ delete pLotusRoot->pAttrTable;
+ delete pLotusRoot;
+
+#ifdef DBG_UTIL
+ pLotusRoot = NULL;
+#endif
+
+ // no need 4 pLotusRoot anymore
+ aLotImpSemaphore.release();
+}
+
+
+void ImportLotus::Bof( void )
+{
+ UINT16 nFileCode, nFileSub, nSaveCnt;
+ BYTE nMajorId, nMinorId, nFlags;
+
+ Read( nFileCode );
+ Read( nFileSub );
+ Read( pLotusRoot->aActRange );
+ Read( nSaveCnt );
+ Read( nMajorId );
+ Read( nMinorId );
+ Skip( 1 );
+ Read( nFlags );
+
+ if( nFileSub == 0x0004 )
+ {
+ if( nFileCode == 0x1000 )
+ {// <= WK3
+ pLotusRoot->eFirstType = pLotusRoot->eActType = Lotus_WK3;
+ }
+ else if( nFileCode == 0x1002 )
+ {// WK4
+ pLotusRoot->eFirstType = pLotusRoot->eActType = Lotus_WK4;
+ }
+ }
+}
+
+
+BOOL ImportLotus::BofFm3( void )
+{
+ UINT16 nFileCode, nFileSub;
+
+ Read( nFileCode );
+ Read( nFileSub );
+
+ return ( nFileCode == 0x8007 && ( nFileSub == 0x0000 || nFileSub == 0x00001 ) );
+}
+
+
+void ImportLotus::Columnwidth( UINT16 nRecLen )
+{
+ DBG_ASSERT( nRecLen >= 4, "*ImportLotus::Columnwidth(): Record zu kurz!" );
+
+ BYTE nLTab, nWindow2;
+ UINT16 nCnt = ( nRecLen - 4 ) / 2;
+
+ Read( nLTab );
+ Read( nWindow2 );
+
+ if( !pD->HasTable( static_cast<SCTAB> (nLTab) ) )
+ pD->MakeTable( static_cast<SCTAB> (nLTab) );
+
+ if( !nWindow2 )
+ {
+ Skip( 2 );
+
+ BYTE nCol, nSpaces;
+
+ while( nCnt )
+ {
+ Read( nCol );
+ Read( nSpaces );
+ // ACHTUNG: Korrekturfaktor nach 'Augenmass' ermittelt!
+ pD->SetColWidth( static_cast<SCCOL> (nCol), static_cast<SCTAB> (nLTab), ( UINT16 ) ( TWIPS_PER_CHAR * 1.28 * nSpaces ) );
+
+ nCnt--;
+ }
+ }
+}
+
+
+void ImportLotus::Hiddencolumn( UINT16 nRecLen )
+{
+ DBG_ASSERT( nRecLen >= 4, "*ImportLotus::Hiddencolumn(): Record zu kurz!" );
+
+ BYTE nLTab, nWindow2;
+ UINT16 nCnt = ( nRecLen - 4 ) / 2;
+
+ Read( nLTab );
+ Read( nWindow2 );
+
+ if( !nWindow2 )
+ {
+ Skip( 2 );
+
+ BYTE nCol;
+
+ while( nCnt )
+ {
+ Read( nCol );
+
+ pD->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), static_cast<SCTAB>(nLTab), true);
+ nCnt--;
+ }
+ }
+}
+
+
+void ImportLotus::Userrange( void )
+{
+ UINT16 nRangeType;
+ ScRange aScRange;
+ sal_Char* pBuffer = new sal_Char[ 32 ];
+
+ Read( nRangeType );
+
+ pIn->Read( pBuffer, 16 );
+ pBuffer[ 16 ] = ( sal_Char ) 0x00; // zur Sicherheit...
+ String aName( pBuffer, eQuellChar );
+
+ Read( aScRange );
+
+ pLotusRoot->pRngNmBffWK3->Add( aName, aScRange );
+ delete[] pBuffer;
+}
+
+
+void ImportLotus::Errcell( void )
+{
+ ScAddress aA;
+
+ Read( aA );
+
+ pD->PutCell( aA.Col(), aA.Row(), aA.Tab(), new ScStringCell( CREATE_STRING( "#ERR!" ) ), (BOOL)TRUE );
+}
+
+
+void ImportLotus::Nacell( void )
+{
+ ScAddress aA;
+
+ Read( aA );
+
+ pD->PutCell( aA.Col(), aA.Row(), aA.Tab(), new ScStringCell( CREATE_STRING( "#NA!" ) ), (BOOL)TRUE );
+}
+
+
+void ImportLotus::Labelcell( void )
+{
+ ScAddress aA;
+ String aLabel;
+ sal_Char cAlign;
+
+ Read( aA );
+ Read( cAlign );
+ Read( aLabel );
+
+// aLabel.Convert( pLotusRoot->eCharsetQ );
+
+ pD->PutCell( aA.Col(), aA.Row(), aA.Tab(), new ScStringCell( aLabel ), (BOOL)TRUE );
+}
+
+
+void ImportLotus::Numbercell( void )
+ {
+ ScAddress aAddr;
+ double fVal;
+
+ Read( aAddr );
+ Read( fVal );
+
+ pD->PutCell( aAddr.Col(), aAddr.Row(), aAddr.Tab(),
+ new ScValueCell( fVal ), (BOOL)TRUE );
+ }
+
+
+void ImportLotus::Smallnumcell( void )
+ {
+ ScAddress aAddr;
+ INT16 nVal;
+
+ Read( aAddr );
+ Read( nVal );
+
+ pD->PutCell( aAddr.Col(), aAddr.Row(), aAddr.Tab(),
+ new ScValueCell( SnumToDouble( nVal ) ), ( BOOL ) TRUE );
+ }
+
+
+ScFormulaCell *ImportLotus::Formulacell( UINT16 n )
+ {
+ DBG_ASSERT( pIn, "-ImportLotus::Formulacell(): Null-Stream -> Rums!" );
+
+ ScAddress aAddr;
+
+ Read( aAddr );
+ Skip( 10 );
+
+ n -= 14;
+
+ const ScTokenArray* pErg;
+ INT32 nRest = n;
+
+ aConv.Reset( aAddr );
+ aConv.SetWK3();
+ aConv.Convert( pErg, nRest );
+
+ ScFormulaCell* pZelle = new ScFormulaCell( pD, aAddr, pErg );
+
+ pZelle->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+
+ pD->PutCell( aAddr.Col(), aAddr.Row(), aAddr.Tab(), pZelle, (BOOL)TRUE );
+
+ return NULL;
+ }
+
+
+void ImportLotus::Read( String &r )
+{
+ ScfTools::AppendCString( *pIn, r, eQuellChar );
+}
+
+
+void ImportLotus::RowPresentation( UINT16 nRecLen )
+{
+ DBG_ASSERT( nRecLen > 4, "*ImportLotus::RowPresentation(): Record zu kurz!" );
+
+ BYTE nLTab, nFlags;
+ UINT16 nRow, nHeight;
+ UINT16 nCnt = ( nRecLen - 4 ) / 8;
+
+ Read( nLTab );
+ Skip( 1 );
+
+ while( nCnt )
+ {
+ Read( nRow );
+ Read( nHeight );
+ Skip( 2 );
+ Read( nFlags );
+ Skip( 1 );
+
+ if( nFlags & 0x02 ) // Fixed / Strech to fit fonts
+ { // fixed
+ // Height in Lotus in 1/32 Points
+ nHeight *= 20; // -> 32 * TWIPS
+ nHeight /= 32; // -> TWIPS
+
+ pD->SetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab), pD->GetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab) ) | CR_MANUALSIZE );
+
+ pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab), nHeight );
+ }
+
+ nCnt--;
+ }
+}
+
+
+void ImportLotus::NamedSheet( void )
+{
+ UINT16 nLTab;
+ String aName;
+
+ Read( nLTab );
+ Read( aName );
+
+ if( pD->HasTable( static_cast<SCTAB> (nLTab) ) )
+ pD->RenameTab( static_cast<SCTAB> (nLTab), aName );
+ else
+ pD->InsertTab( static_cast<SCTAB> (nLTab), aName );
+}
+
+
+void ImportLotus::Font_Face( void )
+{
+ BYTE nNum;
+ String aName;
+
+ Read( nNum );
+
+ // ACHTUNG: QUICK-HACK gegen unerklaerliche Loops
+ if( nNum > 7 )
+ return;
+ // ACHTUNG
+
+ Read( aName );
+
+ pFontBuff->SetName( nNum, aName );
+}
+
+
+void ImportLotus::Font_Type( void )
+{
+ static const UINT16 nAnz = 8;
+ UINT16 nCnt;
+ UINT16 nType;
+
+ for( nCnt = 0 ; nCnt < nAnz ; nCnt++ )
+ {
+ Read( nType );
+ pFontBuff->SetType( nCnt, nType );
+ }
+}
+
+
+void ImportLotus::Font_Ysize( void )
+{
+ static const UINT16 nAnz = 8;
+ UINT16 nCnt;
+ UINT16 nSize;
+
+ for( nCnt = 0 ; nCnt < nAnz ; nCnt++ )
+ {
+ Read( nSize );
+ pFontBuff->SetHeight( nCnt, nSize );
+ }
+}
+
+
+void ImportLotus::_Row( const UINT16 nRecLen )
+ {
+ DBG_ASSERT( nExtTab >= 0, "*ImportLotus::_Row(): Kann hier nicht sein!" );
+
+ UINT16 nRow;
+ UINT16 nHeight;
+ UINT16 nCntDwn = ( nRecLen - 4 ) / 5;
+ SCCOL nColCnt = 0;
+ UINT8 nRepeats;
+ LotAttrWK3 aAttr;
+
+ BOOL bCenter = FALSE;
+ SCCOL nCenterStart = 0, nCenterEnd = 0;
+
+ Read( nRow );
+ Read( nHeight );
+
+ nHeight &= 0x0FFF;
+ nHeight *= 22;
+
+ if( nHeight )
+ pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab), nHeight );
+
+ while( nCntDwn )
+ {
+ Read( aAttr );
+ Read( nRepeats );
+
+ if( aAttr.HasStyles() )
+ pLotusRoot->pAttrTable->SetAttr(
+ nColCnt, static_cast<SCCOL> ( nColCnt + nRepeats ), static_cast<SCROW> (nRow), aAttr );
+
+ // hier und NICHT in class LotAttrTable, weil nur Attributiert wird,
+ // wenn die anderen Attribute gesetzt sind
+ // -> bei Center-Attribute wird generell zentriert gesetzt
+ if( aAttr.IsCentered() )
+ {
+ if( bCenter )
+ {
+ if( pD->HasData( nColCnt, static_cast<SCROW> (nRow), static_cast<SCTAB> (nExtTab) ) )
+ {// neue Center nach vorheriger Center
+ pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+ nCenterStart = nColCnt;
+ }
+ }
+ else
+ {// ganz neue Center
+ bCenter = TRUE;
+ nCenterStart = nColCnt;
+ }
+ nCenterEnd = nColCnt + static_cast<SCCOL>(nRepeats);
+ }
+ else
+ {
+ if( bCenter )
+ {// evtl. alte Center bemachen
+ pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+ bCenter = FALSE;
+ }
+ }
+
+ nColCnt = nColCnt + static_cast<SCCOL>(nRepeats);
+ nColCnt++;
+
+ nCntDwn--;
+ }
+
+ if( bCenter )
+ // evtl. alte Center bemachen
+ pD->DoMerge( static_cast<SCTAB> (nExtTab), nCenterStart, static_cast<SCROW> (nRow), nCenterEnd, static_cast<SCROW> (nRow) );
+ }
+
+
diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx
new file mode 100644
index 000000000000..917337fa91d5
--- /dev/null
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -0,0 +1,324 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+//------------------------------------------------------------------------
+
+#include "document.hxx"
+
+#include "scerrors.hxx"
+#include "root.hxx"
+#include "lotimpop.hxx"
+#include "lotattr.hxx"
+#include "fprogressbar.hxx"
+
+
+class ScFormulaCell;
+
+
+FltError ImportLotus::Read()
+{
+ enum STATE
+ {
+ S_START, // analyse first BOF
+ S_WK1, // in WK1-Stream
+ S_WK3, // in WK3-Section
+ S_WK4, // ...
+ S_FM3, // ...
+ S_END // Import finished
+ };
+
+ UINT16 nOp;
+ UINT16 nSubType;
+ UINT16 nRecLen;
+ UINT32 nNextRec = 0UL;
+ FltError eRet = eERR_OK;
+// ScFormulaCell *pLastFormCell;
+
+ STATE eAkt = S_START;
+
+ nTab = 0;
+ nExtTab = -2;
+
+ pIn->Seek( nNextRec );
+
+ // Progressbar starten
+ ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
+
+ while( eAkt != S_END )
+ {
+ *pIn >> nOp >> nRecLen;
+
+ if( pIn->IsEof() )
+ eAkt = S_END;
+
+ nNextRec += nRecLen + 4;
+
+ switch( eAkt )
+ {
+ // -----------------------------------------------------------
+ case S_START: // S_START
+ if( nOp )
+ {
+ eRet = SCERR_IMPORT_UNKNOWN_WK;
+ eAkt = S_END;
+ }
+ else
+ {
+ if( nRecLen > 2 )
+ {
+ Bof();
+ switch( pLotusRoot->eFirstType )
+ {
+ case Lotus_WK1: eAkt = S_WK1; break;
+ case Lotus_WK3: eAkt = S_WK3; break;
+ case Lotus_WK4: eAkt = S_WK4; break;
+ case Lotus_FM3: eAkt = S_FM3; break;
+ default:
+ eRet = SCERR_IMPORT_UNKNOWN_WK;
+ eAkt = S_END;
+ }
+ }
+ else
+ {
+ eAkt = S_END; // hier kommt wat fuer <= WK1 hinne!
+ eRet = 0xFFFFFFFF;
+ }
+ }
+ break;
+ // -----------------------------------------------------------
+ case S_WK1: // S_WK1
+ break;
+ // -----------------------------------------------------------
+ case S_WK3: // S_WK3
+ case S_WK4: // S_WK4
+ switch( nOp )
+ {
+ case 0x0001: // EOF
+ eAkt = S_FM3;
+ nTab++;
+ break;
+
+ case 0x0002: // PASSWORD
+ eRet = eERR_FILEPASSWD;
+ eAkt = S_END;
+ break;
+
+ case 0x0007: // COLUMNWIDTH
+ Columnwidth( nRecLen );
+ break;
+
+ case 0x0008: // HIDDENCOLUMN
+ Hiddencolumn( nRecLen );
+ break;
+
+ case 0x0009: // USERRANGE
+ Userrange();
+ break;
+
+ case 0x0013: // FORMAT
+
+ break;
+ case 0x0014: // ERRCELL
+ Errcell();
+ break;
+
+ case 0x0015: // NACELL
+ Nacell();
+ break;
+
+ case 0x0016: // LABELCELL
+ Labelcell();
+ break;
+
+ case 0x0017: // NUMBERCELL
+ Numbercell();
+ break;
+
+ case 0x0018: // SMALLNUMCELL
+ Smallnumcell();
+ break;
+
+ case 0x0019: // FORMULACELL
+ Formulacell( nRecLen );
+ break;
+
+ case 0x001b: // extended attributes
+ Read( nSubType );
+ nRecLen -= 2;
+ switch( nSubType )
+ {
+ case 2007: // ROW PRESENTATION
+ RowPresentation( nRecLen );
+ break;
+
+ case 14000: // NAMED SHEET
+ NamedSheet();
+ break;
+ }
+ }
+
+ break;
+ // -----------------------------------------------------------
+ case S_FM3: // S_FM3
+ break;
+ // -----------------------------------------------------------
+ case S_END: // S_END
+ break;
+ // -----------------------------------------------------------
+#ifdef DBG_UTIL
+ default:
+ DBG_ERROR( "*ImportLotus::Read(): State unbekannt!" );
+ eAkt = S_END;
+#endif
+ }
+
+ DBG_ASSERT( nNextRec >= pIn->Tell(),
+ "*ImportLotus::Read(): Etwas zu gierig..." );
+
+ pIn->Seek( nNextRec );
+ aPrgrsBar.Progress();
+ }
+
+ // duemmliche Namen eliminieren
+ SCTAB nTabs = pD->GetTableCount();
+ SCTAB nCnt;
+ String aTabName;
+ String aBaseName;
+ String aRef( RTL_CONSTASCII_USTRINGPARAM( "temp" ) );
+ if( nTabs != 0 )
+ {
+ if( nTabs > 1 )
+ {
+ pD->GetName( 0, aBaseName );
+ aBaseName.Erase( aBaseName.Len() - 1 );
+ }
+ for( nCnt = 1 ; nCnt < nTabs ; nCnt++ )
+ {
+ DBG_ASSERT( pD->HasTable( nCnt ),
+ "-ImportLotus::Read(): Wo ist meine Tabelle?!" );
+ pD->GetName( nCnt, aTabName );
+ if( aTabName == aRef )
+ {
+ aTabName = aBaseName;
+ pD->CreateValidTabName( aTabName );
+ pD->RenameTab( nCnt, aTabName );
+ }
+ }
+ }
+
+ pD->CalcAfterLoad();
+
+ return eRet;
+}
+
+
+FltError ImportLotus::Read( SvStream& rIn )
+{
+ pIn = &rIn;
+
+ BOOL bRead = TRUE;
+ UINT16 nOp;
+ UINT16 nRecLen;
+ UINT32 nNextRec = 0UL;
+ FltError eRet = eERR_OK;
+
+ nTab = 0;
+ nExtTab = -1;
+
+ pIn->Seek( nNextRec );
+
+ // Progressbar starten
+ ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
+
+ while( bRead )
+ {
+ *pIn >> nOp >> nRecLen;
+
+ if( pIn->IsEof() )
+ bRead = FALSE;
+ else
+ {
+ nNextRec += nRecLen + 4;
+
+ switch( nOp )
+ {
+ case 0x0000: // BOF
+ if( nRecLen != 26 || !BofFm3() )
+ {
+ bRead = FALSE;
+ eRet = eERR_FORMAT;
+ }
+ break;
+
+ case 0x0001: // EOF
+ bRead = FALSE;
+ DBG_ASSERT( nTab == 0,
+ "-ImportLotus::Read( SvStream& ): Zweimal EOF nicht erlaubt" );
+ nTab++;
+ break;
+
+ case 174: // FONT_FACE
+ Font_Face();
+ break;
+
+ case 176: // FONT_TYPE
+ Font_Type();
+ break;
+
+ case 177: // FONT_YSIZE
+ Font_Ysize();
+ break;
+
+ case 195:
+ if( nExtTab >= 0 )
+ pLotusRoot->pAttrTable->Apply( ( SCTAB ) nExtTab );
+ nExtTab++;
+ break;
+ case 197:
+ _Row( nRecLen );
+ break;
+ }
+
+ DBG_ASSERT( nNextRec >= pIn->Tell(),
+ "*ImportLotus::Read(): Etwas zu gierig..." );
+ pIn->Seek( nNextRec );
+ aPrgrsBar.Progress();
+ }
+ }
+
+ pLotusRoot->pAttrTable->Apply( ( SCTAB ) nExtTab );
+
+ return eRet;
+}
+
+
+
diff --git a/sc/source/filter/lotus/lotus.cxx b/sc/source/filter/lotus/lotus.cxx
new file mode 100644
index 000000000000..a1a428c5dbeb
--- /dev/null
+++ b/sc/source/filter/lotus/lotus.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#include "lotimpop.hxx"
+
+#include <sfx2/docfile.hxx>
+#include <tools/urlobj.hxx>
+
+#include "scerrors.hxx"
+#include "root.hxx"
+#include "filtopt.hxx"
+#include "ftools.hxx"
+
+//------------------------------------------------------------------------
+
+extern FltError ScImportLotus123old( SvStream&, ScDocument*, CharSet eSrc );
+ // alter Krempel in filter.cxx!
+
+FltError ScFormatFilterPluginImpl::ScImportLotus123( SfxMedium& rMedium, ScDocument* pDocument, CharSet eSrc )
+{
+ ScFilterOptions aFilterOpt;
+ BOOL bWithWK3 = aFilterOpt.GetWK3Flag();
+
+ SvStream* pStream = rMedium.GetInStream();
+
+ if( !pStream )
+ return eERR_OPEN;
+
+ FltError eRet;
+
+ pStream->Seek( 0UL );
+
+ pStream->SetBufferSize( 32768 );
+
+ ImportLotus aLotusImport( *pStream, pDocument, eSrc );
+
+ if( bWithWK3 )
+ eRet = aLotusImport.Read();
+ else
+ eRet = 0xFFFFFFFF; // WK1 /WKS erzwingen
+
+ // ACHTUNG: QUICK-HACK fuer WK1 / WKS <-> WK3 / WK4
+ if( eRet == 0xFFFFFFFF )
+ {
+ pStream->Seek( 0UL );
+
+ pStream->SetBufferSize( 32768 );
+
+ eRet = ScImportLotus123old( *pStream, pDocument, eSrc );
+
+ pStream->SetBufferSize( 0 );
+
+ return eRet;
+ }
+
+ if( eRet != eERR_OK )
+ return eRet;
+
+ if( pLotusRoot->eFirstType == Lotus_WK3 )
+ {// versuchen *.FM3-File zu laden
+ INetURLObject aURL( rMedium.GetURLObject() );
+ aURL.setExtension( CREATE_STRING( "FM3" ) );
+ SfxMedium aMedium( aURL.GetMainURL(INetURLObject::NO_DECODE), STREAM_STD_READ, TRUE );
+ pStream = aMedium.GetInStream();
+ if ( pStream )
+ {
+ if( aLotusImport.Read( *pStream ) != eERR_OK )
+ eRet = SCWARN_IMPORT_WRONG_FM3;
+ }
+ else
+ eRet = SCWARN_IMPORT_OPEN_FM3;
+ }
+
+ return eRet;
+}
+
diff --git a/sc/source/filter/lotus/makefile.mk b/sc/source/filter/lotus/makefile.mk
new file mode 100644
index 000000000000..8fb2360ea2ca
--- /dev/null
+++ b/sc/source/filter/lotus/makefile.mk
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=sc
+TARGET=lotus
+
+PROJECTPCH4DLL=TRUE
+PROJECTPCH=filt_pch
+PROJECTPCHSOURCE=..\pch\filt_pch
+
+AUTOSEG=true
+
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : scpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sc.mk
+
+# --- Files --------------------------------------------------------
+
+SLOFILES = \
+ $(SLO)$/filter.obj \
+ $(SLO)$/lotus.obj \
+ $(SLO)$/lotimpop.obj \
+ $(SLO)$/lotread.obj \
+ $(SLO)$/lotform.obj \
+ $(SLO)$/memory.obj \
+ $(SLO)$/op.obj \
+ $(SLO)$/optab.obj \
+ $(SLO)$/tool.obj \
+ $(SLO)$/expop.obj \
+ $(SLO)$/export.obj \
+ $(SLO)$/lotattr.obj
+
+EXCEPTIONSFILES = \
+ $(SLO)$/op.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/sc/source/filter/lotus/memory.cxx b/sc/source/filter/lotus/memory.cxx
new file mode 100644
index 000000000000..1ac1fa5c470f
--- /dev/null
+++ b/sc/source/filter/lotus/memory.cxx
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+// Bemerkung: Variablen nicht ueber Headerfile, Module muessen sich
+// selbst per extern ihre Sachen besorgen!
+
+
+
+
+#include "scitems.hxx"
+#include <svx/algitem.hxx>
+
+#include "attrib.hxx"
+
+#include "decl.h"
+#include "tool.h"
+
+extern const long nStackSize;
+extern const int nAnzNRange;
+
+extern ScDocument* pDoc;
+
+const long nStackSize = 8L * 1024; // -> form_xxx.cpp
+const int nAnzNRange = 2048; // -> tool_xxx.cpp, max. 2048 Named Ranges
+
+sal_Char* pPuffer; // -> flt_xxx.cxx
+sal_Char* pDummy1; // -> flt_xxx.cxx, ScanVersion()
+sal_Char* pDummy2; // -> tool.cxx, CreateTable()
+
+extern BYTE* pFormelBuffer; // -> tool.cxx, fuer OP_Formula()
+BYTE* pFormelBuffer;
+
+extern FormCache* pValueFormCache; // -> tool.cxx
+
+sal_Char* pStack; // -> formel.cxx
+sal_Char* pPuffer0; // -> formel.cxx
+sal_Char* pPuffer1; // -> formel.cxx
+extern const int nMaxPar;
+const int nMaxPar = 128; // max. 128 Parameter werden unterstuetzt
+sal_Char** pPar; // -> formel.cxx, Pn()
+
+#ifndef _DOS // -> op.cxx
+sal_Char* pAnsi;
+#endif
+sal_Char* pErgebnis; // -> op.cxx
+
+extern BOOL bFormInit; // -> tool.cxx, fuer GetFormHandle()
+BOOL bFormInit;
+
+extern SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter,
+ *pAttrRepeat, *pAttrStandard; // -> tool.cxx, fuer GetFormAttr()
+extern ScProtectionAttr* pAttrUnprot; // -> tool.cxx, fuer PutFormString()
+
+
+
+BOOL MemNew( void )
+{
+ pPuffer = new sal_Char [ 32L*1024L ];
+
+ pDummy1 = new sal_Char [ 32 ];
+
+ pDummy2 = new sal_Char [ 32 ];
+
+ pStack = new sal_Char [ nStackSize * 3 ]; // alle drei auf einmal
+
+ pPuffer0 = pStack + nStackSize;
+ pPuffer1 = pPuffer0 + nStackSize;
+
+ pAnsi = new sal_Char [ 2048 ];
+
+ pErgebnis = new sal_Char [ 32L*1024L ];
+
+ pPar = new sal_Char *[ nMaxPar ];
+
+ pFormelBuffer = new BYTE[ 4096 ];
+
+ pValueFormCache = new FormCache( pDoc );
+
+ // fuer tool.cxx::PutFormString()
+ pAttrUnprot = new ScProtectionAttr( TRUE );
+ pAttrRight = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY );
+ pAttrLeft = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY );
+ pAttrCenter = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY );
+ pAttrRepeat = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_REPEAT, ATTR_HOR_JUSTIFY );
+ pAttrStandard = new SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY );
+ bFormInit = TRUE;
+
+ return TRUE;
+}
+
+
+void MemDelete( void )
+{
+ delete[] pPuffer;
+ delete[] pDummy1;
+ delete[] pDummy2;
+ delete[] pStack;
+ delete[] pAnsi;
+ delete[] pErgebnis;
+ delete[] pPar;
+ delete[] pFormelBuffer;
+
+ delete pValueFormCache;
+ delete pAttrRight;
+ delete pAttrLeft;
+ delete pAttrCenter;
+ delete pAttrRepeat;
+ delete pAttrStandard;
+ delete pAttrUnprot;
+}
+
+
+
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
new file mode 100644
index 000000000000..4ab0c8bb3b14
--- /dev/null
+++ b/sc/source/filter/lotus/op.cxx
@@ -0,0 +1,684 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+//------------------------------------------------------------------------
+
+#include <tools/solar.h>
+#include <rtl/math.hxx>
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+#if defined( ICC )
+#include <stdlib.h>
+#endif
+
+#include "scitems.hxx"
+#include "patattr.hxx"
+#include "docpool.hxx"
+#include <svx/algitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/wghtitem.hxx>
+
+#include "cell.hxx"
+#include "rangenam.hxx"
+#include "document.hxx"
+#include "postit.hxx"
+
+#include "op.h"
+#include "optab.h"
+#include "tool.h"
+//#include "math.h"
+#include "decl.h"
+#include "lotform.hxx"
+#include "lotrange.hxx"
+
+#include "root.hxx"
+
+#include "ftools.hxx"
+
+#include <vector>
+#include <map>
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <ctype.h>
+#if defined( MAC ) || defined( ICC )
+#include <stdlib.h>
+#endif
+
+extern sal_Char* pAnsi; // -> memory.cxx, Puffer zum Umwandeln von OEM->ANSI
+extern sal_Char* pErgebnis; // -> memory.cxx, Ergebnispuffer
+extern WKTYP eTyp; // -> filter.cxx, aktueller Dateityp
+extern BOOL bEOF; // -> filter.cxx, zeigt Dateiende an
+extern sal_Char* pPuffer0; // -> memory.cxx
+extern sal_Char* pPuffer1;
+extern BYTE nDefaultFormat; // -> tool.cxx, Default-Zellenformat
+extern ScDocument* pDoc; // -> filter.cxx, Aufhaenger zum Dokumentzugriff
+extern BYTE* pFormelBuffer; // -> memory.cxx, fuer
+extern CharSet eCharVon; // -> filter.cxx, character set specified
+
+static UINT16 nDefWidth = ( UINT16 ) ( TWIPS_PER_CHAR * 10 );
+
+extern std::map<UINT16, ScPatternAttr> aLotusPatternPool;
+
+void NI( SvStream& r, UINT16 n )
+{
+ r.SeekRel( n );
+}
+
+
+void OP_BOF( SvStream& r, UINT16 /*n*/ )
+{
+ r.SeekRel( 2 ); // Versionsnummer ueberlesen
+}
+
+
+void OP_EOF( SvStream& /*r*/, UINT16 /*n*/ )
+{
+ bEOF = TRUE;
+}
+
+
+void OP_Integer( SvStream& r, UINT16 /*n*/ )
+{
+ BYTE nFormat;
+ UINT16 nCol, nRow;
+ SCTAB nTab = 0;
+ INT16 nValue;
+
+ r >> nFormat >> nCol >> nRow >> nValue;
+
+ ScValueCell* pZelle = new ScValueCell( ( double ) nValue );
+ pDoc->PutCell( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pZelle, ( BOOL ) TRUE );
+
+ // 0 Stellen nach'm Komma!
+ SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, 0 );
+}
+
+
+void OP_Number( SvStream& r, UINT16 /*n*/ )
+{
+ BYTE nFormat;
+ UINT16 nCol, nRow;
+ SCTAB nTab = 0;
+ double fValue;
+
+ r >> nFormat >> nCol >> nRow >> fValue;
+
+ fValue = ::rtl::math::round( fValue, 15 );
+ ScValueCell* pZelle = new ScValueCell( fValue );
+ pDoc->PutCell( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pZelle, ( BOOL ) TRUE );
+
+ SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat );
+}
+
+
+void OP_Label( SvStream& r, UINT16 n )
+{
+ BYTE nFormat;
+ UINT16 nCol, nRow;
+ SCTAB nTab = 0;
+
+ r >> nFormat >> nCol >> nRow;
+ n -= 5;
+
+ sal_Char* pText = new sal_Char[n + 1];
+ r.Read( pText, n );
+ pText[n] = 0;
+
+ nFormat &= 0x80; // Bit 7 belassen
+ nFormat |= 0x75; // protected egal, special-text gesetzt
+
+ PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pText );
+
+ SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezStd );
+
+ delete [] pText;
+}
+
+
+//UNUSED2009-05 void OP_Text( SvStream& r, UINT16 n ) // WK3
+//UNUSED2009-05 {
+//UNUSED2009-05 UINT16 nRow;
+//UNUSED2009-05 BYTE nCol, nTab;
+//UNUSED2009-05 sal_Char pText[ 256 ];
+//UNUSED2009-05
+//UNUSED2009-05 r >> nRow >> nTab >> nCol;
+//UNUSED2009-05 n -= 4;
+//UNUSED2009-05
+//UNUSED2009-05 r.Read( pText, n );
+//UNUSED2009-05 pText[ n ] = 0; // zur Sicherheit Nullterminator anhaengen
+//UNUSED2009-05
+//UNUSED2009-05 PutFormString( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), static_cast<SCTAB> (nTab), pText );
+//UNUSED2009-05 }
+
+
+void OP_Formula( SvStream& r, UINT16 /*n*/ )
+{
+ BYTE nFormat;
+ UINT16 nCol, nRow, nFormulaSize;
+ SCTAB nTab = 0;
+
+ r >> nFormat >> nCol >> nRow;
+ r.SeekRel( 8 ); // Ergebnis ueberspringen
+ r >> nFormulaSize;
+
+ const ScTokenArray* pErg;
+ INT32 nBytesLeft = nFormulaSize;
+ ScAddress aAddress( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab );
+
+ LotusToSc aConv( r, pLotusRoot->eCharsetQ, FALSE );
+ aConv.Reset( aAddress );
+ aConv.Convert( pErg, nBytesLeft );
+
+ ScFormulaCell* pZelle = new ScFormulaCell( pLotusRoot->pDoc, aAddress, pErg );
+
+ pZelle->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+
+ pDoc->PutCell( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, pZelle, ( BOOL ) TRUE );
+
+ // nFormat = Standard -> Nachkommastellen wie Float
+ SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), nTab, nFormat, nDezFloat );
+}
+
+
+void OP_ColumnWidth( SvStream& r, UINT16 /*n*/ )
+{
+ UINT16 nCol, nBreite;
+ BYTE nWidthSpaces;
+ SCTAB nTab = 0;
+
+ r >> nCol >> nWidthSpaces;
+
+ if( nWidthSpaces )
+ // Annahme: 10cpi-Zeichensatz
+ nBreite = ( UINT16 ) ( TWIPS_PER_CHAR * nWidthSpaces );
+ else
+ {
+ pDoc->SetColHidden(static_cast<SCCOL>(nCol), static_cast<SCCOL>(nCol), 0, true);
+ nBreite = nDefWidth;
+ }
+
+ pDoc->SetColWidth( static_cast<SCCOL> (nCol), nTab, nBreite );
+}
+
+
+void OP_NamedRange( SvStream& r, UINT16 /*n*/ )
+ {
+ // POST: waren Koordinaten ungueltig, wird nicht gespeichert
+ UINT16 nColSt, nRowSt, nColEnd, nRowEnd;
+ sal_Char cPuffer[ 32 ];
+
+ r.Read( cPuffer, 16 );
+
+ r >> nColSt >> nRowSt >> nColEnd >> nRowEnd;
+
+ LotusRange* pRange;
+
+ if( nColSt == nColEnd && nRowSt == nRowEnd )
+ pRange = new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) );
+ else
+ pRange = new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt), static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) );
+
+ if( isdigit( *cPuffer ) )
+ { // erstes Zeichen im Namen eine Zahl -> 'A' vor Namen setzen
+ *pAnsi = 'A';
+ strcpy( pAnsi + 1, cPuffer ); // #100211# - checked
+ }
+ else
+ strcpy( pAnsi, cPuffer ); // #100211# - checked
+
+ String aTmp( pAnsi, pLotusRoot->eCharsetQ );
+
+ ScfTools::ConvertToScDefinedName( aTmp );
+
+ pLotusRoot->pRangeNames->Append( pRange, aTmp );
+}
+
+
+void OP_SymphNamedRange( SvStream& r, UINT16 /*n*/ )
+{
+ // POST: waren Koordinaten ungueltig, wird nicht gespeichert
+ UINT16 nColSt, nRowSt, nColEnd, nRowEnd;
+ BYTE nType;
+ sal_Char* pName;
+ sal_Char cPuffer[ 32 ];
+
+ r.Read( cPuffer, 16 );
+ cPuffer[ 16 ] = 0;
+ pName = cPuffer;
+
+ r >> nColSt >> nRowSt >> nColEnd >> nRowEnd >> nType;
+
+ LotusRange* pRange;
+
+ if( nType )
+ pRange = new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt) );
+ else
+ pRange = new LotusRange( static_cast<SCCOL> (nColSt), static_cast<SCROW> (nRowSt), static_cast<SCCOL> (nColEnd), static_cast<SCROW> (nRowEnd) );
+
+ if( isdigit( *cPuffer ) )
+ { // erstes Zeichen im Namen eine Zahl -> 'A' vor Namen setzen
+ *pAnsi = 'A';
+ strcpy( pAnsi + 1, cPuffer ); // #100211# - checked
+ }
+ else
+ strcpy( pAnsi, cPuffer ); // #100211# - checked
+
+ String aTmp( pAnsi, pLotusRoot->eCharsetQ );
+ ScfTools::ConvertToScDefinedName( aTmp );
+
+ pLotusRoot->pRangeNames->Append( pRange, aTmp );
+}
+
+
+void OP_Footer( SvStream& r, UINT16 n )
+{
+ r.SeekRel( n );
+}
+
+
+void OP_Header( SvStream& r, UINT16 n )
+{
+ r.SeekRel( n );
+}
+
+
+void OP_Margins( SvStream& r, UINT16 n )
+{
+ r.SeekRel( n );
+}
+
+
+void OP_HiddenCols( SvStream& r, UINT16 /*n*/ )
+{
+ UINT16 nByte, nBit;
+ SCCOL nCount;
+ BYTE nAkt;
+ nCount = 0;
+
+ for( nByte = 0 ; nByte < 32 ; nByte++ ) // 32 Bytes mit ...
+ {
+ r >> nAkt;
+ for( nBit = 0 ; nBit < 8 ; nBit++ ) // ...jeweils 8 Bits = 256 Bits
+ {
+ if( nAkt & 0x01 ) // unterstes Bit gesetzt?
+ // -> Hidden Col
+ pDoc->SetColHidden(nCount, nCount, 0, true);
+
+ nCount++;
+ nAkt = nAkt / 2; // der Naechste bitte...
+ }
+ }
+}
+
+
+void OP_Window1( SvStream& r, UINT16 n )
+{
+ r.SeekRel( 4 ); // Cursor Pos ueberspringen
+
+ r >> nDefaultFormat;
+
+ r.SeekRel( 1 ); // 'unused' ueberspringen
+
+ r >> nDefWidth;
+
+ r.SeekRel( n - 8 ); // und den Rest ueberspringen
+
+ nDefWidth = ( UINT16 ) ( TWIPS_PER_CHAR * nDefWidth );
+
+ // statt Defaulteinstellung in SC alle Cols zu Fuss setzen
+ for( SCCOL nCol = 0 ; nCol <= MAXCOL ; nCol++ )
+ pDoc->SetColWidth( nCol, 0, nDefWidth );
+}
+
+
+void OP_Blank( SvStream& r, UINT16 /*n*/ )
+{
+ UINT16 nCol, nRow;
+ BYTE nFormat;
+ r >> nFormat >> nCol >> nRow;
+
+ SetFormat( static_cast<SCCOL> (nCol), static_cast<SCROW> (nRow), 0, nFormat, nDezFloat );
+}
+
+void OP_BOF123( SvStream& r, UINT16 /*n*/ )
+{
+ r.SeekRel( 26 );
+}
+
+
+void OP_EOF123( SvStream& /*r*/, UINT16 /*n*/ )
+{
+ bEOF = TRUE;
+}
+
+void OP_Label123( SvStream& r, UINT16 n )
+{
+ BYTE nTab, nCol;
+ UINT16 nRow;
+ r >> nRow >> nTab >> nCol;
+ n -= 4;
+
+ sal_Char* pText = new sal_Char[n + 1];
+ r.Read( pText, n );
+ pText[ n ] = 0;
+
+ PutFormString( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pText );
+
+ delete []pText;
+}
+
+void OP_Number123( SvStream& r, UINT16 /*n*/ )
+{
+ BYTE nCol,nTab;
+ UINT16 nRow;
+ UINT32 nValue;
+
+ r >> nRow >> nTab >> nCol >> nValue;
+ double fValue = Snum32ToDouble( nValue );
+
+ ScValueCell *pCell = new ScValueCell( fValue );
+ pDoc->PutCell( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pCell, (BOOL) TRUE );
+}
+
+void OP_Formula123( SvStream& r, UINT16 n )
+{
+ BYTE nCol,nTab;
+ UINT16 nRow;
+
+ r >> nRow >> nTab >> nCol;
+ r.SeekRel( 8 ); // Result- jump over
+
+ const ScTokenArray* pErg;
+ INT32 nBytesLeft = n - 12;
+ ScAddress aAddress( nCol, nRow, nTab );
+
+ LotusToSc aConv( r, pLotusRoot->eCharsetQ, TRUE );
+ aConv.Reset( aAddress );
+ aConv.Convert( pErg, nBytesLeft );
+
+ ScFormulaCell* pCell = new ScFormulaCell( pLotusRoot->pDoc, aAddress, pErg );
+
+ pCell->AddRecalcMode( RECALCMODE_ONLOAD_ONCE );
+
+ pDoc->PutCell( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pCell, (BOOL) TRUE );
+}
+
+void OP_IEEENumber123( SvStream& r, UINT16 /*n*/ )
+{
+ BYTE nCol,nTab;
+ UINT16 nRow;
+ double dValue;
+
+ r >> nRow >> nTab >> nCol >> dValue;
+
+ ScValueCell *pCell = new ScValueCell(dValue);
+ pDoc->PutCell( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab), pCell, (BOOL) TRUE );
+}
+
+void OP_Note123( SvStream& r, UINT16 n)
+{
+ BYTE nTab, nCol;
+ UINT16 nRow;
+ r >> nRow >> nTab >> nCol;
+ n -= 4;
+
+ sal_Char* pText = new sal_Char[n + 1];
+ r.Read( pText, n );
+ pText[ n ] = 0;
+
+ String aNoteText(pText,pLotusRoot->eCharsetQ);
+ delete [] pText;
+
+ ScAddress aPos( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), static_cast<SCTAB>(nTab) );
+ ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false, false );
+}
+
+void OP_HorAlign123( BYTE nAlignPattern, SfxItemSet& rPatternItemSet )
+{
+// pre: Pattern is stored in the last 3 bites of the 21st byte
+// post: Appropriate Horizontal Alignement is set in rPattern according to the bit pattern.
+//
+// LEFT:001, RIGHT:010, CENTER:011, JUSTIFY:110,
+// LEFT-Text/RIGHT-NUMBER:100, DEFAULT:000
+
+ nAlignPattern = ( nAlignPattern & 0x07);
+
+ switch (nAlignPattern)
+ {
+ case 1:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_LEFT, ATTR_HOR_JUSTIFY ) );
+ break;
+ case 2:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY ) );
+ break;
+ case 3:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY) );
+ break;
+ case 4:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY ) );
+ break;
+ case 6:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_BLOCK, ATTR_HOR_JUSTIFY ) );
+ break;
+ default:
+ rPatternItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_STANDARD, ATTR_HOR_JUSTIFY ) );
+ break;
+ }
+}
+
+void OP_VerAlign123( BYTE nAlignPattern,SfxItemSet& rPatternItemSet )
+{
+// pre: Pattern is stored in the last 3 bites of the 22nd byte
+// post: Appropriate Verticle Alignement is set in rPattern according to the bit pattern.
+//
+// TOP:001, MIDDLE:010, DOWN:100, DEFAULT:000
+
+ nAlignPattern = ( nAlignPattern & 0x07);
+
+ switch (nAlignPattern)
+ {
+ case 0:
+ rPatternItemSet.Put( SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY) );
+ break;
+ case 1:
+ rPatternItemSet.Put( SvxVerJustifyItem(SVX_VER_JUSTIFY_TOP, ATTR_VER_JUSTIFY) );
+ break;
+ case 2:
+ rPatternItemSet.Put( SvxVerJustifyItem(SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY) );
+ break;
+ case 4:
+ rPatternItemSet.Put( SvxVerJustifyItem(SVX_VER_JUSTIFY_BOTTOM, ATTR_VER_JUSTIFY) );
+ break;
+ default:
+ rPatternItemSet.Put( SvxVerJustifyItem(SVX_VER_JUSTIFY_STANDARD, ATTR_VER_JUSTIFY) );
+ break;
+ }
+}
+
+void OP_CreatePattern123( SvStream& r, UINT16 n)
+{
+ UINT16 nCode,nPatternId;
+
+ ScPatternAttr aPattern(pDoc->GetPool());
+ SfxItemSet& rItemSet = aPattern.GetItemSet();
+
+ r >> nCode;
+ n = n - 2;
+
+ if ( nCode == 0x0fd2 )
+ {
+ r >> nPatternId;
+
+ BYTE Hor_Align, Ver_Align, temp;
+ BOOL bIsBold,bIsUnderLine,bIsItalics;
+
+ r.SeekRel(12);
+
+ // Read 17th Byte
+ r >> temp;
+
+ bIsBold = (temp & 0x01);
+ bIsItalics = (temp & 0x02);
+ bIsUnderLine = (temp & 0x04);
+
+ if ( bIsBold )
+ rItemSet.Put( SvxWeightItem(WEIGHT_BOLD,ATTR_FONT_WEIGHT) );
+ if ( bIsItalics )
+ rItemSet.Put( SvxPostureItem(ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
+ if ( bIsUnderLine )
+ rItemSet.Put( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
+
+ r.SeekRel(3);
+
+ // Read 21st Byte
+ r >> Hor_Align;
+ OP_HorAlign123( Hor_Align, rItemSet );
+
+ r >> Ver_Align;
+ OP_VerAlign123( Ver_Align, rItemSet );
+
+ aLotusPatternPool.insert( std::map<UINT16, ScPatternAttr>::value_type( nPatternId, aPattern ) );
+ n = n - 20;
+ }
+ r.SeekRel(n);
+}
+
+void OP_SheetName123( SvStream& rStream, USHORT nLength )
+{
+ if (nLength <= 4)
+ {
+ rStream.SeekRel(nLength);
+ return;
+ }
+
+ // B0 36 [sheet number (2 bytes?)] [sheet name (null terminated char array)]
+
+ sal_uInt16 nDummy;
+ rStream >> nDummy; // ignore the first 2 bytes (B0 36).
+ rStream >> nDummy;
+ SCTAB nSheetNum = static_cast<SCTAB>(nDummy);
+ pDoc->MakeTable(nSheetNum);
+
+ ::std::vector<sal_Char> sSheetName;
+ sSheetName.reserve(nLength-4);
+ for (USHORT i = 4; i < nLength; ++i)
+ {
+ sal_Char c;
+ rStream >> c;
+ sSheetName.push_back(c);
+ }
+
+ if (!sSheetName.empty())
+ {
+ String aName(&sSheetName[0], eCharVon);
+ pDoc->RenameTab(nSheetNum, aName);
+ }
+}
+
+void OP_ApplyPatternArea123( SvStream& rStream )
+{
+ UINT16 nOpcode, nLength;
+ UINT16 nCol = 0, nColCount = 0, nRow = 0, nRowCount = 0, nTab = 0, nData, nTabCount = 0, nLevel = 0;
+
+ do
+ {
+ rStream >> nOpcode >> nLength;
+ switch ( nOpcode )
+ {
+ case ROW_FORMAT_MARKER:
+ nLevel++;
+ break;
+ case COL_FORMAT_MARKER:
+ nLevel--;
+ if( nLevel == 1 )
+ {
+ nTab = nTab + nTabCount;
+ nCol = 0; nColCount = 0;
+ nRow = 0; nRowCount = 0;
+ }
+ break;
+ case LOTUS_FORMAT_INDEX:
+ if( nLength >= 2 )
+ {
+ rStream >> nData;
+ rStream.SeekRel( nLength - 2 );
+ if( nLevel == 1 )
+ nTabCount = nData;
+ else if( nLevel == 2 )
+ {
+ nCol = nCol + nColCount;
+ nColCount = nData;
+ if ( nCol > 0xff ) // 256 is the max col size supported by 123
+ nCol = 0;
+ }
+ else if( nLevel == 3 )
+ {
+ nRow = nRow + nRowCount;
+ nRowCount = nData;
+ if ( nRow > 0x1fff ) // 8192 is the max row size supported by 123
+ nRow = 0;
+ }
+ }
+ else
+ rStream.SeekRel( nLength );
+ break;
+ case LOTUS_FORMAT_INFO:
+ if( nLength >= 2 )
+ {
+ rStream >> nData;
+ rStream.SeekRel( nLength - 2 );
+ for( int i = 0; i < nTabCount; i++)
+ {
+ std::map<UINT16, ScPatternAttr>::iterator loc = aLotusPatternPool.find( nData );
+
+ // #126338# apparently, files with invalid index occur in the wild -> don't crash then
+ DBG_ASSERT( loc != aLotusPatternPool.end(), "invalid format index" );
+ if ( loc != aLotusPatternPool.end() )
+ pDoc->ApplyPatternAreaTab( nCol, nRow, nCol + nColCount - 1, nRow + nRowCount - 1, static_cast< SCTAB >( nTab + i ), loc->second );
+ }
+ }
+ else
+ rStream.SeekRel( nLength );
+ break;
+ default:
+ rStream.SeekRel( nLength );
+ break;
+ }
+ }
+ while( nLevel && !rStream.IsEof() );
+
+ aLotusPatternPool.clear();
+}
diff --git a/sc/source/filter/lotus/optab.cxx b/sc/source/filter/lotus/optab.cxx
new file mode 100644
index 000000000000..503d271a5b74
--- /dev/null
+++ b/sc/source/filter/lotus/optab.cxx
@@ -0,0 +1,248 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+#include "op.h"
+#include "optab.h"
+
+
+// Bearbeitungsfunktion sal_Char *X( sal_Char * )
+OPCODE_FKT pOpFkt[ FKT_LIMIT ] =
+{ // Code
+ OP_BOF, // 0
+ OP_EOF, // 1
+ NI, // 2
+ NI, // 3
+ NI, // 4
+ NI, // 5
+ NI, // 6
+ OP_Window1, // 7
+ OP_ColumnWidth, // 8
+ NI, // 9
+ NI, // 10
+ OP_NamedRange, // 11
+ OP_Blank, // 12
+ OP_Integer, // 13
+ OP_Number, // 14
+ OP_Label, // 15
+ OP_Formula, // 16
+ NI, // 17
+ NI, // 18
+ NI, // 19
+ NI, // 20
+ NI, // 21
+ NI, // 22
+ NI, // 23
+ NI, // 24
+ NI, // 25
+ NI, // 26
+ NI, // 27
+ NI, // 28
+ NI, // 29
+ NI, // 30
+ NI, // 31
+ NI, // 32
+ NI, // 33
+ NI, // 34
+ NI, // 35
+ NI, // 36
+ OP_Footer, // 37
+ OP_Header, // 38
+ NI, // 39
+ OP_Margins, // 40
+ NI, // 41
+ NI, // 42
+ NI, // 43
+ NI, // 44
+ NI, // 45
+ NI, // 46
+ NI, // 47
+ NI, // 48
+ NI, // 49
+ NI, // 50
+ NI, // 51
+ NI, // 52
+ NI, // 53
+ NI, // 54
+ NI, // 55
+ NI, // 56
+ NI, // 57
+ NI, // 58
+ NI, // 59
+ NI, // 60
+ NI, // 61
+ NI, // 62
+ NI, // 63
+ NI, // 64
+ NI, // 65
+ NI, // 66
+ NI, // 67
+ NI, // 68
+ NI, // 69
+ NI, // 70
+ OP_SymphNamedRange, // 71
+ NI, // 72
+ NI, // 73
+ NI, // 74
+ NI, // 75
+ NI, // 76
+ NI, // 77
+ NI, // 78
+ NI, // 79
+ NI, // 80
+ NI, // 81
+ NI, // 82
+ NI, // 83
+ NI, // 84
+ NI, // 85
+ NI, // 86
+ NI, // 87
+ NI, // 88
+ NI, // 89
+ NI, // 90
+ NI, // 91
+ NI, // 92
+ NI, // 93
+ NI, // 94
+ NI, // 95
+ NI, // 96
+ NI, // 97
+ NI, // 98
+ NI, // 99
+ OP_HiddenCols, // 100
+};
+
+
+OPCODE_FKT pOpFkt123[ FKT_LIMIT123 ] =
+{ // Code
+ OP_BOF123, // 0
+ OP_EOF123, // 1
+ NI, // 2
+ NI, // 3
+ NI, // 4
+ NI, // 5
+ NI, // 6
+ NI, // 7
+ NI, // 8
+ NI, // 9
+ NI, // 10
+ NI, // 11
+ NI, // 12
+ NI, // 13
+ NI, // 14
+ NI, // 15
+ NI, // 16
+ NI, // 17
+ NI, // 18
+ NI, // 19
+ NI, // 20
+ NI, // 21
+ OP_Label123, // 22
+ NI, // 23
+ NI, // 24
+ NI, // 25
+ NI, // 26
+ OP_CreatePattern123, // 27
+ NI, // 28
+ NI, // 29
+ NI, // 30
+ NI, // 31
+ NI, // 32
+ NI, // 33
+ NI, // 34
+ OP_SheetName123, // 35
+ NI, // 36
+ OP_Number123, // 37
+ OP_Note123, // 38
+ OP_IEEENumber123, // 39
+ OP_Formula123, // 40
+ NI, // 41
+ NI, // 42
+ NI, // 43
+ NI, // 44
+ NI, // 45
+ NI, // 46
+ NI, // 47
+ NI, // 48
+ NI, // 49
+ NI, // 50
+ NI, // 51
+ NI, // 52
+ NI, // 53
+ NI, // 54
+ NI, // 55
+ NI, // 56
+ NI, // 57
+ NI, // 58
+ NI, // 59
+ NI, // 60
+ NI, // 61
+ NI, // 62
+ NI, // 63
+ NI, // 64
+ NI, // 65
+ NI, // 66
+ NI, // 67
+ NI, // 68
+ NI, // 69
+ NI, // 70
+ NI, // 71
+ NI, // 72
+ NI, // 73
+ NI, // 74
+ NI, // 75
+ NI, // 76
+ NI, // 77
+ NI, // 78
+ NI, // 79
+ NI, // 80
+ NI, // 81
+ NI, // 82
+ NI, // 83
+ NI, // 84
+ NI, // 85
+ NI, // 86
+ NI, // 87
+ NI, // 88
+ NI, // 89
+ NI, // 90
+ NI, // 91
+ NI, // 92
+ NI, // 93
+ NI, // 94
+ NI, // 95
+ NI, // 96
+ NI, // 97
+ NI, // 98
+ NI, // 99
+ NI // 100
+};
+
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
new file mode 100644
index 000000000000..0e99b1140c2a
--- /dev/null
+++ b/sc/source/filter/lotus/tool.cxx
@@ -0,0 +1,651 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+//------------------------------------------------------------------------
+
+#include "scitems.hxx"
+#include <svx/algitem.hxx>
+#include <svl/zforlist.hxx>
+#include <tools/solar.h>
+
+#include "cell.hxx"
+#include "rangenam.hxx"
+#include "compiler.hxx"
+
+#include "tool.h"
+#include "decl.h"
+#include "root.hxx"
+#include "lotrange.hxx"
+#include "namebuff.hxx"
+#include "ftools.hxx"
+
+#include <math.h>
+
+#ifdef _MSC_VER
+#pragma optimize("",off)
+#endif
+
+//--------------------------------------------------------- EXTERNE VARIABLEN -
+extern WKTYP eTyp; // -> filter.cxx, aktueller Dateityp
+extern sal_Char* pDummy2; // -> memory.cxx
+extern ScDocument* pDoc; // -> filter.cxx, Aufhaenger zum Dokumentzugriff
+extern CharSet eCharNach; // -> filter.cxx, Zeichenkonvertierung von->nach
+
+extern BOOL bFormInit; // -> memory.cxx, fuer GetFormHandle()
+
+//--------------------------------------------------------- GLOBALE VARIABLEN -
+BYTE nDefaultFormat; // -> op.cpp, Standard-Zellenformat
+
+extern SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
+extern ScProtectionAttr* pAttrUnprot;
+extern SfxUInt32Item** pAttrValForms;
+
+SvxHorJustifyItem *pAttrRight, *pAttrLeft, *pAttrCenter, *pAttrRepeat, *pAttrStandard;
+ // -> in memory.cxx initialisiert
+ScProtectionAttr* pAttrUnprot; // -> " memory.cxx "
+
+extern FormCache* pValueFormCache; // -> in memory.cxx initialisiert
+FormCache* pValueFormCache;
+
+SCCOL LotusRangeList::nEingCol;
+SCROW LotusRangeList::nEingRow;
+
+
+
+
+void PutFormString( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Char* pString )
+{
+ // Label-Format-Auswertung
+ DBG_ASSERT( pString != NULL, "PutFormString(): pString == NULL" );
+
+ sal_Char cForm;
+ SvxHorJustifyItem* pJustify = NULL;
+
+ cForm = *pString;
+
+ switch( cForm )
+ {
+ case '"': // rechtsbuendig
+ pJustify = pAttrRight;
+ pString++;
+ break;
+ case '\'': // linksbuendig
+ pJustify = pAttrLeft;
+ pString++;
+ break;
+ case '^': // zentriert
+ pJustify = pAttrCenter;
+ pString++;
+ break;
+ case '|': // printer command
+ pString = NULL;
+ break;
+ case '\\': // Wiederholung
+ pJustify = pAttrRepeat;
+ pString++;
+ break;
+ default: // kenn' ich nicht!
+ pJustify = pAttrStandard;
+ }
+
+ if( pString )
+ {
+ pDoc->ApplyAttr( nCol, nRow, nTab, *pJustify );
+ ScStringCell* pZelle = new ScStringCell( String( pString, pLotusRoot->eCharsetQ ) );
+ pDoc->PutCell( nCol, nRow, nTab, pZelle, ( BOOL ) TRUE );
+ }
+}
+
+
+
+
+void SetFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, BYTE nFormat, BYTE nSt )
+{
+ // PREC: nSt = Standard-Dezimalstellenanzahl
+ pDoc->ApplyAttr( nCol, nRow, nTab, *( pValueFormCache->GetAttr( nFormat, nSt ) ) );
+
+ ScProtectionAttr aAttr;
+
+ aAttr.SetProtection( nFormat & 0x80 );
+
+ pDoc->ApplyAttr( nCol, nRow, nTab, aAttr );
+}
+
+void InitPage( void )
+{ // Seitenformat initialisieren, d.h. Default-Werte von SC holen
+ //scGetPageFormat( 0, &aPage );
+}
+
+
+double SnumToDouble( INT16 nVal )
+{
+ const double pFacts[ 8 ] = {
+ 5000.0,
+ 500.0,
+ 0.05,
+ 0.005,
+ 0.0005,
+ 0.00005,
+ 0.0625,
+ 0.015625 };
+
+ double fVal;
+
+ if( nVal & 0x0001 )
+ {
+ fVal = pFacts[ ( nVal >> 1 ) & 0x0007 ];
+ fVal *= ( INT16 ) ( nVal >> 4 );
+ }
+ else
+ fVal = ( INT16 ) ( nVal >> 1 );
+
+ return fVal;
+}
+
+double Snum32ToDouble( UINT32 nValue )
+{
+ double fValue, temp;
+
+ fValue = nValue >> 6;
+ temp = nValue & 0x0f;
+ if (temp)
+ {
+ if (nValue & 0x00000010)
+ fValue /= pow((double)10, temp);
+ else
+ fValue *= pow((double)10, temp);
+ }
+
+ if ((nValue & 0x00000020))
+ fValue = -fValue;
+ return fValue;
+}
+
+
+FormCache::FormCache( ScDocument* pDoc1, BYTE nNewDefaultFormat )
+{ // Default-Format ist 'Default'
+ nDefaultFormat = nNewDefaultFormat;
+ pFormTable = pDoc1->GetFormatTable();
+ for( UINT16 nC = 0 ; nC < __nSize ; nC++ )
+ bValid[ nC ] = FALSE;
+ eLanguage = ScGlobal::eLnge;
+}
+
+
+FormCache::~FormCache()
+{
+ for( UINT16 nC = 0 ; nC < __nSize ; nC++ )
+ delete aIdents[ nC ].GetAttr();
+}
+
+
+SfxUInt32Item* FormCache::NewAttr( BYTE nFormat, BYTE nSt )
+{
+ // neues Format erzeugen
+ BYTE nL, nH; // Low-/High-Nibble
+ BYTE nForm = nFormat;
+ String aFormString;
+ const sal_Char* pFormString = 0;
+ INT16 eType = NUMBERFORMAT_ALL;
+ UINT32 nIndex1;
+ UINT32 nHandle;
+ BOOL bDefault = FALSE;
+ //void GenerateFormat( aFormString, eType, COUNTRY_SYSTEM, LANGUAGE_SYSTEM,
+ // BOOL bThousand, BOOL IsRed, UINT16 nPrecision, UINT16 nAnzLeading );
+
+ if( nForm == 0xFF ) // Default-Format?
+ nForm = nDefaultFormat;
+
+ // Aufdroeseln in Low- und High-Nibble
+ nL = nFormat & 0x0F;
+ nH = ( nFormat & 0xF0 ) / 16;
+
+ nH &= 0x07; // Bits 4-6 'rausziehen
+ switch( nH )
+ {
+ case 0x00: // Festkommaformat (fixed)
+ //fStandard;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ break;
+ case 0x01: // Exponentdarstellung (scientific notation)
+ //fExponent;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_SCIENTIFIC, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ break;
+ case 0x02: // Waehrungsdarstellung (currency)
+ //fMoney;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_CURRENCY, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ break;
+ case 0x03: // Prozent
+ //fPercent;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_PERCENT, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ break;
+ case 0x04: // Komma
+ //fStandard;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, TRUE, FALSE, nL, 1 );
+ break;
+ case 0x05: // frei
+ //fStandard;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ break;
+ case 0x06: // frei
+ //fStandard;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ nIndex1 = 0;
+ break;
+ case 0x07: // Spezialformat
+ switch( nL )
+ {
+ case 0x00: // +/-
+ //fStandard;nSt;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, TRUE, nSt, 1 );
+ break;
+ case 0x01: // generelles Format
+ //fStandard;nSt;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nSt, 1 );
+ break;
+ case 0x02: // Datum: Tag, Monat, Jahr
+ //fDate;dfDayMonthYearLong;
+ eType = NUMBERFORMAT_DATE;
+ pFormString = "TT.MM.JJJJ";
+ break;
+ case 0x03: // Datum: Tag, Monat
+ //fDate;dfDayMonthLong;
+ eType = NUMBERFORMAT_DATE;
+ pFormString = "TT.MMMM";
+ break;
+ case 0x04: // Datum: Monat, Jahr
+ //fDate;dfMonthYearLong;
+ eType = NUMBERFORMAT_DATE;
+ pFormString = "MM.JJJJ";
+ break;
+ case 0x05: // Textformate
+ //fString;nSt;
+ eType = NUMBERFORMAT_TEXT;
+ pFormString = "@";
+ break;
+ case 0x06: // versteckt
+ //wFlag |= paHideAll;bSetFormat = FALSE;
+ eType = NUMBERFORMAT_NUMBER;
+ pFormString = "";
+ break;
+ case 0x07: // Time: hour, min, sec
+ //fTime;tfHourMinSec24;
+ eType = NUMBERFORMAT_TIME;
+ pFormString = "HH:MM:SS";
+ break;
+ case 0x08: // Time: hour, min
+ //fTime;tfHourMin24;
+ eType = NUMBERFORMAT_TIME;
+ pFormString = "HH:MM";
+ break;
+ case 0x09: // Date, intern INT32 1
+ //fDate;dfDayMonthYearLong;
+ eType = NUMBERFORMAT_DATE;
+ pFormString = "TT.MM.JJJJ";
+ break;
+ case 0x0A: // Date, intern INT32 2
+ //fDate;dfDayMonthYearLong;
+ eType = NUMBERFORMAT_DATE;
+ pFormString = "TT.MM.JJJJ";
+ break;
+ case 0x0B: // Time, intern INT32 1
+ //fTime;tfHourMinSec24;
+ eType = NUMBERFORMAT_TIME;
+ pFormString = "HH:MM:SS";
+ break;
+ case 0x0C: // Time, intern INT32 2
+ //fTime;tfHourMinSec24;
+ eType = NUMBERFORMAT_TIME;
+ pFormString = "HH:MM:SS";
+ break;
+ case 0x0F: // Standardeinstellung
+ //fStandard;nSt;
+ bDefault = TRUE;
+ break;
+ default:
+ //fStandard;nSt;
+ bDefault = TRUE;
+ break;
+ }
+ break;
+ default:
+ //fStandard;nL;
+ nIndex1 = pFormTable->GetStandardFormat(
+ NUMBERFORMAT_NUMBER, eLanguage );
+ pFormTable->GenerateFormat( aFormString, nIndex1,
+ eLanguage, FALSE, FALSE, nL, 1 );
+ nIndex1 = 0;
+ break;
+ }
+
+ // Format in Table schieben
+ if( bDefault )
+ nHandle = 0;
+ else
+ {
+ if( pFormString )
+ aFormString.AssignAscii( pFormString );
+
+ xub_StrLen nDummy;
+ pFormTable->PutEntry( aFormString, nDummy, eType, nHandle, eLanguage );
+ }
+
+ return new SfxUInt32Item( ATTR_VALUE_FORMAT, ( UINT32 ) nHandle );
+}
+
+
+
+
+void LotusRange::MakeHash( void )
+{
+ // 33222222222211111111110000000000
+ // 10987654321098765432109876543210
+ // ******** nColS
+ // ******** nColE
+ // **************** nRowS
+ // **************** nRowE
+ nHash = static_cast<UINT32>(nColStart);
+ nHash += static_cast<UINT32>(nColEnd) << 6;
+ nHash += static_cast<UINT32>(nRowStart) << 12;
+ nHash += static_cast<UINT32>(nRowEnd ) << 16;
+}
+
+
+LotusRange::LotusRange( SCCOL nCol, SCROW nRow )
+{
+ nColStart = nColEnd = nCol;
+ nRowStart = nRowEnd = nRow;
+ nId = ID_FAIL;
+ MakeHash();
+}
+
+
+LotusRange::LotusRange( SCCOL nCS, SCROW nRS, SCCOL nCE, SCROW nRE )
+{
+ nColStart = nCS;
+ nColEnd = nCE;
+ nRowStart = nRS;
+ nRowEnd = nRE;
+ nId = ID_FAIL;
+ MakeHash();
+}
+
+
+LotusRange::LotusRange( const LotusRange& rCpy )
+{
+ Copy( rCpy );
+}
+
+
+
+
+
+LotusRangeList::LotusRangeList( void )
+{
+ aComplRef.InitFlags();
+
+ ScSingleRefData* pSingRef;
+ nIdCnt = 1;
+
+ pSingRef = &aComplRef.Ref1;
+ pSingRef->nTab = pSingRef->nRelTab = 0;
+ pSingRef->SetColRel( FALSE );
+ pSingRef->SetRowRel( FALSE );
+ pSingRef->SetTabRel( TRUE );
+ pSingRef->SetFlag3D( FALSE );
+
+ pSingRef = &aComplRef.Ref2;
+ pSingRef->nTab = pSingRef->nRelTab = 0;
+ pSingRef->SetColRel( FALSE );
+ pSingRef->SetRowRel( FALSE );
+ pSingRef->SetTabRel( TRUE );
+ pSingRef->SetFlag3D( FALSE );
+}
+
+
+LotusRangeList::~LotusRangeList( void )
+ {
+ LotusRange *pDel = ( LotusRange * ) List::First();
+
+ while( pDel )
+ {
+ delete pDel;
+ pDel = ( LotusRange * ) List::Next();
+ }
+ }
+
+
+LR_ID LotusRangeList::GetIndex( const LotusRange &rRef )
+{
+ LotusRange* pComp = ( LotusRange* ) List::First();
+
+ while( pComp )
+ {
+ if( *pComp == rRef )
+ return pComp->nId;
+ pComp = ( LotusRange* ) List::Next();
+ }
+
+ return ID_FAIL;
+}
+
+
+void LotusRangeList::Append( LotusRange* pLR, const String& rName )
+{
+ DBG_ASSERT( pLR, "*LotusRangeList::Append(): das wird nichts!" );
+ List::Insert( pLR, CONTAINER_APPEND );
+
+ ScTokenArray aTokArray;
+
+ ScSingleRefData* pSingRef = &aComplRef.Ref1;
+
+ pSingRef->nCol = pLR->nColStart;
+ pSingRef->nRow = pLR->nRowStart;
+
+ if( pLR->IsSingle() )
+ aTokArray.AddSingleReference( *pSingRef );
+ else
+ {
+ pSingRef = &aComplRef.Ref2;
+ pSingRef->nCol = pLR->nColEnd;
+ pSingRef->nRow = pLR->nRowEnd;
+ aTokArray.AddDoubleReference( aComplRef );
+ }
+
+ ScRangeData* pData = new ScRangeData(
+ pLotusRoot->pDoc, rName, aTokArray );
+
+ pLotusRoot->pScRangeName->Insert( pData );
+
+ pLR->SetId( nIdCnt );
+
+ nIdCnt++;
+}
+
+
+
+
+RangeNameBufferWK3::RangeNameBufferWK3( void )
+{
+ pScTokenArray = new ScTokenArray;
+ nIntCount = 1;
+}
+
+
+RangeNameBufferWK3::~RangeNameBufferWK3()
+{
+ ENTRY* pDel = ( ENTRY* ) List::First();
+
+ while( pDel )
+ {
+ delete pDel;
+ pDel = ( ENTRY* ) List::Next();
+ }
+
+ delete pScTokenArray;
+}
+
+
+void RangeNameBufferWK3::Add( const String& rOrgName, const ScComplexRefData& rCRD )
+{
+ String aScName( rOrgName );
+ ScfTools::ConvertToScDefinedName( aScName );
+
+ register ENTRY* pInsert = new ENTRY( rOrgName, aScName, rCRD );
+
+ List::Insert( pInsert, CONTAINER_APPEND );
+
+ pScTokenArray->Clear();
+
+ register const ScSingleRefData& rRef1 = rCRD.Ref1;
+ register const ScSingleRefData& rRef2 = rCRD.Ref2;
+
+ if( rRef1.nCol == rRef2.nCol && rRef1.nRow == rRef2.nRow && rRef1.nTab == rRef2.nTab )
+ {
+ pScTokenArray->AddSingleReference( rCRD.Ref1 );
+ pInsert->bSingleRef = TRUE;
+ }
+ else
+ {
+ pScTokenArray->AddDoubleReference( rCRD );
+ pInsert->bSingleRef = FALSE;
+ }
+
+ ScRangeData* pData = new ScRangeData( pLotusRoot->pDoc, aScName, *pScTokenArray );
+
+ pInsert->nRelInd = nIntCount;
+ pData->SetIndex( nIntCount );
+ nIntCount++;
+
+ pLotusRoot->pScRangeName->Insert( pData );
+}
+
+
+BOOL RangeNameBufferWK3::FindRel( const String& rRef, UINT16& rIndex )
+{
+ StringHashEntry aRef( rRef );
+
+ ENTRY* pFind = ( ENTRY* ) List::First();
+
+ while( pFind )
+ {
+ if( aRef == pFind->aStrHashEntry )
+ {
+ rIndex = pFind->nRelInd;
+ return TRUE;
+ }
+ pFind = ( ENTRY* ) List::Next();
+ }
+
+ return FALSE;
+}
+
+
+BOOL RangeNameBufferWK3::FindAbs( const String& rRef, UINT16& rIndex )
+{
+ String aTmp( rRef );
+ StringHashEntry aRef( aTmp.Erase( 0, 1 ) ); // ohne '$' suchen!
+
+ ENTRY* pFind = ( ENTRY* ) List::First();
+
+ while( pFind )
+ {
+ if( aRef == pFind->aStrHashEntry )
+ {
+ // eventuell neuen Range Name aufbauen
+ if( pFind->nAbsInd )
+ rIndex = pFind->nAbsInd;
+ else
+ {
+ ScSingleRefData* pRef = &pFind->aScComplexRefDataRel.Ref1;
+ pScTokenArray->Clear();
+
+ pRef->SetColRel( FALSE );
+ pRef->SetRowRel( FALSE );
+ pRef->SetTabRel( TRUE );
+
+ if( pFind->bSingleRef )
+ pScTokenArray->AddSingleReference( *pRef );
+ else
+ {
+ pRef = &pFind->aScComplexRefDataRel.Ref2;
+ pRef->SetColRel( FALSE );
+ pRef->SetRowRel( FALSE );
+ pRef->SetTabRel( TRUE );
+ pScTokenArray->AddDoubleReference( pFind->aScComplexRefDataRel );
+ }
+
+ ScRangeData* pData = new ScRangeData( pLotusRoot->pDoc, pFind->aScAbsName, *pScTokenArray );
+
+ rIndex = pFind->nAbsInd = nIntCount;
+ pData->SetIndex( rIndex );
+ nIntCount++;
+
+ pLotusRoot->pScRangeName->Insert( pData );
+ }
+
+ return TRUE;
+ }
+ pFind = ( ENTRY* ) List::Next();
+ }
+
+ return FALSE;
+}
+
+