summaryrefslogtreecommitdiff
path: root/sc/source/filter
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 17:07:02 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-03-26 17:07:02 +0000
commit555d702903fb0857122024e1ab78a72d122d3f16 (patch)
tree6c749e09d7b761f4ce353bedcc31627a38529196 /sc/source/filter
parentff721adbe05f7a6659d9dffcf46c671f8a644da7 (diff)
MWS_SRX644: migrate branch mws_srx644 -> HEAD
Diffstat (limited to 'sc/source/filter')
-rw-r--r--sc/source/filter/dif/difexp.cxx245
-rw-r--r--sc/source/filter/dif/difimp.cxx162
-rw-r--r--sc/source/filter/excel/biffdump.cxx1763
-rw-r--r--sc/source/filter/excel/biffrecdumper.ini1
-rw-r--r--sc/source/filter/excel/colrowst.cxx7
-rw-r--r--sc/source/filter/excel/excdoc.cxx213
-rw-r--r--sc/source/filter/excel/excel.cxx4
-rw-r--r--sc/source/filter/excel/excform.cxx13
-rw-r--r--sc/source/filter/excel/excform8.cxx11
-rw-r--r--sc/source/filter/excel/excimp8.cxx343
-rw-r--r--sc/source/filter/excel/excobj.cxx19
-rw-r--r--sc/source/filter/excel/excrecds.cxx660
-rw-r--r--sc/source/filter/excel/exctools.cxx85
-rw-r--r--sc/source/filter/excel/expop2.cxx15
-rw-r--r--sc/source/filter/excel/fontbuff.cxx4
-rw-r--r--sc/source/filter/excel/impop.cxx120
-rw-r--r--sc/source/filter/excel/makefile.mk5
-rw-r--r--sc/source/filter/excel/namebuff.cxx18
-rw-r--r--sc/source/filter/excel/read.cxx44
-rw-r--r--sc/source/filter/excel/xecontent.cxx4
-rw-r--r--sc/source/filter/excel/xehelper.cxx27
-rw-r--r--sc/source/filter/excel/xelink.cxx4
-rw-r--r--sc/source/filter/excel/xerecord.cxx36
-rw-r--r--sc/source/filter/excel/xeroot.cxx25
-rw-r--r--sc/source/filter/excel/xestream.cxx4
-rw-r--r--sc/source/filter/excel/xestyle.cxx811
-rw-r--r--sc/source/filter/excel/xicontent.cxx11
-rw-r--r--sc/source/filter/excel/xihelper.cxx20
-rw-r--r--sc/source/filter/excel/xilink.cxx21
-rw-r--r--sc/source/filter/excel/xiroot.cxx51
-rw-r--r--sc/source/filter/excel/xistream.cxx34
-rw-r--r--sc/source/filter/excel/xistyle.cxx578
-rw-r--r--sc/source/filter/excel/xlocx.cxx286
-rw-r--r--sc/source/filter/excel/xlroot.cxx26
-rw-r--r--sc/source/filter/excel/xlstyle.cxx8
-rw-r--r--sc/source/filter/excel/xltools.cxx72
-rw-r--r--sc/source/filter/ftools/fapihelper.cxx8
-rw-r--r--sc/source/filter/ftools/fprogressbar.cxx131
-rw-r--r--sc/source/filter/ftools/ftools.cxx123
-rw-r--r--sc/source/filter/ftools/makefile.mk4
-rw-r--r--sc/source/filter/html/htmlimp.cxx31
-rw-r--r--sc/source/filter/html/htmlpars.cxx1964
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx4
-rw-r--r--sc/source/filter/inc/XclImpChangeTrack.hxx4
-rw-r--r--sc/source/filter/inc/colrowst.hxx4
-rw-r--r--sc/source/filter/inc/dif.hxx119
-rw-r--r--sc/source/filter/inc/eeparser.hxx14
-rw-r--r--sc/source/filter/inc/excdefs.hxx9
-rw-r--r--sc/source/filter/inc/excdoc.hxx4
-rw-r--r--sc/source/filter/inc/excform.hxx6
-rw-r--r--sc/source/filter/inc/excimp8.hxx30
-rw-r--r--sc/source/filter/inc/excrecds.hxx185
-rw-r--r--sc/source/filter/inc/exp_op.hxx4
-rw-r--r--sc/source/filter/inc/fapihelper.hxx4
-rw-r--r--sc/source/filter/inc/filt_pch.hxx6
-rw-r--r--sc/source/filter/inc/fprogressbar.hxx152
-rw-r--r--sc/source/filter/inc/ftools.hxx64
-rw-r--r--sc/source/filter/inc/htmlpars.hxx616
-rw-r--r--sc/source/filter/inc/imp_op.hxx5
-rw-r--r--sc/source/filter/inc/lotimpop.hxx4
-rw-r--r--sc/source/filter/inc/namebuff.hxx10
-rw-r--r--sc/source/filter/inc/root.hxx12
-rw-r--r--sc/source/filter/inc/scflt.hxx8
-rw-r--r--sc/source/filter/inc/xcl97dum.hxx26
-rw-r--r--sc/source/filter/inc/xcl97esc.hxx11
-rw-r--r--sc/source/filter/inc/xcl97rec.hxx156
-rw-r--r--sc/source/filter/inc/xecontent.hxx4
-rw-r--r--sc/source/filter/inc/xehelper.hxx9
-rw-r--r--sc/source/filter/inc/xelink.hxx4
-rw-r--r--sc/source/filter/inc/xerecord.hxx52
-rw-r--r--sc/source/filter/inc/xeroot.hxx11
-rw-r--r--sc/source/filter/inc/xestream.hxx4
-rw-r--r--sc/source/filter/inc/xestyle.hxx294
-rw-r--r--sc/source/filter/inc/xicontent.hxx6
-rw-r--r--sc/source/filter/inc/xihelper.hxx9
-rw-r--r--sc/source/filter/inc/xilink.hxx9
-rw-r--r--sc/source/filter/inc/xiroot.hxx20
-rw-r--r--sc/source/filter/inc/xistream.hxx20
-rw-r--r--sc/source/filter/inc/xistyle.hxx122
-rw-r--r--sc/source/filter/inc/xlconst.hxx83
-rw-r--r--sc/source/filter/inc/xlocx.hxx158
-rw-r--r--sc/source/filter/inc/xlroot.hxx25
-rw-r--r--sc/source/filter/inc/xlstyle.hxx29
-rw-r--r--sc/source/filter/inc/xltools.hxx25
-rw-r--r--sc/source/filter/lotus/filter.cxx12
-rw-r--r--sc/source/filter/lotus/lotform.cxx4
-rw-r--r--sc/source/filter/lotus/lotimpop.cxx4
-rw-r--r--sc/source/filter/lotus/lotread.cxx13
-rw-r--r--sc/source/filter/lotus/op.cxx12
-rw-r--r--sc/source/filter/lotus/tool.cxx6
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx23
-rw-r--r--sc/source/filter/starcalc/scflt.cxx21
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx4
-rw-r--r--sc/source/filter/xcl97/XclImpChangeTrack.cxx4
-rw-r--r--sc/source/filter/xcl97/makefile.mk5
-rw-r--r--sc/source/filter/xcl97/xcl97dum.cxx131
-rw-r--r--sc/source/filter/xcl97/xcl97esc.cxx106
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx404
-rw-r--r--sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx7
-rw-r--r--sc/source/filter/xml/XMLConverter.cxx9
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.cxx4
-rw-r--r--sc/source/filter/xml/XMLStylesExportHelper.hxx4
-rw-r--r--sc/source/filter/xml/XMLTableMasterPageExport.cxx12
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx7
-rw-r--r--sc/source/filter/xml/xmldrani.cxx16
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx99
-rw-r--r--sc/source/filter/xml/xmlexprt.hxx15
-rw-r--r--sc/source/filter/xml/xmlwrap.cxx16
108 files changed, 7052 insertions, 4238 deletions
diff --git a/sc/source/filter/dif/difexp.cxx b/sc/source/filter/dif/difexp.cxx
index 9fb53e904930..59f8cc1bf2d0 100644
--- a/sc/source/filter/dif/difexp.cxx
+++ b/sc/source/filter/dif/difexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: difexp.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: er $ $Date: 2002-12-06 17:26:49 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,7 +67,7 @@
//------------------------------------------------------------------------
-#include <tools/solmath.hxx>
+#include <rtl/math.hxx>
#include <stdio.h>
@@ -79,6 +79,9 @@
#include "global.hxx"
#include "progress.hxx"
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
FltError ScExportDif( SvStream& rStream, ScDocument* pDoc,
const ScAddress& rOutPos, const CharSet eNach, UINT32 nDifOption )
@@ -94,42 +97,53 @@ FltError ScExportDif( SvStream& rStream, ScDocument* pDoc,
}
-void lcl_EscapeQuotes( ByteString& rString )
-{
- // Quotes in (quoted) strings have to be escaped (duplicated)
- // (at least Excel and Quattro do it that way)
-
- // This has to be done after converting the string to 8-bit characters,
- // because different characters (typographic quotes) might get converted
- // into quote characters.
-
- xub_StrLen nPos = 0;
- while( ( nPos = rString.Search( (sal_Char)'"', nPos ) ) != STRING_NOTFOUND )
- {
- rString.Insert( (sal_Char)'"', nPos );
- nPos += 2;
- }
-}
-
-
FltError ScExportDif( SvStream& rOut, ScDocument* pDoc,
- const ScRange&rRange, const CharSet eNach, UINT32 nDifOption )
+ const ScRange&rRange, const CharSet eCharSet, UINT32 nDifOption )
{
DBG_ASSERT( rRange.aStart <= rRange.aEnd, "*ScExportDif(): Range unsortiert!" );
DBG_ASSERTWARNING( rRange.aStart.Tab() == rRange.aEnd.Tab(),
"ScExportDif(): nur eine Tabelle bidde!" );
+ const CharSet eStreamCharSet = rOut.GetStreamCharSet();
+ if ( eStreamCharSet != eCharSet )
+ rOut.SetStreamCharSet( eCharSet );
+
+ sal_Unicode cStrDelim('"');
+ ByteString aStrDelimEncoded; // only used if not Unicode
+ UniString aStrDelimDecoded; // only used if context encoding
+ BOOL bContextOrNotAsciiEncoding;
+ if ( eCharSet == RTL_TEXTENCODING_UNICODE )
+ {
+ rOut.StartWritingUnicodeText();
+ bContextOrNotAsciiEncoding = FALSE;
+ }
+ else
+ {
+ aStrDelimEncoded = ByteString( cStrDelim, eCharSet );
+ rtl_TextEncodingInfo aInfo;
+ aInfo.StructSize = sizeof(aInfo);
+ if ( rtl_getTextEncodingInfo( eCharSet, &aInfo ) )
+ {
+ bContextOrNotAsciiEncoding =
+ (((aInfo.Flags & RTL_TEXTENCODING_INFO_CONTEXT) != 0) ||
+ ((aInfo.Flags & RTL_TEXTENCODING_INFO_ASCII) == 0));
+ if ( bContextOrNotAsciiEncoding )
+ aStrDelimDecoded = String( aStrDelimEncoded, eCharSet );
+ }
+ else
+ bContextOrNotAsciiEncoding = FALSE;
+ }
+
const sal_Char* p2DoubleQuotes_LF = "\"\"\n";
const sal_Char* pSpecDataType_LF = "-1,0\n";
const sal_Char* pEmptyData = "1,0\n\"\"\n";
- const sal_Char* pStringData = "1,0\n\"";
+ const sal_Char* pStringData = "1,0\n";
const sal_Char* pNumData = "0,";
const sal_Char* pNumDataERROR = "0,0\nERROR\n";
FltError eRet = eERR_OK;
- ByteString aTmp;
- ByteString aOS;
- String aUniString;
+ String aOS;
+ String aString;
UINT16 nEndCol = rRange.aEnd.Col();
UINT16 nEndRow = rRange.aEnd.Row();
UINT16 nNumCols = nEndCol - rRange.aStart.Col() + 1;
@@ -140,7 +154,7 @@ FltError ScExportDif( SvStream& rOut, ScDocument* pDoc,
const BOOL bPlain = ( nDifOption == SC_DIFOPT_PLAIN );
- ScProgress aPrgrsBar( NULL, ScGlobal::GetRscString( STR_LOAD_DOC ), nNumRows );
+ ScProgress aPrgrsBar( pDoc->GetDocumentShell(), ScGlobal::GetRscString( STR_LOAD_DOC ), nNumRows );
aPrgrsBar.SetState( 0 );
@@ -148,41 +162,47 @@ FltError ScExportDif( SvStream& rOut, ScDocument* pDoc,
DBG_ASSERT( pDoc->HasTable( nTab ), "*ScExportDif(): Tabelle nicht vorhanden!" );
aOS = pKeyTABLE;
- aOS += "\n0,1\n\"";
+ aOS.AppendAscii( "\n0,1\n\"" );
- pDoc->GetName( nTab, aUniString );
- aOS += ByteString( aUniString, eNach );
- aOS += "\"\n";
- rOut.Write( aOS.GetBuffer(), aOS.Len() );
+ pDoc->GetName( nTab, aString );
+ aOS += aString;
+ aOS.AppendAscii( "\"\n" );
+ rOut.WriteUnicodeOrByteText( aOS );
// VECTORS
aOS = pKeyVECTORS;
- aOS += "\n0,";
- aOS += ByteString::CreateFromInt32( nNumCols );
- aOS += '\n';
- aOS += p2DoubleQuotes_LF;
- rOut.Write( aOS.GetBuffer(), aOS.Len() );
+ aOS.AppendAscii( "\n0," );
+ aOS += String::CreateFromInt32( nNumCols );
+ aOS += sal_Unicode('\n');
+ aOS.AppendAscii( p2DoubleQuotes_LF );
+ rOut.WriteUnicodeOrByteText( aOS );
// TUPLES
aOS = pKeyTUPLES;
- aOS += "\n0,";
- aOS += ByteString::CreateFromInt32( nNumRows );
- aOS += '\n';
- aOS += p2DoubleQuotes_LF;
- rOut.Write( aOS.GetBuffer(), aOS.Len() );
+ aOS.AppendAscii( "\n0," );
+ aOS += String::CreateFromInt32( nNumRows );
+ aOS += sal_Unicode('\n');
+ aOS.AppendAscii( p2DoubleQuotes_LF );
+ rOut.WriteUnicodeOrByteText( aOS );
// DATA
- rOut << pKeyDATA << "\n0,0\n" << p2DoubleQuotes_LF;
+ aOS = pKeyDATA;
+ aOS.AppendAscii( "\n0,0\n" );
+ aOS.AppendAscii( p2DoubleQuotes_LF );
+ rOut.WriteUnicodeOrByteText( aOS );
UINT16 nColCnt, nRowCnt;
ScBaseCell* pAkt;
- const sal_Char* pOutString;
for( nRowCnt = rRange.aStart.Row() ; nRowCnt <= nEndRow ; nRowCnt++ )
{
- rOut << pSpecDataType_LF << pKeyBOT << '\n';
+ aOS.AssignAscii( pSpecDataType_LF );
+ aOS += pKeyBOT;
+ aOS += sal_Unicode('\n');
+ rOut.WriteUnicodeOrByteText( aOS );
for( nColCnt = rRange.aStart.Col() ; nColCnt <= nEndCol ; nColCnt++ )
{
+ bool bWriteStringData = false;
pDoc->GetCell( nColCnt, nRowCnt, nTab, pAkt );
if( pAkt )
{
@@ -190,89 +210,138 @@ FltError ScExportDif( SvStream& rOut, ScDocument* pDoc,
{
case CELLTYPE_NONE:
case CELLTYPE_NOTE:
- pOutString = pEmptyData;
+ aOS.AssignAscii( pEmptyData );
break;
case CELLTYPE_VALUE:
- aOS = pNumData;
+ aOS.AssignAscii( pNumData );
if( bPlain )
{
fVal = ( ( ScValueCell * ) pAkt )->GetValue();
- aUniString.Erase();
- SolarMath::DoubleToString( aUniString, fVal, 'G', 14, '.', TRUE );
- aOS += ByteString( aUniString, eNach );
+ aOS += String( ::rtl::math::doubleToUString(
+ fVal, rtl_math_StringFormat_G, 14, '.',
+ TRUE));
}
else
{
- pDoc->GetInputString( nColCnt, nRowCnt, nTab, aUniString );
- aOS += ByteString( aUniString, eNach );
+ pDoc->GetInputString( nColCnt, nRowCnt, nTab, aString );
+ aOS += aString;
}
- aOS += "\nV\n";
- pOutString = aOS.GetBuffer();
+ aOS.AppendAscii( "\nV\n" );
break;
case CELLTYPE_EDIT:
- aOS = pStringData;
- ( ( ScEditCell* ) pAkt )->GetString( aUniString );
- aTmp = ByteString( aUniString, eNach );
- lcl_EscapeQuotes( aTmp );
- aOS += aTmp;
- aOS += "\"\n";
- pOutString = aOS.GetBuffer();
+ ( ( ScEditCell* ) pAkt )->GetString( aString );
+ bWriteStringData = true;
break;
case CELLTYPE_STRING:
- aOS = pStringData;
- ( ( ScStringCell* ) pAkt )->GetString( aUniString );
- aTmp = ByteString( aUniString, eNach );
- lcl_EscapeQuotes( aTmp );
- aOS += aTmp;
- aOS += "\"\n";
- pOutString = aOS.GetBuffer();
+ ( ( ScStringCell* ) pAkt )->GetString( aString );
+ bWriteStringData = true;
break;
case CELLTYPE_FORMULA:
if ( ((ScFormulaCell*)pAkt)->GetErrCode() )
- pOutString = pNumDataERROR;
+ aOS.AssignAscii( pNumDataERROR );
else if( pAkt->HasValueData() )
{
- aOS = pNumData;
+ aOS.AssignAscii( pNumData );
if( bPlain )
{
fVal = ( ( ScFormulaCell * ) pAkt )->GetValue();
- aUniString.Erase();
- SolarMath::DoubleToString( aUniString, fVal, 'G', 14, '.', TRUE );
- aOS += ByteString( aUniString, eNach );
+ aOS += String( ::rtl::math::doubleToUString(
+ fVal, rtl_math_StringFormat_G, 14,
+ '.', TRUE));
}
else
{
- pDoc->GetInputString( nColCnt, nRowCnt, nTab, aUniString );
- aOS += ByteString( aUniString, eNach );
+ pDoc->GetInputString( nColCnt, nRowCnt, nTab, aString );
+ aOS += aString;
}
- aOS += "\nV\n";
- pOutString = aOS.GetBuffer();
+ aOS.AppendAscii( "\nV\n" );
}
else if( pAkt->HasStringData() )
{
- aOS = pStringData;
- ( ( ScFormulaCell * ) pAkt )->GetString( aUniString );
- aTmp = ByteString( aUniString, eNach );
- lcl_EscapeQuotes( aTmp );
- aOS += aTmp;
- aOS += "\"\n";
- pOutString = aOS.GetBuffer();
+ ( ( ScFormulaCell * ) pAkt )->GetString( aString );
+ bWriteStringData = true;
}
else
- pOutString = pNumDataERROR;
+ aOS.AssignAscii( pNumDataERROR );
break;
}
}
else
- pOutString = pEmptyData;
+ aOS.AssignAscii( pEmptyData );
- rOut << pOutString;
+ if ( !bWriteStringData )
+ rOut.WriteUnicodeOrByteText( aOS );
+ else
+ {
+ // for an explanation why this complicated, see
+ // sc/source/ui/docsh.cxx:ScDocShell::AsciiSave()
+ // In fact we should create a common method if this would be
+ // needed just one more time..
+ aOS.AssignAscii( pStringData );
+ rOut.WriteUnicodeOrByteText( aOS, eCharSet );
+ if ( eCharSet == RTL_TEXTENCODING_UNICODE )
+ {
+ xub_StrLen nPos = aString.Search( cStrDelim );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ aString.Insert( cStrDelim, nPos );
+ nPos = aString.Search( cStrDelim, nPos+2 );
+ }
+ rOut.WriteUniOrByteChar( cStrDelim, eCharSet );
+ rOut.WriteUnicodeText( aString );
+ rOut.WriteUniOrByteChar( cStrDelim, eCharSet );
+ }
+ else if ( bContextOrNotAsciiEncoding )
+ {
+ // to byte encoding
+ ByteString aStrEnc( aString, eCharSet );
+ // back to Unicode
+ UniString aStrDec( aStrEnc, eCharSet );
+ // search on re-decoded string
+ xub_StrLen nPos = aStrDec.Search( aStrDelimDecoded );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ aStrDec.Insert( aStrDelimDecoded, nPos );
+ nPos = aStrDec.Search( aStrDelimDecoded,
+ nPos+1+aStrDelimDecoded.Len() );
+ }
+ // write byte re-encoded
+ rOut.WriteUniOrByteChar( cStrDelim, eCharSet );
+ rOut.WriteUnicodeOrByteText( aStrDec, eCharSet );
+ rOut.WriteUniOrByteChar( cStrDelim, eCharSet );
+ }
+ else
+ {
+ ByteString aStrEnc( aString, eCharSet );
+ // search on encoded string
+ xub_StrLen nPos = aStrEnc.Search( aStrDelimEncoded );
+ while ( nPos != STRING_NOTFOUND )
+ {
+ aStrEnc.Insert( aStrDelimEncoded, nPos );
+ nPos = aStrEnc.Search( aStrDelimEncoded,
+ nPos+1+aStrDelimEncoded.Len() );
+ }
+ // write byte encoded
+ rOut.Write( aStrDelimEncoded.GetBuffer(),
+ aStrDelimEncoded.Len() );
+ rOut.Write( aStrEnc.GetBuffer(), aStrEnc.Len() );
+ rOut.Write( aStrDelimEncoded.GetBuffer(),
+ aStrDelimEncoded.Len() );
+ }
+ rOut.WriteUniOrByteChar( '\n', eCharSet );
+ }
}
aPrgrsBar.SetState( nRowCnt );
}
- rOut << pSpecDataType_LF << pKeyEOD << '\n';
+ aOS.AssignAscii( pSpecDataType_LF );
+ aOS += pKeyEOD;
+ aOS += sal_Unicode('\n');
+ rOut.WriteUnicodeOrByteText( aOS );
+
+ // restore original value
+ rOut.SetStreamCharSet( eStreamCharSet );
return eRet;
}
diff --git a/sc/source/filter/dif/difimp.cxx b/sc/source/filter/dif/difimp.cxx
index 87f63c82a63b..0469842fbdf7 100644
--- a/sc/source/filter/dif/difimp.cxx
+++ b/sc/source/filter/dif/difimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: difimp.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: er $ $Date: 2002-10-31 19:15:02 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,7 +73,7 @@
#include "dif.hxx"
#include "filter.hxx"
-#include "fltprgrs.hxx"
+#include "fprogressbar.hxx"
#include "flttools.hxx"
#include "scerrors.hxx"
#include "document.hxx"
@@ -83,51 +83,25 @@
#include "attrib.hxx"
-const sal_Char* pKeyTABLE = "TABLE";
-const sal_Char* pKeyVECTORS = "VECTORS";
-const sal_Char* pKeyTUPLES = "TUPLES";
-const sal_Char* pKeyDATA = "DATA";
-const sal_Char* pKeyBOT = "BOT";
-const sal_Char* pKeyEOD = "EOD";
-const sal_Char* pKeyERROR = "ERROR";
-const sal_Char* pKeyTRUE = "TRUE";
-const sal_Char* pKeyFALSE = "FALSE";
-const sal_Char* pKeyNA = "NA";
-
-
-#if __ALIGNMENT4 == 1
-UINT32 DifParser::nBOT = *( ( UINT32* ) pKeyBOT );
-UINT32 DifParser::nEOD = *( ( UINT32* ) pKeyEOD );
-UINT32 DifParser::n1_0 = *( ( UINT32* ) "1,0" );
-#else
-sal_Char DifParser::cBOT_0 = 'B';
-sal_Char DifParser::cBOT_1 = 'O';
-sal_Char DifParser::cBOT_2 = 'T';
-sal_Char DifParser::cBOT_3 = 0x00;
-sal_Char DifParser::cEOD_0 = 'E';
-sal_Char DifParser::cEOD_1 = 'O';
-sal_Char DifParser::cEOD_2 = 'D';
-sal_Char DifParser::cEOD_3 = 0x00;
-sal_Char DifParser::c1_0_0 = '1';
-sal_Char DifParser::c1_0_1 = ',';
-sal_Char DifParser::c1_0_2 = '0';
-sal_Char DifParser::c1_0_3 = 0x00;
-#endif
-
-#if __ALIGNMENT2 == 1
-UINT16 DifParser::nV = *( ( UINT16* ) "V" );
-#else
-sal_Char DifParser::cV_0 = 'V';
-sal_Char DifParser::cV_1 = 0x00;
-#endif
-
-
+const sal_Unicode pKeyTABLE[] = { 'T', 'A', 'B', 'L', 'E', 0 };
+const sal_Unicode pKeyVECTORS[] = { 'V', 'E', 'C', 'T', 'O', 'R', 'S', 0 };
+const sal_Unicode pKeyTUPLES[] = { 'T', 'U', 'P', 'L', 'E', 'S', 0 };
+const sal_Unicode pKeyDATA[] = { 'D', 'A', 'T', 'A', 0 };
+const sal_Unicode pKeyBOT[] = { 'B', 'O', 'T', 0 };
+const sal_Unicode pKeyEOD[] = { 'E', 'O', 'D', 0 };
+const sal_Unicode pKeyERROR[] = { 'E', 'R', 'R', 'O', 'R', 0 };
+const sal_Unicode pKeyTRUE[] = { 'T', 'R', 'U', 'E', 0 };
+const sal_Unicode pKeyFALSE[] = { 'F', 'A', 'L', 'S', 'E', 0 };
+const sal_Unicode pKeyNA[] = { 'N', 'A', 0 };
+const sal_Unicode pKeyV[] = { 'V', 0 };
+const sal_Unicode pKey1_0[] = { '1', ',', '0', 0 };
FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
const CharSet eVon, UINT32 nDifOption )
{
DifParser aDifParser( rIn, nDifOption, *pDoc, eVon );
+
const BOOL bPlain = aDifParser.IsPlain();
UINT16 nBaseTab = rInsPos.Tab();
@@ -136,7 +110,7 @@ FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
BOOL bSyntErrWarn = FALSE;
BOOL bOverflowWarn = FALSE;
- ByteString& rData = aDifParser.aData;
+ String& rData = aDifParser.aData;
BOOL bData = FALSE;
UINT16 nNumCols = 0;
@@ -144,7 +118,7 @@ FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
rIn.Seek( 0 );
- FilterProgressBar aPrgrsBar( rIn );
+ ScfStreamProgressBar aPrgrsBar( rIn, pDoc->GetDocumentShell() );
while( eTopic != T_DATA && eTopic != T_END )
{
@@ -161,7 +135,7 @@ FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
if( aDifParser.nVector != 0 || aDifParser.nVal != 1 )
bSyntErrWarn = TRUE;
if( bData )
- pDoc->RenameTab( nBaseTab, String( rData, eVon ) );
+ pDoc->RenameTab( nBaseTab, rData );
}
break;
case T_VECTORS:
@@ -261,13 +235,13 @@ FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
aDifParser.nNumFormat );
}
else if( rData == pKeyNA || rData == pKeyERROR )
- pCell = new ScStringCell( String( rData, eVon ) );
+ pCell = new ScStringCell( rData );
else
{
- ByteString aTmp( "#IND: " );
+ String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#IND: " ));
aTmp += rData;
- aTmp += '?';
- pCell = new ScStringCell( String( aTmp, eVon ) );
+ aTmp += sal_Unicode('?');
+ pCell = new ScStringCell( aTmp );
}
pDoc->PutCell( nColCnt, nRowCnt, nBaseTab, pCell, ( BOOL ) TRUE );
@@ -286,7 +260,7 @@ FltError ScImportDif( SvStream& rIn, ScDocument* pDoc, const ScAddress& rInsPos,
if( rData.Len() > 0 )
{
pDoc->PutCell( nColCnt, nRowCnt, nBaseTab,
- ScBaseCell::CreateTextCell( String( rData, eVon ), pDoc ), ( BOOL ) TRUE );
+ ScBaseCell::CreateTextCell( rData, pDoc ), ( BOOL ) TRUE );
}
}
else
@@ -326,6 +300,14 @@ DifParser::DifParser( SvStream& rNewIn, const UINT32 nOption, ScDocument& rDoc,
rIn( rNewIn )
{
eCharSet = e;
+ if ( rIn.GetStreamCharSet() != eCharSet )
+ {
+ DBG_ERRORFILE( "CharSet passed overrides and modifies StreamCharSet" );
+ rIn.SetStreamCharSet( eCharSet );
+ }
+ if ( eCharSet == RTL_TEXTENCODING_UNICODE )
+ rIn.StartReadingUnicodeText();
+
bPlain = ( nOption == SC_DIFOPT_PLAIN );
if( bPlain )
@@ -339,22 +321,33 @@ TOPIC DifParser::GetNextTopic( void )
{
enum STATE { S_VectorVal, S_Data, S_END, S_START, S_UNKNOWN, S_ERROR_L2 };
- static const sal_Char* ppKeys[] =
+ static const sal_Unicode pKeyLABEL[] = { 'L', 'A', 'B', 'E', 'L', 0 };
+ static const sal_Unicode pKeyCOMMENT[] = { 'C', 'O', 'M', 'M', 'E', 'N', 'T', 0 };
+ static const sal_Unicode pKeySIZE[] = { 'S', 'I', 'Z', 'E', 0 };
+ static const sal_Unicode pKeyPERIODICITY[] = { 'P', 'E', 'R', 'I', 'O', 'D', 'I', 'C', 'I', 'T', 'Y', 0 };
+ static const sal_Unicode pKeyMAJORSTART[] = { 'M', 'A', 'J', 'O', 'R', 'S', 'T', 'A', 'R', 'T', 0 };
+ static const sal_Unicode pKeyMINORSTART[] = { 'M', 'I', 'N', 'O', 'R', 'S', 'T', 'A', 'R', 'T', 0 };
+ static const sal_Unicode pKeyTRUELENGTH[] = { 'T', 'R', 'U', 'E', 'L', 'E', 'N', 'G', 'T', 'H', 0 };
+ static const sal_Unicode pKeyUINITS[] = { 'U', 'I', 'N', 'I', 'T', 'S', 0 };
+ static const sal_Unicode pKeyDISPLAYUNITS[] = { 'D', 'I', 'S', 'P', 'L', 'A', 'Y', 'U', 'N', 'I', 'T', 'S', 0 };
+ static const sal_Unicode pKeyUNKNOWN[] = { 0 };
+
+ static const sal_Unicode* ppKeys[] =
{
pKeyTABLE, // 0
pKeyVECTORS,
pKeyTUPLES,
pKeyDATA,
- "LABEL",
- "COMMENT", // 5
- "SIZE",
- "PERIODICITY",
- "MAJORSTART",
- "MINORSTART",
- "TRUELENGTH", // 10
- "UINITS",
- "DISPLAYUNITS",
- "" // 13
+ pKeyLABEL,
+ pKeyCOMMENT, // 5
+ pKeySIZE,
+ pKeyPERIODICITY,
+ pKeyMAJORSTART,
+ pKeyMINORSTART,
+ pKeyTRUELENGTH, // 10
+ pKeyUINITS,
+ pKeyDISPLAYUNITS,
+ pKeyUNKNOWN // 13
};
static const TOPIC pTopics[] =
@@ -377,7 +370,7 @@ TOPIC DifParser::GetNextTopic( void )
STATE eS = S_START;
BOOL bValOverflow = FALSE;
- ByteString aLine;
+ String aLine;
nVector = 0;
nVal = 0;
@@ -385,7 +378,7 @@ TOPIC DifParser::GetNextTopic( void )
while( eS != S_END )
{
- if( !rIn.ReadLine( aLine ) )
+ if( !rIn.ReadUniOrByteStringLine( aLine ) )
{
eS = S_END;
eRet = T_END;
@@ -395,7 +388,7 @@ TOPIC DifParser::GetNextTopic( void )
{
case S_START:
{
- const sal_Char* pRef;
+ const sal_Unicode* pRef;
UINT16 nCnt = 0;
BOOL bSearch = TRUE;
@@ -425,7 +418,7 @@ TOPIC DifParser::GetNextTopic( void )
break;
case S_VectorVal:
{
- const sal_Char* pCur = aLine.GetBuffer();
+ const sal_Unicode* pCur = aLine.GetBuffer();
pCur = ScanIntVal( pCur, nVector );
@@ -455,10 +448,10 @@ TOPIC DifParser::GetNextTopic( void )
#endif
case S_UNKNOWN:
// 2 Zeilen ueberlesen
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
case S_ERROR_L2: // Fehler in Line 2 aufgetreten
// eine Zeile ueberlesen
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
eS = S_END;
break;
#ifdef DBG_UTIL
@@ -472,15 +465,16 @@ TOPIC DifParser::GetNextTopic( void )
}
-void lcl_DeEscapeQuotesDif( ByteString& rString )
+void lcl_DeEscapeQuotesDif( String& rString )
{
// Special handling for DIF import: Escaped (duplicated) quotes are resolved.
// Single quote characters are left in place because older versions didn't
// escape quotes in strings (and Excel doesn't when using the clipboard).
// The quotes around the string are removed before this function is called.
+ static const sal_Unicode aDQ[] = { '"', '"', 0 };
xub_StrLen nPos = 0;
- while ( (nPos = rString.Search( "\"\"", nPos )) != STRING_NOTFOUND )
+ while ( (nPos = rString.Search( aDQ, nPos )) != STRING_NOTFOUND )
{
rString.Erase( nPos, 1 );
++nPos;
@@ -491,10 +485,10 @@ void lcl_DeEscapeQuotesDif( ByteString& rString )
DATASET DifParser::GetNextDataset( void )
{
DATASET eRet = D_UNKNOWN;
- ByteString aLine;
- const sal_Char* pAkt;
+ String aLine;
+ const sal_Unicode* pAkt;
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
pAkt = aLine.GetBuffer();
@@ -505,7 +499,7 @@ DATASET DifParser::GetNextDataset( void )
if( Is1_0( pAkt ) )
{
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
if( IsBOT( aLine.GetBuffer() ) )
eRet = D_BOT;
else if( IsEOD( aLine.GetBuffer() ) )
@@ -527,7 +521,7 @@ DATASET DifParser::GetNextDataset( void )
else
{ // ...und zur Strafe mit'm Numberformatter...
DBG_ASSERT( pNumFormatter, "-DifParser::GetNextDataset(): No Formatter, more fun!" );
- String aTestVal( pAkt, eCharSet );
+ String aTestVal( pAkt );
ULONG nFormat = 0;
double fTmpVal;
if( pNumFormatter->IsNumberFormat( aTestVal, nFormat, fTmpVal ) )
@@ -539,14 +533,14 @@ DATASET DifParser::GetNextDataset( void )
else
eRet = D_SYNT_ERROR;
}
- rIn.ReadLine( aData );
+ rIn.ReadUniOrByteStringLine( aData );
if ( eRet == D_SYNT_ERROR )
{ // for broken records write "#ERR: data" to cell
- ByteString aTmp( "#ERR: " );
+ String aTmp( RTL_CONSTASCII_USTRINGPARAM( "#ERR: " ));
aTmp += pAkt;
- aTmp += " (";
+ aTmp.AppendAscii( " (" );
aTmp += aData;
- aTmp += ')';
+ aTmp += sal_Unicode(')');
aData = aTmp;
eRet = D_STRING;
}
@@ -555,7 +549,7 @@ DATASET DifParser::GetNextDataset( void )
case '1': // String Data
if( Is1_0( aLine.GetBuffer() ) )
{
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
DBG_ASSERT( aLine.Len() >= 2,
"*DifParser::GetNextTopic(): Text ist zu kurz (mind. \"\")!" );
aData = aLine.Copy( 1, aLine.Len() - 2 );
@@ -566,7 +560,7 @@ DATASET DifParser::GetNextDataset( void )
}
if( eRet == D_UNKNOWN )
- rIn.ReadLine( aLine );
+ rIn.ReadUniOrByteStringLine( aLine );
if( rIn.IsEof() )
eRet = D_EOD;
@@ -575,9 +569,9 @@ DATASET DifParser::GetNextDataset( void )
}
-const sal_Char* DifParser::ScanIntVal( const sal_Char* pStart, UINT32& rRet )
+const sal_Unicode* DifParser::ScanIntVal( const sal_Unicode* pStart, UINT32& rRet )
{
- sal_Char cAkt = *pStart;
+ sal_Unicode cAkt = *pStart;
if( IsNumber( cAkt ) )
rRet = ( UINT32 ) ( cAkt - '0' );
@@ -600,7 +594,7 @@ const sal_Char* DifParser::ScanIntVal( const sal_Char* pStart, UINT32& rRet )
}
-BOOL DifParser::ScanFloatVal( const sal_Char* pStart )
+BOOL DifParser::ScanFloatVal( const sal_Unicode* pStart )
{
double fNewVal = 0.0;
BOOL bNeg = FALSE;
@@ -610,7 +604,7 @@ BOOL DifParser::ScanFloatVal( const sal_Char* pStart )
BOOL bExpOverflow = FALSE;
static const UINT16 nExpLimit = 4096; // ACHTUNG: muss genauer ermittelt werden!
- sal_Char cAkt;
+ sal_Unicode cAkt;
BOOL bRet = FALSE;
enum STATE { S_FIRST, S_PRE, S_POST, S_EXP_FIRST, S_EXP, S_END, S_FINDEND };
diff --git a/sc/source/filter/excel/biffdump.cxx b/sc/source/filter/excel/biffdump.cxx
index 9b28ff605d7b..e348e4006eeb 100644
--- a/sc/source/filter/excel/biffdump.cxx
+++ b/sc/source/filter/excel/biffdump.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: biffdump.cxx,v $
*
- * $Revision: 1.53 $
+ * $Revision: 1.54 $
*
- * last change: $Author: dr $ $Date: 2002-12-09 13:43:55 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -85,7 +85,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include <tools/solmath.hxx>
+#include <rtl/math.hxx>
#ifndef SC_DOCUMENT_HXX
#include "document.hxx"
@@ -93,15 +93,17 @@
#ifndef SC_SCGLOB_HXX
#include "global.hxx"
#endif
+
+#ifndef SC_FPROGRESSBAR_HXX
+#include "fprogressbar.hxx"
+#endif
#ifndef SC_XLTOOLS_HXX
#include "xltools.hxx"
#endif
+
#ifndef _FLTTOOLS_HXX
#include "flttools.hxx"
#endif
-#ifndef _FLTPRGRS_HXX
-#include "fltprgrs.hxx"
-#endif
#ifndef _IMP_OP_HXX
#include "imp_op.hxx"
#endif
@@ -258,8 +260,7 @@ static void __AddPureBin( ByteString& r, UINT32 nVal )
inline static void __AddDec( ByteString& r, UINT32 n )
{
sal_Char p[ 32 ];
- sprintf( p, "%u", n );
-
+ sprintf( p, "%u", n ); // #100211# - checked
r += p;
}
@@ -279,8 +280,7 @@ inline static void __AddDec( ByteString& r, UINT8 n )
inline static void __AddDec( ByteString& r, INT32 n )
{
sal_Char p[ 32 ];
- sprintf( p, "%d", n );
-
+ sprintf( p, "%d", n ); // #100211# - checked
r += p;
}
@@ -290,6 +290,11 @@ inline static void __AddDec( ByteString& r, INT16 n )
__AddDec( r, ( INT32 ) n );
}
+inline static void __AddDec( ByteString& r, INT8 n )
+{
+ __AddDec( r, ( INT32 ) n );
+}
+
static void __AddDec( ByteString& r, UINT32 nVal, UINT16 nNumOfDig, sal_Char c = ' ' )
{
@@ -313,9 +318,7 @@ inline static void __AddDec1616( ByteString& r, UINT32 n )
static void __AddDouble( ByteString& r, const double f )
{
- String aStr;
- SolarMath::DoubleToString( aStr, f, 'G', 15, '.', TRUE );
- r += ByteString( aStr, RTL_TEXTENCODING_ASCII_US );
+ r += ByteString( ::rtl::math::doubleToString( f, rtl_math_StringFormat_G, 15, '.', TRUE ) );
}
@@ -642,8 +645,8 @@ DUMP_ERR::~DUMP_ERR()
#define PreDump(LEN) {rIn.PushPosition();ContDump(LEN);rIn.PopPosition();}
#define ADDCELLHEAD() {UINT16 nR,nC,nX;rIn>>nR>>nC>>nX;__AddCellHead(t,nC,nR,nX);}
#define STARTFLAG() {ADDTEXT( "flags (" ); __AddHex( t, __nFlags ); ADDTEXT( "):" );}
-#define ADDFLAG(mask,text) {if( __nFlags & mask ) t += text;}
-#define ADDRESERVED(mask) ADDFLAG(mask," !RESERVED!")
+#define ADDFLAG(mask,text) {if( __nFlags & mask ) t.Append( ' ' ).Append( text );}
+#define ADDRESERVED(mask) ADDFLAG(mask,"!RESERVED!")
UINT16 Biff8RecDumper::DumpXF( XclImpStream& rIn, const sal_Char* pPre )
@@ -910,7 +913,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
case 0x005D: // OBJ
case 0x00EC: // MSODRAWING
case 0x01B6: // TXO
- pIn->InitializeRecord( FALSE );
+ pIn->InitializeRecord( false );
break;
default:
pIn->InitializeRecord( bReadContRecs );
@@ -1027,9 +1030,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
ADDTEXT( " " );
STARTFLAG();
- ADDFLAG( 0x01, " fAlwaysCalc" );
- ADDFLAG( 0x02, " fCalcOnLoad" );
- ADDFLAG( 0x08, " fShrFmla" );
+ ADDFLAG( 0x01, "fAlwaysCalc" );
+ ADDFLAG( 0x02, "fCalcOnLoad" );
+ ADDFLAG( 0x08, "fShrFmla" );
}
PRINT();
LINESTART();
@@ -1085,13 +1088,13 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
rIn >> __nFlags >> n8 >> nNameText >> nNameDef >> n16 >> n16 >> n8 >> n8 >> n8 >> n8;
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fHidden" );
- ADDFLAG( 0x0002, " fFunc" );
- ADDFLAG( 0x0004, " fVBProc" );
- ADDFLAG( 0x0008, " fProc" );
- ADDFLAG( 0x0010, " fCalcExp" );
- ADDFLAG( 0x0020, " fBuiltIn" );
- ADDFLAG( 0x1000, " fBig" );
+ ADDFLAG( 0x0001, "fHidden" );
+ ADDFLAG( 0x0002, "fFunc" );
+ ADDFLAG( 0x0004, "fVBProc" );
+ ADDFLAG( 0x0008, "fProc" );
+ ADDFLAG( 0x0010, "fCalcExp" );
+ ADDFLAG( 0x0020, "fBuiltIn" );
+ ADDFLAG( 0x1000, "fBig" );
ADDRESERVED( 0xE000 );
ADDTEXT( " Fn grp index: " );
__AddDec( t, (UINT16)((__nFlags & 0x0FC0) >> 6) );
@@ -1192,10 +1195,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDTEXT( "/20pt " );
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0002, " fItalic" );
- ADDFLAG( 0x0008, " fStrikeout" );
- ADDFLAG( 0x0010, " fOutline" );
- ADDFLAG( 0x0020, " fShadow" );
+ ADDFLAG( 0x0002, "fItalic" );
+ ADDFLAG( 0x0008, "fStrikeout" );
+ ADDFLAG( 0x0010, "fOutline" );
+ ADDFLAG( 0x0020, "fShadow" );
ADDRESERVED( 0xFFC5 );
PRINT();
LINESTART();
@@ -1236,7 +1239,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fReadOnlyRec" );
+ ADDFLAG( 0x0001, "fReadOnlyRec" );
PRINT();
}
DumpValidPassword( rIn, pPre );
@@ -1260,10 +1263,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
rIn >> __nFlags;
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fHidden" );
+ ADDFLAG( 0x0001, "fHidden" );
ADDTEXT( " outlnlev=" );
__AddDec( t, (UINT16)((__nFlags & 0x0700) >> 8) );
- ADDFLAG( 0x1000, " fCollapsed" );
+ ADDFLAG( 0x1000, "fCollapsed" );
ADDRESERVED( 0xE8FE );
PRINT();
LINESTART();
@@ -1304,22 +1307,22 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
STARTFLAG();
if( __nFlags & 0x00F1 )
{
- ADDFLAG( 0x0001, " fShowAutoBreaks" );
- ADDFLAG( 0x0010, " fDialog" );
- ADDFLAG( 0x0020, " fApplyStyles" );
- ADDFLAG( 0x0040, " fRowSumsBelow" );
- ADDFLAG( 0x0080, " fColSumsBelow" );
+ ADDFLAG( 0x0001, "fShowAutoBreaks" );
+ ADDFLAG( 0x0010, "fDialog" );
+ ADDFLAG( 0x0020, "fApplyStyles" );
+ ADDFLAG( 0x0040, "fRowSumsBelow" );
+ ADDFLAG( 0x0080, "fColSumsBelow" );
PRINT();
LINESTART();
}
if( __nFlags & (0xCD00 | 0x320E) )
{
ADDTEXT( " " );
- ADDFLAG( 0x0100, " fFitToPage" );
- ADDFLAG( 0x0400, " fDispRowGuts" );
- ADDFLAG( 0x0800, " fDispColGuts" );
- ADDFLAG( 0x4000, " fAee" );
- ADDFLAG( 0x8000, " fAfe" );
+ ADDFLAG( 0x0100, "fFitToPage" );
+ ADDFLAG( 0x0400, "fDispRowGuts" );
+ ADDFLAG( 0x0800, "fDispColGuts" );
+ ADDFLAG( 0x4000, "fAee" );
+ ADDFLAG( 0x8000, "fAfe" );
ADDRESERVED( 0x320E );
PRINT();
}
@@ -1370,12 +1373,12 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDDEC( 2 );
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0003, " fJoin" );
- ADDFLAG( 0x0004, " fSimpleEq1" );
- ADDFLAG( 0x0008, " fSimpleEq2" );
- ADDFLAG( 0x0010, " fTop10" );
- ADDFLAG( 0x0020, " fTop" );
- ADDFLAG( 0x0040, " fPercent" );
+ ADDFLAG( 0x0003, "fJoin" );
+ ADDFLAG( 0x0004, "fSimpleEq1" );
+ ADDFLAG( 0x0008, "fSimpleEq2" );
+ ADDFLAG( 0x0010, "fTop10" );
+ ADDFLAG( 0x0020, "fTop" );
+ ADDFLAG( 0x0040, "fPercent" );
PRINT();
LINESTART();
if( __nFlags & 0x0003 )
@@ -1487,14 +1490,14 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0001, " fLeftRight" );
- ADDFLAG( 0x0002, " fPortrait" );
- ADDFLAG( 0x0004, " fNoPrintSettings" );
- ADDFLAG( 0x0008, " fMonochrom" );
- ADDFLAG( 0x0010, " fDraft" );
- ADDFLAG( 0x0020, " fNotes" );
- ADDFLAG( 0x0040, " fNoOrientation" );
- ADDFLAG( 0x0080, " fCustomNumber" );
+ ADDFLAG( 0x0001, "fLeftRight" );
+ ADDFLAG( 0x0002, "fPortrait" );
+ ADDFLAG( 0x0004, "fNoPrintSettings" );
+ ADDFLAG( 0x0008, "fMonochrom" );
+ ADDFLAG( 0x0010, "fDraft" );
+ ADDFLAG( 0x0020, "fNotes" );
+ ADDFLAG( 0x0040, "fNoOrientation" );
+ ADDFLAG( 0x0080, "fCustomNumber" );
PRINT();
LINESTART();
ADDTEXT( "Print res: " ); ADDDEC( 2 );
@@ -1575,15 +1578,15 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fRowGrand" );
- ADDFLAG( 0x0002, " fColGrand" );
- ADDFLAG( 0x0008, " fAutoFormat" );
- ADDFLAG( 0x0010, " fWidthHeightAuto" );
- ADDFLAG( 0x0020, " fFontAuto" );
- ADDFLAG( 0x0040, " fAlignAuto" );
- ADDFLAG( 0x0080, " fBorderAuto" );
- ADDFLAG( 0x0100, " fPatternAuto" );
- ADDFLAG( 0x0200, " fNumberAuto" );
+ ADDFLAG( 0x0001, "fRowGrand" );
+ ADDFLAG( 0x0002, "fColGrand" );
+ ADDFLAG( 0x0008, "fAutoFormat" );
+ ADDFLAG( 0x0010, "fWidthHeightAuto" );
+ ADDFLAG( 0x0020, "fFontAuto" );
+ ADDFLAG( 0x0040, "fAlignAuto" );
+ ADDFLAG( 0x0080, "fBorderAuto" );
+ ADDFLAG( 0x0100, "fPatternAuto" );
+ ADDFLAG( 0x0200, "fNumberAuto" );
PRINT();
}
LINESTART();
@@ -1617,10 +1620,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDTEXT( "):" );
if( __nFlags )
{
- ADDFLAG( 0x0001, " row" );
- ADDFLAG( 0x0002, " col" );
- ADDFLAG( 0x0004, " page" );
- ADDFLAG( 0x0008, " data" );
+ ADDFLAG( 0x0001, "row" );
+ ADDFLAG( 0x0002, "col" );
+ ADDFLAG( 0x0004, "page" );
+ ADDFLAG( 0x0008, "data" );
}
else
ADDTEXT( " no axis" );
@@ -1634,18 +1637,18 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDTEXT( "):" );
if( __nFlags )
{
- ADDFLAG( 0x0001, " Default" );
- ADDFLAG( 0x0002, " Sum" );
- ADDFLAG( 0x0004, " Counta" );
- ADDFLAG( 0x0008, " Average" );
- ADDFLAG( 0x0010, " Max" );
- ADDFLAG( 0x0020, " Min" );
- ADDFLAG( 0x0040, " Product" );
- ADDFLAG( 0x0080, " Count" );
- ADDFLAG( 0x0100, " Stdev" );
- ADDFLAG( 0x0200, " Stddevp" );
- ADDFLAG( 0x0400, " Var" );
- ADDFLAG( 0x0800, " Varp" );
+ ADDFLAG( 0x0001, "Default" );
+ ADDFLAG( 0x0002, "Sum" );
+ ADDFLAG( 0x0004, "Counta" );
+ ADDFLAG( 0x0008, "Average" );
+ ADDFLAG( 0x0010, "Max" );
+ ADDFLAG( 0x0020, "Min" );
+ ADDFLAG( 0x0040, "Product" );
+ ADDFLAG( 0x0080, "Count" );
+ ADDFLAG( 0x0100, "Stdev" );
+ ADDFLAG( 0x0200, "Stddevp" );
+ ADDFLAG( 0x0400, "Var" );
+ ADDFLAG( 0x0800, "Varp" );
}
else
ADDTEXT( " none" );
@@ -1700,10 +1703,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x01, " fHidden" );
- ADDFLAG( 0x02, " fHideDetail" );
- ADDFLAG( 0x04, " fFormula" );
- ADDFLAG( 0x08, " fMissing" );
+ ADDFLAG( 0x01, "fHidden" );
+ ADDFLAG( 0x02, "fHideDetail" );
+ ADDFLAG( 0x04, "fFormula" );
+ ADDFLAG( 0x08, "fMissing" );
PRINT();
}
LINESTART();
@@ -1771,13 +1774,13 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
ADDTEXT( pInd );
STARTFLAG();
- ADDFLAG( 0x0001, " fMultiDataName" );
- ADDFLAG( 0x0200, " fSub" );
- ADDFLAG( 0x0400, " fBlock" );
- ADDFLAG( 0x0800, " fGrand" );
- ADDFLAG( 0x1000, " fMultiDataOnAxis" );
- ADDFLAG( 0x2000, " fBlankLine" ); // undocumented
- ADDFLAG( 0x4000, " fHideDetail" ); // undocumented
+ ADDFLAG( 0x0001, "fMultiDataName" );
+ ADDFLAG( 0x0200, "fSub" );
+ ADDFLAG( 0x0400, "fBlock" );
+ ADDFLAG( 0x0800, "fGrand" );
+ ADDFLAG( 0x1000, "fMultiDataOnAxis" );
+ ADDFLAG( 0x2000, "fBlankLine" ); // undocumented
+ ADDFLAG( 0x4000, "fHideDetail" ); // undocumented
ADDRESERVED( 0x8000 );
PRINT();
LINESTART();
@@ -1966,9 +1969,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDTEXT( pPre );
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0001, " fInIndexList" );
- ADDFLAG( 0x0002, " fNotInList" );
- ADDFLAG( 0x0200, " fLongIndex" );
+ ADDFLAG( 0x0001, "fInIndexList" );
+ ADDFLAG( 0x0002, "fNotInList" );
+ ADDFLAG( 0x0200, "fLongIndex" );
ADDTEXT( " data type: " );
__nFlags &= 0x0DFC;
switch( __nFlags )
@@ -2189,33 +2192,33 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
STARTFLAG();
if( __nFlags & 0x009F )
{
- ADDFLAG( 0x0001, " fShowAllItems" );
- ADDFLAG( 0x0002, " fDragToRow" );
- ADDFLAG( 0x0004, " fDragToColumn" );
- ADDFLAG( 0x0008, " fDragToPage" );
- ADDFLAG( 0x0010, " fDragToHide" );
- ADDFLAG( 0x0080, " fServerBased" );
+ ADDFLAG( 0x0001, "fShowAllItems" );
+ ADDFLAG( 0x0002, "fDragToRow" );
+ ADDFLAG( 0x0004, "fDragToColumn" );
+ ADDFLAG( 0x0008, "fDragToPage" );
+ ADDFLAG( 0x0010, "fDragToHide" );
+ ADDFLAG( 0x0080, "fServerBased" );
PRINT();
LINESTART();
}
if( __nFlags & 0xBF00 )
{
ADDTEXT( " " );
- ADDFLAG( 0x0200, " fAutoSort" );
- ADDFLAG( 0x0400, " fAscendSort" );
- ADDFLAG( 0x0800, " fAutoShow" );
- ADDFLAG( 0x1000, " fAscendShow" );
- ADDFLAG( 0x2000, " fCalculatedField" );
+ ADDFLAG( 0x0200, "fAutoSort" );
+ ADDFLAG( 0x0400, "fAscendSort" );
+ ADDFLAG( 0x0800, "fAutoShow" );
+ ADDFLAG( 0x1000, "fAscendShow" );
+ ADDFLAG( 0x2000, "fCalculatedField" );
PRINT();
LINESTART();
}
if( __nFlags & 0x00FF4000 )
{
ADDTEXT( " " ); // Layout flags:
- ADDFLAG( 0x00004000, " fLONewPage" ); // undocumented
- ADDFLAG( 0x00200000, " fLOReport" ); // undocumented
- ADDFLAG( 0x00400000, " fLOBlankLine" ); // undocumented
- ADDFLAG( 0x00800000, " fLOSubTotalTop" ); // undocumented
+ ADDFLAG( 0x00004000, "fLONewPage" ); // undocumented
+ ADDFLAG( 0x00200000, "fLOReport" ); // undocumented
+ ADDFLAG( 0x00400000, "fLOBlankLine" ); // undocumented
+ ADDFLAG( 0x00800000, "fLOSubTotalTop" ); // undocumented
PRINT();
LINESTART();
}
@@ -2308,7 +2311,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
UINT16 __nFlags = Read2( rIn );
STARTFLAG();
- ADDFLAG( 0x0001, " fAuto" );
+ ADDFLAG( 0x0001, "fAuto" );
ADDRESERVED( 0xFFFE );
UINT16 nCol1, nRow1, nCol2, nRow2;
rIn >> nRow1 >> nRow2 >> nCol1 >> nCol2;
@@ -2634,15 +2637,15 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
UINT16 __nFlags = Read2( rIn );
STARTFLAG();
- ADDFLAG( 0x0001, " fDsplFormulaBar" );
- ADDFLAG( 0x0002, " fDsplStatus" );
- ADDFLAG( 0x0004, " fNoteOff" );
- ADDFLAG( 0x0008, " fDsplHScroll" );
- ADDFLAG( 0x0010, " fDsplVScroll" );
- ADDFLAG( 0x0020, " fBotAdornment" );
- ADDFLAG( 0x0040, " fZoom" );
- ADDFLAG( 0x0080, " fShowPlaceHld" );
- ADDFLAG( 0x0100, " fHideAll" );
+ ADDFLAG( 0x0001, "fDsplFormulaBar" );
+ ADDFLAG( 0x0002, "fDsplStatus" );
+ ADDFLAG( 0x0004, "fNoteOff" );
+ ADDFLAG( 0x0008, "fDsplHScroll" );
+ ADDFLAG( 0x0010, "fDsplVScroll" );
+ ADDFLAG( 0x0020, "fBotAdornment" );
+ ADDFLAG( 0x0040, "fZoom" );
+ ADDFLAG( 0x0080, "fShowPlaceHld" );
+ ADDFLAG( 0x0100, "fHideAll" );
if( !(__nFlags && 0x0180) )
ADDTEXT( " fShowAll" );
PRINT();
@@ -2676,40 +2679,40 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
STARTFLAG();
if( __nFlags & 0x000000FF )
{
- ADDFLAG( 0x00000001, " fShowPgBrk" );
- ADDFLAG( 0x00000002, " fDsplForml" );
- ADDFLAG( 0x00000004, " fDsplGrid" );
- ADDFLAG( 0x00000008, " fDsplRCHead" );
- ADDFLAG( 0x00000010, " fDsplGuts" );
- ADDFLAG( 0x00000020, " fDsplZeros" );
- ADDFLAG( 0x00000040, " fPrintHorC" );
- ADDFLAG( 0x00000080, " fPrintVerC" );
+ ADDFLAG( 0x00000001, "fShowPgBrk" );
+ ADDFLAG( 0x00000002, "fDsplForml" );
+ ADDFLAG( 0x00000004, "fDsplGrid" );
+ ADDFLAG( 0x00000008, "fDsplRCHead" );
+ ADDFLAG( 0x00000010, "fDsplGuts" );
+ ADDFLAG( 0x00000020, "fDsplZeros" );
+ ADDFLAG( 0x00000040, "fPrintHorC" );
+ ADDFLAG( 0x00000080, "fPrintVerC" );
PRINT();
LINESTART();
}
if( __nFlags & 0x00007F00 )
{
ADDTEXT( " " );
- ADDFLAG( 0x00000100, " fPrintRCHead" );
- ADDFLAG( 0x00000200, " fPrintGrid" );
- ADDFLAG( 0x00000400, " fFitToPage" );
- ADDFLAG( 0x00000800, " fPrintArea" );
- ADDFLAG( 0x00001000, " fOnePrintArea" );
- ADDFLAG( 0x00002000, " fFilter" );
- ADDFLAG( 0x00004000, " fAutoFilter" );
+ ADDFLAG( 0x00000100, "fPrintRCHead" );
+ ADDFLAG( 0x00000200, "fPrintGrid" );
+ ADDFLAG( 0x00000400, "fFitToPage" );
+ ADDFLAG( 0x00000800, "fPrintArea" );
+ ADDFLAG( 0x00001000, "fOnePrintArea" );
+ ADDFLAG( 0x00002000, "fFilter" );
+ ADDFLAG( 0x00004000, "fAutoFilter" );
PRINT();
LINESTART();
}
if( __nFlags & 0xFFF80000 )
{
ADDTEXT( " " );
- ADDFLAG( 0x00020000, " fSplitV" );
- ADDFLAG( 0x00040000, " fSplitH" );
- ADDFLAG( 0x00180000, " fHiddenRow" );
- ADDFLAG( 0x00200000, " fHiddenCol" );
- ADDFLAG( 0x01000000, " fChartSize" );
- ADDFLAG( 0x02000000, " fFilterUnique" );
- ADDFLAG( 0x04000000, " fLayoutView" );
+ ADDFLAG( 0x00020000, "fSplitV" );
+ ADDFLAG( 0x00040000, "fSplitH" );
+ ADDFLAG( 0x00180000, "fHiddenRow" );
+ ADDFLAG( 0x00200000, "fHiddenCol" );
+ ADDFLAG( 0x01000000, "fChartSize" );
+ ADDFLAG( 0x02000000, "fFilterUnique" );
+ ADDFLAG( 0x04000000, "fLayoutView" );
ADDRESERVED( 0xF8C18000 );
PRINT();
LINESTART();
@@ -2741,12 +2744,12 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0001, " fTitles" );
- ADDFLAG( 0x0002, " fRowNums" );
- ADDFLAG( 0x0004, " fDisRefr" );
- ADDFLAG( 0x0080, " fFill" );
- ADDFLAG( 0x0100, " fAutoFmt" );
- ADDFLAG( 0x0400, " fDisEdit" );
+ ADDFLAG( 0x0001, "fTitles" );
+ ADDFLAG( 0x0002, "fRowNums" );
+ ADDFLAG( 0x0004, "fDisRefr" );
+ ADDFLAG( 0x0080, "fFill" );
+ ADDFLAG( 0x0100, "fAutoFmt" );
+ ADDFLAG( 0x0400, "fDisEdit" );
ADDRESERVED( 0xFA78 );
PRINT();
LINESTART();
@@ -2809,7 +2812,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
rIn >> __nFlags;
ADDTEXT( " " );
STARTFLAG();
- ADDFLAG( 0x0001, " fToughRecalc" );
+ ADDFLAG( 0x0001, "fToughRecalc" );
ADDRESERVED( 0xFFFE );
PRINT();
LINESTART();
@@ -3017,9 +3020,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
__AddPureBin( t, __nFlags );
ADDTEXT( ")" );
ADDTEXT( "):" );
- ADDFLAG( 0x0001, " fWnClosed" );
- ADDFLAG( 0x0002, " fWnPinned" );
- ADDFLAG( 0x0004, " fCached" );
+ ADDFLAG( 0x0001, "fWnClosed" );
+ ADDFLAG( 0x0002, "fWnPinned" );
+ ADDFLAG( 0x0004, "fCached" );
PRINT();
LINESTART();
ADDTEXT( "input window: " );
@@ -3051,11 +3054,11 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
if( __nFlags )
{
ADDTEXT( " " );
- ADDFLAG( 0x00000080, " fStrLookup" );
- ADDFLAG( 0x00000100, " fAllowBlank" );
- ADDFLAG( 0x00000200, " fSuppressCombo" );
- ADDFLAG( 0x00040000, " fShowInputMsg" );
- ADDFLAG( 0x00080000, " fShowErrorMsg" );
+ ADDFLAG( 0x00000080, "fStrLookup" );
+ ADDFLAG( 0x00000100, "fAllowBlank" );
+ ADDFLAG( 0x00000200, "fSuppressCombo" );
+ ADDFLAG( 0x00040000, "fShowInputMsg" );
+ ADDFLAG( 0x00080000, "fShowErrorMsg" );
}
PRINT();
LINESTART();
@@ -3170,12 +3173,12 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
UINT32 __nFlags = Read4( rIn );
LINESTART();
STARTFLAG();
- ADDFLAG( 0x00000001, " fBody" );
- ADDFLAG( 0x00000002, " fAbs" );
- ADDFLAG( 0x00000014, " fDescr" );
- ADDFLAG( 0x00000008, " fMark" );
- ADDFLAG( 0x00000080, " fFrame" );
- ADDFLAG( 0x00000100, " fUNC" );
+ ADDFLAG( 0x00000001, "fBody" );
+ ADDFLAG( 0x00000002, "fAbs" );
+ ADDFLAG( 0x00000014, "fDescr" );
+ ADDFLAG( 0x00000008, "fMark" );
+ ADDFLAG( 0x00000080, "fFrame" );
+ ADDFLAG( 0x00000100, "fUNC" );
ADDRESERVED( 0xFFFFFE60 );
PRINT();
@@ -3347,10 +3350,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
STARTFLAG();
ADDTEXT( " outlnlev=" );
__AddDec( t, (UINT16)(__nFlags & 0x0007) );
- ADDFLAG( 0x0010, " fCollapsed" );
- ADDFLAG( 0x0020, " fRowHeightZero" );
- ADDFLAG( 0x0040, " fUnsynced" );
- ADDFLAG( 0x0080, " fGhostDirty" );
+ ADDFLAG( 0x0010, "fCollapsed" );
+ ADDFLAG( 0x0020, "fRowHeightZero" );
+ ADDFLAG( 0x0040, "fUnsynced" );
+ ADDFLAG( 0x0080, "fGhostDirty" );
ADDRESERVED( 0xFF08 );
PRINT();
UINT16 nXF;
@@ -3359,8 +3362,8 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
ADDTEXT( "ix to XF: " ); __AddDec( t, (UINT16)(nXF & 0x0FFF) );
ADDTEXT( " add. flags(" ); __AddHex( t, nXF );
ADDTEXT( "):" );
- ADDFLAG( 0x1000, " fExAsc" );
- ADDFLAG( 0x2000, " fExDsc" );
+ ADDFLAG( 0x1000, "fExAsc" );
+ ADDFLAG( 0x2000, "fExDsc" );
ADDRESERVED( 0xC000 );
PRINT();
}
@@ -3378,8 +3381,8 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
PRINT();
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAlwaysCalc" );
- ADDFLAG( 0x0002, " fCalcOnLoad" );
+ ADDFLAG( 0x0001, "fAlwaysCalc" );
+ ADDFLAG( 0x0002, "fCalcOnLoad" );
ADDRESERVED( 0xFFFC );
PRINT();
LINESTART();
@@ -3399,10 +3402,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
ADDTEXT( "default row " );
STARTFLAG();
- ADDFLAG( 0x0001, " fUnsynced" );
- ADDFLAG( 0x0002, " fRowHtZero" );
- ADDFLAG( 0x0004, " fExAsc" );
- ADDFLAG( 0x0008, " fExDsc" );
+ ADDFLAG( 0x0001, "fUnsynced" );
+ ADDFLAG( 0x0002, "fRowHtZero" );
+ ADDFLAG( 0x0004, "fExAsc" );
+ ADDFLAG( 0x0008, "fExDsc" );
ADDRESERVED( 0xFFF0 );
PRINT();
LINESTART();
@@ -3466,17 +3469,17 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
LINESTART();
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0001, " fImportPRE" );
- ADDFLAG( 0x0002, " fIgnoreSep" );
- ADDFLAG( 0x0004, " fUseSetting" );
- ADDFLAG( 0x0010, " fIgnoreDate" );
- ADDFLAG( 0x0020, " fWhatIsIt?" );
+ ADDFLAG( 0x0001, "fImportPRE" );
+ ADDFLAG( 0x0002, "fIgnoreSep" );
+ ADDFLAG( 0x0004, "fUseSetting" );
+ ADDFLAG( 0x0010, "fIgnoreDate" );
+ ADDFLAG( 0x0020, "fWhatIsIt?" );
ADDRESERVED( 0xFFC8 );
PRINT();
LINESTART();
rIn >> __nFlags;
STARTFLAG();
- ADDFLAG( 0x0002, " fTables" );
+ ADDFLAG( 0x0002, "fTables" );
ADDRESERVED( 0xFFFD );
PRINT();
LINESTART();
@@ -3558,14 +3561,14 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
STARTFLAG();
if( __nFlags )
{
- ADDFLAG( 0x00000001, " fWin" );
- ADDFLAG( 0x00000002, " fRisc" );
- ADDFLAG( 0x00000004, " fBeta" );
- ADDFLAG( 0x00000008, " fWinAny" );
- ADDFLAG( 0x00000010, " fMacAny" );
- ADDFLAG( 0x00000020, " fBetaAny" );
- ADDFLAG( 0x00000100, " fRiscAny" );
- ADDFLAG( 0xFFFFE0C0, " fXxxxxxx" );
+ ADDFLAG( 0x00000001, "fWin" );
+ ADDFLAG( 0x00000002, "fRisc" );
+ ADDFLAG( 0x00000004, "fBeta" );
+ ADDFLAG( 0x00000008, "fWinAny" );
+ ADDFLAG( 0x00000010, "fMacAny" );
+ ADDFLAG( 0x00000020, "fBetaAny" );
+ ADDFLAG( 0x00000100, "fRiscAny" );
+ ADDRESERVED( 0xFFFFE0C0 );
}
PRINT();
@@ -3659,8 +3662,8 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAuto" );
- ADDFLAG( 0x0004, " fDrawTick" );
+ ADDFLAG( 0x0001, "fAuto" );
+ ADDFLAG( 0x0004, "fDrawTick" );
PRINT();
}
LINESTART();
@@ -3700,9 +3703,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAuto" );
- ADDFLAG( 0x0010, " fNoBackg" );
- ADDFLAG( 0x0020, " fNoFore" );
+ ADDFLAG( 0x0001, "fAuto" );
+ ADDFLAG( 0x0010, "fNoBackg" );
+ ADDFLAG( 0x0020, "fNoFore" );
ADDRESERVED( 0xFFCE );
PRINT();
}
@@ -3735,8 +3738,8 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x01, " fAuto" );
- ADDFLAG( 0x02, " fInvertNeg" );
+ ADDFLAG( 0x01, "fAuto" );
+ ADDFLAG( 0x02, "fInvertNeg" );
PRINT();
}
}
@@ -3768,7 +3771,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fVaried" );
+ ADDFLAG( 0x0001, "fVaried" );
PRINT();
}
LINESTART();
@@ -3819,12 +3822,12 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x01, " fAutoPosition" );
- ADDFLAG( 0x02, " fAutoSeries" );
- ADDFLAG( 0x04, " fAutoPosX" );
- ADDFLAG( 0x08, " fAutoPosY" );
- ADDFLAG( 0x10, " fVert" );
- ADDFLAG( 0x20, " fWasDataTable" );
+ ADDFLAG( 0x01, "fAutoPosition" );
+ ADDFLAG( 0x02, "fAutoSeries" );
+ ADDFLAG( 0x04, "fAutoPosX" );
+ ADDFLAG( 0x08, "fAutoPosY" );
+ ADDFLAG( 0x10, "fVert" );
+ ADDFLAG( 0x20, "fWasDataTable" );
PRINT();
}
}
@@ -3845,10 +3848,10 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fTranspose" );
- ADDFLAG( 0x0002, " fStacked" );
- ADDFLAG( 0x0004, " f100" );
- ADDFLAG( 0x0008, " fHasShadow" );
+ ADDFLAG( 0x0001, "fTranspose" );
+ ADDFLAG( 0x0002, "fStacked" );
+ ADDFLAG( 0x0004, "f100" );
+ ADDFLAG( 0x0008, "fHasShadow" );
PRINT();
}
}
@@ -3938,9 +3941,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAutoCol" );
- ADDFLAG( 0x0002, " fAutoBack" );
- ADDFLAG( 0x0020, " fAutoRot" );
+ ADDFLAG( 0x0001, "fAutoCol" );
+ ADDFLAG( 0x0002, "fAutoBack" );
+ ADDFLAG( 0x0020, "fAutoRot" );
PRINT();
}
LINESTART();
@@ -3969,14 +3972,14 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAutoMin" );
- ADDFLAG( 0x0002, " fAutoMax" );
- ADDFLAG( 0x0004, " fAutoMajor" );
- ADDFLAG( 0x0008, " fAutoMinor" );
- ADDFLAG( 0x0010, " fAutoCross" );
- ADDFLAG( 0x0020, " fLogScale" );
- ADDFLAG( 0x0040, " fReverse" );
- ADDFLAG( 0x0080, " fMaxCross" );
+ ADDFLAG( 0x0001, "fAutoMin" );
+ ADDFLAG( 0x0002, "fAutoMax" );
+ ADDFLAG( 0x0004, "fAutoMajor" );
+ ADDFLAG( 0x0008, "fAutoMinor" );
+ ADDFLAG( 0x0010, "fAutoCross" );
+ ADDFLAG( 0x0020, "fLogScale" );
+ ADDFLAG( 0x0040, "fReverse" );
+ ADDFLAG( 0x0080, "fMaxCross" );
PRINT();
}
}
@@ -3998,9 +4001,9 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fBetween" );
- ADDFLAG( 0x0002, " fMaxCross" );
- ADDFLAG( 0x0004, " fReverse" );
+ ADDFLAG( 0x0001, "fBetween" );
+ ADDFLAG( 0x0002, "fMaxCross" );
+ ADDFLAG( 0x0004, "fReverse" );
PRINT();
}
}
@@ -4092,18 +4095,18 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAutoColor" );
- ADDFLAG( 0x0002, " fShowKey" );
- ADDFLAG( 0x0004, " fShowValue" );
- ADDFLAG( 0x0008, " fVert" );
- ADDFLAG( 0x0010, " fAutoText" );
- ADDFLAG( 0x0020, " fGenerated" );
- ADDFLAG( 0x0040, " fDeleted" );
- ADDFLAG( 0x0080, " fAutoMode" );
- ADDFLAG( 0x0800, " fShLabPct" );
- ADDFLAG( 0x1000, " fShowPct" );
- ADDFLAG( 0x2000, " fShowBubbleSizes" );
- ADDFLAG( 0x4000, " fShowLabel" );
+ ADDFLAG( 0x0001, "fAutoColor" );
+ ADDFLAG( 0x0002, "fShowKey" );
+ ADDFLAG( 0x0004, "fShowValue" );
+ ADDFLAG( 0x0008, "fVert" );
+ ADDFLAG( 0x0010, "fAutoText" );
+ ADDFLAG( 0x0020, "fGenerated" );
+ ADDFLAG( 0x0040, "fDeleted" );
+ ADDFLAG( 0x0080, "fAutoMode" );
+ ADDFLAG( 0x0800, "fShLabPct" );
+ ADDFLAG( 0x1000, "fShowPct" );
+ ADDFLAG( 0x2000, "fShowBubbleSizes" );
+ ADDFLAG( 0x4000, "fShowLabel" );
PRINT();
}
LINESTART();
@@ -4171,8 +4174,8 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x01, " fAutoSize" );
- ADDFLAG( 0x02, " fAutoPosition" );
+ ADDFLAG( 0x01, "fAutoSize" );
+ ADDFLAG( 0x02, "fAutoPosition" );
PRINT();
}
}
@@ -4310,7 +4313,7 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x01, " fCustomIfmt" );
+ ADDFLAG( 0x01, "fCustomIfmt" );
PRINT();
}
LINESTART();
@@ -4410,14 +4413,14 @@ void Biff8RecDumper::RecDump( BOOL bSubStream )
{
LINESTART();
STARTFLAG();
- ADDFLAG( 0x0001, " fAutiMin" );
- ADDFLAG( 0x0002, " fAutoMax" );
- ADDFLAG( 0x0004, " fAutoMajor" );
- ADDFLAG( 0x0008, " fAutoMinor" );
- ADDFLAG( 0x0010, " fDateAxis" );
- ADDFLAG( 0x0020, " fAutoBase" );
- ADDFLAG( 0x0040, " fAutoCross" );
- ADDFLAG( 0x0080, " fAutoDate" );
+ ADDFLAG( 0x0001, "fAutoMin" );
+ ADDFLAG( 0x0002, "fAutoMax" );
+ ADDFLAG( 0x0004, "fAutoMajor" );
+ ADDFLAG( 0x0008, "fAutoMinor" );
+ ADDFLAG( 0x0010, "fDateAxis" );
+ ADDFLAG( 0x0020, "fAutoBase" );
+ ADDFLAG( 0x0040, "fAutoCross" );
+ ADDFLAG( 0x0080, "fAutoDate" );
PRINT();
}
}
@@ -4911,9 +4914,9 @@ void Biff8RecDumper::ObjDump( const ULONG nMaxLen )
{
ADDTEXT( " " );
STARTFLAG();
- ADDFLAG( 0x0008, " fAsSymbol" );
- ADDFLAG( 0x0002, " fLinked" );
- ADDFLAG( 0x0001, " f1???" );
+ ADDFLAG( 0x0008, "fAsSymbol" );
+ ADDFLAG( 0x0002, "fLinked" );
+ ADDFLAG( 0x0001, "f1???" );
}
}
break;
@@ -4924,12 +4927,12 @@ void Biff8RecDumper::ObjDump( const ULONG nMaxLen )
rIn >> nFmlaLen;
if ( sizeof(nFmlaLen) + nFmlaLen == nL )
{
- ADDTEXT( "linked\n OLE stream: LNK........ (ID in EXTERNNAME of SUPBOOK)\n XTI: " );
- IGNORE(7);
- ADDHEX(2);
- ADDTEXT( " Externname: " );
- ADDHEX(2);
- IGNORE(3); // MAY be right
+ ADDTEXT( "linked\n OLE stream: LNK??? (from EXTERNNAME) " );
+ rIn >> nFmlaLen;
+ ADDTEXT( " unknown=" ); ADDHEX( 4 );
+ PRINT();
+ t.Erase();
+ FormulaDump( nFmlaLen, FT_CellFormula );
}
else
{
@@ -4945,22 +4948,20 @@ void Biff8RecDumper::ObjDump( const ULONG nMaxLen )
ADDTEXT( '\n' );
if ( nBytesLeft < 4 )
ADDTEXT( " >> ByteString OVERRUN <<\n" );
- else if ( nBytesLeft == 5 )
+
+ rIn.Seek( nPos1 + sizeof(nFmlaLen) + nFmlaLen );
+ if( rIn.GetRecLeft() == 4 )
{
- ADDTEXT( " pad byte " );
- ADDHEX(1);
- ADDTEXT( '\n' );
+ ADDTEXT( " OLE storage name: MBD" );
+ __AddPureHex( t, rIn.ReaduInt32() );
}
- else if ( nBytesLeft == 4 )
- ADDTEXT( " no pad byte\n" );
else
- ADDTEXT( " oops.. bytes left?!?\n" );
-
- ADDTEXT( " OLE stream: MBD" );
- rIn.Seek( nPos1 + sizeof(nFmlaLen) + nFmlaLen );
- UINT32 nOleId;
- rIn >> nOleId;
- __AddPureHex( t, nOleId );
+ {
+ ADDTEXT( " Ctls stream data: start=" );
+ ADDHEX( 4 );
+ ADDTEXT( " size=" );
+ ADDHEX( 4 );
+ }
}
}
break;
@@ -5027,12 +5028,10 @@ void Biff8RecDumper::ObjDump( const ULONG nMaxLen )
}
-#undef ADDFLAG
#undef LINESTART
#undef IGNORE
#undef ADDHEX
#undef ADDDEC
-#undef ADDTEXT
#undef ADDCOLROW
#undef PRINT
#undef PreDump
@@ -5206,409 +5205,396 @@ void Biff8RecDumper::ContDumpStream( SvStream& rStrm, const ULONG nL )
struct XclDumpFunc
{
const sal_Char* pName; /// Name of the function.
- sal_uInt16 nIndex; /// Excel built-in function index.
sal_uInt16 nParam; /// Parameter count for fixed functions.
};
const XclDumpFunc pFuncData[] =
{
- { "COUNT", 0, 0 },
- { "IF", 1, 0 },
- { "ISNA", 2, 1 },
- { "ISERROR", 3, 1 },
- { "SUM", 4, 0 },
- { "AVERAGE", 5, 0 },
- { "MIN", 6, 0 },
- { "MAX", 7, 0 },
- { "ROW", 8, 0 },
- { "COLUMN", 9, 0 },
- { "NA", 10, 0 },
- { "NPV", 11, 0 },
- { "STDEV", 12, 0 },
- { "DOLLAR", 13, 0 },
- { "FIXED", 14, 0 },
- { "SIN", 15, 1 },
- { "COS", 16, 1 },
- { "TAN", 17, 1 },
- { "ATAN", 18, 1 },
- { "PI", 19, 0 },
- { "SQRT", 20, 1 },
- { "EXP", 21, 1 },
- { "LN", 22, 1 },
- { "LOG10", 23, 1 },
- { "ABS", 24, 1 },
- { "INT", 25, 1 },
- { "SIGN", 26, 1 },
- { "ROUND", 27, 2 },
- { "LOOKUP", 28, 0 },
- { "INDEX", 29, 0 },
- { "REPT", 30, 2 },
- { "MID", 31, 3 },
- { "LEN", 32, 1 },
- { "VALUE", 33, 1 },
- { "TRUE", 34, 0 },
- { "FALSE", 35, 0 },
- { "AND", 36, 0 },
- { "OR", 37, 0 },
- { "NOT", 38, 1 },
- { "MOD", 39, 2 },
- { "DCOUNT", 40, 3 },
- { "DSUM", 41, 3 },
- { "DAVERAGE", 42, 3 },
- { "DMIN", 43, 3 },
- { "DMAX", 44, 3 },
- { "DSTDEV", 45, 3 },
- { "VAR", 46, 0 },
- { "DVAR", 47, 3 },
- { "TEXT", 48, 2 },
- { "LINEST", 49, 0 },
- { "TREND", 50, 0 },
- { "LOGEST", 51, 0 },
- { "GROWTH", 52, 0 },
- { "GOTO", 53 }, // macro/internal
- { "HALT", 54 }, // macro/internal
- { "RETURN", 55 }, // macro/internal
- { "PV", 56, 0 },
- { "FV", 57, 0 },
- { "NPER", 58, 0 },
- { "PMT", 59, 0 },
- { "RATE", 60, 0 },
- { "MIRR", 61, 3 },
- { "IRR", 62, 0 },
- { "RAND", 63, 0 },
- { "MATCH", 64, 0 },
- { "DATE", 65, 3 },
- { "TIME", 66, 3 },
- { "DAY", 67, 1 },
- { "MONTH", 68, 1 },
- { "YEAR", 69, 1 },
- { "WEEKDAY", 70, 0 },
- { "HOUR", 71, 1 },
- { "MINUTE", 72, 1 },
- { "SECOND", 73, 1 },
- { "NOW", 74, 0 },
- { "AREAS", 75, 1 },
- { "ROWS", 76, 1 },
- { "COLUMNS", 77, 1 },
- { "OFFSET", 78, 0 },
- { "ABSREF", 79 }, // macro/internal
- { "RELREF", 80 }, // macro/internal
- { "ARGUMENT", 81 }, // macro/internal
- { "SEARCH", 82, 0 },
- { "TRANSPOSE", 83, 1 },
- { "ERROR", 84 }, // macro/internal
- { "STEP", 85 }, // macro/internal
- { "TYPE", 86, 1 },
- { "ECHO", 87 }, // macro/internal
- { "SET.NAME", 88 }, // macro/internal
- { "CALLER", 89 }, // macro/internal
- { "DEREF", 90 }, // macro/internal
- { "WINDOWS", 91 }, // macro/internal
- { "SERIES", 92 }, // macro/internal
- { "DOCUMENTS", 93 }, // macro/internal
- { "ACTIVE.CELL", 94 }, // macro/internal
- { "SELECTION", 95 }, // macro/internal
- { "RESULT", 96 }, // macro/internal
- { "ATAN2", 97, 2 },
- { "ASIN", 98, 1 },
- { "ACOS", 99, 1 },
- { "CHOSE", 100, 0 },
- { "HLOOKUP", 101, 0 },
- { "VLOOKUP", 102, 0 },
- { "LINKS", 103 }, // macro/internal
- { "INPUT", 104 }, // macro/internal
- { "ISREF", 105, 1 },
- { "GET.FORMULA", 106 }, // macro/internal
- { "GET.NAME", 107 }, // macro/internal
- { "SET.VALUE", 108, 2 }, // macro/internal
- { "LOG", 109, 0 },
- { "EXEC", 110 }, // macro/internal
- { "CHAR", 111, 1 },
- { "LOWER", 112, 1 },
- { "UPPER", 113, 1 },
- { "PROPER", 114, 1 },
- { "LEFT", 115, 0 },
- { "RIGHT", 116, 0 },
- { "EXACT", 117, 2 },
- { "TRIM", 118, 1 },
- { "REPLACE", 119, 4 },
- { "SUBSTITUTE", 120, 0 },
- { "CODE", 121, 1 },
- { "NAMES", 122 }, // macro/internal
- { "DIRECTORY", 123 }, // macro/internal
- { "FIND", 124, 0 },
- { "CELL", 125, 0 },
- { "ISERR", 126, 1 },
- { "ISTEXT", 127, 1 },
- { "ISNUMBER", 128, 1 },
- { "ISBLANK", 129, 1 },
- { "T", 130, 1 },
- { "N", 131, 1 },
- { "FOPEN", 132 }, // macro/internal
- { "FCLOSE", 133 }, // macro/internal
- { "FSIZE", 134 }, // macro/internal
- { "FREADLN", 135 }, // macro/internal
- { "FREAD", 136 }, // macro/internal
- { "FWRITELN", 137 }, // macro/internal
- { "FWRITE", 138 }, // macro/internal
- { "FPOS", 139 }, // macro/internal
- { "DATEVALUE", 140, 1 },
- { "TIMEVALUE", 141, 1 },
- { "SLN", 142, 3 },
- { "SYD", 143, 4 },
- { "DDB", 144, 0 },
- { "GET.DEF", 145 }, // macro/internal
- { "REFTEXT", 146 }, // macro/internal
- { "TEXTREF", 147 }, // macro/internal
- { "INDIRECT", 148, 0 },
- { "REGISTER", 149 }, // macro/internal
- { "CALL", 150 }, // macro/internal
- { "ADD.BAR", 151 }, // macro/internal
- { "ADD.MENU", 152 }, // macro/internal
- { "ADD.COMMAND", 153 }, // macro/internal
- { "ENABLE.COMMAND", 154 }, // macro/internal
- { "CHECK.COMMAND", 155 }, // macro/internal
- { "RENAME.COMMAND", 156 }, // macro/internal
- { "SHOW.BAR", 157 }, // macro/internal
- { "DELETE.MENU", 158 }, // macro/internal
- { "DELETE.COMMAND", 159 }, // macro/internal
- { "GET.CHART.ITEM", 160 }, // macro/internal
- { "DIALOG.BOX", 161 }, // macro/internal
- { "CLEAN", 162, 1 },
- { "MDETERM", 163, 1 },
- { "MINVERSE", 164, 1 },
- { "MMULT", 165, 2 },
- { "FILES", 166 }, // macro/internal
- { "IPMT", 167, 0 },
- { "PPMT", 168, 0 },
- { "COUNTA", 169, 0 },
- { "CANCEL.KEY", 170 }, // macro/internal
- { "FOR", 171 }, // macro/internal
- { "WHILE", 172 }, // macro/internal
- { "BREAK", 173 }, // macro/internal
- { "NEXT", 174 }, // macro/internal
- { "INITIATE", 175 }, // macro/internal
- { "REQUEST", 176 }, // macro/internal
- { "POKE", 177 }, // macro/internal
- { "EXECUTE", 178 }, // macro/internal
- { "TERMINATE", 179 }, // macro/internal
- { "RESTART", 180 }, // macro/internal
- { "HELP", 181 }, // macro/internal
- { "GET.BAR", 182 }, // macro/internal
- { "PRODUCT", 183, 0 },
- { "FACT", 184, 1 },
- { "GET.CELL", 185 }, // macro/internal
- { "GET.WORKSPACE", 186 }, // macro/internal
- { "GET.WINDOW", 187 }, // macro/internal
- { "GET.DOCUMENT", 188 }, // macro/internal
- { "DPRODUCT", 189, 3 },
- { "ISNONTEXT", 190, 1 },
- { "GET.NOTE", 191 }, // macro/internal
- { "NOTE", 192 }, // macro/internal
- { "STDEVP", 193, 0 },
- { "VARP", 194, 0 },
- { "DSTDDEVP", 195, 3 },
- { "DVARP", 196, 3 },
- { "TRUNC", 197, 0 },
- { "ISLOGICAL", 198, 1 },
- { "DBCOUNTA", 199, 3 },
- { "DELETE.BAR", 200 }, // macro/internal
- { "UNREGISTER", 201 }, // macro/internal
- { "202", 202 }, // not used
- { "203", 203 }, // not used
- { "USDOLLAR", 204 }, // macro/internal
- { "FINDB", 205 }, // macro/internal
- { "SEARCHB", 206 }, // macro/internal
- { "REPLACEB", 207 }, // macro/internal
- { "LEFTB", 208 }, // macro/internal
- { "RIGHTB", 209 }, // macro/internal
- { "MIDB", 210 }, // macro/internal
- { "LENB", 211 }, // macro/internal
- { "ROUNDUP", 212, 2 },
- { "ROUNDDOWN", 213, 2 },
- { "ASC", 214 }, // macro/internal
- { "DBSC", 215 }, // macro/internal
- { "RANK", 216, 0 },
- { "217", 217 }, // not used
- { "218", 218 }, // not used
- { "ADDRESS", 219, 0 },
- { "DAYS360", 220, 0 },
- { "TODAY", 221, 0 },
- { "VDB", 222, 0 },
- { "ELSE", 223 }, // macro/internal
- { "ELSE.IF", 224 }, // macro/internal
- { "END.IF", 225 }, // macro/internal
- { "FOR.CELL", 226 }, // macro/internal
- { "MEDIAN", 227, 0 },
- { "SUMPRODUCT", 228, 0 },
- { "SINH", 229, 1 },
- { "COSH", 230, 1 },
- { "TANH", 231, 1 },
- { "ASINH", 232, 1 },
- { "ACOSH", 233, 1 },
- { "ATANH", 234, 1 },
- { "DGET", 235, 3 },
- { "CREATE.OBJECT", 236 }, // macro/internal
- { "VOLATILE", 237 }, // macro/internal
- { "LAST.ERROR", 238 }, // macro/internal
- { "CUSTOM.UNDO", 239 }, // macro/internal
- { "CUSTOM.REPEAT", 240 }, // macro/internal
- { "FORMULA.CONVERT", 241 }, // macro/internal
- { "GET.LINK.INFO", 242 }, // macro/internal
- { "TEXT.BOX", 243 }, // macro/internal
- { "INFO", 244 }, // macro/internal
- { "GROUP", 245 }, // macro/internal
- { "GET.OBJECT", 246 }, // macro/internal
- { "DB", 247, 0 },
- { "PAUSE", 248 }, // macro/internal
- { "249", 249 }, // not used
- { "250", 250 }, // not used
- { "RESUME", 251 }, // macro/internal
- { "FREQUENCY", 252, 2 },
- { "ADD.TOOLBAR", 253 }, // macro/internal
- { "DELETE.TOOLBAR", 254 }, // macro/internal
- { "EXTERNCALL", 255 }, // macro/internal
- { "RESET.TOOLBAR", 256 }, // macro/internal
- { "EVALUATE", 257 }, // macro/internal
- { "GET.TOOLBAR", 258 }, // macro/internal
- { "GET.TOOL", 259 }, // macro/internal
- { "SPELLING.CHECK", 260 }, // macro/internal
- { "ERROR.TYPE", 261, 1 },
- { "APP.TITLE", 262 }, // macro/internal
- { "WINDOW.TITLE", 263 }, // macro/internal
- { "SAVE.TOOLBAR", 264 }, // macro/internal
- { "ENABLE.TOOL", 265 }, // macro/internal
- { "PRESS.TOOL", 266 }, // macro/internal
- { "REGISTER.ID", 267 }, // macro/internal
- { "GET.WORKBOOK", 268 }, // macro/internal
- { "AVEDEV", 269, 0 },
- { "BETADIST", 270, 0 },
- { "GAMMALN", 271, 1 },
- { "BETAINV", 272, 0 },
- { "BINOMDIST", 273, 4 },
- { "CHIDIST", 274, 2 },
- { "CHIINV", 275, 2 },
- { "COMBIN", 276, 2 },
- { "CONFIDENCE", 277, 3 },
- { "CRITBINOM", 278, 3 },
- { "EVEN", 279, 1 },
- { "EXPONDIST", 280, 3 },
- { "FDIST", 281, 3 },
- { "FINV", 282, 3 },
- { "FISHER", 283, 1 },
- { "FISHERINV", 284, 1 },
- { "FLOOR", 285, 2 },
- { "GAMMADIST", 286, 4 },
- { "GAMMAINV", 287, 3 },
- { "CEILING", 288, 2 },
- { "HYPGEOMDIST", 289, 4 },
- { "LOGNORMDIST", 290, 3 },
- { "LOGINV", 291, 3 },
- { "NEGBINOMDIST", 292, 3 },
- { "NORMDIST", 293, 4 },
- { "NORMSDIST", 294, 1 },
- { "NORMINV", 295, 3 },
- { "NORMSINV", 296, 1 },
- { "STANDARDIZE", 297, 3 },
- { "ODD", 298, 1 },
- { "PERMUT", 299, 2 },
- { "POISSON", 300, 3 },
- { "TDIST", 301, 3 },
- { "WEIBULL", 302, 4 },
- { "SUMXMY2", 303, 2 },
- { "SUMX2MY2", 304, 2 },
- { "SUMX2PY2", 305, 2 },
- { "CHITEST", 306, 2 },
- { "CORREL", 307, 2 },
- { "COVAR", 308, 2 },
- { "FORECAST", 309, 3 },
- { "FTEST", 310, 2 },
- { "INTERCEPT", 311, 2 },
- { "PEARSON", 312, 2 },
- { "RSQ", 313, 2 },
- { "STEYX", 314, 2 },
- { "SLOPE", 315, 2 },
- { "TTEST", 316, 4 },
- { "PROB", 317, 0 },
- { "DEVSQ", 318, 0 },
- { "GEOMEAN", 319, 0 },
- { "HARMEAN", 320, 0 },
- { "SUMSQ", 321, 0 },
- { "KURT", 322, 0 },
- { "SKEW", 323, 0 },
- { "ZTEST", 324, 0 },
- { "LARGE", 325, 2 },
- { "SMALL", 326, 2 },
- { "QUARTILE", 327, 2 },
- { "PERCENTILE", 328, 2 },
- { "PERCENTRANK", 329, 0 },
- { "MODE", 330, 0 },
- { "TRIMMEAN", 331, 2 },
- { "TINV", 332, 2 },
- { "333", 333 }, // not used
- { "MOVIE.COMMAND", 334 }, // macro/internal
- { "GET.MOVIE", 335 }, // macro/internal
- { "CONCATENATE", 336, 0 },
- { "POWER", 337, 2 },
- { "PIVOT.ADD.DATA", 338 }, // macro/internal
- { "GET.PIVOT.TABLE", 339 }, // macro/internal
- { "GET.PIVOT.FIELD", 340 }, // macro/internal
- { "GET.PIVOT.ITEM", 341 }, // macro/internal
- { "RADIANS", 342, 1 },
- { "DEGREES", 343, 1 },
- { "SUBTOTAL", 344, 0 },
- { "SUMIF", 345, 0 },
- { "COUNTIF", 346, 2 },
- { "COUNTBLANK", 347, 1 },
- { "SCENARIO.GET", 348 }, // macro/internal
- { "OPTIONS.LISTS.GET",349 }, // macro/internal
- { "ISPMT", 350, 4 },
- { "DATEDIF", 351 }, // macro/internal
- { "DATESTRING", 352 }, // macro/internal
- { "NUMBERSTRING", 353 }, // macro/internal
- { "ROMAN", 354, 0 },
- { "OPEN.DIALOG", 355 }, // macro/internal
- { "SAVE.DIALOG", 356 }, // macro/internal
- { "VIEW.GET", 357 }, // macro/internal
- { "GETPIVOTDATA", 358, 0 },
- { "HYPERLINK", 359, 2 },
- { "PHONETIC", 360 }, // macro/internal
- { "AVERAGEA", 361, 0 },
- { "MAXA", 362, 0 },
- { "MINA", 363, 0 },
- { "STDEVPA", 364, 0 },
- { "VARPA", 365, 0 },
- { "STDEVA", 366, 0 },
- { "VARA", 367, 0 },
- { "BAHTTEXT", 368, 1 },
- { "THAIDAYOFWEEK", 369 }, // macro/internal
- { "THAIDIGIT", 370 }, // macro/internal
- { "THAIMONTHOFYEAR", 371 }, // macro/internal
- { "THAINUMSOUND", 372 }, // macro/internal
- { "THAINUMSTRING", 373 }, // macro/internal
- { "THAISTRINGLENGTH", 374 }, // macro/internal
- { "ISTHAIDIGIT", 375 }, // macro/internal
- { "ROUNDBAHTDOWN", 376 }, // macro/internal
- { "ROUNDBAHTUP", 377 }, // macro/internal
- { "THAIYEAR", 378 }, // macro/internal
- { "RTD", 379 } // macro/internal
+/* 0*/ { "COUNT", 0 },
+ { "IF", 0 },
+ { "ISNA", 1 },
+ { "ISERROR", 1 },
+ { "SUM", 0 },
+/* 5*/ { "AVERAGE", 0 },
+ { "MIN", 0 },
+ { "MAX", 0 },
+ { "ROW", 0 },
+ { "COLUMN", 0 },
+/* 10*/ { "NA", 0 },
+ { "NPV", 0 },
+ { "STDEV", 0 },
+ { "DOLLAR", 0 },
+ { "FIXED", 0 },
+/* 15*/ { "SIN", 1 },
+ { "COS", 1 },
+ { "TAN", 1 },
+ { "ATAN", 1 },
+ { "PI", 0 },
+/* 20*/ { "SQRT", 1 },
+ { "EXP", 1 },
+ { "LN", 1 },
+ { "LOG10", 1 },
+ { "ABS", 1 },
+/* 25*/ { "INT", 1 },
+ { "SIGN", 1 },
+ { "ROUND", 2 },
+ { "LOOKUP", 0 },
+ { "INDEX", 0 },
+/* 30*/ { "REPT", 2 },
+ { "MID", 3 },
+ { "LEN", 1 },
+ { "VALUE", 1 },
+ { "TRUE", 0 },
+/* 35*/ { "FALSE", 0 },
+ { "AND", 0 },
+ { "OR", 0 },
+ { "NOT", 1 },
+ { "MOD", 2 },
+/* 40*/ { "DCOUNT", 3 },
+ { "DSUM", 3 },
+ { "DAVERAGE", 3 },
+ { "DMIN", 3 },
+ { "DMAX", 3 },
+/* 45*/ { "DSTDEV", 3 },
+ { "VAR", 0 },
+ { "DVAR", 3 },
+ { "TEXT", 2 },
+ { "LINEST", 0 },
+/* 50*/ { "TREND", 0 },
+ { "LOGEST", 0 },
+ { "GROWTH", 0 },
+ { "GOTO" }, // macro/internal
+ { "HALT" }, // macro/internal
+/* 55*/ { "RETURN" }, // macro/internal
+ { "PV", 0 },
+ { "FV", 0 },
+ { "NPER", 0 },
+ { "PMT", 0 },
+/* 60*/ { "RATE", 0 },
+ { "MIRR", 3 },
+ { "IRR", 0 },
+ { "RAND", 0 },
+ { "MATCH", 0 },
+/* 65*/ { "DATE", 3 },
+ { "TIME", 3 },
+ { "DAY", 1 },
+ { "MONTH", 1 },
+ { "YEAR", 1 },
+/* 70*/ { "WEEKDAY", 0 },
+ { "HOUR", 1 },
+ { "MINUTE", 1 },
+ { "SECOND", 1 },
+ { "NOW", 0 },
+/* 75*/ { "AREAS", 1 },
+ { "ROWS", 1 },
+ { "COLUMNS", 1 },
+ { "OFFSET", 0 },
+ { "ABSREF" }, // macro/internal
+/* 80*/ { "RELREF" }, // macro/internal
+ { "ARGUMENT" }, // macro/internal
+ { "SEARCH", 0 },
+ { "TRANSPOSE", 1 },
+ { "ERROR" }, // macro/internal
+/* 85*/ { "STEP" }, // macro/internal
+ { "TYPE", 1 },
+ { "ECHO" }, // macro/internal
+ { "SET.NAME" }, // macro/internal
+ { "CALLER" }, // macro/internal
+/* 90*/ { "DEREF" }, // macro/internal
+ { "WINDOWS" }, // macro/internal
+ { "SERIES" }, // macro/internal
+ { "DOCUMENTS" }, // macro/internal
+ { "ACTIVE.CELL" }, // macro/internal
+/* 95*/ { "SELECTION" }, // macro/internal
+ { "RESULT" }, // macro/internal
+ { "ATAN2", 2 },
+ { "ASIN", 1 },
+ { "ACOS", 1 },
+/*100*/ { "CHOSE", 0 },
+ { "HLOOKUP", 0 },
+ { "VLOOKUP", 0 },
+ { "LINKS" }, // macro/internal
+ { "INPUT" }, // macro/internal
+/*105*/ { "ISREF", 1 },
+ { "GET.FORMULA" }, // macro/internal
+ { "GET.NAME" }, // macro/internal
+ { "SET.VALUE", 2 }, // macro/internal
+ { "LOG", 0 },
+/*110*/ { "EXEC" }, // macro/internal
+ { "CHAR", 1 },
+ { "LOWER", 1 },
+ { "UPPER", 1 },
+ { "PROPER", 1 },
+/*115*/ { "LEFT", 0 },
+ { "RIGHT", 0 },
+ { "EXACT", 2 },
+ { "TRIM", 1 },
+ { "REPLACE", 4 },
+/*120*/ { "SUBSTITUTE", 0 },
+ { "CODE", 1 },
+ { "NAMES" }, // macro/internal
+ { "DIRECTORY" }, // macro/internal
+ { "FIND", 0 },
+/*125*/ { "CELL", 0 },
+ { "ISERR", 1 },
+ { "ISTEXT", 1 },
+ { "ISNUMBER", 1 },
+ { "ISBLANK", 1 },
+/*130*/ { "T", 1 },
+ { "N", 1 },
+ { "FOPEN" }, // macro/internal
+ { "FCLOSE" }, // macro/internal
+ { "FSIZE" }, // macro/internal
+/*135*/ { "FREADLN" }, // macro/internal
+ { "FREAD" }, // macro/internal
+ { "FWRITELN" }, // macro/internal
+ { "FWRITE" }, // macro/internal
+ { "FPOS" }, // macro/internal
+/*140*/ { "DATEVALUE", 1 },
+ { "TIMEVALUE", 1 },
+ { "SLN", 3 },
+ { "SYD", 4 },
+ { "DDB", 0 },
+/*145*/ { "GET.DEF" }, // macro/internal
+ { "REFTEXT" }, // macro/internal
+ { "TEXTREF" }, // macro/internal
+ { "INDIRECT", 0 },
+ { "REGISTER" }, // macro/internal
+/*150*/ { "CALL" }, // macro/internal
+ { "ADD.BAR" }, // macro/internal
+ { "ADD.MENU" }, // macro/internal
+ { "ADD.COMMAND" }, // macro/internal
+ { "ENABLE.COMMAND" }, // macro/internal
+/*155*/ { "CHECK.COMMAND" }, // macro/internal
+ { "RENAME.COMMAND" }, // macro/internal
+ { "SHOW.BAR" }, // macro/internal
+ { "DELETE.MENU" }, // macro/internal
+ { "DELETE.COMMAND" }, // macro/internal
+/*160*/ { "GET.CHART.ITEM" }, // macro/internal
+ { "DIALOG.BOX" }, // macro/internal
+ { "CLEAN", 1 },
+ { "MDETERM", 1 },
+ { "MINVERSE", 1 },
+/*165*/ { "MMULT", 2 },
+ { "FILES" }, // macro/internal
+ { "IPMT", 0 },
+ { "PPMT", 0 },
+ { "COUNTA", 0 },
+/*170*/ { "CANCEL.KEY" }, // macro/internal
+ { "FOR" }, // macro/internal
+ { "WHILE" }, // macro/internal
+ { "BREAK" }, // macro/internal
+ { "NEXT" }, // macro/internal
+/*175*/ { "INITIATE" }, // macro/internal
+ { "REQUEST" }, // macro/internal
+ { "POKE" }, // macro/internal
+ { "EXECUTE" }, // macro/internal
+ { "TERMINATE" }, // macro/internal
+/*180*/ { "RESTART" }, // macro/internal
+ { "HELP" }, // macro/internal
+ { "GET.BAR" }, // macro/internal
+ { "PRODUCT", 0 },
+ { "FACT", 1 },
+/*185*/ { "GET.CELL" }, // macro/internal
+ { "GET.WORKSPACE" }, // macro/internal
+ { "GET.WINDOW" }, // macro/internal
+ { "GET.DOCUMENT" }, // macro/internal
+ { "DPRODUCT", 3 },
+/*190*/ { "ISNONTEXT", 1 },
+ { "GET.NOTE" }, // macro/internal
+ { "NOTE" }, // macro/internal
+ { "STDEVP", 0 },
+ { "VARP", 0 },
+/*195*/ { "DSTDDEVP", 3 },
+ { "DVARP", 3 },
+ { "TRUNC", 0 },
+ { "ISLOGICAL", 1 },
+ { "DBCOUNTA", 3 },
+/*200*/ { "DELETE.BAR" }, // macro/internal
+ { "UNREGISTER" }, // macro/internal
+ { "202" }, // not used
+ { "203" }, // not used
+ { "USDOLLAR" }, // macro/internal
+/*205*/ { "FINDB" }, // macro/internal
+ { "SEARCHB" }, // macro/internal
+ { "REPLACEB" }, // macro/internal
+ { "LEFTB" }, // macro/internal
+ { "RIGHTB" }, // macro/internal
+/*210*/ { "MIDB" }, // macro/internal
+ { "LENB" }, // macro/internal
+ { "ROUNDUP", 2 },
+ { "ROUNDDOWN", 2 },
+ { "ASC" }, // macro/internal
+/*215*/ { "DBSC" }, // macro/internal
+ { "RANK", 0 },
+ { "217" }, // not used
+ { "218" }, // not used
+ { "ADDRESS", 0 },
+/*220*/ { "DAYS360", 0 },
+ { "TODAY", 0 },
+ { "VDB", 0 },
+ { "ELSE" }, // macro/internal
+ { "ELSE.IF" }, // macro/internal
+/*225*/ { "END.IF" }, // macro/internal
+ { "FOR.CELL" }, // macro/internal
+ { "MEDIAN", 0 },
+ { "SUMPRODUCT", 0 },
+ { "SINH", 1 },
+/*230*/ { "COSH", 1 },
+ { "TANH", 1 },
+ { "ASINH", 1 },
+ { "ACOSH", 1 },
+ { "ATANH", 1 },
+/*235*/ { "DGET", 3 },
+ { "CREATE.OBJECT" }, // macro/internal
+ { "VOLATILE" }, // macro/internal
+ { "LAST.ERROR" }, // macro/internal
+ { "CUSTOM.UNDO" }, // macro/internal
+/*240*/ { "CUSTOM.REPEAT" }, // macro/internal
+ { "FORMULA.CONVERT" }, // macro/internal
+ { "GET.LINK.INFO" }, // macro/internal
+ { "TEXT.BOX" }, // macro/internal
+ { "INFO" }, // macro/internal
+/*245*/ { "GROUP" }, // macro/internal
+ { "GET.OBJECT" }, // macro/internal
+ { "DB", 0 },
+ { "PAUSE" }, // macro/internal
+ { "249" }, // not used
+/*250*/ { "250" }, // not used
+ { "RESUME" }, // macro/internal
+ { "FREQUENCY", 2 },
+ { "ADD.TOOLBAR" }, // macro/internal
+ { "DELETE.TOOLBAR" }, // macro/internal
+/*255*/ { "EXTERN.CALL" }, // macro/internal
+ { "RESET.TOOLBAR" }, // macro/internal
+ { "EVALUATE" }, // macro/internal
+ { "GET.TOOLBAR" }, // macro/internal
+ { "GET.TOOL" }, // macro/internal
+/*260*/ { "SPELLING.CHECK" }, // macro/internal
+ { "ERROR.TYPE", 1 },
+ { "APP.TITLE" }, // macro/internal
+ { "WINDOW.TITLE" }, // macro/internal
+ { "SAVE.TOOLBAR" }, // macro/internal
+/*265*/ { "ENABLE.TOOL" }, // macro/internal
+ { "PRESS.TOOL" }, // macro/internal
+ { "REGISTER.ID" }, // macro/internal
+ { "GET.WORKBOOK" }, // macro/internal
+ { "AVEDEV", 0 },
+/*270*/ { "BETADIST", 0 },
+ { "GAMMALN", 1 },
+ { "BETAINV", 0 },
+ { "BINOMDIST", 4 },
+ { "CHIDIST", 2 },
+/*275*/ { "CHIINV", 2 },
+ { "COMBIN", 2 },
+ { "CONFIDENCE", 3 },
+ { "CRITBINOM", 3 },
+ { "EVEN", 1 },
+/*280*/ { "EXPONDIST", 3 },
+ { "FDIST", 3 },
+ { "FINV", 3 },
+ { "FISHER", 1 },
+ { "FISHERINV", 1 },
+/*285*/ { "FLOOR", 2 },
+ { "GAMMADIST", 4 },
+ { "GAMMAINV", 3 },
+ { "CEILING", 2 },
+ { "HYPGEOMDIST", 4 },
+/*290*/ { "LOGNORMDIST", 3 },
+ { "LOGINV", 3 },
+ { "NEGBINOMDIST", 3 },
+ { "NORMDIST", 4 },
+ { "NORMSDIST", 1 },
+/*295*/ { "NORMINV", 3 },
+ { "NORMSINV", 1 },
+ { "STANDARDIZE", 3 },
+ { "ODD", 1 },
+ { "PERMUT", 2 },
+/*300*/ { "POISSON", 3 },
+ { "TDIST", 3 },
+ { "WEIBULL", 4 },
+ { "SUMXMY2", 2 },
+ { "SUMX2MY2", 2 },
+/*305*/ { "SUMX2PY2", 2 },
+ { "CHITEST", 2 },
+ { "CORREL", 2 },
+ { "COVAR", 2 },
+ { "FORECAST", 3 },
+/*310*/ { "FTEST", 2 },
+ { "INTERCEPT", 2 },
+ { "PEARSON", 2 },
+ { "RSQ", 2 },
+ { "STEYX", 2 },
+/*315*/ { "SLOPE", 2 },
+ { "TTEST", 4 },
+ { "PROB", 0 },
+ { "DEVSQ", 0 },
+ { "GEOMEAN", 0 },
+/*320*/ { "HARMEAN", 0 },
+ { "SUMSQ", 0 },
+ { "KURT", 0 },
+ { "SKEW", 0 },
+ { "ZTEST", 0 },
+/*325*/ { "LARGE", 2 },
+ { "SMALL", 2 },
+ { "QUARTILE", 2 },
+ { "PERCENTILE", 2 },
+ { "PERCENTRANK", 0 },
+/*330*/ { "MODE", 0 },
+ { "TRIMMEAN", 2 },
+ { "TINV", 2 },
+ { "333" }, // not used
+ { "MOVIE.COMMAND" }, // macro/internal
+/*335*/ { "GET.MOVIE" }, // macro/internal
+ { "CONCATENATE", 0 },
+ { "POWER", 2 },
+ { "PIVOT.ADD.DATA" }, // macro/internal
+ { "GET.PIVOT.TABLE" }, // macro/internal
+/*340*/ { "GET.PIVOT.FIELD" }, // macro/internal
+ { "GET.PIVOT.ITEM" }, // macro/internal
+ { "RADIANS", 1 },
+ { "DEGREES", 1 },
+ { "SUBTOTAL", 0 },
+/*345*/ { "SUMIF", 0 },
+ { "COUNTIF", 2 },
+ { "COUNTBLANK", 1 },
+ { "SCENARIO.GET" }, // macro/internal
+ { "OPTIONS.LISTS.GET" }, // macro/internal
+/*350*/ { "ISPMT", 4 },
+ { "DATEDIF" }, // macro/internal
+ { "DATESTRING" }, // macro/internal
+ { "NUMBERSTRING" }, // macro/internal
+ { "ROMAN", 0 },
+/*355*/ { "OPEN.DIALOG" }, // macro/internal
+ { "SAVE.DIALOG" }, // macro/internal
+ { "VIEW.GET" }, // macro/internal
+ { "GETPIVOTDATA", 0 },
+ { "HYPERLINK", 2 },
+/*360*/ { "PHONETIC" }, // macro/internal
+ { "AVERAGEA", 0 },
+ { "MAXA", 0 },
+ { "MINA", 0 },
+ { "STDEVPA", 0 },
+/*365*/ { "VARPA", 0 },
+ { "STDEVA", 0 },
+ { "VARA", 0 },
+ { "BAHTTEXT", 1 },
+ { "THAIDAYOFWEEK" }, // macro/internal
+/*370*/ { "THAIDIGIT" }, // macro/internal
+ { "THAIMONTHOFYEAR" }, // macro/internal
+ { "THAINUMSOUND" }, // macro/internal
+ { "THAINUMSTRING" }, // macro/internal
+ { "THAISTRINGLENGTH" }, // macro/internal
+/*375*/ { "ISTHAIDIGIT" }, // macro/internal
+ { "ROUNDBAHTDOWN" }, // macro/internal
+ { "ROUNDBAHTUP" }, // macro/internal
+ { "THAIYEAR" }, // macro/internal
+ { "RTD" } // macro/internal
};
const XclDumpFunc* lcl_GetFuncData( sal_uInt16 nIndex )
{
- const XclDumpFunc* pFirst = pFuncData;
- const XclDumpFunc* pLast = pFuncData + sizeof( pFuncData ) / sizeof( XclDumpFunc ) - 1;
- while( pFirst <= pLast )
- {
- const XclDumpFunc* pCurr = pFirst + (pLast - pFirst) / 2;
- if( pCurr->nIndex > nIndex )
- pLast = pCurr - 1;
- else if( pCurr->nIndex < nIndex )
- pFirst = pCurr + 1;
- else
- return pCurr;
- }
- return NULL;
+ return (nIndex < STATIC_TABLE_SIZE( pFuncData )) ? (pFuncData + nIndex) : NULL;
}
@@ -5985,7 +5971,7 @@ void Biff8RecDumper::FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT )
break;
case 0x1D: // Boolean [315 266]
STARTTOKEN( "Bool" );
- aOperand += pIn->ReaduInt8() ? "FALSE" : "TRUE";
+ aOperand += pIn->ReaduInt8() ? "TRUE" : "FALSE";
t += aOperand;
aStack.PushOperand( aOperand );
break;
@@ -6246,26 +6232,438 @@ void Biff8RecDumper::FormulaDump( const UINT16 nL, const FORMULA_TYPE eFT )
}
-void Biff8RecDumper::ControlsDump( SvStream& rIn )
+
+
+/** Import from bytestream. */
+SvStream& operator>>( SvStream& rStrm, XclGuid& rGuid )
{
- if( !pDumpStream )
- return;
+ rStrm.Read( rGuid.mpData, 16 );
+ return rStrm;
+}
- rIn.Seek( STREAM_SEEK_TO_END );
- ULONG nLen = rIn.Tell();
- rIn.Seek( STREAM_SEEK_TO_BEGIN );
+/** Output as text. */
+SvStream& operator<<( SvStream& rStrm, const XclGuid& rGuid )
+{
+ ByteString aOut;
+ __AddPureHex( aOut, SVBT32ToLong( rGuid.mpData ) );
+ aOut.Append( '-' );
+ __AddPureHex( aOut, SVBT16ToShort( rGuid.mpData + 4 ) );
+ aOut.Append( '-' );
+ __AddPureHex( aOut, SVBT16ToShort( rGuid.mpData + 6 ) );
+ aOut.Append( '-' );
+ __AddPureHex( aOut, rGuid.mpData[ 8 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 9 ] );
+ aOut.Append( '-' );
+ __AddPureHex( aOut, rGuid.mpData[ 10 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 11 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 12 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 13 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 14 ] );
+ __AddPureHex( aOut, rGuid.mpData[ 15 ] );
+ return rStrm << aOut.GetBuffer();
+}
- if( nLen == ~0UL )
- return;
+// *** yet some other ugly macros for the specials of form control dumping ***
+
+// align the instream
+#define EXC_CTRLDUMP_ALIGN_INSTRM( val ) rInStrm.Seek( (rInStrm.Tell()+(val)-1) & ~((val)-1) )
+// push the string to outstream
+#define EXC_CTRLDUMP_PRINT() { if( t.Len() ) { rOutStrm << t.GetBuffer() << '\n'; t.Erase(); } }
+#define EXC_CTRLDUMP_PRINTC() { if( t.Len() > 60 ) EXC_CTRLDUMP_PRINT(); }
+
+// implementation, don't use
+#define IMPL_EXC_CTRLDUMP_VALUE( type, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( type ) ); type n; rInStrm >> n; t += " " text "="; func( t, n ); EXC_CTRLDUMP_PRINTC(); }
+#define IMPL_EXC_CTRLDUMP_VAR( var, mask, func, text ) { EXC_CTRLDUMP_ALIGN_INSTRM( sizeof( var ) ); rInStrm >> var; var &= (mask); t += " " text "="; func( t, var ); EXC_CTRLDUMP_PRINTC(); }
+
+// read a value from stream
+#define EXC_CTRLDUMP_HEX4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt32, __AddHex, text )
+#define EXC_CTRLDUMP_DEC4( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int32, __AddDec, text )
+#define EXC_CTRLDUMP_HEX2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt16, __AddHex, text )
+#define EXC_CTRLDUMP_DEC2( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int16, __AddDec, text )
+#define EXC_CTRLDUMP_HEX1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_uInt8, __AddHex, text )
+#define EXC_CTRLDUMP_DEC1( text ) IMPL_EXC_CTRLDUMP_VALUE( sal_Int8, __AddDec, text )
+// read a value from stream into existing variable
+#define EXC_CTRLDUMP_HEXVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, __AddHex, text )
+#define EXC_CTRLDUMP_DECVAR( var, text ) IMPL_EXC_CTRLDUMP_VAR( var, ~0, __AddDec, text )
+#define EXC_CTRLDUMP_HEXVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, __AddHex, text )
+#define EXC_CTRLDUMP_DECVARMASK( var, mask, text ) IMPL_EXC_CTRLDUMP_VAR( var, mask, __AddDec, text )
+// read a string
+#define EXC_CTRLDUMP_STRING( var, text ) \
+if( var ) \
+{ \
+ EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); \
+ if( var > 128 ) var = 128; \
+ sal_Char* p = new sal_Char[ var + 1 ]; \
+ rInStrm.Read( p, var ); p[ var ] = '\0'; \
+ t.Append( " " text "='" ).Append( p ).Append( '\'' ); \
+ delete [] p; \
+ EXC_CTRLDUMP_PRINTC(); \
+}
+// read flag fields
+#define EXC_CTRLDUMP_STARTFLAG( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); rInStrm >> __nFlags; t += " " text "="; __AddHex( t, __nFlags ); }
+#define EXC_CTRLDUMP_ADDFLAG( flag, text ) { if( __nFlags & (flag) ) t += " -" text; EXC_CTRLDUMP_PRINTC(); }
+#define EXC_CTRLDUMP_ENDFLAG( reserved ) EXC_CTRLDUMP_ADDFLAG( reserved, "!unknown!" )
+// read coordinates
+#define EXC_CTRLDUMP_COORD( text ) { EXC_CTRLDUMP_ALIGN_INSTRM( 4 ); EXC_CTRLDUMP_DEC2( text "-x" ); EXC_CTRLDUMP_DEC2( "y" ); }
+#define EXC_CTRLDUMP_SIZE() { EXC_CTRLDUMP_DEC4( "width" ); EXC_CTRLDUMP_DEC4( "height" ); }
+
+// *** macros end ***
- *pDumpStream << "### start Ctls stream ###\n";
- while( nLen )
+void Biff8RecDumper::ControlsDump( SvStream& rInStrm )
+{
+ static const XclGuid aPushButtonGuid( 0xD7053240, 0xCE69, 0x11CD, 0xA7, 0x77, 0x00, 0xDD, 0x01, 0x14, 0x3C, 0x57 );
+ static const XclGuid aToggleButtonGuid( 0x8BD21D60, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aCheckBoxGuid( 0x8BD21D40, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aRadioButtonGuid( 0x8BD21D50, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aLabelGuid( 0x978C9E23, 0xD4B0, 0x11CE, 0xBF, 0x2D, 0x00, 0xAA, 0x00, 0x3F, 0x40, 0xD0 );
+ static const XclGuid aEditGuid( 0x8BD21D10, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aListBoxGuid( 0x8BD21D20, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aComboBoxGuid( 0x8BD21D30, 0xEC42, 0x11CE, 0x9E, 0x0D, 0x00, 0xAA, 0x00, 0x60, 0x02, 0xF3 );
+ static const XclGuid aSpinGuid( 0x79176FB0, 0xB7F2, 0x11CE, 0x97, 0xEF, 0x00, 0xAA, 0x00, 0x6D, 0x27, 0x76 );
+ static const XclGuid aScrollBarGuid( 0xDFD181E0, 0x5E2F, 0x11CE, 0xA4, 0x49, 0x00, 0xAA, 0x00, 0x4A, 0x80, 0x3D );
+
+ if( !pDumpStream ) return;
+ rInStrm.Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nInSize = rInStrm.Tell();
+ rInStrm.Seek( STREAM_SEEK_TO_BEGIN );
+ if( nInSize == ~0UL ) return;
+
+ SvStream& rOutStrm = *pDumpStream;
+ rOutStrm << "\n\n\n-- Ctls stream dump --\n";
+
+ enum {
+ xlCtrlPushButton,
+ xlCtrlToggleButton,
+ xlCtrlCheckBox,
+ xlCtrlRadioButton,
+ xlCtrlLabel,
+ xlCtrlEdit,
+ xlCtrlListBox,
+ xlCtrlComboBox,
+ xlCtrlSpin,
+ xlCtrlScrollBar,
+ xlCtrlUnknown
+ } eCtrlType = xlCtrlUnknown;
+
+ while( rInStrm.Tell() < nInSize )
{
- UINT16 nPart = ( nLen >= 1024 )? 1024 : ( UINT16 ) nLen;
- ContDumpStream( rIn, nPart );
- nLen -= nPart;
+ ByteString t; // "t" needed for macros
+ sal_uInt32 __nFlags; // "__nFlags" needed for macros
+ sal_uInt16 nId, nSize;
+ sal_uInt32 nNextPos;
+
+ // stream position
+ __AddHex( t, rInStrm.Tell() );
+ rOutStrm << '\n' << t.GetBuffer() << ": ";
+
+ // control type
+ XclGuid aGuid;
+ rInStrm >> aGuid >> nId >> nSize;
+ nNextPos = rInStrm.Tell() + nSize;
+
+ if( aGuid == aPushButtonGuid ) eCtrlType = xlCtrlPushButton;
+ else if( aGuid == aToggleButtonGuid ) eCtrlType = xlCtrlToggleButton;
+ else if( aGuid == aCheckBoxGuid ) eCtrlType = xlCtrlCheckBox;
+ else if( aGuid == aRadioButtonGuid ) eCtrlType = xlCtrlRadioButton;
+ else if( aGuid == aLabelGuid ) eCtrlType = xlCtrlLabel;
+ else if( aGuid == aEditGuid ) eCtrlType = xlCtrlEdit;
+ else if( aGuid == aListBoxGuid ) eCtrlType = xlCtrlListBox;
+ else if( aGuid == aComboBoxGuid ) eCtrlType = xlCtrlComboBox;
+ else if( aGuid == aSpinGuid ) eCtrlType = xlCtrlSpin;
+ else if( aGuid == aScrollBarGuid ) eCtrlType = xlCtrlScrollBar;
+ else eCtrlType = xlCtrlUnknown;
+
+ // write control type
+ rOutStrm << aGuid << " (";
+ switch( eCtrlType )
+ {
+ case xlCtrlPushButton: rOutStrm << "PushButton"; break;
+ case xlCtrlToggleButton: rOutStrm << "ToggleButton"; break;
+ case xlCtrlCheckBox: rOutStrm << "CheckBox"; break;
+ case xlCtrlRadioButton: rOutStrm << "RadioButton"; break;
+ case xlCtrlLabel: rOutStrm << "Label"; break;
+ case xlCtrlEdit: rOutStrm << "Edit"; break;
+ case xlCtrlListBox: rOutStrm << "ListBox"; break;
+ case xlCtrlComboBox: rOutStrm << "ComboBox"; break;
+ case xlCtrlSpin: rOutStrm << "Spin"; break;
+ case xlCtrlScrollBar: rOutStrm << "ScrollBar"; break;
+ default: rOutStrm << "*UNKNOWN*";
+ }
+ rOutStrm << ")\n";
+
+ // control data
+ t = "id="; __AddHex( t, nId ); t += " size="; __AddHex( t, nSize );
+ rOutStrm << t.GetBuffer() << " (control data)\n";
+ t.Erase();
+
+ switch( eCtrlType )
+ {
+ case xlCtrlPushButton:
+ {
+ sal_uInt32 nCaptionLen = 0;
+
+ EXC_CTRLDUMP_STARTFLAG( "content-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0010, "picpos" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0080, "pic" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0100, "accel" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0400, "icon" );
+ EXC_CTRLDUMP_ENDFLAG( 0xFFFFFA00 ); // 0x20 always(?)
+ sal_uInt32 nCtrlFlags = __nFlags;
+
+ if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" );
+ if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
+ if( nCtrlFlags & 0x0004 )
+ {
+ EXC_CTRLDUMP_STARTFLAG( "option-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000008, "backstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
+ EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
+ EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF1 );
+ }
+ if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
+ if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD( "picpos" );
+ if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_HEX2( "mouseptr" );
+ if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEX2( "pic-len" );
+ if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "accel" );
+ if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEX2( "icon-len" );
+ EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
+ EXC_CTRLDUMP_SIZE();
+ }
+ break;
+ case xlCtrlToggleButton:
+ case xlCtrlCheckBox:
+ case xlCtrlRadioButton:
+ case xlCtrlEdit:
+ case xlCtrlListBox:
+ case xlCtrlComboBox:
+ {
+ sal_uInt32 nCaptionLen = 0;
+ sal_uInt32 nValueLen = 0;
+ sal_uInt32 nGroupNameLen = 0;
+
+ EXC_CTRLDUMP_STARTFLAG( "content-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000001, "option" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000002, "backcolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000004, "forecolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000008, "maxlen" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000010, "borderstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000020, "scrollbars" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000040, "style" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000080, "mouseptr" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000200, "password" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000400, "listwidth" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000800, "boundcol" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00001000, "textcol" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00002000, "colcount" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00004000, "listrows" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00008000, "colwidth?" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00010000, "matchentry" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00020000, "liststyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00040000, "showdropbtn" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00100000, "dropbtnstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00200000, "multistate" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00400000, "value" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00800000, "caption" );
+ EXC_CTRLDUMP_ADDFLAG( 0x01000000, "pos" );
+ EXC_CTRLDUMP_ADDFLAG( 0x02000000, "bordercolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x04000000, "specialeff" );
+ EXC_CTRLDUMP_ADDFLAG( 0x08000000, "icon" );
+ EXC_CTRLDUMP_ADDFLAG( 0x10000000, "pic" );
+ EXC_CTRLDUMP_ADDFLAG( 0x20000000, "accel" );
+ EXC_CTRLDUMP_ENDFLAG( 0x40080000 ); // 0x80000100 always set?
+ sal_uInt32 nCtrlFlags = __nFlags;
+
+ EXC_CTRLDUMP_STARTFLAG( "2nd-content-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000001, "groupname" );
+ EXC_CTRLDUMP_ENDFLAG( 0xFFFFFFFE );
+ sal_uInt32 nCtrlFlags2 = __nFlags;
+
+ if( nCtrlFlags & 0x00000001 )
+ {
+ EXC_CTRLDUMP_STARTFLAG( "option-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000008, "backstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000400, "colheads" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000800, "intheight" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00001000, "matchreq" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00002000, "align" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00080000, "dragbehav" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00100000, "enterkeybehav" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00200000, "enterfieldbehav" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00400000, "tabkeybehav" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
+ EXC_CTRLDUMP_ADDFLAG( 0x04000000, "selmargin" );
+ EXC_CTRLDUMP_ADDFLAG( 0x08000000, "autowordsel" );
+ EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
+ EXC_CTRLDUMP_ADDFLAG( 0x20000000, "hidesel" );
+ EXC_CTRLDUMP_ADDFLAG( 0x40000000, "autotab" );
+ EXC_CTRLDUMP_ADDFLAG( 0x80000000, "multiline" );
+ EXC_CTRLDUMP_ENDFLAG( 0x0307C3F1 );
+ }
+ if( nCtrlFlags & 0x00000002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
+ if( nCtrlFlags & 0x00000004 ) EXC_CTRLDUMP_HEX4( "forecolor" );
+ if( nCtrlFlags & 0x00000008 ) EXC_CTRLDUMP_DEC4( "maxlen" );
+ if( nCtrlFlags & 0x00000010 ) EXC_CTRLDUMP_DEC1( "borderstyle" );
+ if( nCtrlFlags & 0x00000020 ) EXC_CTRLDUMP_DEC1( "scrollbars" );
+ if( nCtrlFlags & 0x00000040 ) EXC_CTRLDUMP_DEC1( "style" );
+ if( nCtrlFlags & 0x00000080 ) EXC_CTRLDUMP_DEC1( "mouseptr" );
+ if( nCtrlFlags & 0x00000200 ) EXC_CTRLDUMP_HEX1( "password" );
+ if( nCtrlFlags & 0x00000400 ) EXC_CTRLDUMP_DEC4( "listwidth" );
+ if( nCtrlFlags & 0x00000800 ) EXC_CTRLDUMP_DEC2( "boundcol" );
+ if( nCtrlFlags & 0x00001000 ) EXC_CTRLDUMP_DEC2( "textcol" );
+ if( nCtrlFlags & 0x00002000 ) EXC_CTRLDUMP_DEC2( "colcount" );
+ if( nCtrlFlags & 0x00004000 ) EXC_CTRLDUMP_DEC2( "listrows" );
+ if( nCtrlFlags & 0x00008000 ) EXC_CTRLDUMP_DEC2( "colwidth?" );
+ if( nCtrlFlags & 0x00010000 ) EXC_CTRLDUMP_DEC1( "matchentry" );
+ if( nCtrlFlags & 0x00020000 ) EXC_CTRLDUMP_DEC1( "liststyle" );
+ if( nCtrlFlags & 0x00040000 ) EXC_CTRLDUMP_DEC1( "showdropbtn" );
+ if( nCtrlFlags & 0x00100000 ) EXC_CTRLDUMP_DEC1( "dropbtnstyle" );
+ if( nCtrlFlags & 0x00200000 ) EXC_CTRLDUMP_DEC1( "multistate" );
+ if( nCtrlFlags & 0x00400000 ) EXC_CTRLDUMP_DECVARMASK( nValueLen, 0x7FFFFFFF, "value-len" );
+ if( nCtrlFlags & 0x00800000 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
+ if( nCtrlFlags & 0x01000000 ) EXC_CTRLDUMP_COORD( "pos" );
+ if( nCtrlFlags & 0x02000000 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
+ if( nCtrlFlags & 0x04000000 ) EXC_CTRLDUMP_DEC1( "specialeff" );
+ if( nCtrlFlags & 0x08000000 ) EXC_CTRLDUMP_DEC2( "icon-len" );
+ if( nCtrlFlags & 0x10000000 ) EXC_CTRLDUMP_DEC2( "pic-len" );
+ if( nCtrlFlags & 0x20000000 ) EXC_CTRLDUMP_HEX1( "accel" );
+ if( nCtrlFlags2 & 0x00000001 ) EXC_CTRLDUMP_DECVARMASK( nGroupNameLen, 0x7FFFFFFF, "groupname-len" );
+ EXC_CTRLDUMP_SIZE();
+ EXC_CTRLDUMP_STRING( nValueLen, "value" );
+ EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
+ EXC_CTRLDUMP_STRING( nGroupNameLen, "groupname" );
+ }
+ break;
+ case xlCtrlLabel:
+ {
+ sal_uInt32 nCaptionLen = 0;
+
+ EXC_CTRLDUMP_STARTFLAG( "content-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0001, "forecolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0002, "backcolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0004, "option" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0008, "caption" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0010, "pos" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0040, "mouseptr" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0080, "bordercolor" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0100, "borderstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0200, "specialeff" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0400, "pic" );
+ EXC_CTRLDUMP_ADDFLAG( 0x0800, "accel" );
+ EXC_CTRLDUMP_ADDFLAG( 0x1000, "icon" );
+ EXC_CTRLDUMP_ENDFLAG( 0xFFFFE020 );
+ sal_uInt32 nCtrlFlags = __nFlags;
+
+ if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_HEX4( "forecolor" );
+ if( nCtrlFlags & 0x0002 ) EXC_CTRLDUMP_HEX4( "backcolor" );
+ if( nCtrlFlags & 0x0004 )
+ {
+ EXC_CTRLDUMP_STARTFLAG( "option-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000002, "enabled" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000004, "locked" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00000008, "backstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x00800000, "wordwrap" );
+ EXC_CTRLDUMP_ADDFLAG( 0x10000000, "autosize" );
+ EXC_CTRLDUMP_ENDFLAG( 0xEF7FFFF1 );
+ }
+ if( nCtrlFlags & 0x0008 ) EXC_CTRLDUMP_DECVARMASK( nCaptionLen, 0x7FFFFFFF, "caption-len" );
+ if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_COORD( "pos" );
+ if( nCtrlFlags & 0x0040 ) EXC_CTRLDUMP_HEX2( "mouseptr" );
+ if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_HEX4( "bordercolor" );
+ if( nCtrlFlags & 0x0100 ) EXC_CTRLDUMP_HEX2( "borderstyle" );
+ if( nCtrlFlags & 0x0200 ) EXC_CTRLDUMP_HEX2( "specialleff" );
+ if( nCtrlFlags & 0x0400 ) EXC_CTRLDUMP_HEX2( "pic-len" );
+ if( nCtrlFlags & 0x0800 ) EXC_CTRLDUMP_HEX2( "accel" );
+ if( nCtrlFlags & 0x1000 ) EXC_CTRLDUMP_HEX2( "icon-len" );
+ EXC_CTRLDUMP_STRING( nCaptionLen, "caption" );
+ EXC_CTRLDUMP_SIZE();
+ }
+ break;
+ }
+ EXC_CTRLDUMP_PRINT();
+
+ EXC_CTRLDUMP_ALIGN_INSTRM( 4 );
+ if( rInStrm.Tell() < nNextPos )
+ {
+ rOutStrm << " unknown data:";
+ ContDumpStream( rInStrm, nNextPos - rInStrm.Tell() );
+ rOutStrm << '\n';
+ }
+ rInStrm.Seek( nNextPos );
+
+ // font data
+ rInStrm >> nId >> nSize;
+ if( nId == 0x0200 )
+ {
+ nNextPos = rInStrm.Tell() + nSize;
+
+ t = "id="; __AddHex( t, nId ); t += " size="; __AddHex( t, nSize );
+ rOutStrm << t.GetBuffer() << " (font data)\n";
+ t.Erase();
+
+ EXC_CTRLDUMP_STARTFLAG( "content-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x01, "fontname" );
+ EXC_CTRLDUMP_ADDFLAG( 0x02, "fontstyle" );
+ EXC_CTRLDUMP_ADDFLAG( 0x04, "fontsize" );
+ EXC_CTRLDUMP_ADDFLAG( 0x10, "language-id" );
+ EXC_CTRLDUMP_ADDFLAG( 0x40, "align" );
+ EXC_CTRLDUMP_ADDFLAG( 0x80, "fontweight" );
+ EXC_CTRLDUMP_ENDFLAG( 0xFFFFFF08 ); // 0x20 always set?
+ sal_uInt32 nCtrlFlags = __nFlags;
+ sal_uInt32 nFontLen = 0;
+
+ if( nCtrlFlags & 0x0001 ) EXC_CTRLDUMP_DECVARMASK( nFontLen, 0x7FFFFFFF, "fontname-len" );
+ if( nCtrlFlags & 0x0002 )
+ {
+ EXC_CTRLDUMP_STARTFLAG( "fontstyle-flags" );
+ EXC_CTRLDUMP_ADDFLAG( 0x01, "bold" );
+ EXC_CTRLDUMP_ADDFLAG( 0x02, "italic" );
+ EXC_CTRLDUMP_ADDFLAG( 0x04, "underline" );
+ EXC_CTRLDUMP_ADDFLAG( 0x08, "strikeout" );
+ EXC_CTRLDUMP_ENDFLAG( 0xBFFFFFF0 ); // 0x40000000 always set?
+ }
+ if( nCtrlFlags & 0x0004 ) EXC_CTRLDUMP_DEC4( "fontsize" );
+ if( nCtrlFlags & 0x0010 ) EXC_CTRLDUMP_HEX2( "language-id" );
+ if( nCtrlFlags & 0x0040 )
+ {
+ EXC_CTRLDUMP_ALIGN_INSTRM( 2 );
+ sal_uInt16 nAlign; rInStrm >> nAlign;
+ t += " align="; __AddDec( t, nAlign );
+ switch( nAlign )
+ {
+ case 1: t += "=left"; break;
+ case 2: t += "=right"; break;
+ case 3: t += "=center"; break;
+ default: t += "=!unknown!";
+ }
+ EXC_CTRLDUMP_PRINTC();
+ }
+ if( nCtrlFlags & 0x0080 ) EXC_CTRLDUMP_DEC2( "fontweight" );
+ EXC_CTRLDUMP_STRING( nFontLen, "font" );
+ EXC_CTRLDUMP_PRINT();
+
+ EXC_CTRLDUMP_ALIGN_INSTRM( 4 );
+ if( rInStrm.Tell() < nNextPos )
+ {
+ rOutStrm << " unknown data:";
+ ContDumpStream( rInStrm, nNextPos - rInStrm.Tell() );
+ rOutStrm << '\n';
+ }
+ rInStrm.Seek( nNextPos );
+ }
+ else
+ rInStrm.SeekRel( -4 );
}
- *pDumpStream << "\n### end Ctls stream ###\n";
+
+ rOutStrm << "\n-- end of stream --\n";
}
@@ -7582,11 +7980,14 @@ BOOL Biff8RecDumper::Dump( XclImpStream& r )
r.StoreGlobalPosition();
r.SetWarningMode( bWarnings );
- FilterProgressBar* pPrgrsBar = new FilterProgressBar( r );
+ ::std::auto_ptr< ScfProgressBar > pProgress( new ScfProgressBar(
+ pExcRoot->pIR->GetDocShell(), String( RTL_CONSTASCII_USTRINGPARAM( "Dumper" ) ) ) );
+ sal_Int32 nStreamSeg = pProgress->AddSegment( r.GetStreamSize() );
+ pProgress->ActivateSegment( nStreamSeg );
while( r.StartNextRecord() )
{
- pPrgrsBar->Progress();
+ pProgress->Progress( r.Tell() );
if( HasModeDump( r.GetRecId() ) )
RecDump();
@@ -7595,7 +7996,7 @@ BOOL Biff8RecDumper::Dump( XclImpStream& r )
*pDumpStream << '\n';
pIn = NULL;
- delete pPrgrsBar;
+ pProgress.reset();
r.SeekGlobalPosition();
r.SetWarningMode( TRUE );
diff --git a/sc/source/filter/excel/biffrecdumper.ini b/sc/source/filter/excel/biffrecdumper.ini
index a11b7a5f83da..62629107a08a 100644
--- a/sc/source/filter/excel/biffrecdumper.ini
+++ b/sc/source/filter/excel/biffrecdumper.ini
@@ -74,6 +74,7 @@ BODY=* // alternativ B
0x0042=CODEPAGE ,
0x0043=XF ,
0x0044=IXFE ,
+0x0045=EFONT ,
0x004D=PLS ,
0x0050=DCON ,
0x0051=DCONREF ,
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index c32eea396f43..b3c95293cb41 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: colrowst.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-10 14:07:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -500,7 +500,6 @@ ScExtDocOptions::ScExtDocOptions( void )
pCodenames = NULL;
bChanged = TRUE;
- fColScale = 0.0;
SetWinProtection(false);
}
@@ -578,8 +577,6 @@ ScExtDocOptions& ScExtDocOptions::operator =( const ScExtDocOptions& rCpy )
bChanged = rCpy.bChanged;
- fColScale = rCpy.fColScale;
-
return *this;
}
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index b34765178dad..31bc8417150b 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excdoc.cxx,v $
*
- * $Revision: 1.42 $
+ * $Revision: 1.43 $
*
- * last change: $Author: dr $ $Date: 2002-12-12 13:13:54 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -254,8 +254,9 @@ void ExcTable::SetDefRowXF( UINT16 nXF, UINT16 n )
void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
{
RootData& rR = *pExcRoot;
+ const XclExpRoot& rRoot = *rR.pER;
ScDocument& rDoc = *rR.pDoc;
- XclExpTabIdBuffer& rTabBuffer = rR.pER->GetTabIdBuffer();
+ XclExpTabIdBuffer& rTabBuffer = rRoot.GetTabIdBuffer();
if ( rR.eDateiTyp < Biff8 )
Add( new ExcBofW );
@@ -269,31 +270,15 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
UINT16 nCodenames = rTabBuffer.GetCodenameCount();
ExcNameList* pNameList = rR.pNameList = new ExcNameList( rR );
- UsedAttrList* pXFRecs = rR.pXFRecs = new UsedAttrList( &rR );
rR.pObjRecs = NULL; // per sheet
- rR.pNoteRecs = NULL; // per sheet
-
- pXFRecs->SetBaseIndex( 21 );
if( rR.eDateiTyp < Biff8 )
Add( new ExcDummy_00 );
else
{
// first create style XFs
- SfxStyleSheetIterator aStyleIter( rDoc.GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
- SfxStyleSheetBase* pStyle = aStyleIter.First();
- ScPatternAttr* pPatt;
-
- while( pStyle )
- {
- if( pStyle->IsUserDefined() )
- {
- pPatt = new ScPatternAttr( &pStyle->GetItemSet() );
- pXFRecs->Find( pPatt, TRUE );
- }
- pStyle = aStyleIter.Next();
- }
+ rRoot.GetXFBuffer().InsertUserStyles();
Add( new ExcDummy8_00a );
rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
@@ -347,17 +332,12 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
Add( new ExcDummy_040 );
Add( new Exc1904( rDoc ) );
Add( new ExcDummy_041 );
- // Font
- Add( new XclExpRefRecord( rR.pER->GetFontBuffer() ) );
- // Format
- Add( new XclExpRefRecord( rR.pER->GetNumFmtBuffer() ) );
- // XF + Style
- Add( new ExcDummy_XF );
- Add( pXFRecs );
- // Style
- Add( new ExcDummy_Style );
- // Colors
- Add( new XclExpRefRecord( rR.pER->GetPalette() ) );
+
+ // Formatting: FONT, FORMAT, XF, STYLE, PALETTE
+ Add( new XclExpRefRecord( rRoot.GetFontBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetNumFmtBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetXFBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetPalette() ) );
// Bundlesheet
ExcBundlesheetBase* pBS;
@@ -380,15 +360,12 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
Add( new ExcWindow18( rR ) );
Add( new Exc1904( rDoc ) );
Add( new ExcDummy8_041 );
- // Font
- Add( new XclExpRefRecord( rR.pER->GetFontBuffer() ) );
- // Format
- Add( new XclExpRefRecord( rR.pER->GetNumFmtBuffer() ) );
- // XF + Style
- Add( new ExcDummy8_XF );
- Add( pXFRecs );
- // Style
- Add( new ExcDummy8_Style );
+
+ // Formatting: FONT, FORMAT, XF, STYLE, PALETTE
+ Add( new XclExpRefRecord( rRoot.GetFontBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetNumFmtBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetXFBuffer() ) );
+ Add( new XclExpRefRecord( rRoot.GetPalette() ) );
// Pivot Cache
ScDPCollection* pDPColl = rDoc.GetDPCollection();
@@ -405,9 +382,6 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
}
}
- // Colors
- Add( new XclExpRefRecord( rR.pER->GetPalette() ) );
-
// Change tracking
if( rDoc.GetChangeTrack() )
{
@@ -438,15 +412,15 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
// COUNTRY always Germany
Add( new ExcDummy8_Country );
- // SUPBOOKs, XCTs, CRNs, EXTERNSHEET
- Add( new XclExpRefRecord( rR.pER->GetLinkManager() ) );
- // NAMEs
+ // SUPBOOK, XCT, CRN, EXTERNNAME, EXTERNSHEET
+ Add( new XclExpRefRecord( rRoot.GetLinkManager() ) );
+ // NAME
Add( pNameList );
// MSODRAWINGGROUP per-document data
Add( new XclMsodrawinggroup( rR, ESCHER_DggContainer ) );
// SST, EXTSST
- Add( new XclExpRefRecord( rR.pER->GetSst() ) );
+ Add( new XclExpRefRecord( rRoot.GetSst() ) );
}
Add( new ExcEof );
@@ -456,8 +430,10 @@ void ExcTable::FillAsHeader( ExcRecordListRefs& rBSRecList )
void ExcTable::FillAsTable( void )
{
RootData& rR = *pExcRoot;
- ScDocument& rDoc = *rR.pDoc;
- XclExpTabIdBuffer& rTabBuffer = rR.pER->GetTabIdBuffer();
+ const XclExpRoot& rRoot = *rR.pER;
+ ScDocument& rDoc = rRoot.GetDoc();
+ XclExpTabIdBuffer& rTabBuffer = rRoot.GetTabIdBuffer();
+ XclExpXFBuffer& rXFBuffer = rRoot.GetXFBuffer();
if( nScTab >= rTabBuffer.GetScTabCount() )
{
@@ -477,7 +453,6 @@ void ExcTable::FillAsTable( void )
UINT16 nPrevRow = 0;
UINT16 nColMin; // fuer aktuelle Zeile
// Row-Records
- const UINT16 nDefXF = 0x0F;
UINT16 nCol = 0;
UINT16 nRow = 0;
@@ -507,6 +482,10 @@ void ExcTable::FillAsTable( void )
XclExpDval* pRecDval = NULL; // data validation
+ XclExpNoteList* pNoteList = NULL; // cell notes
+
+ ExcFmlaResultStr* pFormulaResult = NULL;
+
DBG_ASSERT( (nScTab >= 0L) && (nScTab <= MAXTAB), "-ExcTable::Table(): nScTab - no ordinary table!" );
DBG_ASSERT( (nExcTab >= 0L) && (nExcTab <= MAXTAB), "-ExcTable::Table(): nExcTab - no ordinary table!" );
@@ -642,13 +621,15 @@ void ExcTable::FillAsTable( void )
Add( pExcDefColWidth );
// COLINFO records
- ExcColinfo* pLastColInfo = new ExcColinfo( 0, nScTab, nDefXF, rR, aExcOLCol );
+ sal_uInt16 nColDefXF = rXFBuffer.Insert( rDoc.GetPattern( 0, MAXROW, nScTab ) );
+ ExcColinfo* pLastColInfo = new ExcColinfo( 0, nScTab, nColDefXF, rR, aExcOLCol );
ExcColinfo* pNewColInfo;
Add( pLastColInfo );
for( UINT16 iCol = 1; iCol <= MAXCOL; iCol++ )
{
- pNewColInfo = new ExcColinfo( iCol, nScTab, nDefXF, rR, aExcOLCol );
+ nColDefXF = rXFBuffer.Insert( rDoc.GetPattern( iCol, MAXROW, nScTab ) );
+ pNewColInfo = new ExcColinfo( iCol, nScTab, nColDefXF, rR, aExcOLCol );
pLastColInfo->Expand( pNewColInfo );
if( pNewColInfo )
{
@@ -670,7 +651,7 @@ void ExcTable::FillAsTable( void )
// AutoFilter
Add( new ExcAutoFilterRecs( rR, nScTab ) );
// list of NOTE records
- rR.pNoteRecs = new XclNoteList;
+ pNoteList = new XclExpNoteList;
}
// NOTE
@@ -684,7 +665,7 @@ void ExcTable::FillAsTable( void )
// at least one ROW rec
if( !bIter )
- AddRow( new ExcRow( 0, nScTab, 0, 0, nDefXF, rDoc, aExcOLRow, *this ) );
+ AddRow( new ExcRow( 0, nScTab, 0, 0, EXC_XF_DEFAULTCELL, rDoc, aExcOLRow, *this ) );
while( bIter )
{
@@ -693,12 +674,13 @@ void ExcTable::FillAsTable( void )
pPatt = aIterator.GetPattern();
pAktExcCell = NULL;
+ pNote = NULL;
pTableOpRec = NULL;
// add ROW recs from empty rows
while( nPrevRow < nRow )
{
- ExcRow* pRow = new ExcRow( nPrevRow, nScTab, 0, 0, nDefXF, rDoc, aExcOLRow, *this );
+ ExcRow* pRow = new ExcRow( nPrevRow, nScTab, 0, 0, EXC_XF_DEFAULTCELL, rDoc, aExcOLRow, *this );
AddUsedRow( pRow );
nPrevRow++;
}
@@ -764,47 +746,32 @@ void ExcTable::FillAsTable( void )
case CELLTYPE_FORMULA:
{
pLastRKMulRK = NULL;
- ScFormulaCell* pFormCell = ( ScFormulaCell * ) pAktScCell;
- ULONG nCellNumForm = ( pPatt ?
- (( const SfxUInt32Item& ) pPatt->GetItem(
- ATTR_VALUE_FORMAT )).GetValue() : 0 );
- ULONG nAltNumForm;
- BOOL bForceAltNumForm;
- if( ( nCellNumForm % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
- {
- // #73420# Xcl doesn't know boolean number formats,
- // we write "TRUE";"TRUE";"FALSE" or "WAHR";"WAHR";"FALSCH"
- // or any other language dependent key words instead.
- // Don't do it for automatic formula formats,
- // because Xcl gets them right.
- if( pFormCell->GetFormatType() == NUMBERFORMAT_LOGICAL )
- nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND;
- else
- nAltNumForm = pFormCell->GetStandardFormat(
- rFormatter, nCellNumForm );
- bForceAltNumForm = FALSE;
- }
- else
- {
- // #73420# If number format set is boolean and
- // automatic format is boolean don't write that ugly
- // special format.
- if( pFormCell->GetFormatType() == NUMBERFORMAT_LOGICAL
- && rFormatter.GetType( nCellNumForm ) == NUMBERFORMAT_LOGICAL )
- {
- nAltNumForm = 0;
- bForceAltNumForm = TRUE;
- }
- else
- {
- nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND;
- bForceAltNumForm = FALSE;
- }
+ ScFormulaCell* pFormCell = (ScFormulaCell*) pAktScCell;
+
+ // current cell number format
+ sal_uInt32 nCellNumFmt = pPatt ?
+ static_cast< const SfxUInt32Item& >( pPatt->GetItem( ATTR_VALUE_FORMAT ) ).GetValue() :
+ rR.pER->GetNumFmtBuffer().GetStandardFormat();
+ // alternative number format passed to XF buffer
+ sal_uInt32 nFmlaNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND;
+
+ /* #73420# Xcl doesn't know boolean number formats, we write
+ "TRUE";"TRUE";"FALSE" (language dependent). Don't do it for
+ automatic formula formats, because Xcl gets them right. */
+ /* #i8640# Don't set text format, if we have string results */
+ if( ((nCellNumFmt % SV_COUNTRY_LANGUAGE_OFFSET) == 0) &&
+ (pFormCell->GetFormatType() != NUMBERFORMAT_LOGICAL) &&
+ (pFormCell->GetFormatType() != NUMBERFORMAT_TEXT) )
+ nFmlaNumFmt = pFormCell->GetStandardFormat( rFormatter, nCellNumFmt );
+ /* #73420# If cell number format is Boolean and automatic formula
+ format is Boolean don't write that ugly special format. */
+ else if( (pFormCell->GetFormatType() == NUMBERFORMAT_LOGICAL) &&
+ (rFormatter.GetType( nCellNumFmt ) == NUMBERFORMAT_LOGICAL) )
+ nFmlaNumFmt = rR.pER->GetNumFmtBuffer().GetStandardFormat();
- }
ExcFormula* pFmlaCell = new ExcFormula(
- aScPos, pPatt, rR, nAltNumForm, bForceAltNumForm, *pFormCell->GetCode(),
- &pLastArray, ( ScMatrixMode ) pFormCell->GetMatrixFlag(), &pShrdFmla, &aShrdFmlaList );
+ aScPos, pPatt, rR, nFmlaNumFmt, *pFormCell->GetCode(),
+ &pLastArray, ( ScMatrixMode ) pFormCell->GetMatrixFlag(), &pShrdFmla, &aShrdFmlaList, pFormCell, &pFormulaResult);
pAktExcCell = pFmlaCell;
pTableOpRec = aTableOpList.InsertCell( pFormCell->GetCode(), *pFmlaCell );
}
@@ -828,6 +795,7 @@ void ExcTable::FillAsTable( void )
break;
case CELLTYPE_NOTE:
{
+ pAktScCell = NULL; // #i11733# empty note cell is empty cell
pAktExcCell = NULL;
pLastRKMulRK = NULL;
DBG_ASSERT( pNote, "-ExcTable::Table(): Note-Cell ohne Note!" );
@@ -845,17 +813,16 @@ void ExcTable::FillAsTable( void )
pLastRKMulRK = NULL;
}
}
- else
- {// leere Zelle mit Attributierung
- pNote = NULL;
+ // #i11733# not "else" - pAktScCell may be set to NULL above (empty note cell)
+ if( !pAktScCell )
+ {// leere Zelle mit Attributierung
UINT16 nColCnt = aIterator.GetEndCol() - aIterator.GetStartCol() + 1;
if( pLastBlank && pLastBlank->GetLastCol() + 1 == aIterator.GetStartCol() )
{
pLastBlank->Add( aScPos, pPatt, rR, nColCnt, *this );
-
- pAktScCell = NULL; // kein NEUER Record!
+ pAktExcCell = NULL; // kein NEUER Record!
}
else
{
@@ -889,26 +856,36 @@ void ExcTable::FillAsTable( void )
if( pTableOpRec )
Add( pTableOpRec );
- // notes
- String sNoteText;
- String sNoteAuthor;
- if( pNote )
+ if(pFormulaResult)
{
- sNoteText = pNote->GetText();
- sNoteAuthor = pNote->GetAuthor();
+ Add( pFormulaResult );
+ pFormulaResult = NULL;
}
- if( rR.sAddNoteText.Len() )
+
+
+ // notes
+ if( rRoot.GetBiff() < xlBiff8 )
{
- if( sNoteText.Len() )
- (sNoteText += (sal_Unicode) 0x0A) += (sal_Unicode) 0x0A;
- sNoteText += rR.sAddNoteText;
+ String sNoteText;
+ String sNoteAuthor;
+ if( pNote )
+ {
+ sNoteText = pNote->GetText();
+ sNoteAuthor = pNote->GetAuthor();
+ }
+ if( rR.sAddNoteText.Len() )
+ {
+ if( sNoteText.Len() )
+ (sNoteText += (sal_Unicode) 0x0A) += (sal_Unicode) 0x0A;
+ sNoteText += rR.sAddNoteText;
+ }
+ if( sNoteText.Len() || sNoteAuthor.Len() )
+ Add( new ExcNote( aScPos, sNoteText, rR ) );
}
- if( sNoteText.Len() || sNoteAuthor.Len() )
+ else
{
- if ( rR.eDateiTyp < Biff8 )
- Add( new ExcNote( aScPos, sNoteText, rR ) );
- else
- rR.pNoteRecs->Add( new XclNote( rR, aScPos, sNoteText, sNoteAuthor ) );
+ if( pNote || rR.sAddNoteText.Len() )
+ pNoteList->Append( new XclExpNote( rRoot, aScPos, pNote, rR.sAddNoteText ) );
}
if( pPatt && (rR.eDateiTyp >= Biff8) )
@@ -950,7 +927,7 @@ void ExcTable::FillAsTable( void )
// new row -> add previous ROW rec
if( !bIter || (nPrevRow < nRow) )
{
- AddRow( new ExcRow( nPrevRow, nScTab, nColMin, nCol, nDefXF, rDoc, aExcOLRow, *this ) );
+ AddRow( new ExcRow( nPrevRow, nScTab, nColMin, nCol, EXC_XF_DEFAULTCELL, rDoc, aExcOLRow, *this ) );
nPrevRow++;
nColMin = aIterator.GetStartCol();
@@ -964,7 +941,7 @@ void ExcTable::FillAsTable( void )
while( nRow < nMaxFlagRow )
{
nRow++;
- ExcRow* pRow = new ExcRow( nRow, nScTab, 0, 0, nDefXF, rDoc, aExcOLRow, *this );
+ ExcRow* pRow = new ExcRow( nRow, nScTab, 0, 0, EXC_XF_DEFAULTCELL, rDoc, aExcOLRow, *this );
AddUsedRow( pRow );
}
@@ -997,7 +974,7 @@ void ExcTable::FillAsTable( void )
// all MSODRAWING and OBJ stuff of this sheet goes here
Add( rR.pObjRecs );
// NOTE records
- Add( rR.pNoteRecs );
+ Add( pNoteList );
// pivot tables
ScDPCollection* pDPColl = rDoc.GetDPCollection();
@@ -1156,7 +1133,7 @@ ExcDocument::ExcDocument( const XclExpRoot& rRoot ) :
pTabNames = new NameBuffer( 0, 16 );
pPrgrsBar = new ScProgress(
- NULL, ScGlobal::GetRscString(STR_SAVE_DOC),
+ GetDocShell(), ScGlobal::GetRscString(STR_SAVE_DOC),
( UINT32 ) GetDoc().GetCellCount() * 2 );
ExcCell::SetPrgrsBar( *pPrgrsBar );
}
diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx
index febdc7690b53..a04b41debf8b 100644
--- a/sc/source/filter/excel/excel.cxx
+++ b/sc/source/filter/excel/excel.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excel.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:15:59 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 970a12a0e81e..6ab7ceb0deae 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excform.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:15:59 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1857,7 +1857,7 @@ DefTokenId ExcelToSc::IndexToToken( UINT16 nIndex )
ocNoName, // XlfScenarioGet
ocNoName, // XlfOptionsListsGet
ocISPMT, // XlfIspmt
- ocGetDiffDate, // XlfDatedif
+ ocNoName, // XlfDatedif
ocNoName, // XlfDatestring
ocNoName, // XlfNumberstring
ocRoman, // XlfRoman
@@ -2270,7 +2270,7 @@ BYTE ExcelToSc::IndexToAnzahl( UINT16 nIndex )
0, // XlfScenarioGet
0, // XlfOptionsListsGet
4, // XlfIspmt
- 0, // XlfDatedif
+ 3, // XlfDatedif
0, // XlfDatestring
0, // XlfNumberstring
1, // XlfRoman
@@ -2380,6 +2380,11 @@ void ExcelToSc::ExcRelToScRel( UINT16 nRow, UINT8 nCol, SingleRefData &rSRD, con
rSRD.nRelCol = rSRD.nCol - aEingPos.Col();
if ( rSRD.IsRowRel() )
rSRD.nRelRow = rSRD.nRow - aEingPos.Row();
+
+ // T A B
+ // #i10184# abs needed if rel in shared formula for ScCompiler UpdateNameReference
+ if ( rSRD.IsTabRel() && !rSRD.IsFlag3D() )
+ rSRD.nTab = pExcRoot->pIR->GetScTab() + rSRD.nRelTab;
}
}
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 65a38494fe16..cb67ac7455cc 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excform8.cxx,v $
*
- * $Revision: 1.22 $
+ * $Revision: 1.23 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 15:17:05 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -671,6 +671,8 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, UINT32 nFormulaLen
pExcRoot->pDoc->CreateDdeLink( aAppl, aExtDoc, pExtName->GetName() );
}
+ else if( (pExtName->GetType() == xlExtName) && pSupbook->IsAddIn() )
+ aStack << aPool.Store( ocNoName, pExtName->GetAddInName() );
else
aStack << aPool.Store( ocNoName, pExtName->GetName() );
}
@@ -1229,6 +1231,11 @@ void ExcelToSc8::ExcRelToScRel( UINT16 nRow, UINT16 nC, SingleRefData &rSRD, con
rSRD.nRelRow = (INT16) nRow - aEingPos.Row();
else
rSRD.nRow = nRow;
+
+ // T A B
+ // #i10184# abs needed if rel in shared formula for ScCompiler UpdateNameReference
+ if ( rSRD.IsTabRel() && !rSRD.IsFlag3D() )
+ rSRD.nTab = pExcRoot->pIR->GetScTab() + rSRD.nRelTab;
}
}
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 9174fcefbc16..5fd21973a8f4 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excimp8.cxx,v $
*
- * $Revision: 1.79 $
+ * $Revision: 1.80 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-10 14:07:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,7 +96,6 @@
#include <svx/flditem.hxx>
#include <svx/xflclit.hxx>
#include <svx/svxmsbas.hxx>
-#include <svx/unoapi.hxx>
#include <vcl/graph.hxx>
#include <vcl/bmpacc.hxx>
@@ -106,7 +105,7 @@
#include <tools/string.hxx>
#include <tools/urlobj.hxx>
-#include <tools/solmath.hxx>
+#include <rtl/math.hxx>
#ifndef _UNOTOOLS_LOCALEDATAWRAPPER_HXX
#include <unotools/localedatawrapper.hxx>
@@ -128,7 +127,13 @@
#include "markdata.hxx"
#include "rangenam.hxx"
#include "docoptio.hxx"
+#ifndef SC_DETFUNC_HXX
+#include "detfunc.hxx"
+#endif
+#ifndef SC_XLOCX_HXX
+#include "xlocx.hxx"
+#endif
#ifndef SC_XILINK_HXX
#include "xilink.hxx"
#endif
@@ -138,11 +143,9 @@
#include "excimp8.hxx"
#include "excform.hxx"
-#include "fltprgrs.hxx"
#include "flttools.hxx"
#include "scextopt.hxx"
#include "stlpool.hxx"
-#include "scmsocximexp.hxx"
using namespace com::sun::star;
@@ -274,9 +277,10 @@ void ExcCondForm::ReadCf( XclImpStream& rIn, ExcelToSc& rConv )
default: nPosF = 0; nPosL = 0; nPosP = 0;
}
- SfxItemSet& rStyleItemSet = rDoc.GetStyleSheetPool()->Make(
- aStyle, SFX_STYLE_FAMILY_PARA,
- SFXSTYLEBIT_USERDEF ).GetItemSet();
+ SfxStyleSheetBase* pStyleSheet = rDoc.GetStyleSheetPool()->Find( aStyle, SFX_STYLE_FAMILY_PARA );
+ SfxItemSet& rStyleItemSet = pStyleSheet ? pStyleSheet->GetItemSet() :
+ rDoc.GetStyleSheetPool()->Make( aStyle, SFX_STYLE_FAMILY_PARA, SFXSTYLEBIT_USERDEF ).GetItemSet();
+ rStyleItemSet.ClearItem();
const XclImpPalette& rPalette = GetPalette();
@@ -340,42 +344,40 @@ void ExcCondForm::ReadCf( XclImpStream& rIn, ExcelToSc& rConv )
if( nPosL ) // line
{
- UINT8 nLineH, nLineV;
- UINT16 nColH, nColV;
+ sal_uInt16 nLine, nColor1, nColor2;
rIn.Seek( nPosL );
-
- rIn >> nLineV >> nLineH >> nColV >> nColH;
-
- UINT8 nLineL = nLineV & 0x0F;
- UINT16 nColL = nColV & 0x007F;
- UINT8 nLineR = nLineV >> 4;
- UINT16 nColR = ( nColV >> 7 ) & 0x007F;
- UINT8 nLineT = nLineH & 0x0F;
- UINT16 nColT = nColH & 0x007F;
- UINT8 nLineB = nLineH >> 4;
- UINT16 nColB = ( nColH >> 7 ) & 0x007F;
-
- XclImpXF::SetBorder( rStyleItemSet, rPalette,
- nLineL, nColL, nLineR, nColR, nLineT, nColT, nLineB, nColB );
+ rIn >> nLine >> nColor1 >> nColor2;
+
+ XclImpXFBorder aBorder;
+ ::extract_value( aBorder.mnLeftLine, nLine, 0, 4 );
+ ::extract_value( aBorder.mnRightLine, nLine, 4, 4 );
+ ::extract_value( aBorder.mnTopLine, nLine, 8, 4 );
+ ::extract_value( aBorder.mnBottomLine, nLine, 12, 4 );
+ ::extract_value( aBorder.mnLeftColor, nColor1, 0, 7 );
+ ::extract_value( aBorder.mnRightColor, nColor1, 7, 7 );
+ ::extract_value( aBorder.mnTopColor, nColor2, 0, 7 );
+ ::extract_value( aBorder.mnBottomColor, nColor2, 7, 7 );
+ XclImpXF::SetBorder( rStyleItemSet, rPalette, aBorder );
}
if( nPosP ) // pattern (fill)
{
- UINT16 nPatt;
- UINT16 nCol;
-
+ sal_uInt16 nPattern, nColor;
rIn.Seek( nPosP );
- rIn >> nPatt >> nCol;
+ rIn >> nPattern >> nColor;
- UINT8 nF = nCol & 0x007F;
- UINT8 nB = ( nCol >> 7 ) & 0x007F;
- UINT8 nP = (UINT8)((nPatt >> 10) & 0x003F);
- if( nP <= 1 )
+ XclImpXFArea aArea;
+ ::extract_value( aArea.mnForeColor, nColor, 0, 7 );
+ ::extract_value( aArea.mnBackColor, nColor, 7, 7 );
+ ::extract_value( aArea.mnPattern, nPattern, 10, 6 );
+ if( (aArea.mnPattern == EXC_PATT_NONE) || (aArea.mnPattern == EXC_PATT_SOLID) )
{
- nP = nB; nB = nF; nF = nP; nP = 1;
+ // overwrite a cell style with "no fill"
+ // EXC_PATT_SOLID forces creation of a brush item in SetArea()
+ ::std::swap( aArea.mnForeColor, aArea.mnBackColor );
+ aArea.mnPattern = EXC_PATT_SOLID;
}
-
- XclImpXF::SetArea( rStyleItemSet, rPalette, nP, nF, nB );
+ XclImpXF::SetArea( rStyleItemSet, rPalette, aArea );
}
// convert formulas
@@ -448,7 +450,7 @@ void ExcCondForm::Apply( void )
if( nR2 > MAXROW )
nR2 = MAXROW;
- GetDoc().ApplyPatternAreaTab( nC1, nR1, nC2, nR2, GetScTab(), aPat );
+ GetDoc().ApplyPatternAreaTab( nC1, nR1, nC2, nR2, p->aStart.Tab(), aPat );
p = pRangeList->Next();
}
@@ -484,8 +486,7 @@ void ExcCondFormList::Apply( void )
ImportExcel8::ImportExcel8( SvStorage* pStorage, SvStream& rStream, ScDocument* pDoc, const String& rBasePath, SvStorage* pPivotCache ) :
- ImportExcel( rStream, pDoc, rBasePath ),
- aObjManager( *pExcRoot )
+ ImportExcel( rStream, pDoc, rBasePath )
{
delete pFormConv;
@@ -597,20 +598,30 @@ void ImportExcel8::Horizontalpagebreaks( void )
void ImportExcel8::Note( void )
{
- UINT16 nCol, nRow, nId;
+ UINT16 nCol, nRow, nFlags, nId;
- aIn >> nRow >> nCol;
- aIn.Ignore( 2 );
- aIn >> nId;
+ aIn >> nRow >> nCol >> nFlags >> nId;
if( nRow <= MAXROW && nCol <= MAXCOL )
{
if( nId )
{
- const XclImpEscherNote* pObj = aObjManager.GetObjNote( nId, GetScTab() );
+ const XclImpEscherNote* pObj = GetObjectManager().GetObjNote( nId, GetScTab() );
const String* pText = pObj ? pObj->GetText() : NULL;
if( pText )
- pD->SetNote( nCol, nRow, GetScTab(), ScPostIt( *pText ) );
+ {
+ bool bVisible = ::get_flag( nFlags, EXC_NOTE_VISIBLE );
+ ScPostIt aNote( *pText );
+ aNote.SetShown( bVisible );
+ GetDoc().SetNote( nCol, nRow, GetScTab(), aNote );
+ if( bVisible )
+ {
+ ScDocument *pDoc = GetDocPtr();
+ ScDetectiveFunc( pDoc, GetScTab() ).ShowComment( nCol, nRow, TRUE );
+
+ // ScDetectiveFunc( GetDocPtr(), GetScTab() ).ShowComment( nCol, nRow, TRUE );
+ }
+ }
}
}
else
@@ -623,7 +634,7 @@ void ImportExcel8::Note( void )
void ImportExcel8::Cont( void )
{
if( bObjSection )
- aObjManager.ReadMsodrawing( aIn );
+ GetObjectManager().ReadMsodrawing( aIn );
}
@@ -648,14 +659,14 @@ void ImportExcel8::Dconref( void )
aTabName = aUrl;
aUrl.Erase();
}
- ScfTools::ConvertName( aTabName );
+ ScfTools::ConvertToScSheetName( aTabName );
pCurrPivotCache->SetSource( nC1, nR1, nC2, nR2, aUrl, aTabName, bSelf );
}
void ImportExcel8::Obj()
{
- aObjManager.ReadObj( aIn );
+ GetObjectManager().ReadObj( maStrm );
}
@@ -669,7 +680,7 @@ void ImportExcel8::Boundsheet( void )
String aName( aIn.ReadUniString( nLen ) );
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScSheetName( aName );
*pExcRoot->pTabNameBuff << aName;
if( nBdshtTab > 0 )
@@ -730,19 +741,19 @@ void ImportExcel8::Cellmerging( void )
void ImportExcel8::Msodrawinggroup( void )
{
- aObjManager.ReadMsodrawinggroup( aIn );
+ GetObjectManager().ReadMsodrawinggroup( maStrm );
}
void ImportExcel8::Msodrawing( void )
{
- aObjManager.ReadMsodrawing( aIn );
+ GetObjectManager().ReadMsodrawing( maStrm );
}
void ImportExcel8::Msodrawingselection( void )
{
- aObjManager.ReadMsodrawingselection( aIn );
+ GetObjectManager().ReadMsodrawingselection( maStrm );
}
void ImportExcel8::Condfmt( void )
@@ -842,7 +853,7 @@ void ImportExcel8::Label( void )
void ImportExcel8::Txo( void )
{
- aObjManager.ReadTxo( aIn );
+ GetObjectManager().ReadTxo( maStrm );
}
@@ -923,11 +934,18 @@ void ImportExcel8::Name( void )
const BOOL bExtract = bBuiltIn && ( cFirstChar == EXC_BUILTIN_EXTRACT );
BOOL bAppendTabNum = FALSE;
BOOL bSkip = FALSE;
+ RangeType eNameType = RT_ABSAREA;
if( bBuiltIn )
XclTools::GetBuiltInName( aName, cFirstChar, nSheet );
else
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScDefinedName( aName );
+
+ if(bPrintArea)
+ eNameType = RT_PRINTAREA;
+ if(bCriteria)
+ eNameType = RT_CRITERIA;
+
pFormConv->Reset();
if( nOpt & (EXC_NAME_VB | EXC_NAME_PROC | EXC_NAME_BIG) )
@@ -962,7 +980,12 @@ void ImportExcel8::Name( void )
else if( bCriteria )
pAutoFilterBuffer->AddAdvancedRange( aRange );
else if( bExtract )
- pAutoFilterBuffer->AddExtractPos( aRange );
+ {
+ if( pErgebnis->IsValidReference( aRange ) )
+ pAutoFilterBuffer->AddExtractPos( aRange );
+ else
+ eNameType = RT_NAME;
+ }
}
}
}
@@ -973,7 +996,7 @@ void ImportExcel8::Name( void )
pExcRoot->pRNameBuff->Store( aName, NULL, nSheet );
else
// ohne hidden
- pExcRoot->pRNameBuff->Store( aName, pErgebnis, nSheet, bPrintArea );
+ pExcRoot->pRNameBuff->Store( aName, pErgebnis, nSheet, eNameType );
}
@@ -997,28 +1020,18 @@ void ImportExcel8::PostDocLoad( void )
pCondFormList->Apply();
if( pAutoFilterBuffer )
pAutoFilterBuffer->Apply();
- GetWebQueryBuffer().Apply();
+ GetWebQueryBuffer().Apply(); //! test if extant
UINT32 nChartCnt = 0;
- SfxObjectShell* pShell = pD->GetDocumentShell();
- if( aObjManager.HasEscherStream() )
+ SfxObjectShell* pShell = GetDocShell();
+ XclImpObjectManager& rObjManager = GetObjectManager();
+
+ if( pShell && rObjManager.HasEscherStream() )
{
- Biff8MSDffManager* pDffMan = new Biff8MSDffManager( *pExcRoot, aObjManager,
+ Biff8MSDffManager* pDffMan = new Biff8MSDffManager( *pExcRoot, rObjManager,
0, 0, pD->GetDrawLayer(), 1440 );
- const String aStrName( _STRING( "Ctls" ) );
- SvStorage& rStrg = *pExcRoot->pRootStorage;
- const BOOL bHasCtrls = rStrg.IsContained( aStrName ) && rStrg.IsStream( aStrName );
- ScMSConvertControls* pCtrlConv;
- SvStorageStreamRef xStStream;
-
- if( bHasCtrls && pShell )
- {
- pCtrlConv = new ScMSConvertControls( pShell );
- xStStream = pExcRoot->pRootStorage->OpenStream( aStrName, STREAM_READ | STREAM_SHARE_DENYALL );
- }
-
const XclImpAnchorData* pAnch;
const SvxMSDffShapeInfos* pShpInf = pDffMan->GetShapeInfos();
@@ -1045,6 +1058,8 @@ void ImportExcel8::PostDocLoad( void )
nOLEImpFlags |= OLE_POWERPOINT_2_STARIMPRESS;
}
+ XclImpOcxConverter aOcxConverter( *this );
+
for( n = 0 ; n < nMax ; n++ )
{
p = pShpInf->GetObject( ( UINT16 ) n );
@@ -1052,7 +1067,7 @@ void ImportExcel8::PostDocLoad( void )
nShapeId = p->nShapeId;
- XclImpEscherObj* pObj = aObjManager.GetObjFromStream( p->nFilePos );
+ XclImpEscherObj* pObj = rObjManager.GetObjFromStream( p->nFilePos );
if( pObj && !pObj->GetSdrObj() )
{
pMSDffImportData = new SvxMSDffImportData;
@@ -1060,7 +1075,7 @@ void ImportExcel8::PostDocLoad( void )
if( pObj->GetSdrObj() )
{
- pAnch = aObjManager.GetAnchorData( p->nFilePos );
+ pAnch = rObjManager.GetAnchorData( p->nFilePos );
// *** find all objects to ignore ***
bIgnoreObj = false;
@@ -1074,7 +1089,7 @@ void ImportExcel8::PostDocLoad( void )
}
// other objects
if( !bIgnoreObj )
- bIgnoreObj = IsIgnoreObject( pObj->GetId() );
+ bIgnoreObj = rObjManager.IsIgnoreObject( pObj->GetId() );
if( bIgnoreObj )
pObj->SetSdrObj( NULL ); // delete SdrObject
@@ -1086,17 +1101,7 @@ void ImportExcel8::PostDocLoad( void )
((XclImpEscherOle*)pObj)->CreateSdrOle( *pDffMan, nOLEImpFlags );
break;
case otCtrl:
- if( bHasCtrls )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
- xShapeRef = GetXShapeForSdrObject( ( SdrObject* ) pObj->GetSdrObj() );
- if( pCtrlConv->ReadOCXExcelKludgeStream( xStStream, &xShapeRef, TRUE ) )
- {
- SdrObject* pNewObj = GetSdrObjectFromXShape( xShapeRef );
- if( pNewObj )
- pObj->SetSdrObj( pNewObj );
- }
- }
+ aOcxConverter.ReadControl( static_cast< XclImpEscherOle& >( *pObj ) );
break;
}
}
@@ -1106,25 +1111,11 @@ void ImportExcel8::PostDocLoad( void )
}
}
- if( bHasCtrls )
- delete pCtrlConv;
-
delete pDffMan;
}
- aObjManager.Apply();
+ rObjManager.Apply();
- // controls
-/*
- ScMSConvertControls aCtrlConverter( pShell );
- String aStrName( String::CreateFromAscii( "Ctls" ) );
- com::sun::star::uno::Reference< com::sun::star::drawing::XShape >* pShapeRef = NULL;
-
- SvStorageStreamRef xStStream = pExcRoot->pRootStorage->OpenStream(
- aStrName, STREAM_READ | STREAM_SHARE_DENYALL );
- aCtrlConverter.ReadOCXExcelKludgeStream( xStStream, pShapeRef, TRUE );
- // BOOL bFloatingCtrl
-*/
ImportExcel::PostDocLoad();
// Scenarien bemachen! ACHTUNG: Hier wird Tabellen-Anzahl im Dokument erhoeht!!
@@ -1175,45 +1166,6 @@ void ImportExcel8::PostDocLoad( void )
-void ImportExcel8::CreateTmpCtrlStorage( void )
-{
-// if( pExcRoot->pCtrlStorage )
- if( pExcRoot->xCtrlStorage.Is() )
- return; // already done
-
- SvStorageStream* pContrIn = pExcRoot->pRootStorage->OpenStream( _STRINGCONST( "Ctls" ), STREAM_STD_READ );
- if( pContrIn )
- {
- SvStorageRef xStrg( new SvStorage( new SvMemoryStream(), TRUE ) );
- pExcRoot->xCtrlStorage = SvStorageRef( new SvStorage( new SvMemoryStream(), TRUE ) );
-// SvStorage* pStrg = new SvStorage( new SvMemoryStream(), TRUE );
-
-// SvStorageStreamRef xTemp = pStrg->OpenStream( _STRINGCONST( "contents" ) );
- SvStorageStreamRef xTemp = xStrg->OpenStream( _STRINGCONST( "contents" ) );
- if ( xTemp.Is() && ( xTemp->GetError() == SVSTREAM_OK ) )
- {
- pContrIn->Seek( 16 ); // no need for class id at this point
- *xTemp << *pContrIn;
-
- SvGlobalName aName( 0xD7053240, 0xCE69, 0x11CD, 0xA7, 0x77,
- 0x00, 0xDD, 0x01, 0x14, 0x3C, 0x57 );
- UINT32 nClip = SotExchange::RegisterFormatName( _STRING( "Embedded Object" ) );
-// pStrg->SetClass( aName, nClip, _STRING( "Microsoft Forms 2.0 CommandButton" ) );
- xStrg->SetClass( aName, nClip, _STRING( "Microsoft Forms 2.0 CommandButton" ) );
-
- pExcRoot->xCtrlStorage = xStrg;
- }
-/* else
- {
- delete pStrg;
- pStrg = NULL;
- }*/
-
-// pExcRoot->pCtrlStorage = pStrg;
- }
-}
-
-
void ImportExcel8::EndAllChartObjects( void )
{
}
@@ -1335,6 +1287,17 @@ void ImportExcel8::SXVdex( void )
void ImportExcel8::FilterMode( void )
{
+ // The FilterMode record exists: if either the AutoFilter
+ // record exists or an Advanced Filter is saved and stored
+ // in the sheet. Thus if the FilterMode records only exists
+ // then the latter is true..
+ if( !pAutoFilterBuffer ) return;
+
+ pAutoFilterBuffer->IncrementActiveAF();
+
+ XclImpAutoFilterData* pData = pAutoFilterBuffer->GetByTab( GetScTab() );
+ if( pData )
+ pData->SetAutoOrAdvanced();
}
void ImportExcel8::AutoFilterInfo( void )
@@ -1362,10 +1325,14 @@ void ImportExcel8::AutoFilter( void )
XclImpAutoFilterData::XclImpAutoFilterData( RootData* pRoot, const ScRange& rRange, const String& rName ) :
ExcRoot( pRoot ),
+ pCurrDBData(NULL),
nFirstEmpty( 0 ),
bActive( FALSE ),
bHasDropDown( FALSE ),
- bHasConflict( FALSE )
+ bHasConflict( FALSE ),
+ bCriteria( FALSE ),
+ bAutoOrAdvanced(FALSE),
+ aFilterName(rName)
{
aParam.nCol1 = rRange.aStart.Col();
aParam.nRow1 = rRange.aStart.Row();
@@ -1373,21 +1340,18 @@ XclImpAutoFilterData::XclImpAutoFilterData( RootData* pRoot, const ScRange& rRan
aParam.nCol2 = rRange.aEnd.Col();
aParam.nRow2 = rRange.aEnd.Row();
- ScDBCollection& rColl = *pRoot->pDoc->GetDBCollection();
+ // Excel defaults to always in place regardless
+ // of whether an extract record exists. The user
+ // must choose to explicity set the Copy To in the UI.
+ aParam.bInplace = TRUE;
- pCurrDBData = rColl.GetDBAtArea( Tab(), StartCol(), StartRow(), EndCol(), EndRow() );
- if( !pCurrDBData )
- {
- pCurrDBData = new ScDBData( rName, Tab(), StartCol(), StartRow(), EndCol(), EndRow() );
- if( pCurrDBData )
- rColl.Insert( pCurrDBData );
- }
}
void XclImpAutoFilterData::CreateFromDouble( String& rStr, double fVal )
{
- SolarMath::DoubleToString( rStr, fVal, 'A', INT_MAX,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE );
+ rStr += String( ::rtl::math::doubleToUString( fVal,
+ rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE));
}
void XclImpAutoFilterData::SetCellAttribs()
@@ -1563,8 +1527,13 @@ void XclImpAutoFilterData::ReadAutoFilter( XclImpStream& rStrm )
void XclImpAutoFilterData::SetAdvancedRange( const ScRange* pRange )
{
- if( pCurrDBData )
- pCurrDBData->SetAdvancedQuerySource( pRange );
+ if (pRange)
+ {
+ aCriteriaRange = *pRange;
+ bCriteria = TRUE;
+ }
+ else
+ bCriteria = FALSE;
}
void XclImpAutoFilterData::SetExtractPos( const ScAddress& rAddr )
@@ -1572,12 +1541,14 @@ void XclImpAutoFilterData::SetExtractPos( const ScAddress& rAddr )
aParam.nDestCol = rAddr.Col();
aParam.nDestRow = rAddr.Row();
aParam.nDestTab = rAddr.Tab();
- aParam.bInplace = FALSE;
aParam.bDestPers = TRUE;
+
}
-void XclImpAutoFilterData::Apply()
+void XclImpAutoFilterData::Apply( const BOOL bUseUnNamed )
{
+ CreateScDBData(bUseUnNamed);
+
if( bActive )
{
InsertQueryParam();
@@ -1593,8 +1564,68 @@ void XclImpAutoFilterData::Apply()
}
}
+void XclImpAutoFilterData::CreateScDBData( const BOOL bUseUnNamed )
+{
+
+ // Create the ScDBData() object if the AutoFilter is activated
+ // or if we need to create the Advanced Filter.
+ if( bActive || bCriteria)
+ {
+ ScDBCollection& rColl = *pExcRoot->pDoc->GetDBCollection();
+ pCurrDBData = rColl.GetDBAtArea( Tab(), StartCol(), StartRow(), EndCol(), EndRow() );
+ if( !pCurrDBData )
+ {
+ AmendAFName(bUseUnNamed);
+
+ pCurrDBData = new ScDBData( aFilterName, Tab(), StartCol(), StartRow(), EndCol(), EndRow() );
+
+ if( pCurrDBData )
+ {
+ if(bCriteria)
+ {
+ EnableRemoveFilter();
+
+ pCurrDBData->SetQueryParam( aParam );
+ pCurrDBData->SetAdvancedQuerySource(&aCriteriaRange);
+ }
+ else
+ pCurrDBData->SetAdvancedQuerySource(NULL);
+ rColl.Insert( pCurrDBData );
+ }
+ }
+ }
+
+}
+
+void XclImpAutoFilterData::EnableRemoveFilter()
+{
+ // only if this is a saved Advanced filter
+ if( !bActive && bAutoOrAdvanced )
+ {
+ ScQueryEntry& aEntry = aParam.GetEntry( nFirstEmpty );
+ aEntry.bDoQuery = TRUE;
+ ++nFirstEmpty;
+ }
+ // TBD: force the automatic activation of the
+ // "Remove Filter" by setting a virtual mouse click
+ // inside the advanced range
+}
+void XclImpAutoFilterData::AmendAFName(const BOOL bUseUnNamed)
+{
+ // If-and-only-if we have one AF filter then
+ // use the Calc "unnamed" range name. Calc
+ // only supports one in total while Excel
+ // supports one per sheet.
+ if( bUseUnNamed && bAutoOrAdvanced )
+ aFilterName = ScGlobal::GetRscString(STR_DB_NONAME);
+}
+
+XclImpAutoFilterBuffer::XclImpAutoFilterBuffer() :
+ nAFActiveCount( 0 )
+{
+}
XclImpAutoFilterBuffer::~XclImpAutoFilterBuffer()
{
@@ -1626,7 +1657,7 @@ void XclImpAutoFilterBuffer::AddExtractPos( const ScRange& rRange )
void XclImpAutoFilterBuffer::Apply()
{
for( XclImpAutoFilterData* pData = _First(); pData; pData = _Next() )
- pData->Apply();
+ pData->Apply(UseUnNamed());
}
XclImpAutoFilterData* XclImpAutoFilterBuffer::GetByTab( UINT16 nTab )
diff --git a/sc/source/filter/excel/excobj.cxx b/sc/source/filter/excel/excobj.cxx
index cc81bcf16da2..c74da3ec42d6 100644
--- a/sc/source/filter/excel/excobj.cxx
+++ b/sc/source/filter/excel/excobj.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excobj.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:16:00 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,8 +129,6 @@
#include "editutil.hxx"
#include "imp_op.hxx"
-#include "fltprgrs.hxx"
-#include "scmsocximexp.hxx"
#ifndef SC_XILINK_HXX
#include "xilink.hxx"
@@ -544,16 +542,3 @@ void ImportExcel::EndAllChartObjects( void )
#ifdef WNT
#pragma optimize("",on)
#endif
-
-
-
-
-using namespace ::com::sun::star;
-
-BOOL ScMSConvertControls::InsertControl(
- const uno::Reference< form::XFormComponent >& rFComp,
- const awt::Size& rSize,
- uno::Reference< drawing::XShape >* pShape,BOOL bFloatingCtrl )
-{
- return FALSE;
-}
diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx
index 91df7256f829..797f3de0cf8c 100644
--- a/sc/source/filter/excel/excrecds.cxx
+++ b/sc/source/filter/excel/excrecds.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excrecds.cxx,v $
*
- * $Revision: 1.58 $
+ * $Revision: 1.59 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:23 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,6 +100,7 @@
#include <string.h>
#include "global.hxx"
+#include "globstr.hrc"
#include "docpool.hxx"
#include "patattr.hxx"
#include "cell.hxx"
@@ -176,64 +177,6 @@ const BYTE ExcDummy_041::pMyData[] = {
};
const ULONG ExcDummy_041::nMyLen = sizeof( ExcDummy_041::pMyData );
-//--------------------------------------------------------- class ExcDummy_XF -
-const BYTE ExcDummy_XF::pMyData[] = {
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0x00,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf5, 0xff, 0x20, 0xf4,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x05, 0x00, 0x2b, 0x00, 0xf5, 0xff, 0x20, 0xf8,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x05, 0x00, 0x29, 0x00, 0xf5, 0xff, 0x20, 0xf8,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x05, 0x00, 0x09, 0x00, 0xf5, 0xff, 0x20, 0xf8,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x05, 0x00, 0x2c, 0x00, 0xf5, 0xff, 0x20, 0xf8,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xe0, 0x00, 0x10, 0x00, 0x05, 0x00, 0x2a, 0x00, 0xf5, 0xff, 0x20, 0xf8,
- 0xc0, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-const ULONG ExcDummy_XF::nMyLen = sizeof( ExcDummy_XF::pMyData );
-
-//------------------------------------------------------ class ExcDummy_Style -
-const BYTE ExcDummy_Style::pMyData[] = {
- 0x93, 0x02, 0x04, 0x00, 0x10, 0x80, 0x03, 0xff,
- 0x93, 0x02, 0x04, 0x00, 0x11, 0x80, 0x06, 0xff,
- 0x93, 0x02, 0x04, 0x00, 0x12, 0x80, 0x05, 0xff,
- 0x93, 0x02, 0x04, 0x00, 0x00, 0x80, 0x00, 0xff,
- 0x93, 0x02, 0x04, 0x00, 0x13, 0x80, 0x04, 0xff,
- 0x93, 0x02, 0x04, 0x00, 0x14, 0x80, 0x07, 0xff
-};
-const ULONG ExcDummy_Style::nMyLen = sizeof( ExcDummy_Style::pMyData );
-
//-------------------------------------------------------- class ExcDummy_02a -
const BYTE ExcDummy_02a::pMyData[] = {
0x0d, 0x00, 0x02, 0x00, 0x01, 0x00, // CALCMODE
@@ -260,14 +203,6 @@ const BYTE ExcDummy_02c::pMyData[] = {
const ULONG ExcDummy_02c::nMyLen = sizeof( ExcDummy_02c::pMyData );
-//---------------------------------------------------------
-
-
-#ifdef DBG_UTIL
-UINT16 ExcXf::nObjCnt = 0;
-#endif
-
-
//----------------------------------------------------------- class ExcRecord -
void ExcRecord::Save( XclExpStream& rStrm )
@@ -525,35 +460,6 @@ UINT16 Exc1904::GetNum( void ) const
-//--------------------------------------------------------- class ExcDummy_XF -
-
-ULONG ExcDummy_XF::GetLen( void ) const
-{
- return nMyLen;
-}
-
-
-const BYTE* ExcDummy_XF::GetData( void ) const
-{
- return pMyData;
-}
-
-
-
-//------------------------------------------------------ class ExcDummy_Style -
-
-ULONG ExcDummy_Style::GetLen( void ) const
-{
- return nMyLen;
-}
-
-
-const BYTE* ExcDummy_Style::GetData( void ) const
-{
- return pMyData;
-}
-
-
//------------------------------------------------------ class ExcBundlesheet -
ExcBundlesheetBase::ExcBundlesheetBase( RootData& rRootData, UINT16 nTab ) :
@@ -700,19 +606,17 @@ ExcCell::ExcCell(
const ScAddress rPos,
const ScPatternAttr* pAttr,
RootData& rRootData,
- const ULONG nAltNumForm,
- BOOL bForceAltNumForm ) :
+ const ULONG nAltNumForm ) :
aPos( rPos )
{
if( pPrgrsBar )
pPrgrsBar->SetState( GetCellCount() );
IncCellCount();
- DBG_ASSERT( rRootData.pXFRecs, "ExcCell::ExcCell - missing XF record list" );
DBG_ASSERT( rRootData.pCellMerging, "ExcCell::ExcCell - missing cell merging list" );
if( !rRootData.pCellMerging->FindMergeBaseXF( aPos, nXF ) )
- nXF = rRootData.pXFRecs->Find( pAttr, FALSE, nAltNumForm, bForceAltNumForm );
+ nXF = rRootData.pER->GetXFBuffer().Insert( pAttr, nAltNumForm );
#ifdef DBG_UTIL
_nRefCount++;
@@ -799,7 +703,7 @@ ExcBoolerr::ExcBoolerr(
UINT8 nValP,
BOOL bIsError ) :
// #73420# force to "no number format" if boolean value
- ExcCell( rPos, pAttr, rRootData, (bIsError ? NUMBERFORMAT_ENTRY_NOT_FOUND : 0), !bIsError ),
+ ExcCell( rPos, pAttr, rRootData, bIsError ? NUMBERFORMAT_ENTRY_NOT_FOUND : 0 ),
nVal( bIsError ? nValP : (nValP != 0) ),
bError( bIsError != 0 )
{
@@ -868,7 +772,7 @@ ExcRKMulRK* ExcRKMulRK::Extend(
ExcRKMulRKEntry* pNewCont = new ExcRKMulRKEntry;
if( !rRootData.pCellMerging->FindMergeBaseXF( rPos, pNewCont->nXF ) )
- pNewCont->nXF = rRootData.pXFRecs->Find( pAttr );
+ pNewCont->nXF = rRootData.pER->GetXFBuffer().Insert( pAttr );
pNewCont->nVal = nVal;
List::Insert( pNewCont, LIST_APPEND );
return NULL;
@@ -1143,7 +1047,7 @@ ExcRichStr::ExcRichStr( ExcCell& rExcCell, String& rText, const ScPatternAttr* p
}
// XF mit Umbruch auswaehlen?
- rExcCell.SetXF( nParCnt <= 1 ? rRoot.pXFRecs->Find( pAttr ) : rRoot.pXFRecs->FindWithLineBreak( pAttr ) );
+ rExcCell.SetXF( rRoot.pER->GetXFBuffer().Insert( pAttr, nParCnt > 1 ) );
}
else
{
@@ -1232,13 +1136,16 @@ ExcFormula::ExcFormula(
const ScPatternAttr* pAttr,
RootData& rRootData,
const ULONG nAltNumForm,
- BOOL bForceAltNumForm,
const ScTokenArray& rTokArray,
ExcArray** ppArray,
ScMatrixMode eMM,
ExcShrdFmla** ppShrdFmla,
- ExcArrays* pShrdFmlas ) :
- ExcCell( rPos, pAttr, rRootData, nAltNumForm, bForceAltNumForm )
+ ExcArrays* pShrdFmlas,
+ ScFormulaCell* pFormulaCell,
+ ExcFmlaResultStr** pFormulaResult) :
+ ExcCell( rPos, pAttr, rRootData, nAltNumForm ) ,
+ pFCell(pFormulaCell)
+
{
bShrdFmla = FALSE;
EC_Codetype eCodeType;
@@ -1314,6 +1221,30 @@ ExcFormula::ExcFormula(
delete pExcUPN;
+ if(pFCell && (pFCell->GetFormatType() == NUMBERFORMAT_TEXT))
+ {
+ String sText;
+ pFCell->GetString(sText);
+ XclExpString aFormulaText;
+ if ( rRootData.eDateiTyp < Biff8 )
+ {
+ aFormulaText.AssignByte(sText,*rRootData.pCharset);
+ *pFormulaResult = new ExcFmlaResultStr(aFormulaText);
+ }
+ else if(sText.Len())
+ {
+ aFormulaText.Assign(sText);
+ *pFormulaResult = new ExcFmlaResultStr(aFormulaText);
+ }
+ else
+ *pFormulaResult = NULL;
+ }
+ else
+ {
+ *pFormulaResult = NULL;
+ }
+
+
/* if( ppShrdFmla && aExcUPN.GetShrdFmla( pData, nFormLen ) )
{ // shared formula ref only
if( aExcUPN.IsFirstShrdFmla() )
@@ -1358,12 +1289,68 @@ void ExcFormula::SetTableOp( USHORT nCol, USHORT nRow )
ShortToSVBT16( (UINT16) nCol, (BYTE*) &pData[ 3 ] );
}
-
void ExcFormula::SaveDiff( XclExpStream& rStrm )
{// grbit chn
UINT16 nGrBit = bShrdFmla? 0x000B : 0x0003;
- rStrm << ( double ) 0.0 << nGrBit << ( UINT32 ) 0x00000000
- << nFormLen;
+ double fVal = 0.0;
+ UINT16 nErrorCode = 0;
+ String sText;
+
+
+ if(pFCell)
+ {
+ switch(pFCell->GetFormatType())
+ {
+ case NUMBERFORMAT_NUMBER:
+ if(!(nErrorCode = pFCell->GetErrCode()))
+ {
+ fVal = pFCell->GetValue();
+ rStrm << fVal;
+ }
+ else
+ {
+ BYTE nByte = ScErrorCodeToExc(nErrorCode);
+ rStrm << (UINT8)0x02
+ << (UINT8)0
+ << (UINT8)nByte
+ << (UINT16)0 << (UINT8)0
+ << (UINT16)0xFFFF;
+ }
+ break;
+
+ case NUMBERFORMAT_TEXT:
+ pFCell->GetString(sText);
+ if(sText.Len())
+ rStrm << (UINT8)0x00 << (UINT32)0 << (UINT8)0 << (UINT16)0xFFFF;
+ else
+ {
+ if ( rStrm.GetRoot().GetBiff() < xlBiff8 )
+ rStrm << (UINT8)0x00 << (UINT32)0 << (UINT8)0 << (UINT16)0xFFFF;
+ else
+ {
+ // empty formula result cells are represented by 0x03 in Biff8
+ rStrm << (UINT8)0x03 << (UINT32)0 << (UINT8)0 << (UINT16)0xFFFF;
+ }
+ }
+ break;
+
+ case NUMBERFORMAT_LOGICAL:
+ fVal = pFCell->GetValue();
+ rStrm << (UINT8)0x01
+ << (UINT8)0
+ << (UINT8)((fVal != 0) ? 0x01 : 0x00)
+ << (UINT16)0 << (UINT8)0
+ << (UINT16)0xFFFF;
+ break;
+
+ default:
+ rStrm << fVal;
+ break;
+ }
+ }
+
+ rStrm << nGrBit << (UINT32)0x00000000 << nFormLen;
+
rStrm.Write( pData, nFormLen );
}
@@ -1379,6 +1366,33 @@ ULONG ExcFormula::GetDiffLen( void ) const
return 16 + nFormLen;
}
+BYTE ExcFormula::ScErrorCodeToExc(UINT16 nErrorCode)
+{
+ BYTE nRetVal;
+
+ switch(nErrorCode)
+ {
+ case errIllegalFPOperation: //503 to #DIV/0
+ nRetVal = 0x07;
+ break;
+ case errNoValue : //519 to #VALUE (wrong argument or operand)
+ nRetVal = 0x0F;
+ break;
+ case errNoCode: //521 to #NULL
+ nRetVal = 0x00;
+ break;
+ case errNoRef: //524 to #REF(cell referral not valid)
+ nRetVal = 0x17;
+ break;
+ case errNoName: //525 to #NAME (does not recognise text)
+ nRetVal = 0x1D;
+ break;
+ default:
+ nRetVal = 0x0F; // all others to #VALUE
+ break;
+ }
+ return nRetVal;
+}
//---------------------------------------------------- class ExcBlankMulblank -
@@ -1432,7 +1446,7 @@ void ExcBlankMulblank::AddEntries(
DBG_ASSERT( rPos.Col() + nCount <= MAXCOL + 1, "ExcBlankMulblank::AddEntries - column overflow" );
ScAddress aCurrPos( rPos );
- UINT16 nCellXF = rRootData.pXFRecs->Find( pAttr );
+ UINT16 nCellXF = rRootData.pER->GetXFBuffer().Insert( pAttr );
sal_uInt16 nTmpCount = nCount;
while( nTmpCount )
@@ -1577,7 +1591,20 @@ void ExcNameListEntry::SetCode( const ExcUPN& rUPN )
void ExcNameListEntry::SaveCont( XclExpStream& rStrm )
{
- rStrm << (UINT16) EXC_NAME_BUILTIN // grbit (built in only)
+ if(rStrm.GetRoot().GetBiff() < xlBiff8)
+ {
+ rStrm << (UINT16) EXC_NAME_BUILTIN // grbit (built in only)
+ << (UINT8) 0x00 // chKey (keyboard shortcut)
+ << (UINT8) 0x01 // cch (string len)
+ << nFormLen // cce (formula len)
+ << nTabNum // set ixals = itab
+ << nTabNum // itab (table index, 1-based)
+ << (UINT32) 0x00000000 // cch
+ << nBuiltInKey; // string
+ }
+ else
+ {
+ rStrm << (UINT16) EXC_NAME_BUILTIN // grbit (built in only)
<< (UINT8) 0x00 // chKey (keyboard shortcut)
<< (UINT8) 0x01 // cch (string len)
<< nFormLen // cce (formula len)
@@ -1586,6 +1613,7 @@ void ExcNameListEntry::SaveCont( XclExpStream& rStrm )
<< (UINT32) 0x00000000 // cch
<< (UINT8) 0x00 // string grbit
<< nBuiltInKey; // string
+ }
rStrm.Write( pData, nFormLen );
}
@@ -1665,6 +1693,10 @@ ExcName::ExcName( RootData& rRootData, ScDBData* pArea ) :
String aRangeName;
pArea->GetName( aRangeName );
+
+ if( IsBuiltInAFName( aRangeName, EXC_BUILTIN_AUTOFILTER ))
+ return;
+
SetUniqueName( aRangeName );
ScRange aRange;
@@ -1740,6 +1772,16 @@ BOOL ExcName::SetBuiltInName( const String& rName, UINT8 nKey )
return FALSE;
}
+BOOL ExcName::IsBuiltInAFName( const String& rName, UINT8 nKey )
+{
+ if( XclTools::IsBuiltInName( nTabNum, rName, nKey ) ||
+ (rName == ScGlobal::GetRscString( STR_DB_NONAME )))
+ {
+ bDummy = TRUE;
+ return TRUE;
+ }
+ return FALSE;
+}
void ExcName::SaveCont( XclExpStream& rStrm )
{
@@ -1893,8 +1935,15 @@ ExcNameList::ExcNameList( RootData& rRootData ) :
DBG_ASSERT( pData, "ExcNameList::ExcNameList - missing db area" );
ExcName* pExcName = new ExcName( rRootData, pData );
- nExpIx = Append( pExcName );
- pData->SetExportIndex( nExpIx );
+ if( pExcName->IsDummy() )
+ {
+ delete pExcName;
+ }
+ else
+ {
+ nExpIx = Append( pExcName );
+ pData->SetExportIndex( nExpIx );
+ }
}
maNextInsVec.resize( nScTabCount, Count() );
@@ -2092,7 +2141,7 @@ void ExcEGuts::SaveCont( XclExpStream& rStrm )
rStrm << (UINT16)(nRowLevel ? (12 * nRowLevel + 17) : 0)
<< (UINT16)(nColLevel ? (12 * nColLevel + 17) : 0)
<< (UINT16)(nRowLevel + (nRowLevel ? 1 : 0))
- << (UINT16)(nColLevel + (nRowLevel ? 1 : 0));
+ << (UINT16)(nColLevel + (nColLevel ? 1 : 0));
}
@@ -2279,7 +2328,7 @@ ExcColinfo::ExcColinfo( UINT16 nCol, UINT16 nTab, UINT16 nNewXF, RootData& rRoot
nXF = nNewXF;
- SetWidth( rDoc.GetColWidth( nCol, nTab ), rRoot.fColScale );
+ nColWidth = XclTools::GetXclColumnWidth( rDoc.GetColWidth( nCol, nTab ), rRoot.pER->GetCharWidth() );
BYTE nColFlags = rDoc.GetColFlags( nCol, nTab );
nOptions = 0x0000;
@@ -2295,18 +2344,6 @@ ExcColinfo::ExcColinfo( UINT16 nCol, UINT16 nTab, UINT16 nNewXF, RootData& rRoot
}
-void ExcColinfo::SetWidth( UINT16 nWidth, double fColScale )
-{
- double f = nWidth;
- f *= 1328.0 / 25.0;
- f += 90.0;
- f *= 1.0 / 23.0;
- f /= fColScale;
-
- nColWidth = (UINT16) f;
-}
-
-
void ExcColinfo::Expand( ExcColinfo*& rpExp )
{
if( !rpExp ) return;
@@ -2340,226 +2377,6 @@ ULONG ExcColinfo::GetLen( void ) const
-//--------------------------------------------------------------- class ExcXf -
-
-ExcXf::ExcXf( const XclExpRoot& rRoot, UINT16 nFont, UINT16 nForm, const ScPatternAttr* pPattAttr, BOOL& rbWrap, BOOL bSt ) :
- XclExpRoot( rRoot ),
- bStyle( bSt )
-{
-#ifdef DBG_UTIL
- nObjCnt++;
-#endif
-
- bAtrNum = bAtrFnt = bAtrAlc = bAtrBdr = bAtrPat = bAtrProt = !bSt; // always TRUE for cell xfs
-
- nIfnt = nFont;
- nIfmt = nForm;
-
- if( pPattAttr )
- {
- nOffs8 = 0x0000;
- const ScProtectionAttr& rProtAttr = (const ScProtectionAttr&) pPattAttr->GetItem( ATTR_PROTECTION );
- if( rProtAttr.GetProtection() )
- nOffs8 |= EXC_XF_LOCKED;
- if( rProtAttr.GetHideFormula() || rProtAttr.GetHideCell() )
- nOffs8 |= EXC_XF_HIDDEN;
-
- switch( ( SvxCellHorJustify )
- ((const SvxHorJustifyItem&)pPattAttr->GetItem( ATTR_HOR_JUSTIFY )).GetValue() )
- {
- case SVX_HOR_JUSTIFY_STANDARD: eAlc = xlHAlignGeneral; break;
- case SVX_HOR_JUSTIFY_LEFT: eAlc = xlHAlignLeft; break;
- case SVX_HOR_JUSTIFY_CENTER: eAlc = xlHAlignCenter; break;
- case SVX_HOR_JUSTIFY_RIGHT: eAlc = xlHAlignRight; break;
- case SVX_HOR_JUSTIFY_BLOCK: eAlc = xlHAlignJustify; break;
- case SVX_HOR_JUSTIFY_REPEAT: eAlc = xlHAlignFill; break;
- default:
- DBG_ERROR( "ExcXf::ExcXf(): ATTR_HOR_JUSTIFY unbekannt!" );
- eAlc = xlHAlignGeneral;
- }
-
- switch( ( SvxCellVerJustify )
- ((const SvxVerJustifyItem&)pPattAttr->GetItem( ATTR_VER_JUSTIFY )).GetValue() )
- {
- case SVX_VER_JUSTIFY_STANDARD: eAlcV = xlVAlignBottom; break;
- case SVX_VER_JUSTIFY_TOP: eAlcV = xlVAlignTop; break;
- case SVX_VER_JUSTIFY_CENTER: eAlcV = xlVAlignCenter; break;
- case SVX_VER_JUSTIFY_BOTTOM: eAlcV = xlVAlignBottom; break;
- default:
- DBG_ERROR( "ExcXf::ExcXf(): ATTR_VER_JUSTIFY unbekannt!" );
- eAlcV = xlVAlignBottom;
- }
-
- switch( ( SvxCellOrientation )
- ((const SvxOrientationItem&)pPattAttr->GetItem( ATTR_ORIENTATION )).GetValue() )
- {
- case SVX_ORIENTATION_STANDARD: eOri = xlTextOrientNoRot; break;
- case SVX_ORIENTATION_TOPBOTTOM: eOri = xlTextOrient90cw; break;
- case SVX_ORIENTATION_BOTTOMTOP: eOri = xlTextOrient90ccw; break;
- case SVX_ORIENTATION_STACKED: eOri = xlTextOrientTopBottom; break;
- default:
- DBG_ERROR( "ExcXf::ExcXf(): ATTR_ORIENTATION unbekannt!" );
- eOri = xlTextOrientNoRot;
- }
-
- bFWrap = rbWrap ||
- ( ( BOOL ) ((const SfxBoolItem&)pPattAttr->GetItem( ATTR_LINEBREAK )).GetValue() );
-
- // fore-/background
- const SvxBrushItem& rBrushItem = ( const SvxBrushItem& ) pPattAttr->GetItem( ATTR_BACKGROUND );
- Color aCol = rBrushItem.GetColor();
-
- nFls = aCol.GetTransparency()? 0x0000 : 0x0001;
-
- nIcvForeSer = GetPalette().InsertColor( aCol, xlColorCellArea );
- nIcvBackSer = GetPalette().InsertColor( Color( COL_BLACK ), xlColorCellArea );
-
- // Umrandung
- const SvxBoxItem& rBox = ((const SvxBoxItem&)pPattAttr->GetItem( ATTR_BORDER ));
-
- ScToExcBorderLine( GetPalette(), rBox.GetTop(), nIcvTopSer, nDgTop );
- ScToExcBorderLine( GetPalette(), rBox.GetLeft(), nIcvLftSer, nDgLeft );
- ScToExcBorderLine( GetPalette(), rBox.GetBottom(), nIcvBotSer, nDgBottom );
- ScToExcBorderLine( GetPalette(), rBox.GetRight(), nIcvRigSer, nDgRight );
-
- if( bSt )
- {
- static const USHORT pFntChkWichs[] =
- {
- ATTR_FONT_HEIGHT,
- ATTR_FONT_WEIGHT,
- ATTR_FONT_POSTURE,
- ATTR_FONT_UNDERLINE,
- ATTR_FONT_CROSSEDOUT,
- ATTR_FONT_CONTOUR,
- ATTR_FONT_SHADOWED,
- ATTR_FONT_COLOR,
- ATTR_FONT_LANGUAGE,
- 0
- };
-
- const SfxItemSet& rSet = pPattAttr->GetItemSet();
-
- bAtrNum = rSet.GetItemState( ATTR_VALUE_FORMAT, FALSE ) == SFX_ITEM_SET;
- bAtrFnt = pPattAttr->HasItemsSet( pFntChkWichs );
- bAtrAlc = ( rSet.GetItemState( ATTR_HOR_JUSTIFY, FALSE ) == SFX_ITEM_SET ) ||
- ( rSet.GetItemState( ATTR_VER_JUSTIFY, FALSE ) == SFX_ITEM_SET ) ||
- ( rSet.GetItemState( ATTR_LINEBREAK, FALSE ) == SFX_ITEM_SET );
- bAtrBdr = rSet.GetItemState( ATTR_BORDER, FALSE ) == SFX_ITEM_SET;
- bAtrPat = rSet.GetItemState( ATTR_BACKGROUND, FALSE ) == SFX_ITEM_SET;
- bAtrProt = rSet.GetItemState( ATTR_PROTECTION, FALSE ) == SFX_ITEM_SET;
- }
- }
- else
- {
- nOffs8 = EXC_XF_LOCKED;
- eAlc = xlHAlignGeneral;
- eAlcV = xlVAlignBottom;
- eOri = xlTextOrientNoRot;
- bFWrap = FALSE;
- nFls = 0x0000;
- nIcvBackSer = GetPalette().InsertIndex( 65 );
- nIcvForeSer = GetPalette().InsertIndex( 64 );
- nIcvTopSer = nIcvBotSer = nIcvLftSer = nIcvRigSer = 0;
- nDgTop = nDgLeft = nDgBottom = nDgRight = 0;
- }
-
- rbWrap = bFWrap;
-
- bFSxButton = FALSE; // XF Record attached PivotTable Button
-}
-
-
-#ifdef DBG_UTIL
-ExcXf::~ExcXf()
-{
- nObjCnt--;
-}
-#endif
-
-
-void ExcXf::ScToExcBorderLine( XclExpPalette& rPalette, const SvxBorderLine* pLine, UINT32& rIcvSer, UINT16& rDg )
-{
- if( !pLine )
- {
- rIcvSer = rPalette.InsertIndex( 0 );
- rDg = 0;
- return;
- }
-
- rIcvSer = rPalette.InsertColor( pLine->GetColor(), xlColorCellBorder );
-
- if( pLine->GetDistance() )
- // doppelte Linien
- rDg = 6;
- else
- {// einfache Linien
- UINT16 nOut = pLine->GetOutWidth();
-
- if( nOut <= DEF_LINE_WIDTH_1 )
- rDg = 1;
- else if( nOut <= DEF_LINE_WIDTH_2 )
- rDg = 2;
- else
- rDg = 5;
- }
-}
-
-
-void ExcXf::SaveCont( XclExpStream& rStrm )
-{
- UINT16 nTmp;
-
- rStrm << nIfnt << nIfmt // Offs 4 + 6
- << nOffs8; // Offs 8
-
- nTmp = ( UINT16 ) eAlc; // Offs 10
- nTmp |= 0x0800; // locked
- if( bFWrap )
- nTmp += 0x0008;
- nTmp += ( ( UINT16 ) eAlcV ) << 4;
- nTmp += ( ( UINT16 ) eOri ) << 8;
- rStrm << nTmp;
-
- UINT16 nForeInd, nBackInd;
- GetPalette().GetMixedColors( nForeInd, nBackInd, nFls, nIcvForeSer, nIcvBackSer );
- nTmp = nForeInd; // Offs 12
- nTmp |= nBackInd << 7;
-
- if ( bFSxButton )
- nTmp |= 0x2000;
- rStrm << nTmp;
-
- nTmp = nFls; // Offs 14
- nTmp += nDgBottom << 6;
- nTmp |= GetPalette().GetColorIndex( nIcvBotSer ) << 9;
- rStrm << nTmp;
-
- nTmp = nDgTop; // Offs 16
- nTmp += nDgLeft << 3;
- nTmp += nDgRight << 6;
- nTmp |= GetPalette().GetColorIndex( nIcvTopSer ) << 9;
- rStrm << nTmp;
-
- nTmp = GetPalette().GetColorIndex( nIcvLftSer ); // Offs 18
- nTmp |= GetPalette().GetColorIndex( nIcvRigSer ) << 7;
- rStrm << nTmp;
-}
-
-
-UINT16 ExcXf::GetNum( void ) const
-{
- return 0x00E0;
-}
-
-
-ULONG ExcXf::GetLen( void ) const
-{
- return 16;
-}
-
-
-
//------------------------------------------------------ class ExcExterncount -
ExcExterncount::ExcExterncount( RootData* pRD, const BOOL bTableNew ) :
@@ -2608,7 +2425,7 @@ ExcExternsheet::ExcExternsheet( RootData* pExcRoot, const UINT16 nNewTabNum ) :
void ExcExternsheet::SaveCont( XclExpStream& rStrm )
{
- rStrm << ( UINT8 ) Min( (xub_StrLen)(aTabName.Len() + 1), (xub_StrLen) 255 ) << ( UINT8 ) 0x03;
+ rStrm << ( UINT8 ) Min( (xub_StrLen)(aTabName.Len() ), (xub_StrLen) 255 ) << ( UINT8 ) 0x03;
rStrm.WriteByteStringBuffer(
ByteString( aTabName, *pExcRoot->pCharset ), 254 ); // max 254 chars (leading 0x03!)
}
@@ -2721,133 +2538,6 @@ ULONG ExcSelection::GetLen( void ) const
}
-//------------------------------------------------------------ class UsedList -
-
-void UsedList::Save( XclExpStream& rStrm )
-{
- for( ExcRecord* pExcRec = (ExcRecord*) First(); pExcRec; pExcRec = (ExcRecord*) Next() )
- pExcRec->Save( rStrm );
-}
-
-
-
-//-------------------------------------------------------- class UsedAttrList -
-
-UsedAttrList::UsedAttrList( RootData* pRD ) :
- ExcRoot( pRD ),
- rFntLst( pRD->pER->GetFontBuffer() ),
- rFrmLst( pRD->pER->GetNumFmtBuffer() )
-{
-}
-
-
-UsedAttrList::~UsedAttrList()
-{
- for( ENTRY* pEntry = _First(); pEntry; pEntry = _Next() )
- delete pEntry;
-}
-
-
-void UsedAttrList::AddNewXF( const ScPatternAttr* pAttr, const BOOL bStyle, const BOOL bExplLineBreak,
- const ULONG nAltNumForm, BOOL bForceAltNumForm )
-{
- // Aufbauen der Excel-Daten
- ENTRY* pData = new ENTRY;
- pData->pPattAttr = pAttr;
- pData->bLineBreak = bExplLineBreak;
- pData->nAltNumForm = nAltNumForm;
- List::Insert( pData, LIST_APPEND );
-
- // Font-Daten
- UINT16 nFontIndex;
-
- // Format-Daten
- ULONG nScForm;
-
- if( pAttr )
- {
- nFontIndex = rFntLst.Insert( *pAttr );
-
- if ( bForceAltNumForm )
- nScForm = nAltNumForm;
- else
- {
- nScForm = (( SfxUInt32Item& ) pAttr->GetItem( ATTR_VALUE_FORMAT )).GetValue();
-
- if( nAltNumForm != NUMBERFORMAT_ENTRY_NOT_FOUND &&
- ( nScForm % SV_COUNTRY_LANGUAGE_OFFSET ) == 0 )
- nScForm = nAltNumForm;
- }
- }
- else
- {
- nScForm = nAltNumForm;
- nFontIndex = 0;
- }
-
- UINT16 nFormatIndex = rFrmLst.Insert( nScForm );
-
- if ( pExcRoot->eDateiTyp < Biff8 )
- pData->pXfRec = new ExcXf( *pExcRoot->pER, nFontIndex, nFormatIndex, pAttr, pData->bLineBreak, bStyle );
- else
- pData->pXfRec = new ExcXf8( *pExcRoot->pER, nFontIndex, nFormatIndex, pAttr, pData->bLineBreak, bStyle );
-}
-
-
-UINT16 UsedAttrList::Find( const ScPatternAttr* pAttr, const BOOL bStyle,
- const UINT32 nAltNumForm, BOOL bForceAltNumForm )
-{
- if( !pAttr && nAltNumForm == NUMBERFORMAT_ENTRY_NOT_FOUND )
- return 15; // default XF
-
- DBG_ASSERT( nBaseIndex, "*UsedAttrList::Find(): leer == nichtleer?" );
-
- UINT16 nC = nBaseIndex;
- for( ENTRY* pCurr = _First(); pCurr; pCurr = _Next() )
- {
- if( pCurr->Equal( pAttr, nAltNumForm ) )
- return nC;
- nC++;
- }
-
- // neuen ausdenken
-
- AddNewXF( pAttr, bStyle, FALSE, nAltNumForm, bForceAltNumForm );
-
- return nC;
-}
-
-
-UINT16 UsedAttrList::FindWithLineBreak( const ScPatternAttr* pAttr )
-{
- DBG_ASSERT( nBaseIndex,
- "*UsedAttrList::FindWithLineBreak(): leer == nichtleer?" );
-
- UINT16 nC = nBaseIndex;
- for( ENTRY* pCurr = _First(); pCurr; pCurr = _Next() )
- {
- if( pCurr->pPattAttr == pAttr && pCurr->bLineBreak )
- return nC;
- nC++;
- }
-
- // neuen ausdenken
-
- AddNewXF( pAttr, FALSE, TRUE );
-
- return nC;
-}
-
-
-void UsedAttrList::Save( XclExpStream& rStrm )
-{
- for( ENTRY* pEntry = _First(); pEntry; pEntry = _Next() )
- if( pEntry->pXfRec )
- pEntry->pXfRec->Save( rStrm );
-}
-
-
-
// XclExpWsbool ===============================================================
XclExpWsbool::XclExpWsbool( RootData& rRootData ) :
@@ -3861,6 +3551,24 @@ ULONG ExcShrdFmla::GetLen() const
return 10 + nFormLen;
}
+//-----------------------------------------------------------------
+
+void ExcFmlaResultStr::WriteBody( XclExpStream& rStrm )
+{
+ rStrm << maResultText;
+}
+
+
+ExcFmlaResultStr::ExcFmlaResultStr(const XclExpString& aFmlaText) :
+ XclExpRecord( EXC_ID_STRING ),
+ maResultText(aFmlaText)
+{
+}
+
+
+ExcFmlaResultStr::~ExcFmlaResultStr()
+{
+}
//--------------------------- class XclExpTableOp, class XclExpTableOpManager -
diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx
index 7d95fa8f2288..95c4625c73e4 100644
--- a/sc/source/filter/excel/exctools.cxx
+++ b/sc/source/filter/excel/exctools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: exctools.cxx,v $
*
- * $Revision: 1.39 $
+ * $Revision: 1.40 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:23 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,6 @@
#include "imp_op.hxx"
#include "excimp8.hxx"
#include "otlnbuff.hxx"
-#include "fltprgrs.hxx"
#include "excrecds.hxx"
#include "xcl97rec.hxx"
@@ -124,7 +123,7 @@ String RootData::GetCondFormStyleName( const UINT16 n )
RootData::RootData( void )
{
- fColScale = fRowScale = 1.0;
+ fRowScale = 1.0;
pDoc = NULL;
pScRangeName = NULL;
@@ -153,12 +152,10 @@ RootData::RootData( void )
pCellMerging = NULL;
pNameList = NULL;
pScNameList = NULL;
- pXFRecs = NULL;
pExtSheetCntAndRecs = NULL;
nRowMax = 0;
pObjRecs = NULL;
- pNoteRecs = NULL;
pEscher = NULL;
pPivotCacheList = NULL;
@@ -425,82 +422,6 @@ void OutlineBuffer::Reset( ScOutlineArray *pOArray )
-INT32 FilterProgressBar::nInstances = 0;
-
-
-FilterProgressBar::FilterProgressBar( SvStream& rStream ) : pStr( &rStream ), pXIStr( NULL )
-{
- ULONG nOldPos = rStream.Tell();
- rStream.Seek( STREAM_SEEK_TO_END );
- ULONG nStrmLen = rStream.Tell();
- rStream.Seek( nOldPos );
- Init( nOldPos, nStrmLen, STR_LOAD_DOC );
-}
-
-
-FilterProgressBar::FilterProgressBar( XclImpStream& rStream ) : pStr( NULL ), pXIStr( &rStream )
-{
- Init( rStream.Tell(), rStream.GetStreamSize(), STR_LOAD_DOC );
-}
-
-
-FilterProgressBar::FilterProgressBar( UINT32 nObjCount ) : pStr( NULL ), pXIStr( NULL )
-{
- Init( 0, nObjCount, STR_PROGRESS_CALCULATING );
-}
-
-
-FilterProgressBar::~FilterProgressBar()
-{
- nInstances--;
-
- if( pPrgrs )
- delete pPrgrs;
-}
-
-
-void FilterProgressBar::Init( ULONG nStartPos, ULONG nSize, USHORT nResStr )
-{
- nInstances++;
-
- nCnt = 0;
-
- if( nInstances == 1 )
- {
- nUnitSize = (nSize < 128) ? 1 : (nSize / 128);
- nNextUnit = 0;
- pPrgrs = new ScProgress( NULL, ScGlobal::GetRscString( nResStr ), nSize );
- pPrgrs->SetState( nStartPos );
- }
- else
- pPrgrs = NULL;
-}
-
-
-void FilterProgressBar::Progress( void )
-{
- if( pPrgrs )
- {
- UINT32 nNewState;
- if( pStr )
- nNewState = pStr->Tell();
- else if( pXIStr )
- nNewState = pXIStr->Tell();
- else
- {
- nCnt++;
- nNewState = nCnt;
- }
-
- if( nNewState >= nNextUnit )
- {
- pPrgrs->SetState( nNewState );
- nNextUnit += nUnitSize;
- }
- }
-}
-
-
//___________________________________________________________________
diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx
index dad17f1c57f5..4f29f8e3b352 100644
--- a/sc/source/filter/excel/expop2.cxx
+++ b/sc/source/filter/excel/expop2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: expop2.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:16:01 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -135,17 +135,6 @@ ExportBiff5::ExportBiff5( SvStorage& rRootStorage, SvStream& aStream, ScDocument
if( pExcRoot->fRowScale <= 0.0 )
pExcRoot->fRowScale = 1.0;
- double fColScale = pExcRoot->pExtDocOpt->fColScale;
- if( fColScale <= 0.0 )
- {
- fColScale = aFilterOpt.GetExcelColScale();
- if( fColScale <= 0.0 )
- fColScale = 1.0;
-
- fColScale *= 1.027027027027; // adjustment for export of calc documents
- }
- pExcRoot->fColScale = fColScale;
-
pExcDoc = new ExcDocument( *this );
}
diff --git a/sc/source/filter/excel/fontbuff.cxx b/sc/source/filter/excel/fontbuff.cxx
index 67e67d97b17f..b6d7906fcddc 100644
--- a/sc/source/filter/excel/fontbuff.cxx
+++ b/sc/source/filter/excel/fontbuff.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fontbuff.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:16:01 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 83ca0f808803..7b5245468408 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: impop.cxx,v $
*
- * $Revision: 1.47 $
+ * $Revision: 1.48 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -238,10 +238,6 @@ ImportExcel::ImportExcel( SvStream& rSvStrm, ScDocument* pDoc, const String& rBa
// options from configuration
ScFilterOptions aFilterOpt;
- pExcRoot->fColScale = aFilterOpt.GetExcelColScale();
- if( pExcRoot->fColScale <= 0.0 )
- pExcRoot->fColScale = 1.0;
-
pExcRoot->fRowScale = aFilterOpt.GetExcelRowScale();
if( pExcRoot->fRowScale <= 0.0 )
pExcRoot->fRowScale = 1.0;
@@ -497,11 +493,15 @@ void ImportExcel::Row25( void )
void ImportExcel::Bof2( void )
{
sal_uInt16 nSubType;
+#if SC_XCL_USEDECR
maStrm.UseDecryption( false );
+#endif
maStrm.Ignore( 2 );
maStrm >> nSubType;
SetBiff( xlBiff2 );
+#if SC_XCL_USEDECR
maStrm.UseDecryption( true );
+#endif
pExcRoot->eHauptDateiTyp = Biff2;
if( nSubType == 0x0010 ) // Worksheet?
@@ -563,7 +563,7 @@ void ImportExcel::Externsheet( void )
bool bSameWorkBook;
aIn.AppendByteString( aEncodedUrl, false );
XclImpUrlHelper::DecodeUrl( aUrl, aTabName, bSameWorkBook, *pExcRoot->pIR, aEncodedUrl );
- ScfTools::ConvertName( aTabName );
+ ScfTools::ConvertToScSheetName( aTabName );
pExcRoot->pExtSheetBuff->Add( aUrl, aTabName, bSameWorkBook );
}
@@ -584,7 +584,7 @@ void ImportExcel::Name25( void )
// Namen einlesen
String aName( aIn.ReadRawByteString( nLenName ) );
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScDefinedName( aName );
pFormConv->Reset();
if( nAttr0 & 0x02 )
@@ -626,13 +626,18 @@ void ImportExcel::Name25( void )
sal_Char cFirstNameChar = ( sal_Char ) aName.GetChar( 0 );
const BOOL bPrintArea = bBuildIn && ( cFirstNameChar == EXC_BUILTIN_PRINTAREA );
const BOOL bPrintTitles = bBuildIn && ( cFirstNameChar == EXC_BUILTIN_PRINTTITLES );
+ RangeType eNameType = RT_ABSAREA;
+
+ if(bPrintArea)
+ eNameType = RT_PRINTAREA;
+
if( bBuildIn )
{// Build-in name
XclTools::GetBuiltInName( aName, cFirstNameChar, nSheet );
}
else
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScDefinedName( aName );
pFormConv->Reset();
if( nOpt & (EXC_NAME_VB | EXC_NAME_BIG) )
@@ -658,7 +663,7 @@ void ImportExcel::Name25( void )
pExcRoot->pRNameBuff->Store( aName, NULL, nSheet );
else
// ohne hidden
- pExcRoot->pRNameBuff->Store( aName, pErgebnis, nSheet, bPrintArea );
+ pExcRoot->pRNameBuff->Store( aName, pErgebnis, nSheet, eNameType);
}// ----------------------------------------- Ende fuer Biff5
}
@@ -821,7 +826,7 @@ void ImportExcel::Externname25( void )
if( ( nOpt & 0x0001 ) || ( ( nOpt & 0xFFFE ) == 0x0000 ) )
{// external name
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScDefinedName( aName );
pExcRoot->pExtNameBuff->AddName( aName );
}
else if( nOpt & 0x0010 )
@@ -845,7 +850,8 @@ void ImportExcel::Colwidth( void )
if( nColLast > MAXCOL )
nColLast = MAXCOL;
- pColRowBuff->SetWidthRange( nColFirst, nColLast, CalcColWidth( nColWidth ) );
+ sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
+ pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
}
@@ -932,6 +938,7 @@ void ImportExcel::DocProtect( void )
BOOL ImportExcel::Filepass( void )
{
+#if SC_XCL_USEDECR
if( pExcRoot->eHauptDateiTyp <= Biff5 )
{
aIn.UseDecryption( false );
@@ -958,6 +965,7 @@ BOOL ImportExcel::Filepass( void )
return !bValid;
}
else
+#endif
// POST: return = TRUE, wenn Password <> 0
return aIn.ReaduInt32() != 0;
}
@@ -1003,10 +1011,16 @@ void ImportExcel::Ixfe( void )
void ImportExcel::DefColWidth( void )
{
- UINT16 nWidth;
- aIn >> nWidth;
+ // stored as entire characters -> convert to 1/256 of characters (as in COLINFO)
+ double fDefWidth = 256.0 * maStrm.ReaduInt16();
+
+ // #i3006# additional space for default width - Excel adds space depending on font size
+ long nFontHt = GetFontBuffer().GetAppFontData().mnHeight;
+ fDefWidth += 40960.0 / ::std::max( nFontHt - 15L, 60L ) + 50.0;
+ fDefWidth = ::std::min( fDefWidth, 65535.0 );
- pColRowBuff->SetDefWidth( CalcColWidth( (UINT16) ( (double)nWidth * 292.5 ) ) );
+ sal_uInt16 nScWidth = XclTools::GetScColumnWidth( static_cast< sal_uInt16 >( fDefWidth ), GetCharWidth() );
+ pColRowBuff->SetDefWidth( nScWidth );
}
@@ -1034,7 +1048,8 @@ void ImportExcel::Colinfo( void )
if( nOpt & EXC_COL_HIDDEN ) // Cols hidden?
pColRowBuff->HideColRange( nColFirst, nColLast );
- pColRowBuff->SetWidthRange( nColFirst, nColLast, CalcColWidth( nColWidth ) );
+ sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
+ pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
pColRowBuff->SetDefaultXF( nColFirst, nColLast, nXF );
}
@@ -1112,7 +1127,7 @@ void ImportExcel::Boundsheet( void )
nGrbit = 0x0000;
String aName( aIn.ReadByteString( FALSE ) );
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScSheetName( aName );
*pExcRoot->pTabNameBuff << aName;
@@ -1199,10 +1214,8 @@ void ImportExcel::Palette( void )
void ImportExcel::Standardwidth( void )
{
- UINT16 nWidth;
- aIn >> nWidth;
-
- pColRowBuff->SetDefWidth( CalcColWidth( nWidth ), TRUE );
+ sal_uInt16 nScWidth = XclTools::GetScColumnWidth( maStrm.ReaduInt16(), GetCharWidth() );
+ pColRowBuff->SetDefWidth( nScWidth, TRUE );
}
@@ -1634,11 +1647,15 @@ void ImportExcel::Row34( void )
void ImportExcel::Bof3( void )
{
sal_uInt16 nSubType;
+#if SC_XCL_USEDECR
maStrm.UseDecryption( false );
+#endif
maStrm.Ignore( 2 );
maStrm >> nSubType;
SetBiff( xlBiff3 );
+#if SC_XCL_USEDECR
maStrm.UseDecryption( true );
+#endif
DBG_ASSERT( nSubType != 0x0100, "*ImportExcel::Bof3(): Biff3 als Workbook?!" );
pExcRoot->eHauptDateiTyp = Biff3;
@@ -1685,7 +1702,7 @@ void ImportExcel::Name34( void )
}
else
{
- ScfTools::ConvertName( aName );
+ ScfTools::ConvertToScDefinedName( aName );
bPrintArea = bPrintTitles = bBuildIn = FALSE;
}
@@ -1725,7 +1742,7 @@ void ImportExcel::Array34( void )
BYTE nFirstCol, nLastCol;
aIn >> nFirstRow >> nLastRow >> nFirstCol >> nLastCol;
- aIn.Ignore( 6 );
+ aIn.Ignore( (pExcRoot->eHauptDateiTyp >= Biff5) ? 6 : 2 );
aIn >> nFormLen;
if( nLastRow <= MAXROW && nLastCol <= MAXCOL )
@@ -1864,11 +1881,15 @@ void ImportExcel::Window2_5( void )
void ImportExcel::Bof4( void )
{
sal_uInt16 nSubType;
+#if SC_XCL_USEDECR
maStrm.UseDecryption( false );
+#endif
maStrm.Ignore( 2 );
maStrm >> nSubType;
SetBiff( xlBiff4 );
+#if SC_XCL_USEDECR
maStrm.UseDecryption( true );
+#endif
pExcRoot->eHauptDateiTyp = Biff4;
if( nSubType == 0x0010 ) // Sheet?
@@ -1894,10 +1915,14 @@ void ImportExcel::Bof5( void )
BiffTyp eHaupt = Biff5;
BiffTyp eDatei;
+#if SC_XCL_USEDECR
maStrm.UseDecryption( false );
+#endif
maStrm >> nVers >> nSubType;
SetBiff( (nVers == 0x0600) ? xlBiff8 : xlBiff5 );
+#if SC_XCL_USEDECR
maStrm.UseDecryption( true );
+#endif
switch( nSubType )
{
@@ -1961,6 +1986,21 @@ void ImportExcel::EndSheet( void )
if( pExcRoot->eHauptDateiTyp < Biff8 )
pExcRoot->pExtNameBuff->Reset();
+
+ // no or empty HEADER record
+ if( !bHasHeader )
+ {
+ SvxSetItem aHeaderSetItem( (const SvxSetItem&) pStyleSheetItemSet->Get( ATTR_PAGE_HEADERSET ) );
+ aHeaderSetItem.GetItemSet().Put( SfxBoolItem( ATTR_PAGE_ON, sal_False ) );
+ pStyleSheetItemSet->Put( aHeaderSetItem );
+ }
+ // no or empty FOOTER record
+ if( !bHasFooter )
+ {
+ SvxSetItem aFooterSetItem( (const SvxSetItem&) pStyleSheetItemSet->Get( ATTR_PAGE_FOOTERSET ) );
+ aFooterSetItem.GetItemSet().Put( SfxBoolItem( ATTR_PAGE_ON, sal_False ) );
+ pStyleSheetItemSet->Put( aFooterSetItem );
+ }
}
@@ -1975,7 +2015,7 @@ void ImportExcel::NeueTabelle( void )
ScStyleSheetPool* pStyleShPool = pD->GetStyleSheetPool();
SfxStyleSheetBase* pStyleSh = pStyleShPool->Find( aStyleName, SFX_STYLE_FAMILY_PAGE );
- pStyleSheetItemSet = pStyleSh ? &pStyleSh->GetItemSet() :
+ pExcRoot->pStyleSheetItemSet = pStyleSheetItemSet = pStyleSh ? &pStyleSh->GetItemSet() :
&pStyleShPool->Make( aStyleName, SFX_STYLE_FAMILY_PAGE, SFXSTYLEBIT_USERDEF ).GetItemSet();
pExcRoot->bDefaultPage = TRUE;
@@ -2160,7 +2200,6 @@ void ImportExcel::PostDocLoad( void )
}
}
- pExcRoot->pExtDocOpt->fColScale = pExcRoot->fColScale;
pD->SetExtDocOptions( pExcRoot->pExtDocOpt );
pExcRoot->pExtDocOpt = NULL;
@@ -2230,21 +2269,6 @@ void ImportExcel::PostDocLoad( void )
}
}
}
-
- // no or empty HEADER record
- if( !bHasHeader )
- {
- SvxSetItem aHeaderSetItem( (const SvxSetItem&) pStyleSheetItemSet->Get( ATTR_PAGE_HEADERSET ) );
- aHeaderSetItem.GetItemSet().Put( SfxBoolItem( ATTR_PAGE_ON, sal_False ) );
- pStyleSheetItemSet->Put( aHeaderSetItem );
- }
- // no or empty FOOTER record
- if( !bHasFooter )
- {
- SvxSetItem aFooterSetItem( (const SvxSetItem&) pStyleSheetItemSet->Get( ATTR_PAGE_FOOTERSET ) );
- aFooterSetItem.GetItemSet().Put( SfxBoolItem( ATTR_PAGE_ON, sal_False ) );
- pStyleSheetItemSet->Put( aFooterSetItem );
- }
}
@@ -2277,22 +2301,6 @@ void ImportExcel::SetTextCell( const UINT16 nC, const UINT16 nR, String& r, cons
}
-UINT16 ImportExcel::CalcColWidth( const UINT16 n )
-{
- double f = ( double ) n;
-
- f *= pExcRoot->fColScale;
- f *= 23.0;
- f -= 90.0;
- f *= 25.0 / 1328.0;
-
- if( f < 0.0 )
- f = 0.0;
-
- return ( UINT16 ) f;
-}
-
-
void ImportExcel::SetMarginItem( SfxItemSet& rItemSet, double fMarginInch, XclMarginType eType )
{
sal_uInt16 nMarginTwips = XclTools::GetTwipsFromInch( fMarginInch );
diff --git a/sc/source/filter/excel/makefile.mk b/sc/source/filter/excel/makefile.mk
index 7e591e41d9c8..b02c12c73543 100644
--- a/sc/source/filter/excel/makefile.mk
+++ b/sc/source/filter/excel/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.16 $
+# $Revision: 1.17 $
#
-# last change: $Author: dr $ $Date: 2002-11-21 12:16:01 $
+# last change: $Author: hr $ $Date: 2003-03-26 18:04:33 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -84,6 +84,7 @@ SLOFILES = \
$(SLO)$/xltools.obj \
$(SLO)$/xlroot.obj \
$(SLO)$/xlstyle.obj \
+ $(SLO)$/xlocx.obj \
$(SLO)$/xistream.obj \
$(SLO)$/xiroot.obj \
$(SLO)$/xihelper.obj \
diff --git a/sc/source/filter/excel/namebuff.cxx b/sc/source/filter/excel/namebuff.cxx
index d1fc21931936..cef2aa3dbd0e 100644
--- a/sc/source/filter/excel/namebuff.cxx
+++ b/sc/source/filter/excel/namebuff.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: namebuff.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -169,14 +169,14 @@ BOOL NameBuffer::Find( const sal_Char* pRefName, UINT16& rIndex )
-void RangeNameBuffer::Store( ByteString& r, const ScTokenArray* p, UINT16 n, const BOOL b )
+void RangeNameBuffer::Store( ByteString& r, const ScTokenArray* p, UINT16 n, const RangeType t)
{
String aTmpStr( r, *pExcRoot->pCharset );
- Store( aTmpStr, p, n, b );
+ Store( aTmpStr, p, n, t );
}
-void RangeNameBuffer::Store( String& rName, const ScTokenArray* pDef, UINT16 nAltSheet, const BOOL bPrintarea )
+void RangeNameBuffer::Store( String& rName, const ScTokenArray* pDef, UINT16 nAltSheet, const RangeType eNameType)
{
if( pDef )
{
@@ -196,8 +196,12 @@ void RangeNameBuffer::Store( String& rName, const ScTokenArray* pDef, UINT16 nAl
pData->GuessPosition();
pData->SetIndex( ( UINT16 ) Count() );
- if( bPrintarea )
- pData->AddType( RT_PRINTAREA );
+ if( eNameType == RT_PRINTAREA )
+ pData->AddType( eNameType );
+ else if( eNameType == RT_CRITERIA )
+ pData->SetType( eNameType );
+ else if( eNameType == RT_NAME )
+ pData->SetType( eNameType );
pExcRoot->pScRangeName->Insert( pData );
diff --git a/sc/source/filter/excel/read.cxx b/sc/source/filter/excel/read.cxx
index eba5cc7ddafd..784047423ce5 100644
--- a/sc/source/filter/excel/read.cxx
+++ b/sc/source/filter/excel/read.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: read.cxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-10 14:07:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -148,9 +148,8 @@ FltError ImportExcel::Read( void )
DBG_ASSERT( &aIn != NULL, "-ImportExcel::Read(): Kein Stream - wie dass?!" );
- ::std::auto_ptr< ScfProgressBar > pProgress( new ScfProgressBar( ScGlobal::GetRscString( STR_LOAD_DOC ) ) );
- sal_uInt32 nStreamSeg = pProgress->AddSegment( aIn.GetStreamSize() );
- pProgress->ActivateSegment( nStreamSeg );
+ ::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
+ aIn.GetStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
while( eAkt != Z_Ende )
{
@@ -1015,8 +1014,6 @@ FltError ImportExcel8::Read( void )
}
#endif
- CreateTmpCtrlStorage();
-
UINT16 nOpcode; // aktueller Opcode
UINT16 nBofLevel = 0;
@@ -1042,9 +1039,8 @@ FltError ImportExcel8::Read( void )
DBG_ASSERT( &aIn != NULL,
"-ImportExcel8::Read(): Kein Stream - wie dass?!" );
- ::std::auto_ptr< ScfProgressBar > pProgress( new ScfProgressBar( ScGlobal::GetRscString( STR_LOAD_DOC ) ) );
- sal_uInt32 nStreamSeg = pProgress->AddSegment( aIn.GetStreamSize() );
- pProgress->ActivateSegment( nStreamSeg );
+ ::std::auto_ptr< ScfSimpleProgressBar > pProgress( new ScfSimpleProgressBar(
+ aIn.GetStreamSize(), GetDocShell(), STR_LOAD_DOC ) );
bObjSection = FALSE;
@@ -1197,7 +1193,7 @@ FltError ImportExcel8::Read( void )
NeueTabelle();
if( pExcRoot->eDateiTyp == Biff8C )
{
- if( bWithDrawLayer && aObjManager.IsCurrObjChart() )
+ if( bWithDrawLayer && GetObjectManager().IsCurrObjChart() )
ReadChart8( *pProgress, FALSE ); // zunaechst Return vergessen
else
{// Stream-Teil mit Chart ueberlesen
@@ -1256,7 +1252,7 @@ FltError ImportExcel8::Read( void )
case EXC_ID_HLINK: XclImpHyperlink::ReadHlink( maStrm ); break;
case EXC_ID_LABELRANGES: XclImpLabelranges::ReadLabelranges( maStrm ); break;
- case EXC_ID_DVAL: XclImpValidation::ReadDval( maStrm, *this ); break;
+ case EXC_ID_DVAL: XclImpValidation::ReadDval( maStrm ); break;
case EXC_ID_DV: XclImpValidation::ReadDv( maStrm, *pFormConv ); break;
case EXC_ID_QSI: GetWebQueryBuffer().ReadQsi( maStrm ); break;
@@ -1299,7 +1295,7 @@ FltError ImportExcel8::Read( void )
{
Bof5();
if( pExcRoot->eDateiTyp == Biff8C && bWithDrawLayer &&
- aObjManager.IsCurrObjChart() )
+ GetObjectManager().IsCurrObjChart() )
ReadChart8( *pProgress, FALSE ); // zunaechst Return vergessen
else
{
@@ -1359,7 +1355,7 @@ FltError ImportExcel8::Read( void )
Bof5();
NeueTabelle();
- aObjManager.InsertDummyObj();
+ GetObjectManager().InsertDummyObj();
switch( pExcRoot->eDateiTyp )
{
@@ -1372,7 +1368,7 @@ FltError ImportExcel8::Read( void )
aIn.StoreGlobalPosition();
break;
case Biff8C:
- aObjManager.SetNewCurrObjChart();
+ GetObjectManager().SetNewCurrObjChart();
pExcRoot->bChartTab = TRUE;
ReadChart8( *pProgress, TRUE );
pExcRoot->bChartTab = FALSE;
@@ -1500,7 +1496,7 @@ FltError ImportExcel8::Read( void )
//___________________________________________________________________
-FltError ImportExcel8::ReadChart8( ScfProgressBar& rProgress, const BOOL bOwnTab )
+FltError ImportExcel8::ReadChart8( ScfSimpleProgressBar& rProgress, const BOOL bOwnTab )
{
bFirstScl = TRUE;
@@ -1508,7 +1504,7 @@ FltError ImportExcel8::ReadChart8( ScfProgressBar& rProgress, const BOOL bOwnTab
BOOL bLoop;
UINT16 nOpcode; // current opcode
- XclImpChart* pChart = aObjManager.GetCurrChartData();
+ XclImpChart* pChart = GetObjectManager().GetCurrChartData();
if( !pChart )
{
bLoop = TRUE;
@@ -1554,11 +1550,11 @@ FltError ImportExcel8::ReadChart8( ScfProgressBar& rProgress, const BOOL bOwnTab
case 0x100D: pChart->ReadSeriestext( aIn ); break; // SERIESTEXT
case 0x1014: pChart->ReadChartformat(); break; // CHARTFORMAT
case 0x1015: pChart->ReadLegend( aIn ); break; // LEGEND
- case 0x1017: pChart = aObjManager.ReplaceChartData( aIn, ctBar ); break; // BAR
- case 0x1018: pChart = aObjManager.ReplaceChartData( aIn, ctLine ); break; // LINE
- case 0x1019: pChart = aObjManager.ReplaceChartData( aIn, ctPie ); break; // PIE
- case 0x101A: pChart = aObjManager.ReplaceChartData( aIn, ctArea ); break; // AREA
- case 0x101B: pChart = aObjManager.ReplaceChartData( aIn, ctScatter );break; // SCATTER
+ case 0x1017: pChart = GetObjectManager().ReplaceChartData( aIn, ctBar ); break; // BAR
+ case 0x1018: pChart = GetObjectManager().ReplaceChartData( aIn, ctLine ); break; // LINE
+ case 0x1019: pChart = GetObjectManager().ReplaceChartData( aIn, ctPie ); break; // PIE
+ case 0x101A: pChart = GetObjectManager().ReplaceChartData( aIn, ctArea ); break; // AREA
+ case 0x101B: pChart = GetObjectManager().ReplaceChartData( aIn, ctScatter );break; // SCATTER
case 0x101C: pChart->ReadChartline( aIn ); break; // CHARTLINE
case 0x101D: pChart->ReadAxis( aIn ); break; // AXIS
case 0x101E: pChart->ReadTick( aIn ); break; // TICK
@@ -1576,8 +1572,8 @@ FltError ImportExcel8::ReadChart8( ScfProgressBar& rProgress, const BOOL bOwnTab
case 0x103A: pChart->Read3D( aIn ); break; // 3D
case 0x103C: pChart->ReadPicf( aIn ); break; // PICF
case 0x103D: pChart->ReadDropbar( aIn ); break; // DROPBAR
- case 0x103E: pChart = aObjManager.ReplaceChartData( aIn, ctNet ); break; // RADAR
- case 0x103F: pChart = aObjManager.ReplaceChartData( aIn, ctSurface );break; // SURFACE
+ case 0x103E: pChart = GetObjectManager().ReplaceChartData( aIn, ctNet ); break; // RADAR
+ case 0x103F: pChart = GetObjectManager().ReplaceChartData( aIn, ctSurface );break; // SURFACE
case 0x1041: pChart->ReadAxisparent( aIn ); break; // AXISPARENT
case 0x1045: pChart->ReadSertocrt( aIn ); break; // SERTOCRT
case 0x1046: pChart->ReadAxesused( aIn ); break; // AXESUSED
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index bc75b2b5869f..2ffbb9785ebc 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xecontent.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx
index 272108bcc002..fb838eca6ba3 100644
--- a/sc/source/filter/excel/xehelper.cxx
+++ b/sc/source/filter/excel/xehelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xehelper.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:25 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -694,10 +694,29 @@ void XclExpHFConverter::AppendPortion( String& rHFString, const EditTextObject*
aParaText.AppendAscii( "&D" );
else if( pFieldData->ISA( SvxTimeField ) || pFieldData->ISA( SvxExtTimeField ) )
aParaText.AppendAscii( "&T" );
- else if( pFieldData->ISA( SvxFileField ) || pFieldData->ISA( SvxExtFileField ) )
- aParaText.AppendAscii( "&F" );
else if( pFieldData->ISA( SvxTableField ) )
aParaText.AppendAscii( "&A" );
+ else if( pFieldData->ISA( SvxFileField ) ) // title -> file name
+ aParaText.AppendAscii( "&F" );
+ else if( pFieldData->ISA( SvxExtFileField ) )
+ {
+ const SvxExtFileField* pFileField = static_cast< const SvxExtFileField* >( pFieldData );
+ switch( pFileField->GetFormat() )
+ {
+ case SVXFILEFORMAT_NAME_EXT:
+ case SVXFILEFORMAT_NAME:
+ aParaText.AppendAscii( "&F" );
+ break;
+ case SVXFILEFORMAT_PATH:
+ aParaText.AppendAscii( "&Z" );
+ break;
+ case SVXFILEFORMAT_FULLPATH:
+ aParaText.AppendAscii( "&Z&F" );
+ break;
+ default:
+ DBG_ERRORFILE( "XclExpHFConverter::AppendPortion - unknown file field" );
+ }
+ }
}
}
else
diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx
index 199f3b98da87..8391fb3e7fc5 100644
--- a/sc/source/filter/excel/xelink.cxx
+++ b/sc/source/filter/excel/xelink.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xelink.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:25 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/excel/xerecord.cxx b/sc/source/filter/excel/xerecord.cxx
index 1212eda87304..fecc93d55911 100644
--- a/sc/source/filter/excel/xerecord.cxx
+++ b/sc/source/filter/excel/xerecord.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xerecord.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:12:49 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,6 +82,12 @@ void XclExpRecordBase::Save( XclExpStream& rStrm )
{
}
+void XclExpRecordBase::SaveRepeated( XclExpStream& rStrm, sal_uInt32 nCount )
+{
+ for( sal_uInt32 nIndex = 0; nIndex < nCount; ++nIndex )
+ Save( rStrm );
+}
+
// ----------------------------------------------------------------------------
@@ -95,6 +101,12 @@ XclExpRecord::~XclExpRecord()
{
}
+void XclExpRecord::SetRecHeader( sal_uInt16 nRecId, sal_uInt32 nRecSize )
+{
+ SetRecId( nRecId );
+ SetRecSize( nRecSize );
+}
+
void XclExpRecord::WriteBody( XclExpStream& rStrm )
{
}
@@ -118,6 +130,26 @@ void XclExpBoolRecord::WriteBody( XclExpStream& rStrm )
// ----------------------------------------------------------------------------
+XclExpDummyRecord::XclExpDummyRecord( sal_uInt16 nRecId, const void* pRecData, sal_uInt32 nRecSize ) :
+ XclExpRecord( nRecId )
+{
+ SetData( pRecData, nRecSize );
+}
+
+void XclExpDummyRecord::SetData( const void* pRecData, sal_uInt32 nRecSize )
+{
+ mpData = pRecData;
+ SetRecSize( pRecData ? nRecSize : 0 );
+}
+
+void XclExpDummyRecord::WriteBody( XclExpStream& rStrm )
+{
+ rStrm.Write( mpData, GetRecSize() );
+}
+
+
+// ----------------------------------------------------------------------------
+
void XclExpRefRecord::Save( XclExpStream& rStrm )
{
mrRec.Save( rStrm );
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx
index 3cf6f73e92fd..347c40884383 100644
--- a/sc/source/filter/excel/xeroot.cxx
+++ b/sc/source/filter/excel/xeroot.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xeroot.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:26 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,7 @@
#include "xecontent.hxx"
#endif
+#include <patattr.hxx>
// Global data ================================================================
@@ -101,11 +102,12 @@ XclExpRoot::XclExpRoot( XclExpRootData& rExpRootData ) :
XclRoot( rExpRootData ),
mrExpData( rExpRootData )
{
- mrExpData.mpPalette.reset( new XclExpPalette( *this ) );
- mrExpData.mpFontBuffer.reset( new XclExpFontBuffer( *this ) );
- mrExpData.mpNumFmtBuffer.reset( new XclExpNumFmtBuffer( *this ) );
+ mrExpData.mpPalette.reset( new XclExpPalette( GetRoot() ) );
+ mrExpData.mpFontBuffer.reset( new XclExpFontBuffer( GetRoot() ) );
+ mrExpData.mpNumFmtBuffer.reset( new XclExpNumFmtBuffer( GetRoot() ) );
+ mrExpData.mpXFBuffer.reset( new XclExpXFBuffer( GetRoot() ) );
mrExpData.mpTabIdBuffer.reset( new XclExpTabIdBuffer( GetDoc() ) );
- mrExpData.mpLinkManager.reset( new XclExpLinkManager( *this ) );
+ mrExpData.mpLinkManager.reset( new XclExpLinkManager( GetRoot() ) );
}
XclExpRoot::XclExpRoot( const XclExpRoot& rRoot ) :
@@ -123,9 +125,9 @@ XclExpRoot& XclExpRoot::operator=( const XclExpRoot& rRoot )
void XclExpRoot::SetBiff( XclBiff eBiff )
{
XclRoot::SetBiff( eBiff );
- GetPalette().SetBiff( eBiff );
- GetFontBuffer().SetBiff( eBiff );
- GetNumFmtBuffer().SetBiff( eBiff );
+ GetPalette().OnChangeBiff();
+ GetFontBuffer().OnChangeBiff();
+ GetNumFmtBuffer().OnChangeBiff();
}
XclExpSst& XclExpRoot::GetSst() const
@@ -150,6 +152,11 @@ XclExpNumFmtBuffer& XclExpRoot::GetNumFmtBuffer() const
return *mrExpData.mpNumFmtBuffer;
}
+XclExpXFBuffer& XclExpRoot::GetXFBuffer() const
+{
+ return *mrExpData.mpXFBuffer;
+}
+
XclExpTabIdBuffer& XclExpRoot::GetTabIdBuffer() const
{
return *mrExpData.mpTabIdBuffer;
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index b7e69696a6d4..2b4e25019429 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xestream.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:26 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 57655f89d0c7..ad8104e74db3 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xestyle.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2002-12-12 16:42:32 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,24 +76,52 @@
#ifndef _SV_FONTCVT_HXX
#include <vcl/fontcvt.hxx>
#endif
-#ifndef _ZFORLIST_HXX
-#include <svtools/zforlist.hxx>
-#endif
#ifndef _ZFORMAT_HXX
#include <svtools/zformat.hxx>
#endif
+#ifndef SC_ITEMS_HXX
+#include "scitems.hxx"
+#endif
+#ifndef _SVX_ALGITEM_HXX
+#include <svx/algitem.hxx>
+#endif
+#ifndef _SVX_BOXITEM_HXX
+#include <svx/boxitem.hxx>
+#endif
+#ifndef _SVX_ROTMODIT_HXX
+#include <svx/rotmodit.hxx>
+#endif
+#ifndef _SVX_COLRITEM_HXX
+#include <svx/colritem.hxx>
+#endif
+#ifndef _SVX_BRSHITEM_HXX
+#include <svx/brshitem.hxx>
+#endif
+#ifndef _SVX_FRMDIRITEM_HXX
+#include <svx/frmdiritem.hxx>
+#endif
+
#ifndef SC_DOCUMENT_HXX
#include "document.hxx"
#endif
+#ifndef SC_STLPOOL_HXX
+#include "stlpool.hxx"
+#endif
#ifndef SC_SCPATATR_HXX
#include "patattr.hxx"
#endif
+#ifndef SC_SCATTR_HXX
+#include "attrib.hxx"
+#endif
#ifndef SC_XEHELPER_HXX
#include "xehelper.hxx"
#endif
+#ifndef _RTL_TENCINFO_H
+#include <rtl/tencinfo.h>
+#endif
// PALETTE record - color information =========================================
@@ -124,7 +152,7 @@ inline XclExpStream& operator<<( XclExpStream& rStrm, const Color& rColor )
// additional classes for color reduction -------------------------------------
/** Maps a color list index to a palette index.
- @descr Used to remap the CID data vector from list indexes to palette indexes. */
+ @descr Used to remap the color ID data vector from list indexes to palette indexes. */
struct XclRemap
{
sal_uInt32 mnPalIndex; /// Index to palette.
@@ -152,9 +180,9 @@ typedef ::std::vector< XclNearest > XclNearestVec;
IMPL_FIXEDMEMPOOL_NEWDEL( XclExpPalette::XclListColor, 100, 100 )
-XclExpPalette::XclListColor::XclListColor( const Color& rColor, sal_uInt32 nCID ) :
+XclExpPalette::XclListColor::XclListColor( const Color& rColor, sal_uInt32 nColorId ) :
maColor( rColor ),
- mnCID( nCID ),
+ mnColorId( nColorId ),
mnWeight( 0 )
{
}
@@ -198,16 +226,18 @@ const sal_Int32 EXC_PAL_MAXDIST = 0x7FFFFFFF;
XclExpPalette::XclExpPalette( const XclExpRoot& rRoot ) :
XclExpRecord( EXC_ID_PALETTE ),
+ XclDefaultPalette( rRoot.GetBiff() ),
+ XclExpRoot( rRoot ),
mnLastIx( 0 )
{
- SetRecSize( GetColorCount() * 4 + 2 );
InsertColor( Color( COL_BLACK ), xlColorCellText );
- SetBiff( rRoot.GetBiff() );
+ OnChangeBiff();
}
-void XclExpPalette::SetBiff( XclBiff eBiff )
+void XclExpPalette::OnChangeBiff()
{
- XclDefaultPalette::SetBiff( eBiff );
+ SetDefaultColors( GetBiff() );
+ SetRecSize( GetColorCount() * 4 + 2 );
// initialize maPalette with default colors
sal_uInt32 nCount = GetColorCount();
@@ -232,7 +262,7 @@ sal_uInt32 XclExpPalette::InsertColor( const Color& rColor, XclColorType eType,
pEntry->UpdateWeighting( eType );
mnLastIx = nIndex;
- return pEntry->GetCID();
+ return pEntry->GetColorId();
}
sal_uInt32 XclExpPalette::InsertIndex( sal_uInt16 nIndex )
@@ -242,19 +272,19 @@ sal_uInt32 XclExpPalette::InsertIndex( sal_uInt16 nIndex )
void XclExpPalette::ReduceColors()
{
-// --- build initial CID data vector (maCIDDataVec) ---
+// --- build initial color ID data vector (maColorIdDataVec) ---
sal_uInt32 nCount = maColorList.Count();
- maCIDDataVec.resize( nCount );
+ maColorIdDataVec.resize( nCount );
for( sal_uInt32 nIx = 0; nIx < nCount; ++nIx )
{
XclListColor* pListColor = maColorList.GetObject( nIx );
- maCIDDataVec[ pListColor->GetCID() ].Set( pListColor->GetColor(), nIx );
+ maColorIdDataVec[ pListColor->GetColorId() ].Set( pListColor->GetColor(), nIx );
}
// --- loop as long as current color count does not fit into palette of current BIFF ---
- // CID data vector (maCIDDataVec) will map CIDs to color list entries (maColorList)
+ // Color ID data vector (maColorIdDataVec) will map color IDs to color list entries (maColorList)
while( maColorList.Count() > GetColorCount() )
{
// find a list color to remove
@@ -292,19 +322,19 @@ void XclExpPalette::ReduceColors()
aRemapVec[ nFound ].SetIndex( nNearest );
}
- // remap CID data map (maCIDDataVec) from list indexes to palette indexes
- for( XclCIDDataVec::iterator aIter = maCIDDataVec.begin(), aEnd = maCIDDataVec.end();
+ // remap color ID data map (maColorIdDataVec) from list indexes to palette indexes
+ for( XclColorIdDataVec::iterator aIter = maColorIdDataVec.begin(), aEnd = maColorIdDataVec.end();
aIter != aEnd; ++aIter )
aIter->mnIndex = aRemapVec[ aIter->mnIndex ].mnPalIndex;
}
-sal_uInt16 XclExpPalette::GetColorIndex( sal_uInt32 nCID ) const
+sal_uInt16 XclExpPalette::GetColorIndex( sal_uInt32 nColorId ) const
{
sal_uInt16 nRet = 0;
- if( nCID >= EXC_PAL_INDEXBASE )
- nRet = static_cast< sal_uInt16 >( nCID & ~EXC_PAL_INDEXBASE );
- else if( nCID < maCIDDataVec.size() )
- nRet = GetXclIndex( maCIDDataVec[ nCID ].mnIndex );
+ if( nColorId >= EXC_PAL_INDEXBASE )
+ nRet = static_cast< sal_uInt16 >( nColorId & ~EXC_PAL_INDEXBASE );
+ else if( nColorId < maColorIdDataVec.size() )
+ nRet = GetXclIndex( maColorIdDataVec[ nColorId ].mnIndex );
return nRet;
}
@@ -319,22 +349,22 @@ sal_uInt16 XclExpPalette::GetColorIndex( const Color& rColor, sal_uInt16 nAutoDe
}
void XclExpPalette::GetMixedColors(
- sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt16& rnXclPattern,
- sal_uInt32 nCIDForegr, sal_uInt32 nCIDBackgr ) const
+ sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt8& rnXclPattern,
+ sal_uInt32 nForeColorId, sal_uInt32 nBackColorId ) const
{
- if( (nCIDForegr >= EXC_PAL_INDEXBASE) || (nCIDBackgr >= EXC_PAL_INDEXBASE) || (rnXclPattern != EXC_PATT_SOLID) )
+ if( (nForeColorId >= EXC_PAL_INDEXBASE) || (nBackColorId >= EXC_PAL_INDEXBASE) || (rnXclPattern != EXC_PATT_SOLID) )
{
- rnXclForeIx = GetColorIndex( nCIDForegr );
- rnXclBackIx = GetColorIndex( nCIDBackgr );
+ rnXclForeIx = GetColorIndex( nForeColorId );
+ rnXclBackIx = GetColorIndex( nBackColorId );
return;
}
rnXclForeIx = rnXclBackIx = 0;
- if( nCIDForegr >= maCIDDataVec.size() )
+ if( nForeColorId >= maColorIdDataVec.size() )
return;
sal_uInt32 nIndex1, nIndex2;
- Color aForeColor( GetOriginalColor( nCIDForegr ) );
+ Color aForeColor( GetOriginalColor( nForeColorId ) );
sal_Int32 nFirstDist = GetNearPaletteColors( nIndex1, nIndex2, aForeColor );
if( (nIndex1 >= maPalette.size()) || (nIndex2 >= maPalette.size()) )
return;
@@ -377,10 +407,10 @@ ColorData XclExpPalette::GetColorData( sal_uInt16 nXclIndex, ColorData nDefault
return GetDefColorData( nXclIndex, nDefault );
}
-const Color& XclExpPalette::GetOriginalColor( sal_uInt32 nCID ) const
+const Color& XclExpPalette::GetOriginalColor( sal_uInt32 nColorId ) const
{
- if( nCID < maCIDDataVec.size() )
- return maCIDDataVec[ nCID ].maColor;
+ if( nColorId < maColorIdDataVec.size() )
+ return maColorIdDataVec[ nColorId ].maColor;
return maPalette[ 0 ].maColor;
}
@@ -446,9 +476,9 @@ void XclExpPalette::MergeListColors( sal_uInt32 nKeep, sal_uInt32 nRemove )
pKeepEntry->Merge( *pRemoveEntry );
maColorList.Delete( nRemove );
- // recalculate CID data map (maps CIDs to color list indexes)
- XclCIDDataVec::iterator aEnd = maCIDDataVec.end();
- for( XclCIDDataVec::iterator aIter = maCIDDataVec.begin(); aIter != aEnd; ++aIter )
+ // recalculate color ID data map (maps color IDs to color list indexes)
+ XclColorIdDataVec::iterator aEnd = maColorIdDataVec.end();
+ for( XclColorIdDataVec::iterator aIter = maColorIdDataVec.begin(); aIter != aEnd; ++aIter )
{
if( aIter->mnIndex == nRemove ) aIter->mnIndex = nKeep;
// not "else if", aIter->mnIndex may become greater than nRemove in previous op.
@@ -582,7 +612,7 @@ inline XclExpStream& operator<<( XclExpStream& rStrm, XclEscapement eEscapem )
XclExpFont::XclExpFont( const XclExpRoot& rRoot ) :
XclExpRecord( EXC_ID_FONT, 14 ),
XclExpRoot( rRoot ),
- mnCID( rRoot.GetPalette().InsertIndex( EXC_FONT_AUTOCOLOR ) ),
+ mnColorId( rRoot.GetPalette().InsertIndex( EXC_FONT_AUTOCOLOR ) ),
mnHash( 0 ),
mbHasColor( false )
{
@@ -602,12 +632,12 @@ void XclExpFont::SetName( const String& rName )
void XclExpFont::SetColor( const Color& rColor )
{
- SetCID( GetPalette().InsertColor( rColor, xlColorCellText, EXC_FONT_AUTOCOLOR ) );
+ SetColorId( GetPalette().InsertColor( rColor, xlColorCellText, EXC_FONT_AUTOCOLOR ) );
}
-void XclExpFont::SetCID( sal_uInt32 nCID )
+void XclExpFont::SetColorId( sal_uInt32 nColorId )
{
- mnCID = nCID;
+ mnColorId = nColorId;
mbHasColor = true;
}
@@ -627,8 +657,8 @@ void XclExpFont::SetFont( const Font& rFont )
SetUnderline( rFont.GetUnderline() );
SetItalic( rFont.GetItalic() != ITALIC_NONE );
SetStrikeout( rFont.GetStrikeout() != STRIKEOUT_NONE );
- SetOutline( rFont.IsOutline() == TRUE );
- SetShadow( rFont.IsShadow() == TRUE );
+ SetOutline( !!rFont.IsOutline() ); // BOOL->bool
+ SetShadow( !!rFont.IsShadow() ); // BOOL->bool
CalcHash();
}
@@ -651,7 +681,7 @@ bool XclExpFont::operator==( const XclExpFont& rCmp ) const
{
return
(mnHash == rCmp.mnHash) &&
- (!mbHasColor || !rCmp.mbHasColor || (mnCID == rCmp.mnCID)) &&
+ (!mbHasColor || !rCmp.mbHasColor || (mnColorId == rCmp.mnColorId)) &&
(maData.mnHeight == rCmp.maData.mnHeight) &&
(maData.mnWeight == rCmp.maData.mnWeight) &&
(maData.meUnderline == rCmp.maData.meUnderline) &&
@@ -683,21 +713,7 @@ sal_uInt8 XclExpFont::GetXclFamily( FontFamily eFamily )
sal_uInt8 XclExpFont::GetXclCharSet( rtl_TextEncoding eCharSet )
{
- switch( eCharSet )
- {
- case RTL_TEXTENCODING_DONTKNOW: return EXC_FONTCSET_DONTKNOW;
- case RTL_TEXTENCODING_MS_1252: return EXC_FONTCSET_MS_1252;
- case RTL_TEXTENCODING_APPLE_ROMAN: return EXC_FONTCSET_APPLE_ROMAN;
- case RTL_TEXTENCODING_IBM_437: return EXC_FONTCSET_IBM_437;
- case RTL_TEXTENCODING_IBM_850: return EXC_FONTCSET_IBM_850;
- case RTL_TEXTENCODING_IBM_860: return EXC_FONTCSET_IBM_860;
- case RTL_TEXTENCODING_IBM_861: return EXC_FONTCSET_IBM_861;
- case RTL_TEXTENCODING_IBM_863: return EXC_FONTCSET_IBM_863;
- case RTL_TEXTENCODING_IBM_865: return EXC_FONTCSET_IBM_865;
- case (rtl_TextEncoding) 9: return EXC_FONTCSET_SYSTEM;
- case RTL_TEXTENCODING_SYMBOL: return EXC_FONTCSET_SYMBOL;
- }
- return EXC_FONTCSET_DONTKNOW;
+ return rtl_getBestWindowsCharsetFromTextEncoding(eCharSet);
}
sal_uInt16 XclExpFont::GetXclWeight( FontWeight eWeight )
@@ -757,7 +773,7 @@ void XclExpFont::WriteBody( XclExpStream& rStrm )
rStrm << maData.mnHeight
<< nAttr
- << GetPalette().GetColorIndex( mnCID )
+ << GetPalette().GetColorIndex( mnColorId )
<< maData.mnWeight
<< maData.meEscapem
<< maData.meUnderline
@@ -772,20 +788,23 @@ void XclExpFont::WriteBody( XclExpStream& rStrm )
XclExpFontBuffer::XclExpFontBuffer( const XclExpRoot& rRoot ) :
XclExpRoot( rRoot ),
- mnMaxCount( 0 )
+ mnXclMaxCount( 0 )
{
- SetBiff( GetBiff() );
+ OnChangeBiff();
+
+ // currently always using Arial/10
+ SetCharWidth( 110 );
}
-void XclExpFontBuffer::SetBiff( XclBiff eBiff )
+void XclExpFontBuffer::OnChangeBiff()
{
- DBG_ASSERT( maFontList.Empty(), "XclExpFontBuffer::SetBiff - call is too late" );
- switch( eBiff )
+ DBG_ASSERT( maFontList.Empty(), "XclExpFontBuffer::OnChangeBiff - call is too late" );
+ switch( GetBiff() )
{
- case xlBiff4: mnMaxCount = EXC_FONT_MAXCOUNT4; break;
+ case xlBiff4: mnXclMaxCount = EXC_FONT_MAXCOUNT4; break;
case xlBiff5:
- case xlBiff7: mnMaxCount = EXC_FONT_MAXCOUNT5; break;
- case xlBiff8: mnMaxCount = EXC_FONT_MAXCOUNT8; break;
+ case xlBiff7: mnXclMaxCount = EXC_FONT_MAXCOUNT5; break;
+ case xlBiff8: mnXclMaxCount = EXC_FONT_MAXCOUNT8; break;
default: DBG_ERROR_BIFF();
}
}
@@ -793,7 +812,7 @@ void XclExpFontBuffer::SetBiff( XclBiff eBiff )
sal_uInt16 XclExpFontBuffer::GetIndex( const XclExpFont& rFont, sal_uInt16 nDefault )
{
sal_uInt32 nIndex = Find( rFont );
- return (nIndex < mnMaxCount) ? GetXclIndex( nIndex ) : nDefault;
+ return (nIndex < mnXclMaxCount) ? GetXclIndex( nIndex ) : nDefault;
}
sal_uInt16 XclExpFontBuffer::Insert( XclExpFont*& rpFont )
@@ -810,11 +829,11 @@ sal_uInt16 XclExpFontBuffer::Insert( XclExpFont*& rpFont )
XclExpFont* pOldFont = maFontList.GetObject( nIndex );
// old font does not have a color -> take color from new font
if( !pOldFont->HasColor() )
- pOldFont->SetCID( rpFont->GetCID() );
+ pOldFont->SetColorId( rpFont->GetColorId() );
delete rpFont;
rpFont = pOldFont;
}
- else if( nCount < mnMaxCount )
+ else if( nCount < mnXclMaxCount )
{
// --- font not found, possible to insert ---
maFontList.Append( rpFont );
@@ -833,7 +852,7 @@ sal_uInt16 XclExpFontBuffer::Insert( XclExpFont*& rpFont )
sal_uInt16 XclExpFontBuffer::Insert( const Font& rFont )
{
- XclExpFont* pNewFont = new XclExpFont( *this );
+ XclExpFont* pNewFont = new XclExpFont( GetRoot() );
pNewFont->SetFont( rFont );
return Insert( pNewFont );
}
@@ -854,7 +873,7 @@ void XclExpFontBuffer::Save( XclExpStream& rStrm )
void XclExpFontBuffer::InitDefaultFonts()
{
- XclExpFont aFont( *this );
+ XclExpFont aFont( GetRoot() );
aFont.SetName( String( RTL_CONSTASCII_USTRINGPARAM( "Arial" ) ) );
aFont.SetFamily( FAMILY_DONTKNOW );
aFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
@@ -889,7 +908,7 @@ void XclExpFontBuffer::InitDefaultFonts()
}
}
-sal_uInt16 XclExpFontBuffer::GetXclIndex( sal_uInt32 nIndex )
+sal_uInt16 XclExpFontBuffer::GetXclIndex( sal_uInt32 nIndex ) const
{
if( nIndex > 3 )
++nIndex;
@@ -948,9 +967,10 @@ XclExpNumFmtBuffer::XclExpNumFmtBuffer( const XclExpRoot& rRoot ) :
cannot convert from 'class String *' to 'class String (*)[54]'
The effective result here is class String (*)[54*1] */
mpKeywordTable( new NfKeywordTable[ 1 ] ),
- mpFormatter( new SvNumberFormatter( rRoot.GetDoc().GetServiceManager(), LANGUAGE_ENGLISH_US ) )
+ mpFormatter( new SvNumberFormatter( rRoot.GetDoc().GetServiceManager(), LANGUAGE_ENGLISH_US ) ),
+ mnStdFmt( GetFormatter().GetStandardFormat( GetDefLanguage() ) )
{
- SetBiff( GetBiff() );
+ OnChangeBiff();
mpFormatter->FillKeywordTable( *mpKeywordTable, LANGUAGE_ENGLISH_US );
// remap codes unknown to Excel
@@ -965,10 +985,10 @@ XclExpNumFmtBuffer::~XclExpNumFmtBuffer()
delete[] mpKeywordTable;
}
-void XclExpNumFmtBuffer::SetBiff( XclBiff eBiff )
+void XclExpNumFmtBuffer::OnChangeBiff()
{
- DBG_ASSERT( maFormatMap.empty(), "XclExpNumFmtBuffer::SetBiff - call is too late" );
- switch( eBiff )
+ DBG_ASSERT( maFormatMap.empty(), "XclExpNumFmtBuffer::OnChangeBiff - call is too late" );
+ switch( GetBiff() )
{
case xlBiff5:
case xlBiff7: mnXclOffset = EXC_FORMAT_OFFSET5; break;
@@ -977,10 +997,10 @@ void XclExpNumFmtBuffer::SetBiff( XclBiff eBiff )
}
}
-sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uInt32 nFormatIx )
+sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uInt32 nScFormatIx )
{
XclExpNumFmtVec::const_iterator aIter =
- ::std::find_if( maFormatMap.begin(), maFormatMap.end(), XclExpNumFmtPred( nFormatIx ) );
+ ::std::find_if( maFormatMap.begin(), maFormatMap.end(), XclExpNumFmtPred( nScFormatIx ) );
if( aIter != maFormatMap.end() )
return aIter->mnXclIx;
@@ -988,7 +1008,7 @@ sal_uInt16 XclExpNumFmtBuffer::Insert( sal_uInt32 nFormatIx )
if( nSize < 0xFFFFUL - mnXclOffset )
{
sal_uInt16 nXclIx = static_cast< sal_uInt16 >( nSize + mnXclOffset );
- maFormatMap.push_back( XclExpNumFmt( nFormatIx, nXclIx ) );
+ maFormatMap.push_back( XclExpNumFmt( nScFormatIx, nXclIx ) );
return nXclIx;
}
@@ -1062,7 +1082,7 @@ void XclExpNumFmtBuffer::WriteFormatRecord( XclExpStream& rStrm, const XclExpNum
void XclExpNumFmtBuffer::WriteDefaultFormats( XclExpStream& rStrm )
{
- const XclExpDefaultFormat* pEnd = pDefaultFormats + STATIC_TABLE_SIZE( pDefaultFormats );
+ const XclExpDefaultFormat* pEnd = STATIC_TABLE_END( pDefaultFormats );
for( const XclExpDefaultFormat* pCurr = pDefaultFormats; pCurr != pEnd; ++pCurr )
WriteFormatRecord( rStrm, pCurr->mnIndex, String( pCurr->mpFormat, RTL_TEXTENCODING_UTF8 ) );
}
@@ -1070,5 +1090,630 @@ void XclExpNumFmtBuffer::WriteDefaultFormats( XclExpStream& rStrm )
// XF, STYLE record - Cell formatting =========================================
+XclExpXFBorder::XclExpXFBorder() :
+ mnLeftColorId( 0 ),
+ mnRightColorId( 0 ),
+ mnTopColorId( 0 ),
+ mnBottomColorId( 0 ),
+ mnLeftLine( EXC_LINE_NONE ),
+ mnRightLine( EXC_LINE_NONE ),
+ mnTopLine( EXC_LINE_NONE ),
+ mnBottomLine( EXC_LINE_NONE )
+{
+}
+
+#if 0
+void lcl_GetBorder2( sal_uInt8& rnFlags, const XclExpXFBorder& rBorder )
+{
+ ::set_flag( rnFlags, EXC_XF2_LEFTLINE, rBorder.mnLeftLine != EXC_LINE_NONE );
+ ::set_flag( rnFlags, EXC_XF2_RIGHTLINE, rBorder.mnRightLine != EXC_LINE_NONE );
+ ::set_flag( rnFlags, EXC_XF2_TOPLINE, rBorder.mnTopLine != EXC_LINE_NONE );
+ ::set_flag( rnFlags, EXC_XF2_BOTTOMLINE, rBorder.mnBottomLine != EXC_LINE_NONE );
+}
+
+void lcl_GetBorder3( sal_uInt32& rnFlags, const XclExpXFBorder& rBorder, const XclExpPalette& rPalette )
+{
+ ::insert_value( rnFlags, rBorder.mnTopLine, 0, 3 );
+ ::insert_value( rnFlags, rBorder.mnLeftLine, 8, 3 );
+ ::insert_value( rnFlags, rBorder.mnBottomLine, 16, 3 );
+ ::insert_value( rnFlags, rBorder.mnRightLine, 24, 3 );
+ ::insert_value( rnFlags, rPalette.GetColorIndex( rBorder.mnTopColorId ), 3, 5 );
+ ::insert_value( rnFlags, rPalette.GetColorIndex( rBorder.mnLeftColorId ), 11, 5 );
+ ::insert_value( rnFlags, rPalette.GetColorIndex( rBorder.mnBottomColorId ), 19, 5 );
+ ::insert_value( rnFlags, rPalette.GetColorIndex( rBorder.mnRightColorId ), 27, 5 );
+}
+#endif
+
+void lcl_GetBorder5(
+ sal_uInt32& rnBorder, sal_uInt32& rnArea,
+ const XclExpXFBorder& rBorder, const XclExpPalette& rPalette )
+{
+ ::insert_value( rnBorder, rBorder.mnTopLine, 0, 3 );
+ ::insert_value( rnBorder, rBorder.mnLeftLine, 3, 3 );
+ ::insert_value( rnArea, rBorder.mnBottomLine, 22, 3 );
+ ::insert_value( rnBorder, rBorder.mnRightLine, 6, 3 );
+ ::insert_value( rnBorder, rPalette.GetColorIndex( rBorder.mnTopColorId ), 9, 7 );
+ ::insert_value( rnBorder, rPalette.GetColorIndex( rBorder.mnLeftColorId ), 16, 7 );
+ ::insert_value( rnArea, rPalette.GetColorIndex( rBorder.mnBottomColorId ), 25, 7 );
+ ::insert_value( rnBorder, rPalette.GetColorIndex( rBorder.mnRightColorId ), 23, 7 );
+}
+
+void lcl_GetBorder8(
+ sal_uInt32& rnBorder1, sal_uInt32& rnBorder2,
+ const XclExpXFBorder& rBorder, const XclExpPalette& rPalette )
+{
+ ::insert_value( rnBorder1, rBorder.mnLeftLine, 0, 4 );
+ ::insert_value( rnBorder1, rBorder.mnRightLine, 4, 4 );
+ ::insert_value( rnBorder1, rBorder.mnTopLine, 8, 4 );
+ ::insert_value( rnBorder1, rBorder.mnBottomLine, 12, 4 );
+ ::insert_value( rnBorder1, rPalette.GetColorIndex( rBorder.mnLeftColorId ), 16, 7 );
+ ::insert_value( rnBorder1, rPalette.GetColorIndex( rBorder.mnRightColorId ), 23, 7 );
+ ::insert_value( rnBorder2, rPalette.GetColorIndex( rBorder.mnTopColorId ), 0, 7 );
+ ::insert_value( rnBorder2, rPalette.GetColorIndex( rBorder.mnBottomColorId ), 7, 7 );
+}
+
+
+// ----------------------------------------------------------------------------
+
+XclExpXFArea::XclExpXFArea() :
+ mnForeColorId( 0 ),
+ mnBackColorId( 0 ),
+ mnPattern( EXC_PATT_NONE )
+{
+}
+
+#if 0
+void lcl_GetArea2( sal_uInt8& rnFlags, const XclExpXFArea& rArea )
+{
+ ::set_flag( rnFlags, EXC_XF2_BACKGROUND, rArea.mnPattern != EXC_PATT_NONE );
+}
+
+void lcl_GetArea3( sal_uInt16& rnArea, const XclExpXFArea& rArea, const XclExpPalette& rPalette )
+{
+ ::insert_value( rnArea, rArea.mnPattern, 0, 6 );
+ ::insert_value( rnArea, rPalette.GetColorIndex( rArea.mnForeColorId ), 6, 5 );
+ ::insert_value( rnArea, rPalette.GetColorIndex( rArea.mnBackColorId ), 11, 5 );
+}
+#endif
+
+void lcl_GetArea5( sal_uInt32& rnArea, const XclExpXFArea& rArea, const XclExpPalette& rPalette )
+{
+ sal_uInt16 nXclForeIx, nXclBackIx;
+ sal_uInt8 nXclPattern = rArea.mnPattern;
+ rPalette.GetMixedColors( nXclForeIx, nXclBackIx, nXclPattern, rArea.mnForeColorId, rArea.mnBackColorId );
+ ::insert_value( rnArea, nXclPattern, 16, 6 );
+ ::insert_value( rnArea, nXclForeIx, 0, 7 );
+ ::insert_value( rnArea, nXclBackIx, 7, 7 );
+}
+
+void lcl_GetArea8( sal_uInt32& rnBorder2, sal_uInt16& rnArea, const XclExpXFArea& rArea, const XclExpPalette& rPalette )
+{
+ sal_uInt16 nXclForeIx, nXclBackIx;
+ sal_uInt8 nXclPattern = rArea.mnPattern;
+ rPalette.GetMixedColors( nXclForeIx, nXclBackIx, nXclPattern, rArea.mnForeColorId, rArea.mnBackColorId );
+ ::insert_value( rnBorder2, nXclPattern, 26, 6 );
+ ::insert_value( rnArea, nXclForeIx, 0, 7 );
+ ::insert_value( rnArea, nXclBackIx, 7, 7 );
+}
+
+
+// ----------------------------------------------------------------------------
+
+XclExpXF::XclExpXF(
+ const XclExpRoot& rRoot, const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt, bool bForceWrapped ) :
+ mbCellXF( true )
+{
+ Init( rRoot, pPattern, nForcedNumFmt, bForceWrapped );
+}
+
+XclExpXF::XclExpXF( const XclExpRoot& rRoot, SfxStyleSheetBase& rStyleSheet ) :
+ mbCellXF( false )
+{
+ // create an own ScPatternAttr and let Init() do all the work
+ mpOwnPattern.reset( new ScPatternAttr( rStyleSheet.GetItemSet().Clone() ) );
+ Init( rRoot, mpOwnPattern.get() );
+}
+
+bool XclExpXF::Equals( const ScPatternAttr* pPattern, sal_uInt32 nForcedNumFmt, bool bForceWrapped ) const
+{
+ return mbCellXF && (mpPattern == pPattern) &&
+ ((nForcedNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND) || (mnNumFmt == nForcedNumFmt)) &&
+ (!bForceWrapped || mbWrapped);
+}
+
+void XclExpXF::GetBorderLine(
+ sal_uInt8& rnXclLine, sal_uInt32& rnColorId,
+ XclExpPalette& rPalette, const SvxBorderLine* pLine )
+{
+ if( pLine )
+ {
+ sal_uInt16 nOuterWidth = pLine->GetOutWidth();
+ sal_uInt16 nDistance = pLine->GetDistance();
+ if( nDistance > 0 )
+ rnXclLine = EXC_LINE_DOUBLE;
+ else if( nOuterWidth > DEF_LINE_WIDTH_2 )
+ rnXclLine = EXC_LINE_THICK;
+ else if( nOuterWidth > DEF_LINE_WIDTH_1 )
+ rnXclLine = EXC_LINE_MEDIUM;
+ else if( nOuterWidth > DEF_LINE_WIDTH_0 )
+ rnXclLine = EXC_LINE_THIN;
+ else if( nOuterWidth > 0 )
+ rnXclLine = EXC_LINE_HAIR;
+ else
+ rnXclLine = EXC_LINE_NONE;
+ rnColorId = rPalette.InsertColor( pLine->GetColor(), xlColorCellBorder );
+ }
+ else
+ {
+ rnXclLine = EXC_LINE_NONE;
+ rnColorId = rPalette.InsertIndex( 0 );
+ }
+}
+
+void XclExpXF::GetBorder( XclExpXFBorder& rBorder, XclExpPalette& rPalette, const ScPatternAttr& rPattern )
+{
+ const SvxBoxItem& rBoxItem = static_cast< const SvxBoxItem& >( rPattern.GetItem( ATTR_BORDER ) );
+ GetBorderLine( rBorder.mnLeftLine, rBorder.mnLeftColorId, rPalette, rBoxItem.GetLeft() );
+ GetBorderLine( rBorder.mnRightLine, rBorder.mnRightColorId, rPalette, rBoxItem.GetRight() );
+ GetBorderLine( rBorder.mnTopLine, rBorder.mnTopColorId, rPalette, rBoxItem.GetTop() );
+ GetBorderLine( rBorder.mnBottomLine, rBorder.mnBottomColorId, rPalette, rBoxItem.GetBottom() );
+}
+
+void XclExpXF::GetArea( XclExpXFArea& rArea, XclExpPalette& rPalette, const ScPatternAttr& rPattern )
+{
+ const SvxBrushItem& rBrushItem = static_cast< const SvxBrushItem& >( rPattern.GetItem( ATTR_BACKGROUND ) );
+ rArea.mnPattern = rBrushItem.GetColor().GetTransparency() ? EXC_PATT_NONE : EXC_PATT_SOLID;
+ rArea.mnForeColorId = rPalette.InsertColor( rBrushItem.GetColor(), xlColorCellArea );
+ rArea.mnBackColorId = rPalette.InsertColor( Color( COL_BLACK ), xlColorCellArea );
+}
+
+void XclExpXF::Init(
+ const XclExpRoot& rRoot, const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt, bool bForceWrapped )
+{
+ XclExpPalette& rPalette = rRoot.GetPalette();
+ XclExpNumFmtBuffer& rNumFmtBuffer = rRoot.GetNumFmtBuffer();
+
+// *** reset members ***
+
+ // mbCellXF set in constructors
+ SetRecHeader( EXC_ID_XF, (rRoot.GetBiff() == xlBiff8) ? 20 : 16 );
+ mpPattern = pPattern;
+ meHorAlign = xlHAlignGeneral;
+ meVerAlign = xlVAlignBottom;
+ meOrient = xlTextOrientNoRot;
+ meTextDir = xlTextDirContext;
+ mnParent = mbCellXF ? EXC_XF_DEFAULTSTYLE : EXC_XF_STYLEPARENT;
+ mnFont = mnNumFmt = 0;
+ if( nForcedNumFmt != NUMBERFORMAT_ENTRY_NOT_FOUND )
+ mnNumFmt = rNumFmtBuffer.Insert( nForcedNumFmt );
+ mnIndent = mnRotation = 0;
+ mbLocked = true; // default in Calc and Excel
+ mbHidden = false;
+ mbWrapped = bForceWrapped;
+ mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = false;
+
+// *** formatting attributes ***
+
+ if( !mpPattern )
+ {
+ maArea.mnForeColorId = rPalette.InsertIndex( 64 );
+ maArea.mnBackColorId = rPalette.InsertIndex( 65 );
+ if( nForcedNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ mnNumFmt = rNumFmtBuffer.Insert( rNumFmtBuffer.GetStandardFormat() );
+ return;
+ }
+
+// Creates a variable 'name' of type "const 'type' &" and assigns item with 'which' ID from mpPattern.
+#define GETITEM( type, name, which ) \
+ const type & name = static_cast< const type & >( mpPattern->GetItem( which ) )
+
+ // cell protection
+ GETITEM( ScProtectionAttr, rProtItem, ATTR_PROTECTION );
+ mbLocked = !!rProtItem.GetProtection(); // BOOL->bool
+ mbHidden = rProtItem.GetHideFormula() || rProtItem.GetHideCell();
+
+ // font
+ mnFont = rRoot.GetFontBuffer().Insert( *mpPattern );
+
+ // number format
+ if( nForcedNumFmt == NUMBERFORMAT_ENTRY_NOT_FOUND ) // don't overwrite forced format
+ {
+ GETITEM( SfxUInt32Item, rNumFmtItem, ATTR_VALUE_FORMAT );
+ mnNumFmt = rNumFmtBuffer.Insert( rNumFmtItem.GetValue() );
+ }
+
+ // horizontal alignment
+ GETITEM( SvxHorJustifyItem, rHorJustItem, ATTR_HOR_JUSTIFY );
+ switch( static_cast< SvxCellHorJustify >( rHorJustItem.GetValue() ) )
+ {
+ case SVX_HOR_JUSTIFY_STANDARD: meHorAlign = xlHAlignGeneral; break;
+ case SVX_HOR_JUSTIFY_LEFT: meHorAlign = xlHAlignLeft; break;
+ case SVX_HOR_JUSTIFY_CENTER: meHorAlign = xlHAlignCenter; break;
+ case SVX_HOR_JUSTIFY_RIGHT: meHorAlign = xlHAlignRight; break;
+ case SVX_HOR_JUSTIFY_BLOCK: meHorAlign = xlHAlignJustify; break;
+ case SVX_HOR_JUSTIFY_REPEAT: meHorAlign = xlHAlignFill; break;
+ default: DBG_ERROR( "XclExpXF::Init - unknown horizontal adjustment" );
+ }
+
+ // text wrap
+ if( !mbWrapped ) // only, if not yet forced by caller
+ {
+ GETITEM( SfxBoolItem, rWrapItem, ATTR_LINEBREAK );
+ mbWrapped = !!rWrapItem.GetValue(); // BOOL->bool
+ }
+
+ // vertical alignment
+ GETITEM( SvxVerJustifyItem, rVerJustItem, ATTR_VER_JUSTIFY );
+ switch( static_cast< SvxCellVerJustify >( rVerJustItem.GetValue() ) )
+ {
+ case SVX_VER_JUSTIFY_STANDARD: meVerAlign = xlVAlignBottom; break;
+ case SVX_VER_JUSTIFY_TOP: meVerAlign = xlVAlignTop; break;
+ case SVX_VER_JUSTIFY_CENTER: meVerAlign = xlVAlignCenter; break;
+ case SVX_VER_JUSTIFY_BOTTOM: meVerAlign = xlVAlignBottom; break;
+ default: DBG_ERROR( "XclExpXF::Init - unknown vertical adjustment" );
+ }
+
+ // text indent
+ GETITEM( SfxUInt16Item, rIndentItem, ATTR_INDENT );
+ sal_Int32 nTmpIndent = rIndentItem.GetValue(); // SfxUInt16Item returns INT16, weird...
+ (nTmpIndent += 100) /= 200;
+ mnIndent = static_cast< sal_uInt8 >( ::std::max( ::std::min( nTmpIndent, 0x0FL ), 0L ) );
+
+ // orientation and rotation
+ GETITEM( SvxOrientationItem, rOrientItem, ATTR_ORIENTATION );
+ switch( static_cast< SvxCellOrientation >( rOrientItem.GetValue() ) )
+ {
+ case SVX_ORIENTATION_STANDARD: meOrient = xlTextOrientNoRot; break;
+ case SVX_ORIENTATION_TOPBOTTOM: meOrient = xlTextOrient90cw; break;
+ case SVX_ORIENTATION_BOTTOMTOP: meOrient = xlTextOrient90ccw; break;
+ case SVX_ORIENTATION_STACKED: meOrient = xlTextOrientTopBottom; break;
+ default: DBG_ERROR( "XclExpXF::Init - unknown text orientation" );
+ }
+ switch( meOrient )
+ {
+ case xlTextOrientTopBottom: mnRotation = EXC_XF8_STACKED; break;
+ // #i4378# old calc doc's without real rotation
+ case xlTextOrient90ccw: mnRotation = 90; break;
+ case xlTextOrient90cw: mnRotation = 180; break;
+ default:
+ {
+ GETITEM( SfxInt32Item, rRotateItem, ATTR_ROTATE_VALUE );
+ mnRotation = XclTools::GetXclRotation( rRotateItem.GetValue() );
+ }
+ }
+
+ // cell border
+ GetBorder( maBorder, rPalette, *mpPattern );
+
+ // cell background area
+ GetArea( maArea, rPalette, *mpPattern );
+
+ // CTL text direction
+ GETITEM( SvxFrameDirectionItem, rFrameDirItem, ATTR_WRITINGDIR );
+ switch( static_cast< SvxFrameDirection >( rFrameDirItem.GetValue() ) )
+ {
+ case FRMDIR_ENVIRONMENT: meTextDir = xlTextDirContext; break;
+ case FRMDIR_HORI_LEFT_TOP: meTextDir = xlTextDirLTR; break;
+ case FRMDIR_HORI_RIGHT_TOP: meTextDir = xlTextDirRTL; break;
+ default: DBG_ERRORFILE( "XclExpXF::Init - unknown CTL text direction" );
+ }
+
+#undef GETITEM
+
+// *** used/unused flags ***
+
+ // all font items
+ static const sal_uInt16 pnFontWhichIds[] =
+ {
+ ATTR_FONT_HEIGHT,
+ ATTR_FONT_WEIGHT,
+ ATTR_FONT_POSTURE,
+ ATTR_FONT_UNDERLINE,
+ ATTR_FONT_CROSSEDOUT,
+ ATTR_FONT_CONTOUR,
+ ATTR_FONT_SHADOWED,
+ ATTR_FONT_COLOR,
+ ATTR_FONT_LANGUAGE,
+ 0
+ };
+
+ const SfxItemSet& rItemSet = mpPattern->GetItemSet();
+
+// Expands to true if rItemSet really contains the item with 'which' ID.
+#define CHECKITEM( which ) (rItemSet.GetItemState( which, FALSE ) == SFX_ITEM_SET)
+
+ switch( rRoot.GetBiff() )
+ {
+ // all 'case's -> run through
+ case xlBiff8: // new in BIFF8/BIFF8X
+ mbAlignUsed |= CHECKITEM( ATTR_ROTATE_VALUE ) ||
+ CHECKITEM( ATTR_INDENT ) || CHECKITEM( ATTR_WRITINGDIR );
+
+ case xlBiff7: // new in BIFF7 - nothing
+ case xlBiff5: // new in BIFF5 - nothing
+ case xlBiff4: // new in BIFF4
+ mbAlignUsed |= CHECKITEM( ATTR_VER_JUSTIFY ) || CHECKITEM( ATTR_ORIENTATION );
+
+ case xlBiff3: // attributes in all BIFF versions (BIFF2 does not use the flags at all)
+ mbProtUsed |= CHECKITEM( ATTR_PROTECTION );
+ mbFontUsed |= !!mpPattern->HasItemsSet( pnFontWhichIds ); // BOOL->bool
+ mbFmtUsed |= CHECKITEM( ATTR_VALUE_FORMAT );
+ mbBorderUsed |= CHECKITEM( ATTR_BORDER );
+ mbAreaUsed |= CHECKITEM( ATTR_BACKGROUND );
+ mbAlignUsed |= CHECKITEM( ATTR_HOR_JUSTIFY ) || CHECKITEM( ATTR_LINEBREAK );
+ break;
+ }
+
+#undef CHECKITEM
+}
+
+sal_uInt8 XclExpXF::GetUsedAttribMask() const
+{
+ sal_uInt8 nUsedFlags = 0;
+ // "mbCellXF == mb***Used" evaluates to correct value in cell and style XFs
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_PROT, mbCellXF == mbProtUsed );
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_FONT, mbCellXF == mbFontUsed );
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_VALFMT, mbCellXF == mbFmtUsed );
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_ALIGN, mbCellXF == mbAlignUsed );
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_BORDER, mbCellXF == mbBorderUsed );
+ ::set_flag( nUsedFlags, EXC_XF_DIFF_AREA, mbCellXF == mbAreaUsed );
+ return nUsedFlags;
+}
+
+void XclExpXF::WriteBody5( XclExpStream& rStrm )
+{
+ sal_uInt16 nTypeProt = 0;
+ ::set_flag( nTypeProt, EXC_XF_LOCKED, mbLocked );
+ ::set_flag( nTypeProt, EXC_XF_HIDDEN, mbHidden );
+ ::set_flag( nTypeProt, EXC_XF_STYLE, !mbCellXF );
+ ::insert_value( nTypeProt, mnParent, 4, 12 );
+
+ sal_uInt16 nAlign = 0;
+ ::insert_value( nAlign, meHorAlign, 0, 3 );
+ ::set_flag( nAlign, EXC_XF_WRAPPED, mbWrapped );
+ ::insert_value( nAlign, meVerAlign, 4, 3 );
+ ::insert_value( nAlign, meOrient, 8, 2 );
+ ::insert_value( nAlign, GetUsedAttribMask(), 10, 6 );
+
+ sal_uInt32 nArea = 0, nBorder = 0;
+ lcl_GetBorder5( nBorder, nArea, maBorder, rStrm.GetRoot().GetPalette() );
+ lcl_GetArea5( nArea, maArea, rStrm.GetRoot().GetPalette() );
+
+ rStrm << mnFont << mnNumFmt << nTypeProt << nAlign << nArea << nBorder;
+}
+
+void XclExpXF::WriteBody8( XclExpStream& rStrm )
+{
+ sal_uInt16 nTypeProt = 0;
+ ::set_flag( nTypeProt, EXC_XF_LOCKED, mbLocked );
+ ::set_flag( nTypeProt, EXC_XF_HIDDEN, mbHidden );
+ ::set_flag( nTypeProt, EXC_XF_STYLE, !mbCellXF );
+ ::insert_value( nTypeProt, mnParent, 4, 12 );
+
+ sal_uInt16 nAlign = 0;
+ ::insert_value( nAlign, meHorAlign, 0, 3 );
+ ::set_flag( nAlign, EXC_XF_WRAPPED, mbWrapped );
+ ::insert_value( nAlign, meVerAlign, 4, 3 );
+ ::insert_value( nAlign, mnRotation, 8, 8 );
+
+ sal_uInt16 nMiscAttrib = 0;
+ ::insert_value( nMiscAttrib, mnIndent, 0, 4 );
+ ::insert_value( nMiscAttrib, meTextDir, 6, 2 );
+ ::insert_value( nMiscAttrib, GetUsedAttribMask(), 10, 6 );
+
+ sal_uInt32 nBorder1 = 0, nBorder2 = 0;
+ sal_uInt16 nArea = 0;
+ lcl_GetBorder8( nBorder1, nBorder2, maBorder, rStrm.GetRoot().GetPalette() );
+ lcl_GetArea8( nBorder2, nArea, maArea, rStrm.GetRoot().GetPalette() );
+
+ rStrm << mnFont << mnNumFmt << nTypeProt << nAlign << nMiscAttrib << nBorder1 << nBorder2 << nArea;
+}
+
+void XclExpXF::WriteBody( XclExpStream& rStrm )
+{
+ switch( rStrm.GetRoot().GetBiff() )
+ {
+ case xlBiff5:
+ case xlBiff7: WriteBody5( rStrm ); break;
+ case xlBiff8: WriteBody8( rStrm ); break;
+ default: DBG_ERROR_BIFF();
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+
+XclExpStyle::XclExpStyle( const String& rName, sal_uInt16 nXFIndex ) :
+ XclExpRecord( EXC_ID_STYLE ),
+ maName( rName ),
+ mnXFIndex( nXFIndex )
+{
+ DBG_ASSERT( maName.Len(), "XclExpStyle::XclExpStyle - empty style name" );
+}
+
+void XclExpStyle::WriteBody( XclExpStream& rStrm )
+{
+ XclExpString aNameEx;
+ if( rStrm.GetRoot().GetBiff() >= xlBiff8 )
+ aNameEx.Assign( maName );
+ else
+ aNameEx.AssignByte( maName, rStrm.GetRoot().GetCharSet(), EXC_STR_8BITLENGTH );
+ rStrm << mnXFIndex << aNameEx;
+}
+
+
+// ----------------------------------------------------------------------------
+
+XclExpXFBuffer::XclExpXFBuffer( const XclExpRoot& rRoot ) :
+ XclExpRoot( rRoot ),
+ mnXclMaxCount( EXC_XF_MAXCOUNT ),
+ mnXclOffset( EXC_XF_OFFSET )
+{
+}
+
+void XclExpXFBuffer::InsertUserStyles()
+{
+ SfxStyleSheetIterator aStyleIter( GetDoc().GetStyleSheetPool(), SFX_STYLE_FAMILY_PARA );
+ for( SfxStyleSheetBase* pStyle = aStyleIter.First(); pStyle; pStyle = aStyleIter.Next() )
+ if( pStyle->IsUserDefined() )
+ InsertStyle( *pStyle );
+}
+
+sal_uInt16 XclExpXFBuffer::Insert( const ScPatternAttr* pPattern, bool bForceWrapped )
+{
+ return InsertCellXF( pPattern, NUMBERFORMAT_ENTRY_NOT_FOUND, bForceWrapped );
+}
+
+sal_uInt16 XclExpXFBuffer::Insert( const ScPatternAttr* pPattern, sal_uInt32 nForcedNumFmt )
+{
+ return InsertCellXF( pPattern, nForcedNumFmt, false );
+}
+
+sal_uInt16 XclExpXFBuffer::InsertStyle( SfxStyleSheetBase& rStyleSheet )
+{
+ // create the XF record
+ sal_uInt16 nXFIndex = EXC_XF_DEFAULTSTYLE;
+ if( maXFList.Count() < EXC_XF_MAXCOUNT )
+ {
+ nXFIndex = GetXclIndex( maXFList.Count() );
+ maXFList.Append( new XclExpXF( GetRoot(), rStyleSheet ) );
+ }
+
+ // create the STYLE record
+ if( rStyleSheet.GetName().Len() )
+ maStyleList.Append( new XclExpStyle( rStyleSheet.GetName(), nXFIndex ) );
+
+ return nXFIndex;
+}
+
+void XclExpXFBuffer::Save( XclExpStream& rStrm )
+{
+ // XF records
+ switch( GetBiff() )
+ {
+ case xlBiff5:
+ case xlBiff7: WriteDefaultXFs5( rStrm ); break;
+ case xlBiff8: WriteDefaultXFs8( rStrm ); break;
+ default: DBG_ERROR_BIFF();
+ }
+ maXFList.Save( rStrm );
+
+ // STYLE records
+ switch( GetBiff() )
+ {
+ case xlBiff5:
+ case xlBiff7:
+ case xlBiff8: WriteDefaultStyles5( rStrm ); break;
+ default: DBG_ERROR_BIFF();
+ }
+ maStyleList.Save( rStrm );
+}
+
+sal_uInt16 XclExpXFBuffer::GetXclIndex( sal_uInt32 nIndex ) const
+{
+ DBG_ASSERT( nIndex < mnXclMaxCount, "XclExpXFBuffer::GetXclIndex - invalid index" );
+ return static_cast< sal_uInt16 >( nIndex + mnXclOffset );
+}
+
+sal_uInt16 XclExpXFBuffer::InsertCellXF(
+ const ScPatternAttr* pPattern, sal_uInt32 nForcedNumFmt, bool bForceWrapped )
+{
+ sal_uInt32 nIndex = LIST_ENTRY_NOTFOUND;
+
+ // try to find existing cell XF
+ for( const XclExpXF* pXF = maXFList.First(); pXF; pXF = maXFList.Next() )
+ {
+ if( pXF->Equals( pPattern, nForcedNumFmt, bForceWrapped ) )
+ {
+ nIndex = maXFList.GetCurPos();
+ break;
+ }
+ }
+
+ // not found - insert new XF
+ if( nIndex == LIST_ENTRY_NOTFOUND )
+ {
+ nIndex = maXFList.Count();
+ if( nIndex < EXC_XF_MAXCOUNT )
+ maXFList.Append( new XclExpXF( GetRoot(), pPattern, nForcedNumFmt, bForceWrapped ) );
+ else
+ // list full - fall back to default cell XF
+ return EXC_XF_DEFAULTCELL;
+ }
+
+ return GetXclIndex( nIndex );
+}
+
+void XclExpXFBuffer::WriteDefaultXFs5( XclExpStream& rStrm )
+{
+ static const sal_uInt8 pnDefStyle[] = { 0x00,0x00,0x00,0x00,0xF5,0xFF,0x20,0x00,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnOutlineStyle1[] = { 0x01,0x00,0x00,0x00,0xF5,0xFF,0x20,0xF4,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnOutlineStyle2[] = { 0x02,0x00,0x00,0x00,0xF5,0xFF,0x20,0xF4,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnOutlineStyle3[] = { 0x00,0x00,0x00,0x00,0xF5,0xFF,0x20,0xF4,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnDefCell[] = { 0x00,0x00,0x00,0x00,0x01,0x00,0x20,0x00,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnBuiltInStyle1[] = { 0x05,0x00,0x2B,0x00,0xF5,0xFF,0x20,0xF8,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnBuiltInStyle2[] = { 0x05,0x00,0x29,0x00,0xF5,0xFF,0x20,0xF8,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnBuiltInStyle3[] = { 0x05,0x00,0x2C,0x00,0xF5,0xFF,0x20,0xF8,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnBuiltInStyle4[] = { 0x05,0x00,0x2A,0x00,0xF5,0xFF,0x20,0xF8,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+ static const sal_uInt8 pnBuiltInStyle5[] = { 0x05,0x00,0x09,0x00,0xF5,0xFF,0x20,0xF8,0xC0,0x20,0x00,0x00,0x00,0x00,0x00,0x00 };
+
+ // default style (1)
+ XclExpDummyRecord aXF( EXC_ID_XF, pnDefStyle, STATIC_TABLE_SIZE( pnDefStyle ) ); aXF.Save( rStrm );
+ // outline styles (14)
+ aXF.SetData( pnOutlineStyle1, STATIC_TABLE_SIZE( pnOutlineStyle1 ) ); aXF.SaveRepeated( rStrm, 2 );
+ aXF.SetData( pnOutlineStyle2, STATIC_TABLE_SIZE( pnOutlineStyle2 ) ); aXF.SaveRepeated( rStrm, 2 );
+ aXF.SetData( pnOutlineStyle3, STATIC_TABLE_SIZE( pnOutlineStyle3 ) ); aXF.SaveRepeated( rStrm, 10 );
+ // default cell XF (1)
+ aXF.SetData( pnDefCell, STATIC_TABLE_SIZE( pnDefCell ) ); aXF.Save( rStrm );
+ // built-in styles (5)
+ aXF.SetData( pnBuiltInStyle1, STATIC_TABLE_SIZE( pnBuiltInStyle1 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle2, STATIC_TABLE_SIZE( pnBuiltInStyle2 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle3, STATIC_TABLE_SIZE( pnBuiltInStyle3 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle4, STATIC_TABLE_SIZE( pnBuiltInStyle4 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle5, STATIC_TABLE_SIZE( pnBuiltInStyle5 ) ); aXF.Save( rStrm );
+}
+
+void XclExpXFBuffer::WriteDefaultXFs8( XclExpStream& rStrm )
+{
+ static const sal_uInt8 pnDefStyle[] = { 0x00,0x00,0x00,0x00,0xF5,0xFF,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnOutlineStyle1[] = { 0x01,0x00,0x00,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnOutlineStyle2[] = { 0x02,0x00,0x00,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnOutlineStyle3[] = { 0x00,0x00,0x00,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnDefCell[] = { 0x00,0x00,0x00,0x00,0x01,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnBuiltInStyle1[] = { 0x01,0x00,0x2B,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnBuiltInStyle2[] = { 0x01,0x00,0x29,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnBuiltInStyle3[] = { 0x01,0x00,0x2C,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnBuiltInStyle4[] = { 0x01,0x00,0x2A,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+ static const sal_uInt8 pnBuiltInStyle5[] = { 0x01,0x00,0x09,0x00,0xF5,0xFF,0x20,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x20 };
+
+ // default style (1)
+ XclExpDummyRecord aXF( EXC_ID_XF, pnDefStyle, STATIC_TABLE_SIZE( pnDefStyle ) ); aXF.Save( rStrm );
+ // outline styles (14)
+ aXF.SetData( pnOutlineStyle1, STATIC_TABLE_SIZE( pnOutlineStyle1 ) ); aXF.SaveRepeated( rStrm, 2 );
+ aXF.SetData( pnOutlineStyle2, STATIC_TABLE_SIZE( pnOutlineStyle2 ) ); aXF.SaveRepeated( rStrm, 2 );
+ aXF.SetData( pnOutlineStyle3, STATIC_TABLE_SIZE( pnOutlineStyle3 ) ); aXF.SaveRepeated( rStrm, 10 );
+ // default cell XF (1)
+ aXF.SetData( pnDefCell, STATIC_TABLE_SIZE( pnDefCell ) ); aXF.Save( rStrm );
+ // built-in styles (5)
+ aXF.SetData( pnBuiltInStyle1, STATIC_TABLE_SIZE( pnBuiltInStyle1 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle2, STATIC_TABLE_SIZE( pnBuiltInStyle2 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle3, STATIC_TABLE_SIZE( pnBuiltInStyle3 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle4, STATIC_TABLE_SIZE( pnBuiltInStyle4 ) ); aXF.Save( rStrm );
+ aXF.SetData( pnBuiltInStyle5, STATIC_TABLE_SIZE( pnBuiltInStyle5 ) ); aXF.Save( rStrm );
+}
+
+void XclExpXFBuffer::WriteDefaultStyles5( XclExpStream& rStrm )
+{
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF038010 ).Save( rStrm );
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF068011 ).Save( rStrm );
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF048012 ).Save( rStrm );
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF078013 ).Save( rStrm );
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF008000 ).Save( rStrm );
+ XclExpUInt32Record( EXC_ID_STYLE, 0xFF058014 ).Save( rStrm );
+}
+
+
// ============================================================================
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index a5f8366356b8..49ee80cfd828 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xicontent.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-04 14:18:17 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -145,6 +145,7 @@
#endif
+#include "XclImpObjects.hxx"
#include "excform.hxx"
@@ -183,6 +184,7 @@ void XclImpBitmap::ReadBitmap( XclImpStream& rStrm )
{
const XclImpRoot& rRoot = rStrm.GetRoot();
DBG_ASSERT( rRoot.mpRD->pStyleSheetItemSet, "XclImpBitmap::ReadBitmap - no itemset" );
+ if( !rRoot.mpRD->pStyleSheetItemSet ) return;
SfxItemSet& rItemSet = *rRoot.mpRD->pStyleSheetItemSet;
sal_uInt32 nID;
@@ -475,15 +477,16 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm )
// Data Validation ============================================================
-void XclImpValidation::ReadDval( XclImpStream& rStrm, XclImpRoot& rRoot )
+void XclImpValidation::ReadDval( XclImpStream& rStrm )
{
+ const XclImpRoot& rRoot = rStrm.GetRoot();
DBG_ASSERT_BIFF( rRoot.GetBiff() == xlBiff8 );
sal_uInt32 nObjId;
rStrm.Ignore( 10 );
rStrm >> nObjId;
if( nObjId != EXC_DVAL_NOOBJ )
- rRoot.SetIgnoreObject( nObjId );
+ rRoot.GetObjectManager().SetIgnoreObject( nObjId );
}
void XclImpValidation::ReadDv( XclImpStream& rStrm, ExcelToSc& rFmlaConv )
diff --git a/sc/source/filter/excel/xihelper.cxx b/sc/source/filter/excel/xihelper.cxx
index a0d68643a523..2c304539777c 100644
--- a/sc/source/filter/excel/xihelper.cxx
+++ b/sc/source/filter/excel/xihelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xihelper.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:26 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -323,6 +323,7 @@ void XclImpHFConverter::ParseString( const String& rHFString )
} eState = xlPSText;
const sal_Unicode* pChar = rHFString.GetBuffer();
+ const sal_Unicode* pNull = pChar + rHFString.Len(); // pointer to teminating null char
while( *pChar )
{
switch( eState )
@@ -365,9 +366,20 @@ void XclImpHFConverter::ParseString( const String& rHFString )
case 'N': InsertField( SvxFieldItem( SvxPagesField() ) ); break; // page count
case 'D': InsertField( SvxFieldItem( SvxDateField() ) ); break; // date
case 'T': InsertField( SvxFieldItem( SvxTimeField() ) ); break; // time
- case 'F': InsertField( SvxFieldItem( SvxExtFileField() ) ); break; // file
case 'A': InsertField( SvxFieldItem( SvxTableField() ) ); break; // table name
+ case 'Z': // file path
+ InsertField( SvxFieldItem( SvxExtFileField() ) ); // convert to full name
+ if( (pNull - pChar >= 2) && (*(pChar + 1) == '&') && (*(pChar + 2) == 'F') )
+ {
+ // &Z&F found - ignore the &F part
+ pChar += 2;
+ }
+ break;
+ case 'F': // file name
+ InsertField( SvxFieldItem( SvxExtFileField( EMPTY_STRING, SVXFILETYPE_VAR, SVXFILEFORMAT_NAME_EXT ) ) );
+ break;
+
case 'U': // underline
SetAttribs();
mpFontData->meUnderline = (mpFontData->meUnderline == xlUnderlSingle) ?
@@ -616,7 +628,7 @@ void XclImpUrlHelper::DecodeUrl(
rUrl.Append( '\\' );
else // control character in raw name -> DDE link
{
- rUrl.Append( '|' );
+ rUrl.Append( EXC_DDE_DELIM );
eState = xlUrlRaw;
}
break;
diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx
index 7f80582178b5..5ed531463adf 100644
--- a/sc/source/filter/excel/xilink.cxx
+++ b/sc/source/filter/excel/xilink.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xilink.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:12:51 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -129,8 +129,8 @@ XclImpExtName::XclImpExtName( XclImpStream& rStrm )
if( ::get_flag( nFlags, EXC_EXTN_BUILTIN ) || !::get_flag( nFlags, EXC_EXTN_OLE_OR_DDE ) )
{
meType = xlExtName;
- ScfTools::ConvertName( maName, true ); // also a point is a valid char for func names!
- maName = rStrm.GetRoot().GetAddInNames().GetScName( maName );
+ maAddInName = rStrm.GetRoot().GetAddInNames().GetScName( maName );
+ ScfTools::ConvertToScDefinedName( maName );
}
else
meType = ::get_flagvalue( nFlags, EXC_EXTN_OLE, xlExtOLE, xlExtDDE );
@@ -205,14 +205,17 @@ void XclImpSupbookTab::CreateTable( ScDocument& rDoc, const String& rUrl )
XclImpSupbook::XclImpSupbook( XclImpStream& rStrm ) :
mnCurrExcTab( EXC_TAB_INVALID ),
- mbSelf( false )
+ mbSelf( false ),
+ mbAddIn( false )
{
sal_uInt16 nTabCnt;
rStrm >> nTabCnt;
if( rStrm.GetRecLeft() == 2 )
{
- mbSelf = (rStrm.ReaduInt16() == EXC_SUPB_SELF);
+ sal_uInt16 nType = rStrm.ReaduInt16();
+ mbSelf = (nType == EXC_SUPB_SELF);
+ mbAddIn = (nType == EXC_SUPB_ADDIN);
return;
}
@@ -242,7 +245,7 @@ void XclImpSupbook::ReadUrl( XclImpStream& rStrm, String& rUrl, bool& rbSelf )
void XclImpSupbook::ReadTabName( XclImpStream& rStrm, String& rTabName )
{
rStrm.AppendUniString( rTabName );
- ScfTools::ConvertName( rTabName );
+ ScfTools::ConvertToScSheetName( rTabName );
}
void XclImpSupbook::ReadXct( XclImpStream& rStrm )
@@ -277,9 +280,7 @@ const XclImpExtName* XclImpSupbook::GetExtName( sal_uInt16 nXclIndex ) const
bool XclImpSupbook::GetLink( String& rApplic, String& rDoc ) const
{
- // first backslash is application name delimiter
- // (created by XclImpUrlDecoder::DecodeUrl())
- xub_StrLen nPos = maUrl.Search( '\\' );
+ xub_StrLen nPos = maUrl.Search( EXC_DDE_DELIM );
if( mbSelf || !maUrl.Len() || (nPos == STRING_NOTFOUND) )
return false;
rApplic = maUrl.Copy( 0, nPos );
diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx
index 88cc80e83959..f24c562fdd95 100644
--- a/sc/source/filter/excel/xiroot.cxx
+++ b/sc/source/filter/excel/xiroot.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xiroot.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:12:51 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,7 +62,6 @@
#ifdef PCH
#include "filt_pch.hxx"
#endif
-
#pragma hdrstop
// ============================================================================
@@ -81,12 +80,13 @@
#include "xicontent.hxx"
#endif
+#include "XclImpObjects.hxx"
+
// Global data ================================================================
XclImpRootData::XclImpRootData( XclBiff eBiff, ScDocument& rDocument, const String& rBasePath, CharSet eCharSet ) :
- XclRootData( eBiff, rDocument, rBasePath, eCharSet ),
- mbIgnoreObjSorted( false )
+ XclRootData( eBiff, rDocument, rBasePath, eCharSet )
{
}
@@ -101,13 +101,13 @@ XclImpRoot::XclImpRoot( XclImpRootData& rImpRootData ) :
XclRoot( rImpRootData ),
mrImpData( rImpRootData )
{
- mrImpData.mpPalette.reset( new XclImpPalette( *this ) );
- mrImpData.mpFontBuffer.reset( new XclImpFontBuffer( *this ) );
- mrImpData.mpNumFmtBuffer.reset( new XclImpNumFmtBuffer( *this ) );
- mrImpData.mpXFBuffer.reset( new XclImpXFBuffer( *this ) );
- mrImpData.mpXFIndexBuffer.reset( new XclImpXFIndexBuffer( *this ) );
+ mrImpData.mpPalette.reset( new XclImpPalette( GetRoot() ) );
+ mrImpData.mpFontBuffer.reset( new XclImpFontBuffer( GetRoot() ) );
+ mrImpData.mpNumFmtBuffer.reset( new XclImpNumFmtBuffer( GetRoot() ) );
+ mrImpData.mpXFBuffer.reset( new XclImpXFBuffer( GetRoot() ) );
+ mrImpData.mpXFIndexBuffer.reset( new XclImpXFIndexBuffer( GetRoot() ) );
mrImpData.mpTabIdBuffer.reset( new XclImpTabIdBuffer );
- mrImpData.mpLinkManager.reset( new XclImpLinkManager( *this ) );
+ mrImpData.mpLinkManager.reset( new XclImpLinkManager( GetRoot() ) );
}
XclImpRoot::XclImpRoot( const XclImpRoot& rRoot ) :
@@ -125,13 +125,13 @@ XclImpRoot& XclImpRoot::operator=( const XclImpRoot& rRoot )
void XclImpRoot::SetBiff( XclBiff eBiff )
{
XclRoot::SetBiff( eBiff );
- GetPalette().SetBiff( eBiff );
+ GetPalette().OnChangeBiff();
}
XclImpSst& XclImpRoot::GetSst() const
{
if( !mrImpData.mpSst.get() )
- mrImpData.mpSst.reset( new XclImpSst( *this ) );
+ mrImpData.mpSst.reset( new XclImpSst( GetRoot() ) );
return *mrImpData.mpSst;
}
@@ -170,10 +170,17 @@ XclImpLinkManager& XclImpRoot::GetLinkManager() const
return *mrImpData.mpLinkManager;
}
+XclImpObjectManager& XclImpRoot::GetObjectManager() const
+{
+ if( !mrImpData.mpObjManager.get() )
+ mrImpData.mpObjManager.reset( new XclImpObjectManager( GetRoot() ) );
+ return *mrImpData.mpObjManager;
+}
+
XclImpWebQueryBuffer& XclImpRoot::GetWebQueryBuffer() const
{
if( !mrImpData.mpWebQBuffer.get() )
- mrImpData.mpWebQBuffer.reset( new XclImpWebQueryBuffer( *this ) );
+ mrImpData.mpWebQBuffer.reset( new XclImpWebQueryBuffer( GetRoot() ) );
return *mrImpData.mpWebQBuffer;
}
@@ -192,22 +199,6 @@ void XclImpRoot::CheckCellRangeList( ScRangeList& rRanges ) const
XclRoot::CheckCellRangeList( rRanges, GetScMaxPos() );
}
-void XclImpRoot::SetIgnoreObject( sal_uInt32 nObjId )
-{
- mrImpData.maIgnoreObj.push_back( nObjId );
- mrImpData.mbIgnoreObjSorted = false;
-}
-
-bool XclImpRoot::IsIgnoreObject( sal_uInt32 nObjId ) const
-{
- if( !mrImpData.mbIgnoreObjSorted )
- {
- ::std::sort( mrImpData.maIgnoreObj.begin(), mrImpData.maIgnoreObj.end() );
- mrImpData.mbIgnoreObjSorted = true;
- }
- return ::std::binary_search( mrImpData.maIgnoreObj.begin(), mrImpData.maIgnoreObj.end(), nObjId );
-}
-
// ============================================================================
diff --git a/sc/source/filter/excel/xistream.cxx b/sc/source/filter/excel/xistream.cxx
index eb367435abc1..e81d3c1a906b 100644
--- a/sc/source/filter/excel/xistream.cxx
+++ b/sc/source/filter/excel/xistream.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xistream.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:27 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,6 +83,7 @@
// ============================================================================
+#if SC_XCL_USEDECR
XclImpDecrypter::~XclImpDecrypter()
{
}
@@ -222,6 +223,7 @@ sal_uInt32 XclImpBiff8Decrypter::ReadDecrypt( SvStream& rStrm, void* pData, sal_
{
return rStrm.Read( pData, nBytes );
}
+#endif
// ============================================================================
@@ -279,7 +281,9 @@ XclImpStream::XclImpStream( SvStream& rInStrm, const XclImpRoot& rRoot, bool bCo
mnRecSize( 0 ),
mnRecLeft( 0 ),
mbCont( bContHandling ),
+#if SC_XCL_USEDECR
mbUseDecr( false ),
+#endif
mbValidRec( false ),
mbValid( false ),
mbWarnings( true )
@@ -300,7 +304,9 @@ bool XclImpStream::GetNextRecord( sal_uInt16& rnRecId, sal_uInt16& rnRecSize )
if( bRet )
{
mrStrm >> rnRecId >> rnRecSize; // read direct
+#if SC_XCL_USEDECR
SetDecrypterOffset( rnRecSize );
+#endif
}
else
rnRecId = rnRecSize = 0;
@@ -359,6 +365,7 @@ void XclImpStream::InitializeRecord( bool bContHandling, sal_uInt16 nAltContId )
}
}
+#if SC_XCL_USEDECR
void XclImpStream::EnableDecryption( XclImpDecrypter* pDecrypter )
{
mpDecrypter.reset( pDecrypter );
@@ -370,6 +377,7 @@ void XclImpStream::UseDecryption( bool bUse )
{
mbUseDecr = (mpDecrypter.get() && mpDecrypter->IsValid()) ? bUse : false;
}
+#endif
bool XclImpStream::GetContinue()
{
@@ -455,7 +463,9 @@ void XclImpStream::SeekGlobalPosition()
mnComplRecSize = mnCurrRecSize;
mbHasComplRec = !mbCont;
mbValidRec = mbValid = mbGlobValidRec;
+#if SC_XCL_USEDECR
SetDecrypterOffset( mnRecSize );
+#endif
}
}
@@ -477,24 +487,29 @@ sal_uInt32 XclImpStream::GetRecSize()
void XclImpStream::ReadAtom( sal_Int8& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
mpDecrypter->ReadDecrypt( mrStrm, &rnValue, 1 );
else
+#endif
mrStrm >> rnValue;
--mnRecLeft;
}
void XclImpStream::ReadAtom( sal_uInt8& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
mpDecrypter->ReadDecrypt( mrStrm, &rnValue, 1 );
else
+#endif
mrStrm >> rnValue;
--mnRecLeft;
}
void XclImpStream::ReadAtom( sal_Int16& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT16 pBuffer;
@@ -502,12 +517,14 @@ void XclImpStream::ReadAtom( sal_Int16& rnValue )
rnValue = static_cast< sal_Int16 >( SVBT16ToShort( pBuffer ) );
}
else
+#endif
mrStrm >> rnValue;
mnRecLeft -= 2;
}
void XclImpStream::ReadAtom( sal_uInt16& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT16 pBuffer;
@@ -515,12 +532,14 @@ void XclImpStream::ReadAtom( sal_uInt16& rnValue )
rnValue = SVBT16ToShort( pBuffer );
}
else
+#endif
mrStrm >> rnValue;
mnRecLeft -= 2;
}
void XclImpStream::ReadAtom( sal_Int32& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT32 pBuffer;
@@ -528,12 +547,14 @@ void XclImpStream::ReadAtom( sal_Int32& rnValue )
rnValue = static_cast< sal_Int32 >( SVBT32ToLong( pBuffer ) );
}
else
+#endif
mrStrm >> rnValue;
mnRecLeft -= 4;
}
void XclImpStream::ReadAtom( sal_uInt32& rnValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT32 pBuffer;
@@ -541,12 +562,14 @@ void XclImpStream::ReadAtom( sal_uInt32& rnValue )
rnValue = SVBT32ToLong( pBuffer );
}
else
+#endif
mrStrm >> rnValue;
mnRecLeft -= 4;
}
void XclImpStream::ReadAtom( float& rfValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT32 pBuffer;
@@ -555,12 +578,14 @@ void XclImpStream::ReadAtom( float& rfValue )
memcpy( &rfValue, &nValue, 4 );
}
else
+#endif
mrStrm >> rfValue;
mnRecLeft -= 4;
}
void XclImpStream::ReadAtom( double& rfValue )
{
+#if SC_XCL_USEDECR
if( mbUseDecr )
{
SVBT64 pBuffer;
@@ -568,14 +593,19 @@ void XclImpStream::ReadAtom( double& rfValue )
rfValue = SVBT64ToDouble( pBuffer );
}
else
+#endif
mrStrm >> rfValue;
mnRecLeft -= 8;
}
sal_uInt32 XclImpStream::ReadData( void* pData, sal_uInt32 nBytes )
{
+#if SC_XCL_USEDECR
sal_uInt32 nRet = mbUseDecr ?
mpDecrypter->ReadDecrypt( mrStrm, pData, nBytes ) : mrStrm.Read( pData, nBytes );
+#else
+ sal_uInt32 nRet = mrStrm.Read( pData, nBytes );
+#endif
mnRecLeft -= nRet;
return nRet;
}
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index e0a489fa9e35..f7c5eb32fe3e 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xistyle.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:27 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -161,10 +161,16 @@
// PALETTE record - color information =========================================
XclImpPalette::XclImpPalette( const XclImpRoot& rRoot ) :
- XclDefaultPalette( rRoot.GetBiff() )
+ XclDefaultPalette( rRoot.GetBiff() ),
+ XclImpRoot( rRoot )
{
}
+void XclImpPalette::OnChangeBiff()
+{
+ SetDefaultColors( GetBiff() );
+}
+
ColorData XclImpPalette::GetColorData( sal_uInt16 nXclIndex, ColorData nDefault ) const
{
if( nXclIndex >= GetIndexOffset() )
@@ -244,6 +250,19 @@ XclImpFont::XclImpFont( const XclImpRoot& rRoot, const XclFontData& rFontData )
Update(); /// sets internal font charset/family and script types
}
+long XclImpFont::GetCharWidth() const
+{
+ if( SfxPrinter* pPrinter = GetPrinter() )
+ {
+ Font aFont( maData.maName, Size( 0, maData.mnHeight ) );
+ aFont.SetFamily( meFontFamily );
+ aFont.SetCharSet( meFontCharSet );
+ pPrinter->SetFont( aFont );
+ return pPrinter->GetTextWidth( String( '0' ) );
+ }
+ return 11 * maData.mnHeight / 20;
+}
+
void XclImpFont::ReadFont( XclImpStream& rStrm )
{
switch( GetBiff() )
@@ -274,35 +293,6 @@ void XclImpFont::ReadFont( XclImpStream& rStrm )
Update();
}
-double XclImpFont::CalcColumnScale() const
-{
- double fScale;
- switch( maData.mnHeight )
- {
- case 240: fScale = 1.21860; break; // 12pt
- case 320: fScale = 1.61040; break; // 16pt
- default:
- {
- SfxPrinter* pPrinter = GetPrinter();
- if( pPrinter )
- {
- Font aFont( maData.maName, Size( 0, maData.mnHeight ) );
- aFont.SetFamily( meFontFamily );
- aFont.SetCharSet( meFontCharSet );
- pPrinter->SetFont( aFont );
- fScale = pPrinter->GetTextWidth( String( '0' ) );
- fScale /= 111.0;
- }
- else
- {
- fScale = maData.mnHeight;
- fScale /= 200.0; // default height = 10pt = 200twips
- }
- }
- }
- return fScale;
-}
-
void XclImpFont::FillToItemSet( SfxItemSet& rItemSet, XclFontWhichIDMode eMode ) const
{
bool bEE = (eMode == xlFontEEIDs) || (eMode == xlFontHFIDs);
@@ -469,15 +459,7 @@ FontFamily XclImpFont::GetScFontFamily( sal_uInt8 nXclFamily, const String& rNam
CharSet XclImpFont::GetScFontCharSet( sal_uInt8 nXclCharSet )
{
- CharSet eScCharSet;
- switch( nXclCharSet )
- {
- case EXC_FONTCSET_MS_1252: eScCharSet = RTL_TEXTENCODING_MS_1252; break;
- case EXC_FONTCSET_IBM_850: eScCharSet = RTL_TEXTENCODING_IBM_850; break;
- case EXC_FONTCSET_SYMBOL: eScCharSet = RTL_TEXTENCODING_SYMBOL; break;
- default: eScCharSet = ScfTools::GetSystemCharSet();
- }
- return eScCharSet;
+ return rtl_getTextEncodingFromWindowsCharset(nXclCharSet);
}
FontItalic XclImpFont::GetScFontPosture( bool bXclItalic )
@@ -531,19 +513,31 @@ SvxEscapement XclImpFont::GetScFontEscapement( XclEscapement eXclEscapem )
// ----------------------------------------------------------------------------
+XclImpFontBuffer::XclImpFontBuffer( const XclImpRoot& rRoot ) :
+ XclImpRoot( rRoot )
+{
+ // application font for column width calculation, filled with first font from font list
+ maAppFont.maName.AssignAscii( "Arial" );
+ maAppFont.mnHeight = 200;
+ SetCharWidth( 110 );
+}
+
void XclImpFontBuffer::ReadFont( XclImpStream& rStrm )
{
// Font with index 4 is not stored in an Excel file -> create a dummy font.
if( maFontList.Count() == 4 )
- maFontList.Append( new XclImpFont( *maFontList.GetObject( 0 ) ) );
+ maFontList.Append( new XclImpFont( *GetFont( 0 ) ) );
- XclImpFont* pFont = new XclImpFont( *this );
+ XclImpFont* pFont = new XclImpFont( GetRoot() );
pFont->ReadFont( rStrm );
maFontList.Append( pFont );
- // Calculate the column scale from first font and current printer.
if( maFontList.Count() == 1 )
- mpRD->fColScale *= pFont->CalcColumnScale();
+ {
+ maAppFont = pFont->GetFontData();
+ // #i3006# Calculate the width of '0' from first font and current printer.
+ SetCharWidth( pFont->GetCharWidth() );
+ }
}
void XclImpFontBuffer::FillToItemSet( sal_uInt16 nFontIndex, SfxItemSet& rItemSet, XclFontWhichIDMode eMode ) const
@@ -613,7 +607,7 @@ static const XclImpBuiltInFormat pBuiltInFormats[] =
XclImpNumFmtBuffer::XclImpNumFmtBuffer( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
- mnDefault( GetFormatter().GetStandardFormat( GetDefLanguage() ) )
+ mnStdFmt( GetFormatter().GetStandardFormat( GetDefLanguage() ) )
{
}
@@ -622,7 +616,7 @@ sal_uInt32 XclImpNumFmtBuffer::GetFormat( sal_uInt32 nIndex )
if( maKeyVec.empty() )
InsertBuiltinFormats();
- return (nIndex < maKeyVec.size()) ? maKeyVec[ nIndex ] : mnDefault;
+ return (nIndex < maKeyVec.size()) ? maKeyVec[ nIndex ] : mnStdFmt;
}
void XclImpNumFmtBuffer::ReadFormat( XclImpStream& rStrm )
@@ -676,7 +670,7 @@ void XclImpNumFmtBuffer::ReadFormat( XclImpStream& rStrm )
void XclImpNumFmtBuffer::InsertBuiltinFormats()
{
- const XclImpBuiltInFormat* pEnd = pBuiltInFormats + STATIC_TABLE_SIZE( pBuiltInFormats );
+ const XclImpBuiltInFormat* pEnd = STATIC_TABLE_END( pBuiltInFormats );
String aFormat;
xub_StrLen nCheckPos;
@@ -700,122 +694,87 @@ void XclImpNumFmtBuffer::InsertBuiltinFormats()
void XclImpNumFmtBuffer::InsertKey( sal_uInt32 nIndex, sal_uInt32 nFormatKey )
{
if( nIndex >= maKeyVec.size() )
- maKeyVec.resize( nIndex + 1, mnDefault );
+ maKeyVec.resize( nIndex + 1, mnStdFmt );
maKeyVec[ nIndex ] = nFormatKey;
}
// XF, STYLE record - Cell formatting =========================================
-/** Contains color and line style for each cell border line. */
-struct XclImpXFBorder
-{
- sal_uInt16 mnLeftColor; /// Index to color for left line.
- sal_uInt16 mnRightColor; /// Index to color for right line.
- sal_uInt16 mnTopColor; /// Index to color for top line.
- sal_uInt16 mnBottomColor; /// Index to color for bottom line.
- sal_uInt8 mnLeftLine; /// Style of left line.
- sal_uInt8 mnRightLine; /// Style of right line.
- sal_uInt8 mnTopLine; /// Style of top line.
- sal_uInt8 mnBottomLine; /// Style of bottom line.
-
- void SetBorder2( sal_uInt8 nFlags );
- void SetBorder34( sal_uInt32 nBorder );
- void SetBorder5( sal_uInt32 nBorder, sal_uInt32 nArea );
- void SetBorder8( sal_uInt32 nBorder1, sal_uInt32 nBorder2 );
-};
-
-void XclImpXFBorder::SetBorder2( sal_uInt8 nFlags )
+void lcl_SetBorder2( XclImpXFBorder& rBorder, sal_uInt8 nFlags )
{
- ::extract_value( mnLeftLine, nFlags, 3, 1 );
- ::extract_value( mnRightLine, nFlags, 4, 1 );
- ::extract_value( mnTopLine, nFlags, 5, 1 );
- ::extract_value( mnBottomLine, nFlags, 6, 1 );
- mnLeftColor = mnRightColor = mnTopColor = mnBottomColor = 0; // black
+ rBorder.mnLeftLine = ::get_flagvalue( nFlags, EXC_XF2_LEFTLINE, EXC_LINE_THIN, EXC_LINE_NONE );
+ rBorder.mnRightLine = ::get_flagvalue( nFlags, EXC_XF2_RIGHTLINE, EXC_LINE_THIN, EXC_LINE_NONE );
+ rBorder.mnTopLine = ::get_flagvalue( nFlags, EXC_XF2_TOPLINE, EXC_LINE_THIN, EXC_LINE_NONE );
+ rBorder.mnBottomLine = ::get_flagvalue( nFlags, EXC_XF2_BOTTOMLINE, EXC_LINE_THIN, EXC_LINE_NONE );
+ rBorder.mnLeftColor = rBorder.mnRightColor = rBorder.mnTopColor = rBorder.mnBottomColor = EXC_COLOR_BIFF2_BLACK;
}
-void XclImpXFBorder::SetBorder34( sal_uInt32 nBorder )
+void lcl_SetBorder3( XclImpXFBorder& rBorder, sal_uInt32 nBorder )
{
- ::extract_value( mnTopLine, nBorder, 0, 3 );
- ::extract_value( mnLeftLine, nBorder, 8, 3 );
- ::extract_value( mnBottomLine, nBorder, 16, 3 );
- ::extract_value( mnRightLine, nBorder, 24, 3 );
- ::extract_value( mnTopColor, nBorder, 3, 5 );
- ::extract_value( mnLeftColor, nBorder, 11, 5 );
- ::extract_value( mnBottomColor, nBorder, 19, 5 );
- ::extract_value( mnRightColor, nBorder, 27, 5 );
+ ::extract_value( rBorder.mnTopLine, nBorder, 0, 3 );
+ ::extract_value( rBorder.mnLeftLine, nBorder, 8, 3 );
+ ::extract_value( rBorder.mnBottomLine, nBorder, 16, 3 );
+ ::extract_value( rBorder.mnRightLine, nBorder, 24, 3 );
+ ::extract_value( rBorder.mnTopColor, nBorder, 3, 5 );
+ ::extract_value( rBorder.mnLeftColor, nBorder, 11, 5 );
+ ::extract_value( rBorder.mnBottomColor, nBorder, 19, 5 );
+ ::extract_value( rBorder.mnRightColor, nBorder, 27, 5 );
}
-void XclImpXFBorder::SetBorder5( sal_uInt32 nBorder, sal_uInt32 nArea )
+void lcl_SetBorder5( XclImpXFBorder& rBorder, sal_uInt32 nBorder, sal_uInt32 nArea )
{
- ::extract_value( mnTopLine, nBorder, 0, 3 );
- ::extract_value( mnLeftLine, nBorder, 3, 3 );
- ::extract_value( mnBottomLine, nArea, 22, 3 );
- ::extract_value( mnRightLine, nBorder, 6, 3 );
- ::extract_value( mnTopColor, nBorder, 9, 7 );
- ::extract_value( mnLeftColor, nBorder, 16, 7 );
- ::extract_value( mnBottomColor, nArea, 25, 7 );
- ::extract_value( mnRightColor, nBorder, 23, 7 );
+ ::extract_value( rBorder.mnTopLine, nBorder, 0, 3 );
+ ::extract_value( rBorder.mnLeftLine, nBorder, 3, 3 );
+ ::extract_value( rBorder.mnBottomLine, nArea, 22, 3 );
+ ::extract_value( rBorder.mnRightLine, nBorder, 6, 3 );
+ ::extract_value( rBorder.mnTopColor, nBorder, 9, 7 );
+ ::extract_value( rBorder.mnLeftColor, nBorder, 16, 7 );
+ ::extract_value( rBorder.mnBottomColor, nArea, 25, 7 );
+ ::extract_value( rBorder.mnRightColor, nBorder, 23, 7 );
}
-void XclImpXFBorder::SetBorder8( sal_uInt32 nBorder1, sal_uInt32 nBorder2 )
+void lcl_SetBorder8( XclImpXFBorder& rBorder, sal_uInt32 nBorder1, sal_uInt32 nBorder2 )
{
- ::extract_value( mnLeftLine, nBorder1, 0, 4 );
- ::extract_value( mnRightLine, nBorder1, 4, 4 );
- ::extract_value( mnTopLine, nBorder1, 8, 4 );
- ::extract_value( mnBottomLine, nBorder1, 12, 4 );
- ::extract_value( mnLeftColor, nBorder1, 16, 7 );
- ::extract_value( mnRightColor, nBorder1, 23, 7 );
- ::extract_value( mnTopColor, nBorder2, 0, 7 );
- ::extract_value( mnBottomColor, nBorder2, 7, 7 );
+ ::extract_value( rBorder.mnLeftLine, nBorder1, 0, 4 );
+ ::extract_value( rBorder.mnRightLine, nBorder1, 4, 4 );
+ ::extract_value( rBorder.mnTopLine, nBorder1, 8, 4 );
+ ::extract_value( rBorder.mnBottomLine, nBorder1, 12, 4 );
+ ::extract_value( rBorder.mnLeftColor, nBorder1, 16, 7 );
+ ::extract_value( rBorder.mnRightColor, nBorder1, 23, 7 );
+ ::extract_value( rBorder.mnTopColor, nBorder2, 0, 7 );
+ ::extract_value( rBorder.mnBottomColor, nBorder2, 7, 7 );
}
// ----------------------------------------------------------------------------
-/** Contains background colors and pattern. */
-struct XclImpXFArea
-{
- sal_uInt16 mnForeColor; /// Index to foreground color.
- sal_uInt16 mnBackColor; /// Index to background color.
- sal_uInt8 mnPattern; /// Fill pattern.
-
- void SetArea2( sal_uInt8 nFlags );
- void SetArea34( sal_uInt16 nArea );
- void SetArea5( sal_uInt32 nArea );
- void SetArea8( sal_uInt32 nBorder2, sal_uInt16 nArea );
-};
-
-void XclImpXFArea::SetArea2( sal_uInt8 nFlags )
+void lcl_SetArea2( XclImpXFArea& rArea, sal_uInt8 nFlags )
{
- mnPattern = EXC_PATT_NONE;
- if( nFlags & EXC_XF2_BACKGROUND )
- {
- mnPattern = EXC_PATT_12_5_PERC;
- mnForeColor = EXC_COLOR_BIFF2_BLACK;
- mnBackColor = EXC_COLOR_BIFF2_WHITE;
- }
+ rArea.mnPattern = ::get_flagvalue( nFlags, EXC_XF2_BACKGROUND, EXC_PATT_12_5_PERC, EXC_PATT_NONE );
+ rArea.mnForeColor = EXC_COLOR_BIFF2_BLACK;
+ rArea.mnBackColor = EXC_COLOR_BIFF2_WHITE;
}
-void XclImpXFArea::SetArea34( sal_uInt16 nArea )
+void lcl_SetArea3( XclImpXFArea& rArea, sal_uInt16 nArea )
{
- ::extract_value( mnPattern, nArea, 0, 6 );
- ::extract_value( mnForeColor, nArea, 6, 5 );
- ::extract_value( mnBackColor, nArea, 11, 5 );
+ ::extract_value( rArea.mnPattern, nArea, 0, 6 );
+ ::extract_value( rArea.mnForeColor, nArea, 6, 5 );
+ ::extract_value( rArea.mnBackColor, nArea, 11, 5 );
}
-void XclImpXFArea::SetArea5( sal_uInt32 nArea )
+void lcl_SetArea5( XclImpXFArea& rArea, sal_uInt32 nArea )
{
- ::extract_value( mnPattern, nArea, 16, 6 );
- ::extract_value( mnForeColor, nArea, 0, 7 );
- ::extract_value( mnBackColor, nArea, 7, 7 );
+ ::extract_value( rArea.mnPattern, nArea, 16, 6 );
+ ::extract_value( rArea.mnForeColor, nArea, 0, 7 );
+ ::extract_value( rArea.mnBackColor, nArea, 7, 7 );
}
-void XclImpXFArea::SetArea8( sal_uInt32 nBorder2, sal_uInt16 nArea )
+void lcl_SetArea8( XclImpXFArea& rArea, sal_uInt32 nBorder2, sal_uInt16 nArea )
{
- ::extract_value( mnPattern, nBorder2, 26, 6 );
- ::extract_value( mnForeColor, nArea, 0, 7 );
- ::extract_value( mnBackColor, nArea, 7, 7 );
+ ::extract_value( rArea.mnPattern, nBorder2, 26, 6 );
+ ::extract_value( rArea.mnForeColor, nArea, 0, 7 );
+ ::extract_value( rArea.mnBackColor, nArea, 7, 7 );
}
@@ -823,22 +782,25 @@ void XclImpXFArea::SetArea8( sal_uInt32 nBorder2, sal_uInt16 nArea )
XclImpXF::XclImpXF( const XclImpRoot& rRoot ) :
XclImpRoot( rRoot ),
- meHorAlign( xlHAlignParent ),
- meVerAlign( xlVAlignParent ),
- meWrap( xlTextWrapParent ),
- meOrient( xlTextOrientParent ),
- meTextDir( xlTextDirParent ),
- mnRotation( 0 ),
- mnValFormat( 0 ),
- mnIndent( 0 ),
- mnFont( 0 ),
+ meHorAlign( xlHAlignGeneral ),
+ meVerAlign( xlVAlignBottom ),
+ meOrient( xlTextOrientNoRot ),
+ meTextDir( xlTextDirContext ),
mnParent( 0 ),
+ mnNumFmt( 0 ),
+ mnFont( 0 ),
+ mnIndent( 0 ),
+ mnRotation( 0 ),
mbCellXF( true ), // default is cell XF
mbLocked( true ), // default in Excel and Calc
mbHidden( false ),
- mbFontValid( false ),
- mbFmtValid( false ),
- mbProtValid( false )
+ mbWrapped( false ),
+ mbProtUsed( false ),
+ mbFontUsed( false ),
+ mbFmtUsed( false ),
+ mbAlignUsed( false ),
+ mbBorderUsed( false ),
+ mbAreaUsed( false )
{
}
@@ -848,136 +810,160 @@ XclImpXF::~XclImpXF()
void XclImpXF::ReadXF2( XclImpStream& rStrm )
{
- sal_uInt8 nValFmt, nFlags;
+ sal_uInt8 nNumFmt, nFlags;
mnFont = rStrm.ReaduInt8();
rStrm.Ignore( 1 );
- rStrm >> nValFmt >> nFlags;
+ rStrm >> nNumFmt >> nFlags;
- GetBorder().SetBorder2( nFlags );
- GetArea().SetArea2( nFlags );
- mnValFormat = GetNumFmtBuffer().GetFormat( nValFmt & EXC_XF2_VALFMT_MASK );
+ lcl_SetBorder2( maBorder, nFlags );
+ lcl_SetArea2( maArea, nFlags );
+ mnNumFmt = GetNumFmtBuffer().GetFormat( nNumFmt & EXC_XF2_VALFMT_MASK );
::extract_value( meHorAlign, nFlags, 0, 3 );
- meVerAlign = xlVAlignTop;
- meWrap = xlTextWrapNo;
- meOrient = xlTextOrientNoRot;
- mbLocked = ::get_flag( nValFmt, EXC_XF2_LOCKED );
- mbHidden = ::get_flag( nValFmt, EXC_XF2_HIDDEN );
+ mbLocked = ::get_flag( nNumFmt, EXC_XF2_LOCKED );
+ mbHidden = ::get_flag( nNumFmt, EXC_XF2_HIDDEN );
- mbFontValid = mbFmtValid = mbProtValid = true;
+ //! TODO flags
+ mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = true;
}
void XclImpXF::ReadXF3( XclImpStream& rStrm )
{
sal_uInt32 nBorder;
sal_uInt16 nFlags, nAlign, nArea;
- sal_uInt8 nValFmt;
+ sal_uInt8 nNumFmt;
mnFont = rStrm.ReaduInt8();
- rStrm >> nValFmt >> nFlags >> nAlign >> nArea >> nBorder;
+ rStrm >> nNumFmt >> nFlags >> nAlign >> nArea >> nBorder;
mbCellXF = !::get_flag( nFlags, EXC_XF_STYLE ); // new in BIFF3
::extract_value( mnParent, nAlign, 4, 12 ); // new in BIFF3
- GetBorder().SetBorder34( nBorder );
- GetArea().SetArea34( nArea ); // new in BIFF3
- mnValFormat = GetNumFmtBuffer().GetFormat( nValFmt );
+ lcl_SetBorder3( maBorder, nBorder );
+ lcl_SetArea3( maArea, nArea ); // new in BIFF3
+ mnNumFmt = GetNumFmtBuffer().GetFormat( nNumFmt );
::extract_value( meHorAlign, nAlign, 0, 3 );
- meVerAlign = xlVAlignTop;
- ::extract_value( meWrap, nAlign, 3, 1 ); // new in BIFF3
- meOrient = xlTextOrientNoRot;
+ mbWrapped = ::get_flag( nAlign, EXC_XF_WRAPPED ); // new in BIFF3
mbLocked = ::get_flag( nFlags, EXC_XF_LOCKED );
mbHidden = ::get_flag( nFlags, EXC_XF_HIDDEN );
- mbFontValid = mbFmtValid = mbProtValid = true;
+ //! TODO flags
+ mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = true;
}
void XclImpXF::ReadXF4( XclImpStream& rStrm )
{
sal_uInt32 nBorder;
sal_uInt16 nFlags, nAlign, nArea;
- sal_uInt8 nValFmt;
+ sal_uInt8 nNumFmt;
mnFont = rStrm.ReaduInt8();
- rStrm >> nValFmt >> nFlags >> nAlign >> nArea >> nBorder;
+ rStrm >> nNumFmt >> nFlags >> nAlign >> nArea >> nBorder;
mbCellXF = !::get_flag( nFlags, EXC_XF_STYLE );
::extract_value( mnParent, nFlags, 4, 12 );
- GetBorder().SetBorder34( nBorder );
- GetArea().SetArea34( nArea );
- mnValFormat = GetNumFmtBuffer().GetFormat( nValFmt );
+ lcl_SetBorder3( maBorder, nBorder );
+ lcl_SetArea3( maArea, nArea );
+ mnNumFmt = GetNumFmtBuffer().GetFormat( nNumFmt );
::extract_value( meHorAlign, nAlign, 0, 3 );
::extract_value( meVerAlign, nAlign, 4, 2 ); // new in BIFF4
- ::extract_value( meWrap, nAlign, 3, 1 );
+ mbWrapped = ::get_flag( nAlign, EXC_XF_WRAPPED );
::extract_value( meOrient, nAlign, 6, 2 ); // new in BIFF4
mbLocked = ::get_flag( nFlags, EXC_XF_LOCKED );
mbHidden = ::get_flag( nFlags, EXC_XF_HIDDEN );
- mbFontValid = mbFmtValid = mbProtValid = true;
+ //! TODO flags
+ mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = true;
}
void XclImpXF::ReadXF5( XclImpStream& rStrm )
{
sal_uInt32 nArea, nBorder;
- sal_uInt16 nValFmt, nFlags, nAlign;
- rStrm >> mnFont >> nValFmt >> nFlags >> nAlign >> nArea >> nBorder;
+ sal_uInt16 nNumFmt, nFlags, nAlign;
+ rStrm >> mnFont >> nNumFmt >> nFlags >> nAlign >> nArea >> nBorder;
mbCellXF = !::get_flag( nFlags, EXC_XF_STYLE );
::extract_value( mnParent, nFlags, 4, 12 );
- GetBorder().SetBorder5( nBorder, nArea );
- GetArea().SetArea5( nArea );
- mnValFormat = GetNumFmtBuffer().GetFormat( nValFmt );
+ lcl_SetBorder5( maBorder, nBorder, nArea );
+ lcl_SetArea5( maArea, nArea );
+ mnNumFmt = GetNumFmtBuffer().GetFormat( nNumFmt );
::extract_value( meHorAlign, nAlign, 0, 3 );
::extract_value( meVerAlign, nAlign, 4, 3 );
- ::extract_value( meWrap, nAlign, 3, 1 );
+ mbWrapped = ::get_flag( nAlign, EXC_XF_WRAPPED );
::extract_value( meOrient, nAlign, 8, 2 );
mbLocked = ::get_flag( nFlags, EXC_XF_LOCKED );
mbHidden = ::get_flag( nFlags, EXC_XF_HIDDEN );
- mbFontValid = mbFmtValid = mbProtValid = true;
+ //! TODO flags
+ mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = true;
}
void XclImpXF::ReadXF8( XclImpStream& rStrm )
{
sal_uInt32 nBorder1, nBorder2;
- sal_uInt16 nReadFont, nValFmt, nFlags1, nAlign, nFlags2, nArea;
- rStrm >> nReadFont >> nValFmt >> nFlags1 >> nAlign >> nFlags2 >> nBorder1 >> nBorder2 >> nArea;
+ sal_uInt16 nReadFont, nReadNumFmt, nTypeProt, nAlign, nMiscAttrib, nArea;
+ rStrm >> nReadFont >> nReadNumFmt >> nTypeProt >> nAlign >> nMiscAttrib >> nBorder1 >> nBorder2 >> nArea;
- mbCellXF = !::get_flag( nFlags1, EXC_XF_STYLE );
+ mbCellXF = !::get_flag( nTypeProt, EXC_XF_STYLE );
if( mbCellXF )
- ::extract_value( mnParent, nFlags1, 4, 12 );
- // Border
- if( mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_BORDER ) )
- GetBorder().SetBorder8( nBorder1, nBorder2 );
- // Area
- if( mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_AREA ) )
- GetArea().SetArea8( nBorder2, nArea );
- // Font
- mbFontValid = mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_FONT );
- if( mbFontValid )
+ ::extract_value( mnParent, nTypeProt, 4, 12 );
+
+ // Remark about finding the mb***Used flags:
+ // - In cell XFs a *set* bit means a used attribute.
+ // - In style XFs a *cleared* bit means a used attribute.
+ // The mb***Used members always store true, if the attribute is used.
+ // The "mbCellXF == ::get_flag(...)" construct evaluates to true in
+ // both mentioned cases: cell XF and set bit; or style XF and cleared bit.
+ sal_uInt8 nUsedFlags;
+ ::extract_value( nUsedFlags, nMiscAttrib, 10, 6 );
+
+ // Remark about using the attributes from the XFs:
+ // Cell XF flag used (set) -> take from cell XF
+ // Cell XF flag unused (cleared):
+ // Parent style XF flag used (cleared) -> take from style XF
+ // Parent style XF flag unused (set) -> take from cell XF (!)
+ //! TODO not implemented yet
+
+ // cell border
+ mbBorderUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_BORDER ));
+ if( mbCellXF || mbBorderUsed ) //! always in cell XFs until the parent XF is really read
+ lcl_SetBorder8( maBorder, nBorder1, nBorder2 );
+
+ // background area
+ mbAreaUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_AREA ));
+ if( mbCellXF || mbAreaUsed )
+ lcl_SetArea8( maArea, nBorder2, nArea );
+
+ // font
+ mbFontUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_FONT ));
+ if( mbCellXF || mbFontUsed )
mnFont = nReadFont;
- // Value format
- mbFmtValid = mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_VALFMT );
- if( mbFmtValid )
- mnValFormat = GetNumFmtBuffer().GetFormat( nValFmt );
- // Alignment
- if( mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_ALIGN ) )
+
+ // number format
+ mbFmtUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_VALFMT ));
+ if( mbCellXF || mbFmtUsed )
+ mnNumFmt = GetNumFmtBuffer().GetFormat( nReadNumFmt );
+
+ // alignment
+ mbAlignUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_ALIGN ));
+ if( mbCellXF || mbAlignUsed )
{
::extract_value( meHorAlign, nAlign, 0, 3 );
::extract_value( meVerAlign, nAlign, 4, 3 );
- ::extract_value( meWrap, nAlign, 3, 1 );
- ::extract_value( mnRotation, nAlign, 8, 8 ); // new in BIFF8
- meOrient = (mnRotation == EXC_ROT_STACKED) ? xlTextOrientTopBottom : xlTextOrientRot;
- ::extract_value( meTextDir, nFlags2, 6, 2 ); // new in BIFF8X
+ mbWrapped = ::get_flag( nAlign, EXC_XF_WRAPPED );
+ ::extract_value( mnRotation, nAlign, 8, 8 ); // new in BIFF8
+ meOrient = (mnRotation == EXC_XF8_STACKED) ? xlTextOrientTopBottom : xlTextOrientRot;
+ ::extract_value( mnIndent, nMiscAttrib, 0, 4 ); // new in BIFF8
+ mnIndent *= 200;
+ ::extract_value( meTextDir, nMiscAttrib, 6, 2 ); // new in BIFF8X
}
- // Cell protection
- mbProtValid = mbCellXF || !::get_flag( nFlags2, EXC_XF_DIFF_PROT );
- if( mbProtValid )
+
+ // cell protection
+ mbProtUsed = (mbCellXF == ::get_flag( nUsedFlags, EXC_XF_DIFF_PROT ));
+ if( mbCellXF || mbProtUsed )
{
- mbLocked = ::get_flag( nFlags1, EXC_XF_LOCKED );
- mbHidden = ::get_flag( nFlags1, EXC_XF_HIDDEN );
+ mbLocked = ::get_flag( nTypeProt, EXC_XF_LOCKED );
+ mbHidden = ::get_flag( nTypeProt, EXC_XF_HIDDEN );
}
- ::extract_value( mnIndent, nFlags2, 0, 4 ); // new in BIFF8
- mnIndent *= 200;
}
void XclImpXF::ReadXF( XclImpStream& rStrm )
@@ -994,7 +980,7 @@ void XclImpXF::ReadXF( XclImpStream& rStrm )
}
}
-const ScPatternAttr& XclImpXF::GetPattern()
+const ScPatternAttr& XclImpXF::GetPattern() const
{
if( mpPattern.get() )
return *mpPattern;
@@ -1003,87 +989,71 @@ const ScPatternAttr& XclImpXF::GetPattern()
mpPattern.reset( new ScPatternAttr( GetDoc().GetPool() ) );
SfxItemSet& rItemSet = mpPattern->GetItemSet();
- // value format
- if( mbCellXF || mbFmtValid )
- {
- rItemSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, static_cast< sal_uInt32 >( mnValFormat ) ) );
- ScGlobal::AddLanguage( rItemSet, GetFormatter() );
- }
+ // locked/hidden
+ if( mbCellXF || mbProtUsed )
+ rItemSet.Put( ScProtectionAttr( mbLocked, mbHidden ) );
// font
- if( mbCellXF || mbFontValid )
+ if( mbCellXF || mbFontUsed )
GetFontBuffer().FillToItemSet( mnFont, rItemSet, xlFontScIDs );
- // locked/hidden
- if( mbCellXF || mbProtValid )
- rItemSet.Put( ScProtectionAttr( mbLocked, mbHidden ) );
+ // value format
+ if( mbCellXF || mbFmtUsed )
+ {
+ rItemSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, static_cast< sal_uInt32 >( mnNumFmt ) ) );
+ ScGlobal::AddLanguage( rItemSet, GetFormatter() );
+ }
// border
- if( mpBorder.get() )
- SetBorder( rItemSet, GetPalette(),
- mpBorder->mnLeftLine, mpBorder->mnLeftColor,
- mpBorder->mnRightLine, mpBorder->mnRightColor,
- mpBorder->mnTopLine, mpBorder->mnTopColor,
- mpBorder->mnBottomLine, mpBorder->mnBottomColor );
+ if( mbCellXF || mbBorderUsed )
+ SetBorder( rItemSet, GetPalette(), maBorder );
// area
- if( mpArea.get() )
- SetArea( rItemSet, GetPalette(), mpArea->mnPattern, mpArea->mnForeColor, mpArea->mnBackColor );
+ if( mbCellXF || mbAreaUsed )
+ SetArea( rItemSet, GetPalette(), maArea );
- // horizontal alignment
- if( mbCellXF || (meHorAlign != xlHAlignParent) )
+ // alignment
+ if( mbCellXF || mbAlignUsed )
{
+ // horizontal alignment
SvxCellHorJustify eHorJust = SVX_HOR_JUSTIFY_STANDARD;
switch( meHorAlign )
{
- case xlHAlignParent:
case xlHAlignGeneral: eHorJust = SVX_HOR_JUSTIFY_STANDARD; break;
case xlHAlignLeft: eHorJust = SVX_HOR_JUSTIFY_LEFT; break;
case xlHAlignCenterAcrSel:
case xlHAlignCenter: eHorJust = SVX_HOR_JUSTIFY_CENTER; break;
case xlHAlignRight: eHorJust = SVX_HOR_JUSTIFY_RIGHT; break;
case xlHAlignFill: eHorJust = SVX_HOR_JUSTIFY_REPEAT; break;
- case xlHAlignJustify: eHorJust = SVX_HOR_JUSTIFY_BLOCK; break;
- default:
- DBG_ERRORFILE( "XclImpXF::GetPattern - unknown horizontal adjustment" );
+ case xlHAlignJustify:
+ case xlHAlignDistrib: eHorJust = SVX_HOR_JUSTIFY_BLOCK; break;
+ default: DBG_ERRORFILE( "XclImpXF::GetPattern - unknown horizontal adjustment" );
}
rItemSet.Put( SvxHorJustifyItem( eHorJust ) );
- }
- // text wrap
- if( mbCellXF || (meWrap != xlTextWrapParent) )
- {
+ // text wrap
SfxBoolItem aWrap( ATTR_LINEBREAK );
- aWrap.SetValue( meWrap == xlTextWrapYes );
+ aWrap.SetValue( mbWrapped );
rItemSet.Put( aWrap );
- }
- // vertical alignment
- if( mbCellXF || (meVerAlign != xlVAlignParent) )
- {
+ // vertical alignment
SvxCellVerJustify eVertJust = SVX_VER_JUSTIFY_STANDARD;
switch( meVerAlign )
{
- case xlVAlignParent:
case xlVAlignTop: eVertJust = SVX_VER_JUSTIFY_TOP; break;
case xlVAlignCenter: eVertJust = SVX_VER_JUSTIFY_CENTER; break;
case xlVAlignBottom: eVertJust = SVX_VER_JUSTIFY_BOTTOM; break;
case xlVAlignJustify:
case xlVAlignDistrib: eVertJust = SVX_VER_JUSTIFY_TOP; break;
- default:
- DBG_ERRORFILE( "XclImpXF::GetPattern - unknown vertical adjustment" );
+ default: DBG_ERRORFILE( "XclImpXF::GetPattern - unknown vertical adjustment" );
}
rItemSet.Put( SvxVerJustifyItem( eVertJust ) );
- }
- // indent
- if( mnIndent > 0 )
+ // indent
rItemSet.Put( SfxUInt16Item( ATTR_INDENT, mnIndent ) );
- // text orientation
- if( mbCellXF || (meOrient != xlTextOrientParent) )
- {
- if( (meOrient == xlTextOrientRot) && (mnRotation != EXC_ROT_STACKED) )
+ // text orientation
+ if( (meOrient == xlTextOrientRot) && (mnRotation != EXC_XF8_STACKED) )
{
// set an angle in the range from -90 to 90 degrees
DBG_ASSERT( mnRotation <= 180, "XclImpXF::GetPattern - illegal rotation angle" );
@@ -1101,33 +1071,27 @@ const ScPatternAttr& XclImpXF::GetPattern()
SvxCellOrientation eSvxOrient = SVX_ORIENTATION_STANDARD;
switch( meOrient )
{
- case xlTextOrientParent:
case xlTextOrientNoRot: eSvxOrient = SVX_ORIENTATION_STANDARD; break;
case xlTextOrientRot:
- DBG_ASSERT( mnRotation == EXC_ROT_STACKED,
+ DBG_ASSERT( mnRotation == EXC_XF8_STACKED,
"XclImpXF::GetPattern - stacked expected (0xFF)" );
+ // run through
case xlTextOrientTopBottom: eSvxOrient = SVX_ORIENTATION_STACKED; break;
case xlTextOrient90ccw: eSvxOrient = SVX_ORIENTATION_BOTTOMTOP; break;
case xlTextOrient90cw: eSvxOrient = SVX_ORIENTATION_TOPBOTTOM; break;
- default:
- DBG_ERRORFILE( "XclImpXF::GetPattern - unknown text orientation" );
+ default: DBG_ERRORFILE( "XclImpXF::GetPattern - unknown text orientation" );
}
rItemSet.Put( SvxOrientationItem( eSvxOrient ) );
}
- }
- // CTL text direction
- if( mbCellXF || (meTextDir != xlTextDirParent) )
- {
+ // CTL text direction
SvxFrameDirection eFrameDir = FRMDIR_ENVIRONMENT;
switch( meTextDir )
{
- case xlTextDirParent:
case xlTextDirContext: eFrameDir = FRMDIR_ENVIRONMENT; break;
case xlTextDirLTR: eFrameDir = FRMDIR_HORI_LEFT_TOP; break;
case xlTextDirRTL: eFrameDir = FRMDIR_HORI_RIGHT_TOP; break;
- default:
- DBG_ERRORFILE( "XclImpXF::GetPattern - unknown CTL text direction" );
+ default: DBG_ERRORFILE( "XclImpXF::GetPattern - unknown CTL text direction" );
}
rItemSet.Put( SvxFrameDirectionItem( eFrameDir, ATTR_WRITINGDIR ) );
}
@@ -1135,26 +1099,12 @@ const ScPatternAttr& XclImpXF::GetPattern()
return *mpPattern;
}
-XclImpXFBorder& XclImpXF::GetBorder()
+SvxBorderLine* XclImpXF::CreateBorderLine( const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
{
- if( !mpBorder.get() )
- mpBorder.reset( new XclImpXFBorder );
- return *mpBorder;
-}
-
-XclImpXFArea& XclImpXF::GetArea()
-{
- if( !mpArea.get() )
- mpArea.reset( new XclImpXFArea );
- return *mpArea;
-}
-
-SvxBorderLine* XclImpXF::CreateBorderItem( const XclImpPalette& rPalette, sal_uInt8 nXclLine, sal_uInt16 nXclColor )
-{
- if( !nXclLine )
+ if( nXclLine == EXC_LINE_NONE )
return NULL;
- static const sal_uInt16 ppLineParam[][ 3 ] =
+ static const sal_uInt16 ppnLineParam[][ 3 ] =
{
// outer width, inner width, distance
{ 0, 0, 0 }, // 0 = none
@@ -1173,44 +1123,37 @@ SvxBorderLine* XclImpXF::CreateBorderItem( const XclImpPalette& rPalette, sal_uI
{ DEF_LINE_WIDTH_2, 0, 0 } // D = med slant dashdot
};
- if( nXclLine >= STATIC_TABLE_SIZE( ppLineParam ) )
- nXclLine = 1;
+ if( nXclLine >= STATIC_TABLE_SIZE( ppnLineParam ) )
+ nXclLine = EXC_LINE_THIN;
SvxBorderLine* pItem = new SvxBorderLine;
pItem->SetColor( rPalette.GetColor( nXclColor, COL_BLACK ) );
- pItem->SetOutWidth( ppLineParam[ nXclLine ][ 0 ] );
- pItem->SetInWidth( ppLineParam[ nXclLine ][ 1 ] );
- pItem->SetDistance( ppLineParam[ nXclLine ][ 2 ] );
+ pItem->SetOutWidth( ppnLineParam[ nXclLine ][ 0 ] );
+ pItem->SetInWidth( ppnLineParam[ nXclLine ][ 1 ] );
+ pItem->SetDistance( ppnLineParam[ nXclLine ][ 2 ] );
return pItem;
}
-void XclImpXF::SetBorder(
- SfxItemSet& rItemSet, const XclImpPalette& rPalette,
- sal_uInt8 nXclLeftLine, sal_uInt16 nXclLeftColor,
- sal_uInt8 nXclRightLine, sal_uInt16 nXclRightColor,
- sal_uInt8 nXclTopLine, sal_uInt16 nXclTopColor,
- sal_uInt8 nXclBottomLine, sal_uInt16 nXclBottomColor )
+void XclImpXF::SetBorder( SfxItemSet& rItemSet, const XclImpPalette& rPalette, const XclImpXFBorder& rBorder )
{
SvxBoxItem aBox( ATTR_BORDER );
- ::std::auto_ptr< SvxBorderLine > pLineItem;
- pLineItem.reset( CreateBorderItem( rPalette, nXclLeftLine, nXclLeftColor ) );
- aBox.SetLine( pLineItem.get(), BOX_LINE_LEFT );
- pLineItem.reset( CreateBorderItem( rPalette, nXclRightLine, nXclRightColor ) );
- aBox.SetLine( pLineItem.get(), BOX_LINE_RIGHT );
- pLineItem.reset( CreateBorderItem( rPalette, nXclTopLine, nXclTopColor ) );
- aBox.SetLine( pLineItem.get(), BOX_LINE_TOP );
- pLineItem.reset( CreateBorderItem( rPalette, nXclBottomLine, nXclBottomColor ) );
- aBox.SetLine( pLineItem.get(), BOX_LINE_BOTTOM );
+ ::std::auto_ptr< SvxBorderLine > pLine;
+ pLine.reset( CreateBorderLine( rPalette, rBorder.mnLeftLine, rBorder.mnLeftColor ) );
+ aBox.SetLine( pLine.get(), BOX_LINE_LEFT );
+ pLine.reset( CreateBorderLine( rPalette, rBorder.mnRightLine, rBorder.mnRightColor ) );
+ aBox.SetLine( pLine.get(), BOX_LINE_RIGHT );
+ pLine.reset( CreateBorderLine( rPalette, rBorder.mnTopLine, rBorder.mnTopColor ) );
+ aBox.SetLine( pLine.get(), BOX_LINE_TOP );
+ pLine.reset( CreateBorderLine( rPalette, rBorder.mnBottomLine, rBorder.mnBottomColor ) );
+ aBox.SetLine( pLine.get(), BOX_LINE_BOTTOM );
rItemSet.Put( aBox );
}
-void XclImpXF::SetArea(
- SfxItemSet& rItemSet, const XclImpPalette& rPalette,
- sal_uInt8 nXclPattern, sal_uInt16 nXclForeColor, sal_uInt16 nXclBackColor )
+void XclImpXF::SetArea( SfxItemSet& rItemSet, const XclImpPalette& rPalette, const XclImpXFArea& rArea )
{
- static const sal_uInt16 pRatioTable[] =
+ static const sal_uInt16 pnRatioTable[] =
{ // 0x8000 = 100%
0x8000, 0x0000, 0x4000, 0x2000, // 00 - 03
0x6000, 0x4000, 0x4000, 0x4000, // 04 - 07
@@ -1220,23 +1163,20 @@ void XclImpXF::SetArea(
};
// no background -> set nothing!
- if( nXclPattern != EXC_PATT_NONE )
+ if( rArea.mnPattern != EXC_PATT_NONE )
{
- Color aFore( rPalette.GetColor( nXclForeColor, COL_WHITE ) );
- if( nXclForeColor == 64 )
+ Color aFore( rPalette.GetColor( rArea.mnForeColor, COL_WHITE ) );
+ if( rArea.mnForeColor == 64 )
aFore.SetColor( COL_BLACK );
- Color aBack( rPalette.GetColor( nXclBackColor, COL_WHITE ) );
- if( nXclBackColor == 64 )
+ Color aBack( rPalette.GetColor( rArea.mnBackColor, COL_WHITE ) );
+ if( rArea.mnBackColor == 64 )
aBack.SetColor( COL_BLACK );
- if( nXclPattern < STATIC_TABLE_SIZE( pRatioTable ) )
- {
- sal_uInt16 nRatio = pRatioTable[ nXclPattern ];
- rItemSet.Put( SvxBrushItem( ScfTools::GetMixedColor( aFore, aBack, nRatio ) ) );
- }
- else
- rItemSet.Put( SvxBrushItem( aFore ) );
+ if( rArea.mnPattern < STATIC_TABLE_SIZE( pnRatioTable ) )
+ aFore = ScfTools::GetMixedColor( aFore, aBack, pnRatioTable[ rArea.mnPattern ] );
+
+ rItemSet.Put( SvxBrushItem( aFore ) );
}
}
@@ -1251,7 +1191,7 @@ XclImpXFBuffer::XclImpXFBuffer( const XclImpRoot& rRoot ) :
void XclImpXFBuffer::ReadXF( XclImpStream& rStrm )
{
- XclImpXF* pXF = new XclImpXF( *this );
+ XclImpXF* pXF = new XclImpXF( GetRoot() );
pXF->ReadXF( rStrm );
maXFList.Append( pXF );
}
@@ -1285,7 +1225,7 @@ void XclImpXFBuffer::ReadStyle( XclImpStream& rStrm )
}
}
-const ScPatternAttr& XclImpXFBuffer::GetPattern( sal_uInt32 nXFIndex )
+const ScPatternAttr& XclImpXFBuffer::GetPattern( sal_uInt32 nXFIndex ) const
{
XclImpXF* pXF = maXFList.GetObject( nXFIndex );
DBG_ASSERT( pXF || (GetBiff() == xlBiff2), "XclImpXFBuffer::GetPattern - XF not found" );
diff --git a/sc/source/filter/excel/xlocx.cxx b/sc/source/filter/excel/xlocx.cxx
new file mode 100644
index 000000000000..77155a00028b
--- /dev/null
+++ b/sc/source/filter/excel/xlocx.cxx
@@ -0,0 +1,286 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlocx.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifdef PCH
+#include "filt_pch.hxx"
+#endif
+#pragma hdrstop
+
+// ============================================================================
+
+#ifndef SC_XLOCX_HXX
+#include "xlocx.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
+#include <com/sun/star/lang/XComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
+#include <com/sun/star/container/XIndexContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_XDRAWPAGE_HPP_
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DRAWING_XCONTROLSHAPE_HPP_
+#include <com/sun/star/drawing/XControlShape.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORMCOMPONENT_HPP_
+#include <com/sun/star/form/XFormComponent.hpp>
+#endif
+
+#ifndef _SVDPAGE_HXX
+#include <svx/svdpage.hxx>
+#endif
+#ifndef _SVX_UNOAPI_HXX_
+#include <svx/unoapi.hxx>
+#endif
+
+#ifndef SC_DOCUMENT_HXX
+#include "document.hxx"
+#endif
+#ifndef SC_DRWLAYER_HXX
+#include "drwlayer.hxx"
+#endif
+
+#include "XclImpObjects.hxx"
+#include "xcl97rec.hxx"
+
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::awt::XControlModel;
+using ::com::sun::star::form::XFormComponent;
+using ::com::sun::star::drawing::XDrawPage;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::drawing::XControlShape;
+
+
+#define EXC_STREAMNAME_CTLS String( RTL_CONSTASCII_USTRINGPARAM( "Ctls" ) )
+
+
+// OCX controls ===============================================================
+
+XclOcxConverter::XclOcxConverter( const XclRoot& rRoot ) :
+ SvxMSConvertOCXControls( rRoot.GetDocShell(), NULL ),
+ XclRoot( rRoot ),
+ mnCurrTab( 0 ),
+ mnCachedTab( 0 )
+{
+}
+
+XclOcxConverter::~XclOcxConverter()
+{
+}
+
+void XclOcxConverter::SetCurrTab( sal_uInt16 nTab )
+{
+ mnCurrTab = nTab;
+}
+
+const Reference< XDrawPage >& XclOcxConverter::GetDrawPage()
+{
+ // find and cache draw page if uninitialized or sheet index has been changed
+ if( !xDrawPage.is() || (mnCachedTab != mnCurrTab) )
+ {
+ if( ScDrawLayer* pDrawLayer = GetDoc().GetDrawLayer() )
+ {
+ // mnCurrTab set in ReadControl() contains sheet index of current control
+ if( SdrPage* pPage = pDrawLayer->GetPage( mnCurrTab ) )
+ {
+ xDrawPage = Reference< XDrawPage >( pPage->getUnoPage(), UNO_QUERY );
+ mnCachedTab = mnCurrTab;
+ }
+ }
+ }
+
+ return xDrawPage;
+}
+
+
+// ----------------------------------------------------------------------------
+
+XclImpOcxConverter::XclImpOcxConverter( const XclRoot& rRoot ) :
+ XclOcxConverter( rRoot )
+{
+ mxStrm = ScfTools::OpenStorageStreamRead( GetRootStorage(), EXC_STREAMNAME_CTLS );
+}
+
+void XclImpOcxConverter::ReadControl( XclImpEscherOle& rObj )
+{
+ DBG_ASSERT( rObj.GetObjType() == otCtrl, "XclOcxConverter::ReadControl - no control object" );
+ if( mxStrm.Is() && (rObj.GetObjType() == otCtrl) )
+ {
+ // virtual call of GetDrawPage() needs current sheet index
+ SetCurrTab( rObj.GetTab() );
+
+ // stream position of the extra data for this control
+ sal_uInt32 nStrmPos = rObj.GetCtrlStreamPos();
+ mxStrm->Seek( nStrmPos );
+
+ // the shape to fill
+ Reference< XShape > xShape = ::GetXShapeForSdrObject( const_cast< SdrObject* >( rObj.GetSdrObj() ) );
+
+ // reads from mxStrm into xShape, inserts the control into the document
+ if( ReadOCXExcelKludgeStream( mxStrm, &xShape, TRUE ) )
+ {
+ if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( xShape ) )
+ rObj.SetSdrObj( pSdrObj );
+ }
+ }
+}
+
+sal_Bool XclImpOcxConverter::InsertControl(
+ const Reference< XFormComponent >& rxFormComp,
+ const ::com::sun::star::awt::Size& rSize,
+ Reference< XShape >* pxShape,
+ BOOL bFloatingCtrl )
+{
+ sal_Bool bRet = sal_False;
+ XShapeRef xShape;
+
+ const Reference< XIndexContainer >& rxFormCompsIC = GetFormComps();
+ const Reference< XMultiServiceFactory >& rxServiceFactory = GetServiceFactory();
+ if( rxFormCompsIC.is() && rxServiceFactory.is() )
+ {
+ Any aFormCompAny;
+ aFormCompAny <<= rxFormComp;
+ rxFormCompsIC->insertByIndex( rxFormCompsIC->getCount(), aFormCompAny );
+
+ // create the control shape
+ Reference< XInterface > xCreate = rxServiceFactory->createInstance(
+ String( RTL_CONSTASCII_STRINGPARAM( "com.sun.star.drawing.ControlShape" ) ) );
+ xShape = Reference< XShape >( xCreate, UNO_QUERY );
+ if( xShape.is() )
+ {
+ xShape->setSize( rSize );
+ // set control model at the shape
+ Reference< XControlShape > xControlShape( xShape, UNO_QUERY );
+ Reference< XControlModel > xControlModel( rxFormComp, UNO_QUERY );
+ if( xControlShape.is() && xControlModel.is() )
+ {
+ xControlShape->setControl( xControlModel );
+ if( pxShape )
+ *pxShape = xShape;
+ bRet = sal_True;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+
+// ----------------------------------------------------------------------------
+
+#if EXC_INCL_EXP_OCX
+
+XclExpOcxConverter::XclExpOcxConverter( const XclRoot& rRoot ) :
+ XclOcxConverter( rRoot )
+{
+}
+
+XclExpObjControl* XclExpOcxConverter::CreateObjRec( const Reference< XShape >& rxShape )
+{
+ XclExpObjControl* pObjRec = NULL;
+
+ // the shape to export
+ const SdrObject* pSdrObj = ::GetSdrObjectFromXShape( rxShape );
+ Reference< XControlShape > xControlShape( rxShape, UNO_QUERY );
+
+ if( pSdrObj && xControlShape.is() )
+ {
+ // the control model
+ Reference< XControlModel > xControlModel = xControlShape->getControl();
+ if( xControlModel.is() )
+ {
+ // output stream
+ if( !mxStrm.Is() )
+ mxStrm = ScfTools::OpenStorageStreamWrite( GetRootStorage(), EXC_STREAMNAME_CTLS );
+ if( mxStrm.Is() )
+ {
+ String aClassName;
+ sal_uInt32 nStrmStart = mxStrm->Tell();
+
+ // writes from xControlModel into mxStrm, raw class name returned in aClassName
+ if( WriteOCXExcelKludgeStream( mxStrm, xControlModel, rxShape->getSize(), aClassName ) )
+ {
+ sal_uInt32 nStrmSize = mxStrm->Tell() - nStrmStart;
+ // adjust the class name to "Forms.***.1"
+ aClassName.InsertAscii( "Forms.", 0 ).AppendAscii( ".1" );
+ pObjRec = new XclExpObjControl( *this, rxShape, aClassName, nStrmStart, nStrmSize );
+ }
+ }
+ }
+ }
+ return pObjRec;
+}
+
+#endif
+
+// ============================================================================
+
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 3a3a998c3bf8..fcf67866f763 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xlroot.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:12:53 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -111,14 +111,21 @@ XclRootData::XclRootData( XclBiff eBiff, ScDocument& rDocument, const String& rB
meLang( ScGlobal::eLnge ),
maScMaxPos( MAXCOL, MAXROW, MAXTAB ),
maXclMaxPos( EXC_MAXCOL_BIFF2, EXC_MAXROW_BIFF2, EXC_MAXTAB_BIFF2 ),
+ mnCharWidth( 110 ),
mnScTab( 0 ),
mbTruncated( false ),
mpRDP( new RootData )//!
{
+#ifdef DBG_UTIL
+ mnObjCnt = 0;
+#endif
}
XclRootData::~XclRootData()
{
+#ifdef DBG_UTIL
+ DBG_ASSERT( mnObjCnt == 0, "XclRootData::~XclRootData - wrong object count" );
+#endif
}
@@ -128,20 +135,30 @@ XclRoot::XclRoot( XclRootData& rRootData ) :
mrData( rRootData ),
mpRD( rRootData.mpRDP.get() )//!
{
+#ifdef DBG_UTIL
+ ++mrData.mnObjCnt;
+#endif
}
XclRoot::XclRoot( const XclRoot& rRoot ) :
mrData( rRoot.mrData ),
mpRD( rRoot.mpRD )//!
{
+#ifdef DBG_UTIL
+ ++mrData.mnObjCnt;
+#endif
}
XclRoot::~XclRoot()
{
+#ifdef DBG_UTIL
+ --mrData.mnObjCnt;
+#endif
}
XclRoot& XclRoot::operator=( const XclRoot& rRoot )
{
+ // allowed for assignment in derived classes - but test if the same root data is used
DBG_ASSERT( &mrData == &rRoot.mrData, "XclRoot::operator= - incompatible root data" );
return *this;
}
@@ -187,6 +204,11 @@ ScRangeName& XclRoot::GetNamedRanges() const
return *GetDoc().GetRangeName();
}
+SvStorage* XclRoot::GetRootStorage() const
+{
+ return mpRD->pRootStorage;
+}
+
ScEditEngineDefaulter& XclRoot::GetEditEngine() const
{
if( !mrData.mpEditEngine.get() )
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 150f52a5461d..ab1a70419d0c 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xlstyle.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:12:53 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,10 +116,10 @@ XclDefaultPalette::XclDefaultPalette( XclBiff eBiff ) :
mnIndexOffset( 0 )
{
if( eBiff != xlBiffUnknown )
- SetBiff( eBiff );
+ SetDefaultColors( eBiff );
}
-void XclDefaultPalette::SetBiff( XclBiff eBiff )
+void XclDefaultPalette::SetDefaultColors( XclBiff eBiff )
{
switch( eBiff )
{
diff --git a/sc/source/filter/excel/xltools.cxx b/sc/source/filter/excel/xltools.cxx
index 127c56376228..6183b5376e83 100644
--- a/sc/source/filter/excel/xltools.cxx
+++ b/sc/source/filter/excel/xltools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xltools.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:39:27 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -82,10 +82,6 @@
#include <svx/editstat.hxx>
#endif
-#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_
-#include <com/sun/star/uno/Reference.hxx>
-#endif
-
#ifndef SC_DOCUMENT_HXX
#include "document.hxx"
#endif
@@ -110,13 +106,6 @@
#endif
-namespace com { namespace sun { namespace star { namespace frame { class XModel; } } } }
-
-
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::frame::XModel;
-
-
// GUID import/export =========================================================
XclGuid::XclGuid()
@@ -124,16 +113,12 @@ XclGuid::XclGuid()
memset( mpData, 0, 16 );
}
-XclGuid::XclGuid( const XclGuid& rSrc )
-{
- operator=( rSrc );
-}
-
XclGuid::XclGuid(
sal_uInt32 nData1, sal_uInt16 nData2, sal_uInt16 nData3,
sal_uInt8 nData41, sal_uInt8 nData42, sal_uInt8 nData43, sal_uInt8 nData44,
sal_uInt8 nData45, sal_uInt8 nData46, sal_uInt8 nData47, sal_uInt8 nData48 )
{
+ // convert to little endian -> makes streaming easy
LongToSVBT32( nData1, mpData );
ShortToSVBT16( nData2, mpData + 4 );
ShortToSVBT16( nData3, mpData + 6 );
@@ -147,12 +132,6 @@ XclGuid::XclGuid(
mpData[ 15 ] = nData48;
}
-XclGuid& XclGuid::operator=( const XclGuid& rSrc )
-{
- memcpy( mpData, rSrc.mpData, 16 );
- return *this;
-}
-
bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 )
{
return memcmp( rCmp1.mpData, rCmp2.mpData, 16 ) == 0;
@@ -160,13 +139,13 @@ bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 )
XclImpStream& operator>>( XclImpStream& rStrm, XclGuid& rGuid )
{
- rStrm.Read( rGuid.mpData, 16 );
+ rStrm.Read( rGuid.mpData, 16 ); // mpData always in little endian
return rStrm;
}
XclExpStream& operator<<( XclExpStream& rStrm, const XclGuid& rGuid )
{
- rStrm.Write( rGuid.mpData, 16 );
+ rStrm.Write( rGuid.mpData, 16 ); // mpData already in little endian
return rStrm;
}
@@ -238,24 +217,24 @@ bool XclTools::GetRKFromDouble( sal_Int32& rnRKValue, double fValue )
}
-sal_Int32 XclTools::GetScRotation( sal_uInt16 nExcRot )
+sal_Int32 XclTools::GetScRotation( sal_uInt16 nXclRot )
{
- if( nExcRot > 180 )
+ if( nXclRot > 180 )
return 27000;
- return static_cast< sal_Int32 >( 100 * ((nExcRot > 90) ? 450 - nExcRot : nExcRot) );
+ return static_cast< sal_Int32 >( 100 * ((nXclRot > 90) ? 450 - nXclRot : nXclRot) );
}
-sal_uInt16 XclTools::GetExcRotation( sal_Int32 nScRot )
+sal_uInt8 XclTools::GetXclRotation( sal_Int32 nScRot )
{
- sal_Int32 nExcRot = nScRot / 100;
- if( (0 <= nExcRot) && (nExcRot <= 90) )
- return static_cast< sal_uInt16 >( nExcRot );
- if( nExcRot < 180 )
- return static_cast< sal_uInt16 >( 270 - nExcRot );
- if( nExcRot < 270 )
- return static_cast< sal_uInt16 >( nExcRot - 180 );
- if( nExcRot < 360 )
- return static_cast< sal_uInt16 >( 450 - nExcRot );
+ sal_Int32 nXclRot = nScRot / 100;
+ if( (0 <= nXclRot) && (nXclRot <= 90) )
+ return static_cast< sal_uInt8 >( nXclRot );
+ if( nXclRot < 180 )
+ return static_cast< sal_uInt8 >( 270 - nXclRot );
+ if( nXclRot < 270 )
+ return static_cast< sal_uInt8 >( nXclRot - 180 );
+ if( nXclRot < 360 )
+ return static_cast< sal_uInt8 >( 450 - nXclRot );
return 0;
}
@@ -316,6 +295,19 @@ double XclTools::GetInchFromTwips( sal_uInt16 nTwips )
}
+sal_uInt16 XclTools::GetScColumnWidth( sal_uInt16 nXclWidth, long nScCharWidth )
+{
+ double fScWidth = static_cast< double >( nXclWidth ) / 256.0 * nScCharWidth + 0.5;
+ return static_cast< sal_uInt16 >( ::std::min( fScWidth, 65535.0 ) );
+}
+
+sal_uInt16 XclTools::GetXclColumnWidth( sal_uInt16 nScWidth, long nScCharWidth )
+{
+ double fXclWidth = static_cast< double >( nScWidth ) * 256.0 / nScCharWidth + 0.5;
+ return static_cast< sal_uInt16 >( ::std::min( fXclWidth, 65535.0 ) );
+}
+
+
// built-in names -------------------------------------------------------------
static const sal_Char* ppNames[] =
@@ -422,7 +414,7 @@ bool XclTools::GetScLanguage( LanguageType& reScLang, sal_uInt16 nXclCountry )
{
const XclLanguageEntry* pLast = pLanguages + STATIC_TABLE_SIZE( pLanguages );
const XclLanguageEntry* pResult = ::std::lower_bound( pLanguages, pLast, nXclCountry, XclLanguageEntrySWO() );
- if( pResult != pLast )
+ if( (pResult != pLast) && (pResult->mnXclCountry == nXclCountry) )
{
reScLang = pResult->meLanguage;
return true;
diff --git a/sc/source/filter/ftools/fapihelper.cxx b/sc/source/filter/ftools/fapihelper.cxx
index 66f30846266c..560d29d700cd 100644
--- a/sc/source/filter/ftools/fapihelper.cxx
+++ b/sc/source/filter/ftools/fapihelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fapihelper.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:09:09 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,8 +105,10 @@ bool getPropAny( Any& rAny, const Reference< XPropertySet >& rxProp, const OUStr
{
Reference< XPropertySetInfo > xInfo = rxProp->getPropertySetInfo();
if( xInfo.is() && xInfo->hasPropertyByName( rName ) )
+ {
rAny = rxProp->getPropertyValue( rName );
- bSuccess = true;
+ bSuccess = true;
+ }
}
catch( Exception& )
{
diff --git a/sc/source/filter/ftools/fprogressbar.cxx b/sc/source/filter/ftools/fprogressbar.cxx
index 4f9ccda49500..4aea61460bad 100644
--- a/sc/source/filter/ftools/fprogressbar.cxx
+++ b/sc/source/filter/ftools/fprogressbar.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fprogressbar.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:09:09 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,11 @@
// ============================================================================
+const sal_Int32 SCF_INVALID_SEG = -1;
+
+
+// ============================================================================
+
ScfProgressBar::ScfProgressSegment::ScfProgressSegment( sal_uInt32 nSize ) :
mpProgress( NULL ),
mnSize( nSize ),
@@ -95,40 +100,41 @@ ScfProgressBar::ScfProgressSegment::~ScfProgressSegment()
// ============================================================================
-ScfProgressBar::ScfProgressBar( const String& rText ) :
- maText( rText ),
- mpSysProgress( NULL ),
- mpParentProgress( NULL ),
- mpParentSegment( NULL ),
- mpCurrSegment( NULL ),
- mnTotalSize( 0 ),
- mnTotalPos( 0 ),
- mnUnitSize( 0 ),
- mnNextUnitPos( 0 ),
- mbInProgress( false )
+ScfProgressBar::ScfProgressBar( SfxObjectShell* pDocShell, const String& rText ) :
+ maText( rText )
+{
+ Init( pDocShell );
+}
+
+ScfProgressBar::ScfProgressBar( SfxObjectShell* pDocShell, sal_uInt16 nResId ) :
+ maText( ScGlobal::GetRscString( nResId ) )
{
+ Init( pDocShell );
}
-ScfProgressBar::ScfProgressBar( ScfProgressBar* pParProgress, ScfProgressSegment* pParSegment ) :
- mpSysProgress( NULL ),
- mpParentProgress( pParProgress ),
- mpParentSegment( pParSegment ),
- mpCurrSegment( NULL ),
- mnTotalSize( 0 ),
- mnTotalPos( 0 ),
- mnUnitSize( 0 ),
- mnNextUnitPos( 0 ),
- mbInProgress( false )
+ScfProgressBar::ScfProgressBar( ScfProgressBar& rParProgress, ScfProgressSegment* pParSegment )
{
+ Init( rParProgress.mpDocShell );
+ mpParentProgress = &rParProgress;
+ mpParentSegment = pParSegment;
}
ScfProgressBar::~ScfProgressBar()
{
}
-ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_uInt32 nSegment ) const
+void ScfProgressBar::Init( SfxObjectShell* pDocShell )
+{
+ mpDocShell = pDocShell;
+ mpParentProgress = NULL;
+ mpParentSegment = mpCurrSegment = NULL;
+ mnTotalSize = mnTotalPos = mnUnitSize = mnNextUnitPos = 0;
+ mbInProgress = false;
+}
+
+ScfProgressBar::ScfProgressSegment* ScfProgressBar::GetSegment( sal_Int32 nSegment ) const
{
- if( nSegment == ~0UL )
+ if( nSegment < 0 )
return NULL;
DBG_ASSERT( maSegments.GetObject( nSegment ), "ScfProgressBar::GetSegment - invalid segment index" );
return maSegments.GetObject( nSegment );
@@ -143,7 +149,7 @@ void ScfProgressBar::SetCurrSegment( ScfProgressSegment* pSegment )
if( mpParentProgress && mpParentSegment )
mpParentProgress->SetCurrSegment( mpParentSegment );
else if( !mpSysProgress.get() && mnTotalSize )
- mpSysProgress.reset( new ScProgress( NULL, maText, mnTotalSize ) );
+ mpSysProgress.reset( new ScProgress( mpDocShell, maText, mnTotalSize ) );
if( !mbInProgress && mpCurrSegment && mnTotalSize )
{
@@ -181,26 +187,31 @@ void ScfProgressBar::IncreaseProgressBar( sal_uInt32 nDelta )
mnTotalPos = nNewPos;
}
-sal_uInt32 ScfProgressBar::AddSegment( sal_uInt32 nSize )
+sal_Int32 ScfProgressBar::AddSegment( sal_uInt32 nSize )
{
DBG_ASSERT( !mbInProgress, "ScfProgressBar::AddSegment - already in progress mode" );
if( !nSize )
- return ~0UL;
+ return SCF_INVALID_SEG;
maSegments.Append( new ScfProgressSegment( nSize ) );
mnTotalSize += nSize;
return maSegments.Count() - 1;
}
-ScfProgressBar& ScfProgressBar::GetSegmentProgressBar( sal_uInt32 nSegment )
+ScfProgressBar& ScfProgressBar::GetSegmentProgressBar( sal_Int32 nSegment )
{
ScfProgressSegment* pSegment = GetSegment( nSegment );
- if( pSegment && !pSegment->mpProgress.get() )
- pSegment->mpProgress.reset( new ScfProgressBar( this, pSegment ) );
- return pSegment ? *pSegment->mpProgress : *this;
+ DBG_ASSERT( !pSegment || !pSegment->mnPos, "ScfProgressBar::GetSegmentProgressBar - segment already started" );
+ if( pSegment && !pSegment->mnPos )
+ {
+ if( !pSegment->mpProgress.get() )
+ pSegment->mpProgress.reset( new ScfProgressBar( *this, pSegment ) );
+ return *pSegment->mpProgress;
+ }
+ return *this;
}
-void ScfProgressBar::ActivateSegment( sal_uInt32 nSegment )
+void ScfProgressBar::ActivateSegment( sal_Int32 nSegment )
{
DBG_ASSERT( mnTotalSize, "ScfProgressBar::ActivateSegment - progress range is zero" );
if( mnTotalSize )
@@ -212,6 +223,7 @@ void ScfProgressBar::Progress( sal_uInt32 nPos )
DBG_ASSERT( mbInProgress && mpCurrSegment, "ScfProgressBar::Progress - no segment started" );
if( mpCurrSegment )
{
+ DBG_ASSERT( !mpCurrSegment->mpProgress.get(), "ScfProgressBar::Progress - contains sub progress" );
DBG_ASSERT( mpCurrSegment->mnPos <= nPos, "ScfProgressBar::Progress - delta pos < 0" );
DBG_ASSERT( nPos <= mpCurrSegment->mnSize, "ScfProgressBar::Progress - segment overflow" );
if( (mpCurrSegment->mnPos < nPos) && (nPos <= mpCurrSegment->mnSize) )
@@ -230,3 +242,56 @@ void ScfProgressBar::Progress()
// ============================================================================
+ScfSimpleProgressBar::ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, const String& rText ) :
+ maProgress( pDocShell, rText )
+{
+ Init( nSize );
+}
+
+ScfSimpleProgressBar::ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, sal_uInt16 nResId ) :
+ maProgress( pDocShell, nResId )
+{
+ Init( nSize );
+}
+
+void ScfSimpleProgressBar::Init( sal_uInt32 nSize )
+{
+ sal_Int32 nSegment = maProgress.AddSegment( nSize );
+ if( nSegment >= 0 )
+ maProgress.ActivateSegment( nSegment );
+}
+
+
+// ============================================================================
+
+ScfStreamProgressBar::ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, const String& rText ) :
+ mrStrm( rStrm )
+{
+ Init( pDocShell, rText );
+}
+
+ScfStreamProgressBar::ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, sal_uInt16 nResId ) :
+ mrStrm( rStrm )
+{
+ Init( pDocShell, ScGlobal::GetRscString( nResId ) );
+}
+
+void ScfStreamProgressBar::Progress()
+{
+ mpProgress->Progress( mrStrm.Tell() );
+}
+
+void ScfStreamProgressBar::Init( SfxObjectShell* pDocShell, const String& rText )
+{
+ sal_uInt32 nPos = mrStrm.Tell();
+ mrStrm.Seek( STREAM_SEEK_TO_END );
+ sal_uInt32 nSize = mrStrm.Tell();
+ mrStrm.Seek( nPos );
+
+ mpProgress.reset( new ScfSimpleProgressBar( nSize, pDocShell, rText ) );
+ Progress();
+}
+
+
+// ============================================================================
+
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx
index aca8c1686fa1..71b65cbfb347 100644
--- a/sc/source/filter/ftools/ftools.cxx
+++ b/sc/source/filter/ftools/ftools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftools.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:09:10 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,9 @@
#include "ftools.hxx"
#endif
+#ifndef _SVSTOR_HXX
+#include <so3/svstor.hxx>
+#endif
#ifndef _UNOTOOLS_CHARCLASS_HXX
#include <unotools/charclass.hxx>
#endif
@@ -80,6 +83,9 @@
#ifndef SC_SCGLOB_HXX
#include "global.hxx"
#endif
+#ifndef SC_COMPILER_HXX
+#include "compiler.hxx"
+#endif
#include "excdefs.hxx"
@@ -225,39 +231,44 @@ void ScfTools::EraseQuotes( String& rString, sal_Unicode cQuote )
// *** conversion of names *** ------------------------------------------------
-void ScfTools::ConvertName( String& rName, bool bCheckPeriod )
+void ScfTools::ConvertToScSheetName( String& rName )
{
- if( !rName.Len() ) return;
+ for( xub_StrLen nPos = 0, nLen = rName.Len(); nPos < nLen; ++nPos )
+ {
+ sal_Unicode cChar = rName.GetChar( nPos );
+ bool bSpace = (cChar == ' ');
+ if( (!ScGlobal::pCharClass->isLetterNumeric( rName, nPos ) && !bSpace) || (!nPos && bSpace) )
+ rName.SetChar( nPos, '_' );
+ }
+}
- const sal_Unicode cUnderSc = '_';
- const sal_Unicode cBlank = ' ';
- const sal_Unicode cPoint = '.';
+void ScfTools::ConvertToScDefinedName( String& rName )
+{
+ xub_StrLen nLen = rName.Len();
+ if( nLen && !ScCompiler::IsCharWordChar( rName.GetChar( 0 ) ) )
+ rName.SetChar( 0, '_' );
+ for( xub_StrLen nPos = 1; nPos < nLen; ++nPos )
+ if( !ScCompiler::IsWordChar( rName.GetChar( nPos ) ) )
+ rName.SetChar( nPos, '_' );
+}
- String aNewTable;
- bool bSpace = false;
- for( const sal_Unicode* pChar = rName.GetBuffer(); *pChar; pChar++ )
- {
- if( !(ScGlobal::pCharClass->isLetterNumeric( rName, pChar - rName.GetBuffer() ) ||
- (*pChar == cUnderSc) || (*pChar == cBlank) || (bCheckPeriod && (*pChar == cPoint))) )
- {
- aNewTable += cUnderSc;
- bSpace = false;
- }
- else if( *pChar == cBlank )
- {
- if( bSpace )
- aNewTable += cUnderSc;
- else
- bSpace = true;
- }
- else
- {
- aNewTable += *pChar;
- bSpace = false;
- }
- }
- rName = aNewTable;
+// *** streams and storages *** -----------------------------------------------
+
+const SvStorageStreamRef ScfTools::OpenStorageStreamRead( SvStorage* pStorage, const String& rStrmName )
+{
+ SvStorageStreamRef xStrm;
+ if( pStorage && pStorage->IsContained( rStrmName ) && pStorage->IsStream( rStrmName ) )
+ xStrm = pStorage->OpenStream( rStrmName, STREAM_READ | STREAM_SHARE_DENYALL );
+ return xStrm;
+}
+
+const SvStorageStreamRef ScfTools::OpenStorageStreamWrite( SvStorage* pStorage, const String& rStrmName )
+{
+ SvStorageStreamRef xStrm;
+ if( pStorage )
+ xStrm = pStorage->OpenStream( rStrmName/*, STREAM_READWRITE | STREAM_TRUNC*/ );
+ return xStrm;
}
@@ -316,36 +327,66 @@ void ScfTools::AppendCString( SvStream& rStrm, String& rString, CharSet eSrc )
// *** HTML table names <-> named range names *** -----------------------------
-const String ScfTools::maHTMLDoc( RTL_CONSTASCII_USTRINGPARAM( "HTML_all" ) );
-const String ScfTools::maHTMLTables( RTL_CONSTASCII_USTRINGPARAM( "HTML_tables" ) );
-const String ScfTools::maHTMLTableIndex( RTL_CONSTASCII_USTRINGPARAM( "HTML_" ) );
-const String ScfTools::maHTMLTableName( RTL_CONSTASCII_USTRINGPARAM( "HTML__" ) );
+const String& ScfTools::GetHTMLDocName()
+{
+ static const String saHTMLDoc( RTL_CONSTASCII_USTRINGPARAM( "HTML_all" ) );
+ return saHTMLDoc;
+}
+
+const String& ScfTools::GetHTMLTablesName()
+{
+ static const String saHTMLTables( RTL_CONSTASCII_USTRINGPARAM( "HTML_tables" ) );
+ return saHTMLTables;
+}
+
+const String& ScfTools::GetHTMLIndexPrefix()
+{
+ static const String saHTMLIndexPrefix( RTL_CONSTASCII_USTRINGPARAM( "HTML_" ) );
+ return saHTMLIndexPrefix;
+
+}
+
+const String& ScfTools::GetHTMLNamePrefix()
+{
+ static const String saHTMLNamePrefix( RTL_CONSTASCII_USTRINGPARAM( "HTML__" ) );
+ return saHTMLNamePrefix;
+}
String ScfTools::GetNameFromHTMLIndex( sal_uInt32 nIndex )
{
- String aName( maHTMLTableIndex );
+ String aName( GetHTMLIndexPrefix() );
aName += String::CreateFromInt32( static_cast< sal_Int32 >( nIndex ) );
return aName;
}
String ScfTools::GetNameFromHTMLName( const String& rTabName )
{
- String aName( maHTMLTableName );
+ String aName( GetHTMLNamePrefix() );
aName += rTabName;
return aName;
}
+bool ScfTools::IsHTMLDocName( const String& rSource )
+{
+ return rSource.EqualsIgnoreCaseAscii( GetHTMLDocName() ) == TRUE;
+}
+
+bool ScfTools::IsHTMLTablesName( const String& rSource )
+{
+ return rSource.EqualsIgnoreCaseAscii( GetHTMLTablesName() ) == TRUE;
+}
+
bool ScfTools::GetHTMLNameFromName( const String& rSource, String& rName )
{
rName.Erase();
- if( rSource.EqualsIgnoreCaseAscii( maHTMLTableName, 0, maHTMLTableName.Len() ) )
+ if( rSource.EqualsIgnoreCaseAscii( GetHTMLNamePrefix(), 0, GetHTMLNamePrefix().Len() ) )
{
- rName = rSource.Copy( maHTMLTableName.Len() );
+ rName = rSource.Copy( GetHTMLNamePrefix().Len() );
AddQuotes( rName );
}
- else if( rSource.EqualsIgnoreCaseAscii( maHTMLTableIndex, 0, maHTMLTableIndex.Len() ) )
+ else if( rSource.EqualsIgnoreCaseAscii( GetHTMLIndexPrefix(), 0, GetHTMLIndexPrefix().Len() ) )
{
- String aIndex( rSource.Copy( maHTMLTableIndex.Len() ) );
+ String aIndex( rSource.Copy( GetHTMLIndexPrefix().Len() ) );
if( CharClass::isAsciiNumeric( aIndex ) && (aIndex.ToInt32() > 0) )
rName = aIndex;
}
diff --git a/sc/source/filter/ftools/makefile.mk b/sc/source/filter/ftools/makefile.mk
index f4265fc0558e..0c36c6101a47 100644
--- a/sc/source/filter/ftools/makefile.mk
+++ b/sc/source/filter/ftools/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: dr $ $Date: 2002-11-21 12:09:10 $
+# last change: $Author: hr $ $Date: 2003-03-26 18:04:51 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
diff --git a/sc/source/filter/html/htmlimp.cxx b/sc/source/filter/html/htmlimp.cxx
index 99f8ad890af2..9e8555e0f7b4 100644
--- a/sc/source/filter/html/htmlimp.cxx
+++ b/sc/source/filter/html/htmlimp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlimp.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:17:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -139,7 +139,10 @@ ScHTMLImport::ScHTMLImport( ScDocument* pDocP, const ScRange& rRange, BOOL bCalc
aPageSize = pDefaultDev->LogicToPixel(
SvxPaperInfo::GetPaperSize( SVX_PAPER_A4 ), MapMode( MAP_TWIP ) );
}
- pParser = new ScHTMLParser( pEngine, aPageSize, pDocP, bCalcWidthHeight );
+ if( bCalcWidthHeight )
+ pParser = new ScHTMLLayoutParser( pEngine, aPageSize, pDocP );
+ else
+ pParser = new ScHTMLQueryParser( pEngine, pDocP );
}
@@ -167,12 +170,12 @@ void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
ScEEImport::WriteToDocument( bSizeColsRows, nOutputFactor );
const ScHTMLParser* pParser = GetParser();
- ScHTMLTableDataTable* pHTMLTables = pParser->GetHTMLTables();
- if( !pHTMLTables )
+ const ScHTMLTable* pGlobTable = pParser->GetGlobalTable();
+ if( !pGlobTable )
return;
// set cell borders for HTML table cells
- pHTMLTables->SetCellBorders( pDoc, aRange.aStart );
+ pGlobTable->ApplyCellBorders( pDoc, aRange.aStart );
// correct cell borders for merged cells
for ( ScEEParseEntry* pEntry = pParser->First(); pEntry; pEntry = pParser->Next() )
@@ -209,10 +212,8 @@ void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
// create ranges for HTML tables
// 1 - entire document
ScRange aNewRange( aRange.aStart );
- USHORT nColDim, nRowDim;
- pParser->GetDimensions( nColDim, nRowDim );
- aNewRange.aEnd.IncCol( nColDim - 1 );
- aNewRange.aEnd.IncRow( nRowDim - 1 );
+ aNewRange.aEnd.IncCol( pGlobTable->GetDocSize( tdCol ) - 1 );
+ aNewRange.aEnd.IncRow( pGlobTable->GetDocSize( tdRow ) - 1 );
InsertRangeName( pDoc, ScfTools::GetHTMLDocName(), aNewRange );
// 2 - all tables
@@ -223,14 +224,14 @@ void ScHTMLImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
short nRowDiff = (short)aRange.aStart.Row();
short nTabDiff = (short)aRange.aStart.Tab();
- ScHTMLTableData* pTable = NULL;
- ULONG nTab = 0;
- while( pTable = pHTMLTables->GetTable( ++nTab ) )
+ ScHTMLTable* pTable = NULL;
+ ScHTMLTableId nTableId = SC_HTML_GLOBAL_TABLE;
+ while( pTable = pGlobTable->FindNestedTable( ++nTableId ) )
{
- pTable->GetRange( aNewRange );
+ pTable->GetDocRange( aNewRange );
aNewRange.Move( nColDiff, nRowDiff, nTabDiff );
// insert table number as name
- InsertRangeName( pDoc, ScfTools::GetNameFromHTMLIndex( nTab ), aNewRange );
+ InsertRangeName( pDoc, ScfTools::GetNameFromHTMLIndex( nTableId ), aNewRange );
// insert table id as name
if( pTable->GetTableName().Len() )
{
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 01405399551f..984b657880b2 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlpars.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: er $ $Date: 2002-10-01 19:10:33 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,6 +67,8 @@
//------------------------------------------------------------------------
+#include <boost/shared_ptr.hpp>
+
#define SC_HTMLPARS_CXX
#include "scitems.hxx"
#include <svx/eeitem.hxx>
@@ -120,344 +122,39 @@
#include "flttools.hxx"
#include "document.hxx"
#include "rangelst.hxx"
+#include "ftools.hxx"
SV_IMPL_VARARR_SORT( ScHTMLColOffset, ULONG );
-//------------------------------------------------------------------------
-
-ScHTMLTableData::ScHTMLTableData(
- const String& rTabName, USHORT _nFirstCol, USHORT _nFirstRow,
- USHORT _nColSpan, USHORT _nRowSpan, BOOL bBorder ) :
- aTableName( rTabName ),
- nFirstCol( _nFirstCol ),
- nFirstRow( _nFirstRow ),
- nLastCol( _nFirstCol ),
- nLastRow( _nFirstRow ),
- nColSpan( _nColSpan ),
- nRowSpan( _nRowSpan ),
- nDocCol( _nFirstCol ),
- nDocRow( _nFirstRow ),
- bBorderOn( bBorder ),
- pNestedTables( NULL )
-{
-}
-
-ScHTMLTableData::~ScHTMLTableData()
-{
- if( pNestedTables )
- delete pNestedTables;
-}
-
-USHORT ScHTMLTableData::GetCount( const Table& rTab, ULONG nIndex )
-{
- USHORT nCount = (USHORT)(ULONG) rTab.Get( nIndex );
- return Max( nCount, (USHORT)1 ); // width/height is at least 1 cell
-}
-
-USHORT ScHTMLTableData::GetSize( const Table& rDataTab, ULONG nStart, ULONG nEnd )
-{
- USHORT nSize = 0;
- for( ULONG nIndex = nStart; nIndex <= nEnd; nIndex++ )
- nSize += GetCount( rDataTab, nIndex );
- return nSize;
-}
-
-USHORT ScHTMLTableData::CalcDocPos( ScHTMLTableDataKey eCRKey, ULONG nIndex ) const
-{
- USHORT nFirst = GetFirst( eCRKey );
- return GetDocPos( eCRKey ) + ((nFirst < nIndex) ? GetSize( GetDataTable( eCRKey ), nFirst, nIndex - 1 ) : 0);
-}
-USHORT ScHTMLTableData::CalcSpan( ScHTMLTableDataKey eCRKey, ULONG nIndex, USHORT nSpan ) const
-{
- return GetSize( GetDataTable( eCRKey ), nIndex, nIndex + nSpan - 1 );
-}
-
-void ScHTMLTableData::GetRange( ScRange& rRange ) const
-{
- USHORT nCol = CalcDocCol( nFirstCol );
- USHORT nRow = CalcDocRow( nFirstRow );
- rRange.aStart.Set( nCol, nRow, 0 );
- rRange.aEnd.Set( nCol + GetSize( tdCol ) - 1, nRow + GetSize( tdRow ) - 1, 0 );
-}
+// ============================================================================
+// BASE class for HTML parser classes
+// ============================================================================
-ScHTMLTableData* ScHTMLTableData::GetNestedTable( ULONG nTab ) const
+ScHTMLParser::ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc ) :
+ ScEEParser( pEditEngine ),
+ mpDoc( pDoc )
{
- return pNestedTables ? pNestedTables->GetTable( nTab ) : NULL;
-}
-
-void ScHTMLTableData::SetMaxCount( Table& rDataTab, ULONG nIndex, USHORT nCount )
-{
- if( GetCount( rDataTab, nIndex ) < nCount )
- {
- if( rDataTab.IsKeyValid( nIndex ) )
- rDataTab.Replace( nIndex, (void*) nCount );
- else
- rDataTab.Insert( nIndex, (void*) nCount );
- }
-}
-
-ScHTMLTableData* ScHTMLTableData::InsertNestedTable(
- ULONG nTab, const String& rTabName, USHORT _nFirstCol, USHORT _nFirstRow,
- USHORT _nColSpan, USHORT _nRowSpan, BOOL bBorder )
-{
- if( !pNestedTables )
- pNestedTables = new ScHTMLTableDataTable;
- return pNestedTables->InsertTable( nTab, rTabName, _nFirstCol, _nFirstRow, _nColSpan, _nRowSpan, bBorder );
-}
-
-void ScHTMLTableData::ChangeDocCoord( short nColDiff, short nRowDiff )
-{
- nDocCol += nColDiff;
- nDocRow += nRowDiff;
- if( pNestedTables )
- for( ScHTMLTableData* pTable = pNestedTables->GetFirst(); pTable; pTable = pNestedTables->GetNext() )
- pTable->ChangeDocCoord( nColDiff, nRowDiff );
-}
-
-void ScHTMLTableData::SetDocCoord( USHORT nCol, USHORT nRow )
-{
- short nColDiff = nCol - nFirstCol;
- short nRowDiff = nRow - nFirstRow;
- ChangeDocCoord( nColDiff, nRowDiff );
-}
-
-void ScHTMLTableData::RecalcSizeDim( ScHTMLTableDataKey eCRKey )
-{
- if( !pNestedTables ) return;
- for( ScHTMLTableData* pTable = pNestedTables->GetFirstInOrder( eCRKey );
- pTable; pTable = pNestedTables->GetNextInOrder() )
- {
- USHORT nIndex = pTable->GetFirst( eCRKey );
- USHORT nSpan = pTable->GetSpan( eCRKey );
- USHORT nSize = pTable->GetSize( eCRKey );
- Table& rDataTab = GetDataTable( eCRKey );
- while( nSpan > 1 )
- {
- nSize -= Min( nSize, GetCount( rDataTab, nIndex ) );
- nIndex++;
- nSpan--;
- }
- SetMaxCount( rDataTab, nIndex, nSize );
- }
-}
-
-void ScHTMLTableData::RecalcSize()
-{
- if( !pNestedTables ) return;
- pNestedTables->RecalcSizes();
- // all nested tables have the right size now -> calculate it for this table
- RecalcSizeDim( tdCol );
- RecalcSizeDim( tdRow );
- // set correct position of nested tables inside of THIS table
- for( ScHTMLTableData* pTable = pNestedTables->GetFirst(); pTable; pTable = pNestedTables->GetNext() )
- pTable->SetDocCoord( CalcDocCol( pTable->GetFirstCol() ), CalcDocRow( pTable->GetFirstRow() ) );
-}
-
-void ScHTMLTableData::SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos )
-{
- if( bBorderOn )
- {
- const USHORT nOuterLine = DEF_LINE_WIDTH_2;
- const USHORT nInnerLine = DEF_LINE_WIDTH_0;
- SvxBorderLine aOuterLine, aInnerLine;
- aOuterLine.SetColor( Color( COL_BLACK ) );
- aOuterLine.SetOutWidth( nOuterLine );
- aInnerLine.SetColor( Color( COL_BLACK ) );
- aInnerLine.SetOutWidth( nInnerLine );
- SvxBoxItem aBorderItem;
-
- for( USHORT nCol = nFirstCol; nCol <= nLastCol; nCol++ )
- {
- SvxBorderLine* pLeftLine = (nCol == nFirstCol) ? &aOuterLine : &aInnerLine;
- SvxBorderLine* pRightLine = (nCol == nLastCol) ? &aOuterLine : &aInnerLine;
- USHORT nCellCol1 = CalcDocCol( nCol ) + rFirstPos.Col();
- USHORT nCellCol2 = nCellCol1 + GetCount( aColCount, nCol ) - 1;
- for( USHORT nRow = nFirstRow; nRow <= nLastRow; nRow++ )
- {
- SvxBorderLine* pTopLine = (nRow == nFirstRow) ? &aOuterLine : &aInnerLine;
- SvxBorderLine* pBottomLine = (nRow == nLastRow) ? &aOuterLine : &aInnerLine;
- USHORT nCellRow1 = CalcDocRow( nRow ) + rFirstPos.Row();
- USHORT nCellRow2 = nCellRow1 + GetCount( aRowCount, nRow ) - 1;
- for( USHORT nCellCol = nCellCol1; nCellCol <= nCellCol2; nCellCol++ )
- {
- aBorderItem.SetLine( (nCellCol == nCellCol1) ? pLeftLine : NULL, BOX_LINE_LEFT );
- aBorderItem.SetLine( (nCellCol == nCellCol2) ? pRightLine : NULL, BOX_LINE_RIGHT );
- for( USHORT nCellRow = nCellRow1; nCellRow <= nCellRow2; nCellRow++ )
- {
- aBorderItem.SetLine( (nCellRow == nCellRow1) ? pTopLine : NULL, BOX_LINE_TOP );
- aBorderItem.SetLine( (nCellRow == nCellRow2) ? pBottomLine : NULL, BOX_LINE_BOTTOM );
- pDoc->ApplyAttr( nCellCol, nCellRow, rFirstPos.Tab(), aBorderItem );
- }
- }
- }
- }
- }
-
- if( pNestedTables )
- pNestedTables->SetCellBorders( pDoc, rFirstPos );
-}
-
-
-
-ScHTMLTableDataTable::ScHTMLTableDataTable() :
- pCurrTab( NULL ),
- nCurrTab( 0 )
-{
-}
-
-ScHTMLTableDataTable::~ScHTMLTableDataTable()
-{
- for( ScHTMLTableData* pData = GetFirst(); pData; pData = GetNext() )
- delete pData;
-}
-
-ScHTMLTableData* ScHTMLTableDataTable::GetTable( ULONG nTab )
-{
- if( nTab == nCurrTab )
- return pCurrTab;
- if( !nTab )
- return NULL;
-
- ScHTMLTableData* pTable = _Get( nTab );
- if( pTable )
- {
- SetCurrTable( nTab, pTable );
- return pTable;
- }
-
- ScHTMLTableData* pNested = NULL;
- for( pTable = GetFirst(); pTable; pTable = GetNext() )
- {
- pNested = pTable->GetNestedTable( nTab );
- if( pNested )
- {
- SetCurrTable( nTab, pNested );
- return pNested;
- }
- }
- return NULL;
-}
-
-ScHTMLTableData* ScHTMLTableDataTable::GetFirstInOrder( ScHTMLTableDataKey eKey )
-{
- nSearchMin1 = nSearchMin2 = 0;
- eSearchKey = eKey;
- return GetNextInOrder();
-}
-
-ScHTMLTableData* ScHTMLTableDataTable::GetNextInOrder()
-{
- ScHTMLTableDataKey eOppKey = (eSearchKey == tdCol) ? tdRow : tdCol;
- ScHTMLTableData* pTableFound = NULL;
- USHORT nFoundPos1 = (USHORT)~0;
- USHORT nFoundPos2 = (USHORT)~0;
-
- for( ScHTMLTableData* pTable = GetFirst(); pTable; pTable = GetNext() )
- {
- USHORT nTablePos1 = pTable->GetFirst( eSearchKey ) + pTable->GetSpan( eSearchKey ) - 1;
- USHORT nTablePos2 = pTable->GetFirst( eOppKey );
- if( ((nTablePos1 > nSearchMin1) || ((nTablePos1 == nSearchMin1) && (nTablePos2 > nSearchMin2))) &&
- ((nTablePos1 < nFoundPos1) || ((nTablePos1 == nFoundPos1) && (nTablePos2 < nFoundPos2))) )
- { // position of this table is between min position and last found position
- pTableFound = pTable;
- nFoundPos1 = nTablePos1;
- nFoundPos2 = nTablePos2;
- }
- }
- nSearchMin1 = nFoundPos1;
- nSearchMin2 = nFoundPos2;
- return pTableFound;
-}
-
-USHORT ScHTMLTableDataTable::GetNextFreeRow( ULONG nTab )
-{
- ScHTMLTableData* pTable = _Get( nTab );
- if( pTable )
- return pTable->GetFirstRow() + pTable->GetSize( tdRow );
-
- for( pTable = GetFirst(); pTable; pTable = GetNext() )
- if( pTable->GetNestedTable( nTab ) )
- return pTable->GetFirstRow() + pTable->GetSize( tdRow );
-
- return 0;
-}
-
-ScHTMLTableData* ScHTMLTableDataTable::InsertTable(
- ULONG nTab, const String& rTabName, USHORT nFirstCol, USHORT nFirstRow,
- USHORT nColSpan, USHORT nRowSpan, BOOL bBorder, ULONG nNestedIn )
-{
- ScHTMLTableData* pTable = GetTable( nTab );
- // table already exists
- if( pTable )
- return pTable;
- // insert in nested table
- if( nNestedIn )
- {
- pTable = GetTable( nNestedIn );
- if( pTable )
- {
- ScHTMLTableData* pNewTab = pTable->InsertNestedTable(
- nTab, rTabName, nFirstCol, nFirstRow, nColSpan, nRowSpan, bBorder );
- SetCurrTable( nTab, pNewTab );
- return pNewTab;
- }
- }
- // insert in this table
- _Insert( nTab, pTable = new ScHTMLTableData(
- rTabName, nFirstCol, nFirstRow, nColSpan, nRowSpan, bBorder ) );
- SetCurrTable( nTab, pTable );
- return pTable;
-}
-
-void ScHTMLTableDataTable::SetCellCoord( ULONG nTab, USHORT nCol, USHORT nRow )
-{
- ScHTMLTableData* pTable = GetTable( nTab );
- if( pTable )
- pTable->SetCellCoord( nCol, nRow );
-}
-
-void ScHTMLTableDataTable::RecalcSizes()
-{
- for( ScHTMLTableData* pTable = GetFirst(); pTable; pTable = GetNext() )
- pTable->RecalcSize();
+ OfaHtmlOptions* pHtmlOptions = ((OfficeApplication*)SFX_APP())->GetHtmlOptions();
+ for( sal_uInt16 nIndex = 0; nIndex < SC_HTML_FONTSIZES; ++nIndex )
+ maFontHeights[ nIndex ] = pHtmlOptions->GetFontSize( nIndex ) * 20;
}
-void ScHTMLTableDataTable::Recalc()
+ScHTMLParser::~ScHTMLParser()
{
- // table sizes
- RecalcSizes();
- // table positions (move tables down)
- USHORT nDocRow;
- USHORT nRowDiff = 0;
- for( ScHTMLTableData* pTable = GetFirst(); pTable; pTable = GetNext() )
- {
- nDocRow = pTable->GetFirstRow() + nRowDiff;
- pTable->SetDocCoord( pTable->GetFirstCol(), nDocRow );
- nRowDiff += (pTable->GetSize( tdRow ) + pTable->GetFirstRow() - pTable->GetLastRow() - 1);
- }
}
-void ScHTMLTableDataTable::SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos )
-{
- DBG_ASSERT( pDoc, "ScHTMLTableDataTable::SetCellBorders - no document" );
- for( ScHTMLTableData* pTable = GetFirst(); pTable; pTable = GetNext() )
- pTable->SetCellBorders( pDoc, rFirstPos );
-}
-//------------------------------------------------------------------------
+// ============================================================================
-ScHTMLParser::ScHTMLParser( EditEngine* pEditP, const Size& aPageSizeP,
- ScDocument* pDocP, BOOL _bCalcWidthHeight ) :
- ScEEParser( pEditP ),
+ScHTMLLayoutParser::ScHTMLLayoutParser( EditEngine* pEditP, const Size& aPageSizeP, ScDocument* pDocP ) :
+ ScHTMLParser( pEditP, pDocP ),
aPageSize( aPageSizeP ),
xLockedList( new ScRangeList ),
- pDoc( pDocP ),
pTables( NULL ),
- pTableData( _bCalcWidthHeight ? NULL : new ScHTMLTableDataTable ),
- pColOffset( _bCalcWidthHeight ? new ScHTMLColOffset : NULL ),
- pLocalColOffset( _bCalcWidthHeight ? new ScHTMLColOffset : NULL ),
+ pColOffset( new ScHTMLColOffset ),
+ pLocalColOffset( new ScHTMLColOffset ),
nFirstTableCell(0),
nTableLevel(0),
nTable(0),
@@ -468,29 +165,17 @@ ScHTMLParser::ScHTMLParser( EditEngine* pEditP, const Size& aPageSizeP,
nColOffset(0),
nColOffsetStart(0),
nMetaCnt(0),
- bCalcWidthHeight( _bCalcWidthHeight ),
bTabInTabCell( FALSE ),
bFirstRow( TRUE ),
bInCell( FALSE ),
bInTitle( FALSE )
{
- // neue Konfiguration setzen
- OfaHtmlOptions* pHtmlOptions = ((OfficeApplication*)SFX_APP())->GetHtmlOptions();
- for ( USHORT j=0; j < SC_HTML_FONTSIZES; j++ )
- {
- // in Twips merken, wie unser SvxFontHeightItem
- aFontHeights[j] = pHtmlOptions->GetFontSize( j ) * 20;
- }
-
- if( bCalcWidthHeight )
- {
- MakeColNoRef( pLocalColOffset, 0, 0, 0, 0 );
- MakeColNoRef( pColOffset, 0, 0, 0, 0 );
- }
+ MakeColNoRef( pLocalColOffset, 0, 0, 0, 0 );
+ MakeColNoRef( pColOffset, 0, 0, 0, 0 );
}
-ScHTMLParser::~ScHTMLParser()
+ScHTMLLayoutParser::~ScHTMLLayoutParser()
{
ScHTMLTableStackEntry* pS;
while ( pS = aTableStack.Pop() )
@@ -511,17 +196,15 @@ ScHTMLParser::~ScHTMLParser()
delete pT;
delete pTables;
}
- if ( pTableData )
- delete pTableData;
}
-ULONG ScHTMLParser::Read( SvStream& rStream )
+ULONG ScHTMLLayoutParser::Read( SvStream& rStream )
{
Link aOldLink = pEdit->GetImportHdl();
- pEdit->SetImportHdl( LINK( this, ScHTMLParser, HTMLImportHdl ) );
+ pEdit->SetImportHdl( LINK( this, ScHTMLLayoutParser, HTMLImportHdl ) );
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
BOOL bLoading = pObjSh && pObjSh->IsLoading();
SvKeyValueIteratorRef xValues;
@@ -549,29 +232,30 @@ ULONG ScHTMLParser::Read( SvStream& rStream )
pEdit->SetImportHdl( aOldLink );
// Spaltenbreiten erzeugen
- if( bCalcWidthHeight )
+ Adjust();
+ OutputDevice* pDefaultDev = Application::GetDefaultDevice();
+ USHORT nCount = pColOffset->Count();
+ const ULONG* pOff = (const ULONG*) pColOffset->GetData();
+ ULONG nOff = *pOff++;
+ Size aSize;
+ for ( USHORT j = 1; j < nCount; j++, pOff++ )
{
- Adjust();
- OutputDevice* pDefaultDev = Application::GetDefaultDevice();
- USHORT nCount = pColOffset->Count();
- const ULONG* pOff = (const ULONG*) pColOffset->GetData();
- ULONG nOff = *pOff++;
- Size aSize;
- for ( USHORT j = 1; j < nCount; j++, pOff++ )
- {
- aSize.Width() = *pOff - nOff;
- aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
- pColWidths->Insert( j-1, (void*)aSize.Width() );
- nOff = *pOff;
- }
+ aSize.Width() = *pOff - nOff;
+ aSize = pDefaultDev->PixelToLogic( aSize, MapMode( MAP_TWIP ) );
+ pColWidths->Insert( j-1, (void*)aSize.Width() );
+ nOff = *pOff;
}
- else
- AdjustNoWidthHeight();
return nErr;
}
-void ScHTMLParser::NewActEntry( ScEEParseEntry* pE )
+const ScHTMLTable* ScHTMLLayoutParser::GetGlobalTable() const
+{
+ return 0;
+}
+
+
+void ScHTMLLayoutParser::NewActEntry( ScEEParseEntry* pE )
{
ScEEParser::NewActEntry( pE );
if ( pE )
@@ -587,7 +271,7 @@ void ScHTMLParser::NewActEntry( ScEEParseEntry* pE )
}
-void ScHTMLParser::EntryEnd( ScEEParseEntry* pE, const ESelection& rSel )
+void ScHTMLLayoutParser::EntryEnd( ScEEParseEntry* pE, const ESelection& rSel )
{
if ( rSel.nEndPara >= pE->aSel.nStartPara )
{
@@ -604,7 +288,7 @@ void ScHTMLParser::EntryEnd( ScEEParseEntry* pE, const ESelection& rSel )
}
-void ScHTMLParser::NextRow( ImportInfo* pInfo )
+void ScHTMLLayoutParser::NextRow( ImportInfo* pInfo )
{
if ( bInCell )
CloseEntry( pInfo );
@@ -616,10 +300,10 @@ void ScHTMLParser::NextRow( ImportInfo* pInfo )
}
-BOOL ScHTMLParser::SeekOffset( ScHTMLColOffset* pOffset, USHORT nOffset,
+BOOL ScHTMLLayoutParser::SeekOffset( ScHTMLColOffset* pOffset, USHORT nOffset,
USHORT* pCol, USHORT nOffsetTol )
{
- DBG_ASSERT( pOffset, "ScHTMLParser::SeekOffset - illegal call" );
+ DBG_ASSERT( pOffset, "ScHTMLLayoutParser::SeekOffset - illegal call" );
if ( pOffset->Seek_Entry( nOffset, pCol ) )
return TRUE;
USHORT nCount = pOffset->Count();
@@ -639,10 +323,10 @@ BOOL ScHTMLParser::SeekOffset( ScHTMLColOffset* pOffset, USHORT nOffset,
}
-void ScHTMLParser::MakeCol( ScHTMLColOffset* pOffset, USHORT& nOffset,
+void ScHTMLLayoutParser::MakeCol( ScHTMLColOffset* pOffset, USHORT& nOffset,
USHORT& nWidth, USHORT nOffsetTol, USHORT nWidthTol )
{
- DBG_ASSERT( pOffset, "ScHTMLParser::MakeCol - illegal call" );
+ DBG_ASSERT( pOffset, "ScHTMLLayoutParser::MakeCol - illegal call" );
USHORT nPos;
if ( SeekOffset( pOffset, nOffset, &nPos, nOffsetTol ) )
nOffset = (USHORT)(*pOffset)[nPos];
@@ -658,10 +342,10 @@ void ScHTMLParser::MakeCol( ScHTMLColOffset* pOffset, USHORT& nOffset,
}
-void ScHTMLParser::MakeColNoRef( ScHTMLColOffset* pOffset, USHORT nOffset,
+void ScHTMLLayoutParser::MakeColNoRef( ScHTMLColOffset* pOffset, USHORT nOffset,
USHORT nWidth, USHORT nOffsetTol, USHORT nWidthTol )
{
- DBG_ASSERT( pOffset, "ScHTMLParser::MakeColNoRef - illegal call" );
+ DBG_ASSERT( pOffset, "ScHTMLLayoutParser::MakeColNoRef - illegal call" );
USHORT nPos;
if ( SeekOffset( pOffset, nOffset, &nPos, nOffsetTol ) )
nOffset = (USHORT)(*pOffset)[nPos];
@@ -675,10 +359,10 @@ void ScHTMLParser::MakeColNoRef( ScHTMLColOffset* pOffset, USHORT nOffset,
}
-void ScHTMLParser::ModifyOffset( ScHTMLColOffset* pOffset, USHORT& nOldOffset,
+void ScHTMLLayoutParser::ModifyOffset( ScHTMLColOffset* pOffset, USHORT& nOldOffset,
USHORT& nNewOffset, USHORT nOffsetTol )
{
- DBG_ASSERT( pOffset, "ScHTMLParser::ModifyOffset - illegal call" );
+ DBG_ASSERT( pOffset, "ScHTMLLayoutParser::ModifyOffset - illegal call" );
USHORT nPos;
if ( !SeekOffset( pOffset, nOldOffset, &nPos, nOffsetTol ) )
{
@@ -716,7 +400,7 @@ void ScHTMLParser::ModifyOffset( ScHTMLColOffset* pOffset, USHORT& nOldOffset,
}
-void ScHTMLParser::SkipLocked( ScEEParseEntry* pE, BOOL bJoin )
+void ScHTMLLayoutParser::SkipLocked( ScEEParseEntry* pE, BOOL bJoin )
{
if ( pE->nCol <= MAXCOL )
{ // wuerde sonst bei ScAddress falschen Wert erzeugen, evtl. Endlosschleife!
@@ -751,7 +435,7 @@ void ScHTMLParser::SkipLocked( ScEEParseEntry* pE, BOOL bJoin )
}
-void ScHTMLParser::Adjust()
+void ScHTMLLayoutParser::Adjust()
{
for ( ScRange* pR = xLockedList->First(); pR; pR = xLockedList->Next() )
delete pR;
@@ -871,57 +555,8 @@ void ScHTMLParser::Adjust()
}
-void ScHTMLParser::AdjustNoWidthHeight()
-{
- DBG_ASSERT( pTableData, "ScHTMLParser::AdjustNoWidthHeight - no table data" );
- pTableData->Recalc();
-
- USHORT nLastCol = 0;
- USHORT nLastRow = 0;
- USHORT nLastTab = 0;
- USHORT nDocCol = 0;
- USHORT nDocRow = 0;
-
- for ( ScEEParseEntry* pEntry = pList->First(); pEntry; pEntry = pList->Next() )
- {
- ScHTMLTableData* pTable = pTableData->GetTable( pEntry->nTab );
-
- if( pTable )
- {
- nDocCol = pTable->CalcDocCol( pEntry->nCol );
- nDocRow = pTable->CalcDocRow( pEntry->nRow );
- pEntry->nColOverlap = pTable->CalcColSpan( pEntry->nCol, pEntry->nColOverlap );
- pEntry->nRowOverlap = pTable->CalcRowSpan( pEntry->nRow, pEntry->nRowOverlap );
- }
- else if( nLastTab )
- {
- nDocCol = pEntry->nCol;
- nDocRow = pTableData->GetNextFreeRow( nLastTab );
- }
- else
- {
- nDocCol += pEntry->nCol - nLastCol;
- nDocRow += pEntry->nRow - nLastRow;
- }
-
- nLastCol = pEntry->nCol;
- nLastRow = pEntry->nRow;
- nLastTab = pEntry->nTab;
-
- pEntry->nCol = nDocCol;
- pEntry->nRow = nDocRow;
-
- nColMax = Max( nColMax, (USHORT)(pEntry->nCol + pEntry->nColOverlap) );
- nRowMax = Max( nRowMax, (USHORT)(pEntry->nRow + pEntry->nRowOverlap) );
- }
-}
-
-
-USHORT ScHTMLParser::GetWidth( ScEEParseEntry* pE )
+USHORT ScHTMLLayoutParser::GetWidth( ScEEParseEntry* pE )
{
- if( !bCalcWidthHeight )
- return 0;
-
if ( pE->nWidth )
return pE->nWidth;
USHORT nPos = Min( pE->nCol - nColCntStart + pE->nColOverlap,
@@ -933,10 +568,8 @@ USHORT ScHTMLParser::GetWidth( ScEEParseEntry* pE )
}
-void ScHTMLParser::SetWidths()
+void ScHTMLLayoutParser::SetWidths()
{
- if( !bCalcWidthHeight ) return;
-
ScEEParseEntry* pE;
USHORT nCol;
if ( !nTableWidth )
@@ -1053,7 +686,7 @@ void ScHTMLParser::SetWidths()
if ( pE->nTab == nTable )
{
nCol = pE->nCol - nColCntStart;
- DBG_ASSERT( nCol < nColsPerRow, "ScHTMLParser::SetWidths: column overflow" );
+ DBG_ASSERT( nCol < nColsPerRow, "ScHTMLLayoutParser::SetWidths: column overflow" );
if ( nCol < nColsPerRow )
{
pE->nOffset = pOffsets[nCol];
@@ -1093,35 +726,32 @@ void ScHTMLParser::SetWidths()
}
-void ScHTMLParser::Colonize( ScEEParseEntry* pE )
+void ScHTMLLayoutParser::Colonize( ScEEParseEntry* pE )
{
USHORT nCol = pE->nCol;
SkipLocked( pE ); // Spaltenverdraengung nach rechts
- if( bCalcWidthHeight )
- {
- if ( nCol < pE->nCol )
- { // verdraengt
- nCol = pE->nCol - nColCntStart;
- USHORT nCount = pLocalColOffset->Count();
- if ( nCol < nCount )
- nColOffset = (USHORT) (*pLocalColOffset)[nCol];
- else
- nColOffset = (USHORT) (*pLocalColOffset)[nCount - 1];
- }
- pE->nOffset = nColOffset;
- USHORT nWidth = GetWidth( pE );
- MakeCol( pLocalColOffset, pE->nOffset, nWidth );
- if ( pE->nWidth )
- pE->nWidth = nWidth;
- nColOffset = pE->nOffset + nWidth;
- if ( nTableWidth < nColOffset - nColOffsetStart )
- nTableWidth = nColOffset - nColOffsetStart;
+ if ( nCol < pE->nCol )
+ { // verdraengt
+ nCol = pE->nCol - nColCntStart;
+ USHORT nCount = pLocalColOffset->Count();
+ if ( nCol < nCount )
+ nColOffset = (USHORT) (*pLocalColOffset)[nCol];
+ else
+ nColOffset = (USHORT) (*pLocalColOffset)[nCount - 1];
}
+ pE->nOffset = nColOffset;
+ USHORT nWidth = GetWidth( pE );
+ MakeCol( pLocalColOffset, pE->nOffset, nWidth );
+ if ( pE->nWidth )
+ pE->nWidth = nWidth;
+ nColOffset = pE->nOffset + nWidth;
+ if ( nTableWidth < nColOffset - nColOffsetStart )
+ nTableWidth = nColOffset - nColOffsetStart;
}
-void ScHTMLParser::CloseEntry( ImportInfo* pInfo )
+void ScHTMLLayoutParser::CloseEntry( ImportInfo* pInfo )
{
bInCell = FALSE;
if ( bTabInTabCell )
@@ -1161,14 +791,14 @@ void ScHTMLParser::CloseEntry( ImportInfo* pInfo )
DBG_ERRORFILE( "CloseEntry: EditEngine ESelection Start > End" );
rSel.nEndPara = rSel.nStartPara;
}
- if ( rSel.HasRange() && bCalcWidthHeight )
+ if ( rSel.HasRange() )
pActEntry->aItemSet.Put( SfxBoolItem( ATTR_LINEBREAK, TRUE ) );
pList->Insert( pActEntry, LIST_APPEND );
NewActEntry( pActEntry ); // neuer freifliegender pActEntry
}
-IMPL_LINK( ScHTMLParser, HTMLImportHdl, ImportInfo*, pInfo )
+IMPL_LINK( ScHTMLLayoutParser, HTMLImportHdl, ImportInfo*, pInfo )
{
#if defined(erDEBUG) //|| 1
static ESelection aDebugSel;
@@ -1338,7 +968,7 @@ USHORT lcl_KGV( USHORT a, USHORT b )
}
-void ScHTMLParser::TableDataOn( ImportInfo* pInfo )
+void ScHTMLLayoutParser::TableDataOn( ImportInfo* pInfo )
{
if ( bInCell )
CloseEntry( pInfo );
@@ -1427,24 +1057,37 @@ void ScHTMLParser::TableDataOn( ImportInfo* pInfo )
pActEntry->nRow = nRowCnt;
pActEntry->nTab = nTable;
- if( pTableData )
- {
- SkipLocked( pActEntry, FALSE );
- nColCnt = pActEntry->nCol;
- nRowCnt = pActEntry->nRow;
- pTableData->SetCellCoord( nTable, pActEntry->nCol, pActEntry->nRow );
- }
-
if ( bHorJustifyCenterTH )
pActEntry->aItemSet.Put(
SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY) );
}
-void ScHTMLParser::TableOn( ImportInfo* pInfo )
+void ScHTMLLayoutParser::TableRowOn( ImportInfo* pInfo )
+{
+ if ( nColCnt > nColCntStart )
+ NextRow( pInfo ); // das optionale TableRowOff war nicht
+ nColOffset = nColOffsetStart;
+}
+
+
+void ScHTMLLayoutParser::TableRowOff( ImportInfo* pInfo )
+{
+ NextRow( pInfo );
+}
+
+
+void ScHTMLLayoutParser::TableDataOff( ImportInfo* pInfo )
+{
+ if ( bInCell )
+ CloseEntry( pInfo ); // aber nur wenn's auch eine war
+}
+
+
+void ScHTMLLayoutParser::TableOn( ImportInfo* pInfo )
{
String aTabName;
- BOOL bBorderOn = FALSE;
+ bool bBorderOn = false;
if ( ++nTableLevel > 1 )
{ // Table in Table
@@ -1499,10 +1142,6 @@ void ScHTMLParser::TableOn( ImportInfo* pInfo )
nColOffsetStart = nColOffset;
}
- if( pTableData )
- pTableData->InsertTable( nMaxTable + 1, aTabName, pActEntry->nCol, pActEntry->nRow,
- pActEntry->nColOverlap, pActEntry->nRowOverlap, bBorderOn, nTable );
-
ScEEParseEntry* pE = pList->Last();
NewActEntry( pE ); // neuer freifliegender pActEntry
xLockedList = new ScRangeList;
@@ -1544,28 +1183,22 @@ void ScHTMLParser::TableOn( ImportInfo* pInfo )
}
}
}
-
- if( pTableData )
- pTableData->InsertTable( nMaxTable + 1, aTabName, nColCnt, nRowCnt, 1, 1, bBorderOn );
}
nTable = ++nMaxTable;
bFirstRow = TRUE;
nFirstTableCell = pList->Count();
- if( bCalcWidthHeight )
- {
- pLocalColOffset = new ScHTMLColOffset;
- MakeColNoRef( pLocalColOffset, nColOffsetStart, 0, 0, 0 );
- }
+ pLocalColOffset = new ScHTMLColOffset;
+ MakeColNoRef( pLocalColOffset, nColOffsetStart, 0, 0, 0 );
}
-void ScHTMLParser::TableOff( ImportInfo* pInfo )
+void ScHTMLLayoutParser::TableOff( ImportInfo* pInfo )
{
if ( bInCell )
CloseEntry( pInfo );
if ( nColCnt > nColCntStart )
- NextRow( pInfo ); // das optionale TableRowOff war nicht
+ TableRowOff( pInfo ); // das optionale TableRowOff war nicht
if ( !nTableLevel )
{
DBG_ERROR( "Dummbatz-Dok! </TABLE> ohne oeffnendes <TABLE>" );
@@ -1578,7 +1211,7 @@ void ScHTMLParser::TableOff( ImportInfo* pInfo )
{
ScEEParseEntry* pE = pS->pCellEntry;
USHORT nRows = nRowCnt - pS->nRowCnt;
- if ( nRows > 1 && bCalcWidthHeight )
+ if ( nRows > 1 )
{ // Groesse der Tabelle an dieser Position eintragen
USHORT j;
USHORT nCol = nColCntStart;
@@ -1668,23 +1301,20 @@ void ScHTMLParser::TableOff( ImportInfo* pInfo )
}
}
- if( bCalcWidthHeight )
- {
- SetWidths();
+ SetWidths();
- if ( !pE->nWidth )
- pE->nWidth = nTableWidth;
- else if ( pE->nWidth < nTableWidth )
- {
- USHORT nOldOffset = pE->nOffset + pE->nWidth;
- USHORT nNewOffset = pE->nOffset + nTableWidth;
- ModifyOffset( pS->pLocalColOffset, nOldOffset, nNewOffset );
- USHORT nTmp = nNewOffset - pE->nOffset - pE->nWidth;
- pE->nWidth = nNewOffset - pE->nOffset;
- pS->nTableWidth += nTmp;
- if ( pS->nColOffset >= nOldOffset )
- pS->nColOffset += nTmp;
- }
+ if ( !pE->nWidth )
+ pE->nWidth = nTableWidth;
+ else if ( pE->nWidth < nTableWidth )
+ {
+ USHORT nOldOffset = pE->nOffset + pE->nWidth;
+ USHORT nNewOffset = pE->nOffset + nTableWidth;
+ ModifyOffset( pS->pLocalColOffset, nOldOffset, nNewOffset );
+ USHORT nTmp = nNewOffset - pE->nOffset - pE->nWidth;
+ pE->nWidth = nNewOffset - pE->nOffset;
+ pS->nTableWidth += nTmp;
+ if ( pS->nColOffset >= nOldOffset )
+ pS->nColOffset += nTmp;
}
nColCnt = pE->nCol + pE->nColOverlap;
@@ -1728,10 +1358,8 @@ void ScHTMLParser::TableOff( ImportInfo* pInfo )
}
-void ScHTMLParser::Image( ImportInfo* pInfo )
+void ScHTMLLayoutParser::Image( ImportInfo* pInfo )
{
- if( !bCalcWidthHeight ) return;
-
if ( !pActEntry->pImageList )
pActEntry->pImageList = new ScHTMLImageList;
ScHTMLImageList* pIL = pActEntry->pImageList;
@@ -1827,10 +1455,8 @@ void ScHTMLParser::Image( ImportInfo* pInfo )
}
-void ScHTMLParser::ColOn( ImportInfo* pInfo )
+void ScHTMLLayoutParser::ColOn( ImportInfo* pInfo )
{
- if( !bCalcWidthHeight ) return;
-
const HTMLOptions* pOptions = ((HTMLParser*)pInfo->pParser)->GetOptions();
USHORT nArrLen = pOptions->Count();
for ( USHORT i = 0; i < nArrLen; i++ )
@@ -1850,11 +1476,8 @@ void ScHTMLParser::ColOn( ImportInfo* pInfo )
}
-USHORT ScHTMLParser::GetWidthPixel( const HTMLOption* pOption )
+USHORT ScHTMLLayoutParser::GetWidthPixel( const HTMLOption* pOption )
{
- if( !bCalcWidthHeight )
- return 0;
-
const String& rOptVal = pOption->GetString();
if ( rOptVal.Search('%') != STRING_NOTFOUND )
{ // Prozent
@@ -1874,7 +1497,7 @@ USHORT ScHTMLParser::GetWidthPixel( const HTMLOption* pOption )
}
-void ScHTMLParser::AnchorOn( ImportInfo* pInfo )
+void ScHTMLLayoutParser::AnchorOn( ImportInfo* pInfo )
{
const HTMLOptions* pOptions = ((HTMLParser*)pInfo->pParser)->GetOptions();
USHORT nArrLen = pOptions->Count();
@@ -1893,7 +1516,7 @@ void ScHTMLParser::AnchorOn( ImportInfo* pInfo )
}
-BOOL ScHTMLParser::IsAtBeginningOfText( ImportInfo* pInfo )
+BOOL ScHTMLLayoutParser::IsAtBeginningOfText( ImportInfo* pInfo )
{
ESelection& rSel = pActEntry->aSel;
return rSel.nStartPara == rSel.nEndPara &&
@@ -1902,7 +1525,7 @@ BOOL ScHTMLParser::IsAtBeginningOfText( ImportInfo* pInfo )
}
-void ScHTMLParser::FontOn( ImportInfo* pInfo )
+void ScHTMLLayoutParser::FontOn( ImportInfo* pInfo )
{
if ( IsAtBeginningOfText( pInfo ) )
{ // nur am Anfang des Textes, gilt dann fuer gesamte Zelle
@@ -1940,7 +1563,7 @@ void ScHTMLParser::FontOn( ImportInfo* pInfo )
else if ( nSize > SC_HTML_FONTSIZES )
nSize = SC_HTML_FONTSIZES;
pActEntry->aItemSet.Put( SvxFontHeightItem(
- aFontHeights[nSize-1], 100, ATTR_FONT_HEIGHT ) );
+ maFontHeights[nSize-1], 100, ATTR_FONT_HEIGHT ) );
}
break;
case HTML_O_COLOR :
@@ -1956,7 +1579,7 @@ void ScHTMLParser::FontOn( ImportInfo* pInfo )
}
-void ScHTMLParser::ProcToken( ImportInfo* pInfo )
+void ScHTMLLayoutParser::ProcToken( ImportInfo* pInfo )
{
#ifdef DEBUG
HTML_TOKEN_IDS eTokenId = (HTML_TOKEN_IDS)pInfo->nToken;
@@ -1971,8 +1594,8 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
HTMLParser* pParser = (HTMLParser*) pInfo->pParser;
const HTMLOptions* pOptions = pParser->GetOptions( &nContentOpt );
SfxFrameHTMLParser::ParseMetaOptions(
- &pDoc->GetDocumentShell()->GetDocInfo(),
- pDoc->GetDocumentShell()->GetHeaderAttributes(),
+ &mpDoc->GetDocumentShell()->GetDocInfo(),
+ mpDoc->GetDocumentShell()->GetHeaderAttributes(),
pOptions, nMetaCnt, eEnc );
// If the encoding is set by a META tag, it may only overwrite the
// current encoding if both, the current and the new encoding, are 1-BYTE
@@ -1998,7 +1621,7 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
// Leerzeichen von Zeilenumbruechen raus
aString.EraseLeadingChars();
aString.EraseTrailingChars();
- pDoc->GetDocumentShell()->GetDocInfo().SetTitle( aString );
+ mpDoc->GetDocumentShell()->GetDocInfo().SetTitle( aString );
}
bInTitle = FALSE;
}
@@ -2029,20 +1652,17 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
case HTML_TABLEHEADER_OFF:
case HTML_TABLEDATA_OFF: // schliesst Zelle
{
- if ( bInCell )
- CloseEntry( pInfo ); // aber nur wenn's auch eine war
+ TableDataOff( pInfo );
}
break;
case HTML_TABLEROW_ON: // vor erster Zelle in Row
{
- if ( nColCnt > nColCntStart )
- NextRow( pInfo ); // das optionale TableRowOff war nicht
- nColOffset = nColOffsetStart;
+ TableRowOn( pInfo );
}
break;
case HTML_TABLEROW_OFF: // nach letzter Zelle in Row
{
- NextRow( pInfo );
+ TableRowOff( pInfo );
}
break;
case HTML_TABLE_OFF:
@@ -2076,7 +1696,7 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
//2do: aktuelle Fontgroesse merken und einen groesser
if ( IsAtBeginningOfText( pInfo ) )
pActEntry->aItemSet.Put( SvxFontHeightItem(
- aFontHeights[3], 100, ATTR_FONT_HEIGHT ) );
+ maFontHeights[3], 100, ATTR_FONT_HEIGHT ) );
}
break;
case HTML_SMALLPRINT_ON :
@@ -2084,7 +1704,7 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
//2do: aktuelle Fontgroesse merken und einen kleiner
if ( IsAtBeginningOfText( pInfo ) )
pActEntry->aItemSet.Put( SvxFontHeightItem(
- aFontHeights[0], 100, ATTR_FONT_HEIGHT ) );
+ maFontHeights[0], 100, ATTR_FONT_HEIGHT ) );
}
break;
case HTML_BOLD_ON :
@@ -2143,3 +1763,1313 @@ void ScHTMLParser::ProcToken( ImportInfo* pInfo )
+// ============================================================================
+// HTML DATA QUERY PARSER
+// ============================================================================
+
+template< typename Type >
+inline Type bound( const Type& rValue, const Type& rMin, const Type& rMax )
+{ return ::std::max( ::std::min( rValue, rMax ), rMin ); }
+
+
+// ============================================================================
+
+/** Iterates through all HTML tag options of the passed ImportInfo struct. */
+class ScHTMLOptionIterator
+{
+private:
+ const HTMLOptions* mpOptions; /// The options array.
+ const HTMLOption* mpCurrOption; /// Current option.
+ sal_uInt16 mnCount; /// Size of the options array.
+ sal_uInt16 mnIndex; /// Next option to return.
+
+public:
+ explicit ScHTMLOptionIterator( const ImportInfo& rInfo );
+
+ inline bool is() const { return mnIndex < mnCount; }
+ inline const HTMLOption* operator->() const { return mpCurrOption; }
+ inline const HTMLOption& operator*() const { return *mpCurrOption; }
+ ScHTMLOptionIterator& operator++();
+};
+
+
+// ----------------------------------------------------------------------------
+
+ScHTMLOptionIterator::ScHTMLOptionIterator( const ImportInfo& rInfo ) :
+ mpOptions( 0 ),
+ mpCurrOption( 0 ),
+ mnCount( 0 ),
+ mnIndex( 0 )
+{
+ const HTMLParser* pParser = static_cast< const HTMLParser* >( rInfo.pParser );
+ if( pParser )
+ mpOptions = pParser->GetOptions();
+ if( mpOptions )
+ mnCount = mpOptions->Count();
+ if( mnCount )
+ mpCurrOption = mpOptions->GetObject( 0 );
+}
+
+ScHTMLOptionIterator& ScHTMLOptionIterator::operator++()
+{
+ if( mnIndex < mnCount ) ++mnIndex;
+ mpCurrOption = (mnIndex < mnCount) ? mpOptions->GetObject( mnIndex ) : 0;
+ return *this;
+}
+
+
+// ============================================================================
+
+ScHTMLEntry::ScHTMLEntry( const SfxItemSet& rItemSet, ScHTMLTableId nTableId ) :
+ ScEEParseEntry( rItemSet ),
+ mbImportAlways( false )
+{
+ nTab = nTableId;
+ bEntirePara = false;
+}
+
+bool ScHTMLEntry::HasContents() const
+{
+ return mbImportAlways || aSel.HasRange() || aAltText.Len() || IsTable();
+}
+
+void ScHTMLEntry::AdjustStart( const ImportInfo& rInfo )
+{
+ // set start position
+ aSel.nStartPara = rInfo.aSelection.nStartPara;
+ aSel.nStartPos = rInfo.aSelection.nStartPos;
+ // adjust end position
+ if( (aSel.nEndPara < aSel.nStartPara) || ((aSel.nEndPara == aSel.nStartPara) && (aSel.nEndPos < aSel.nStartPos)) )
+ {
+ aSel.nEndPara = aSel.nStartPara;
+ aSel.nEndPos = aSel.nStartPos;
+ }
+}
+
+void ScHTMLEntry::AdjustEnd( const ImportInfo& rInfo )
+{
+ DBG_ASSERT( (aSel.nEndPara < rInfo.aSelection.nEndPara) ||
+ ((aSel.nEndPara == rInfo.aSelection.nEndPara) && (aSel.nEndPos <= rInfo.aSelection.nEndPos)),
+ "ScHTMLQueryParser::AdjustEntryEnd - invalid end position" );
+ // set end position
+ aSel.nEndPara = rInfo.aSelection.nEndPara;
+ aSel.nEndPos = rInfo.aSelection.nEndPos;
+}
+
+void ScHTMLEntry::Strip( const EditEngine& rEditEngine )
+{
+ // strip leading empty paragraphs
+ while( (aSel.nStartPara < aSel.nEndPara) && (rEditEngine.GetTextLen( aSel.nStartPara ) <= aSel.nStartPos) )
+ {
+ ++aSel.nStartPara;
+ aSel.nStartPos = 0;
+ }
+ // strip trailing empty paragraphs
+ while( (aSel.nStartPara < aSel.nEndPara) && (aSel.nEndPos == 0) )
+ {
+ --aSel.nEndPara;
+ aSel.nEndPos = rEditEngine.GetTextLen( aSel.nEndPara );
+ }
+}
+
+
+// ============================================================================
+
+/** A map of ScHTMLTable objects.
+ @descr Organizes the tables with a unique table key. Stores nested tables inside
+ the parent table and forms in this way a tree structure of tables.
+ An instance of this class ownes the contained table objects and deletes them
+ on destruction. */
+class ScHTMLTableMap
+{
+private:
+ typedef ::boost::shared_ptr< ScHTMLTable > ScHTMLTablePtr;
+ typedef ::std::map< ScHTMLTableId, ScHTMLTablePtr > ScHTMLTableStdMap;
+
+public:
+ typedef ScHTMLTableStdMap::iterator iterator;
+ typedef ScHTMLTableStdMap::const_iterator const_iterator;
+
+private:
+ ScHTMLTable& mrParentTable; /// Reference to parent table.
+ ScHTMLTableStdMap maTables; /// Container for all table objects.
+ mutable ScHTMLTable* mpCurrTable; /// Current table, used for fast search.
+
+public:
+ explicit ScHTMLTableMap( ScHTMLTable& rParentTable );
+ virtual ~ScHTMLTableMap();
+
+ inline iterator begin() { return maTables.begin(); }
+ inline const_iterator begin() const { return maTables.begin(); }
+ inline iterator end() { return maTables.end(); }
+ inline const_iterator end() const { return maTables.end(); }
+ inline bool empty() const { return maTables.empty(); }
+
+ /** Returns the specified table.
+ @param nTableId Unique identifier of the table.
+ @param bDeep true = searches deep in all nested table; false = only in this container. */
+ ScHTMLTable* FindTable( ScHTMLTableId nTableId, bool bDeep = true ) const;
+
+ /** Inserts a new table into the container. This container owns the created table.
+ @param bPreFormText true = New table is based on preformatted text (<pre> tag). */
+ ScHTMLTable* CreateTable( const ImportInfo& rInfo, bool bPreFormText );
+
+private:
+ /** Sets a working table with its index for search optimization. */
+ inline void SetCurrTable( ScHTMLTable* pTable ) const
+ { if( pTable ) mpCurrTable = pTable; }
+};
+
+
+// ----------------------------------------------------------------------------
+
+ScHTMLTableMap::ScHTMLTableMap( ScHTMLTable& rParentTable ) :
+ mrParentTable( rParentTable )
+{
+}
+
+ScHTMLTableMap::~ScHTMLTableMap()
+{
+}
+
+ScHTMLTable* ScHTMLTableMap::FindTable( ScHTMLTableId nTableId, bool bDeep ) const
+{
+ ScHTMLTable* pResult = 0;
+ if( mpCurrTable && (nTableId == mpCurrTable->GetTableId()) )
+ pResult = mpCurrTable; // cached table
+ else
+ {
+ const_iterator aFind = maTables.find( nTableId );
+ if( aFind != maTables.end() )
+ pResult = aFind->second.get(); // table from this container
+ }
+
+ // not found -> search deep in nested tables
+ if( !pResult && bDeep )
+ for( const_iterator aIter = begin(), aEnd = end(); !pResult && (aIter != aEnd); ++aIter )
+ pResult = aIter->second->FindNestedTable( nTableId );
+
+ SetCurrTable( pResult );
+ return pResult;
+}
+
+ScHTMLTable* ScHTMLTableMap::CreateTable( const ImportInfo& rInfo, bool bPreFormText )
+{
+ ScHTMLTable* pTable = new ScHTMLTable( mrParentTable, rInfo, bPreFormText );
+ maTables[ pTable->GetTableId() ].reset( pTable );
+ SetCurrTable( pTable );
+ return pTable;
+}
+
+
+// ----------------------------------------------------------------------------
+
+/** Simplified forward iterator for convenience.
+ @descr Before the iterator can be dereferenced, it must be tested with the
+ is() method. The iterator may be invalid directly after construction
+ (i.e. empty container). */
+class ScHTMLTableIterator
+{
+private:
+ ScHTMLTableMap::const_iterator maIter;
+ ScHTMLTableMap::const_iterator maEnd;
+
+public:
+ /** Constructs the iterator for the passed table map.
+ @param pTableMap Pointer to the table map (is allowed to be NULL). */
+ explicit ScHTMLTableIterator( const ScHTMLTableMap* pTableMap );
+
+ inline bool is() const { return maIter != maEnd; }
+ inline ScHTMLTable* operator->() { return maIter->second.get(); }
+ inline ScHTMLTable& operator*() { return *maIter->second; }
+ inline ScHTMLTableIterator& operator++() { ++maIter; return *this; }
+};
+
+ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap )
+{
+ if( pTableMap )
+ {
+ maIter = pTableMap->begin();
+ maEnd = pTableMap->end();
+ }
+}
+
+
+// ============================================================================
+
+ScHTMLTableAutoId::ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId ) :
+ mnTableId( rnUnusedId ),
+ mrnUnusedId( rnUnusedId )
+{
+ ++mrnUnusedId;
+}
+
+
+// ----------------------------------------------------------------------------
+
+ScHTMLTable::ScHTMLTable( ScHTMLTable& rParentTable, const ImportInfo& rInfo, bool bPreFormText ) :
+ mpParentTable( &rParentTable ),
+ maTableId( rParentTable.maTableId.mrnUnusedId ),
+ maTableItemSet( rParentTable.GetCurrItemSet() ),
+ mrEditEngine( rParentTable.mrEditEngine ),
+ mrEEParseList( rParentTable.mrEEParseList ),
+ mpCurrEntryList( 0 ),
+ maSize( 1, 1 ),
+ mbBorderOn( false ),
+ mbPreFormText( bPreFormText ),
+ mbRowOn( false ),
+ mbDataOn( false ),
+ mbPushEmptyLine( false )
+{
+ if( mbPreFormText )
+ {
+ ImplRowOn();
+ ImplDataOn( ScHTMLSize( 1, 1 ) );
+ }
+ else
+ {
+ ProcessFormatOptions( maTableItemSet, rInfo );
+ for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+ {
+ switch( aIter->GetToken() )
+ {
+ case HTML_O_BORDER:
+ mbBorderOn = ((aIter->GetString().Len() == 0) || (aIter->GetNumber() != 0));
+ break;
+ case HTML_O_ID:
+ maTableName = aIter->GetString();
+ break;
+ }
+ }
+ }
+
+ CreateNewEntry( rInfo );
+}
+
+ScHTMLTable::ScHTMLTable( SfxItemPool& rPool, EditEngine& rEditEngine, ScEEParseList& rEEParseList, ScHTMLTableId& rnUnusedId ) :
+ mpParentTable( 0 ),
+ maTableId( rnUnusedId ),
+ maTableItemSet( rPool ),
+ mrEditEngine( rEditEngine ),
+ mrEEParseList( rEEParseList ),
+ mpCurrEntryList( 0 ),
+ maSize( 1, 1 ),
+ mbBorderOn( false ),
+ mbPreFormText( false ),
+ mbRowOn( false ),
+ mbDataOn( false ),
+ mbPushEmptyLine( false )
+{
+ // open the first "cell" of the document
+ ImplRowOn();
+ ImplDataOn( ScHTMLSize( 1, 1 ) );
+ mpCurrEntry.reset( CreateEntry() );
+}
+
+ScHTMLTable::~ScHTMLTable()
+{
+}
+
+const SfxItemSet& ScHTMLTable::GetCurrItemSet() const
+{
+ // first try cell item set, then row item set, then table item set
+ return mpDataItemSet.get() ? *mpDataItemSet : (mpRowItemSet.get() ? *mpRowItemSet : maTableItemSet);
+}
+
+ScHTMLSize ScHTMLTable::GetSpan( const ScHTMLPos& rCellPos )
+{
+ ScHTMLSize aSpan( 1, 1 );
+ if( ScRange* pRange = maLockList.Find( rCellPos.MakeAddr() ) )
+ aSpan.Set( pRange->aEnd.Col() - pRange->aStart.Col() + 1, pRange->aEnd.Row() - pRange->aStart.Row() + 1 );
+ return aSpan;
+}
+
+ScHTMLTable* ScHTMLTable::FindNestedTable( ScHTMLTableId nTableId ) const
+{
+ return mpNestedTables.get() ? mpNestedTables->FindTable( nTableId, true ) : 0;
+}
+
+void ScHTMLTable::PutItem( const SfxPoolItem& rItem )
+{
+ DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PutItem - no current entry" );
+ if( mpCurrEntry.get() && mpCurrEntry->IsEmpty() )
+ mpCurrEntry->aItemSet.Put( rItem );
+}
+
+void ScHTMLTable::PutText( const ImportInfo& rInfo )
+{
+ DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PutText - no current entry" );
+ if( mpCurrEntry.get() )
+ {
+ if( !mpCurrEntry->HasContents() && IsSpaceCharInfo( rInfo ) )
+ mpCurrEntry->AdjustStart( rInfo );
+ else
+ mpCurrEntry->AdjustEnd( rInfo );
+ }
+}
+
+void ScHTMLTable::InsertPara( const ImportInfo& rInfo )
+{
+ if( mpCurrEntry.get() && mbDataOn && !IsEmptyCell() )
+ mpCurrEntry->SetImportAlways();
+ PushEntry( rInfo );
+ CreateNewEntry( rInfo );
+ InsertLeadingEmptyLine();
+}
+
+void ScHTMLTable::BreakOn()
+{
+ // empty line, if <br> is at start of cell
+ mbPushEmptyLine = !mbPreFormText && mbDataOn && IsEmptyCell();
+}
+
+void ScHTMLTable::HeadingOn()
+{
+ // call directly, InsertPara() has not been called before
+ InsertLeadingEmptyLine();
+}
+
+void ScHTMLTable::InsertLeadingEmptyLine()
+{
+ // empty line, if <p>, </p>, <h?>, or </h*> are not at start of cell
+ mbPushEmptyLine = !mbPreFormText && mbDataOn && !IsEmptyCell();
+}
+
+void ScHTMLTable::AnchorOn()
+{
+ DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::AnchorOn - no current entry" );
+ // don't skip entries with single hyperlinks
+ if( mpCurrEntry.get() )
+ mpCurrEntry->SetImportAlways();
+}
+
+ScHTMLTable* ScHTMLTable::TableOn( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo );
+ return InsertNestedTable( rInfo, false );
+}
+
+ScHTMLTable* ScHTMLTable::TableOff( const ImportInfo& rInfo )
+{
+ return mbPreFormText ? this : CloseTable( rInfo );
+}
+
+ScHTMLTable* ScHTMLTable::PreOn( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo );
+ return InsertNestedTable( rInfo, true );
+}
+
+ScHTMLTable* ScHTMLTable::PreOff( const ImportInfo& rInfo )
+{
+ return mbPreFormText ? CloseTable( rInfo ) : this;
+}
+
+void ScHTMLTable::RowOn( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo, true );
+ if( mpParentTable && !mbPreFormText ) // no rows allowed in global and preformatted tables
+ {
+ ImplRowOn();
+ ProcessFormatOptions( *mpRowItemSet, rInfo );
+ }
+ CreateNewEntry( rInfo );
+}
+
+void ScHTMLTable::RowOff( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo, true );
+ if( mpParentTable && !mbPreFormText ) // no rows allowed in global and preformatted tables
+ ImplRowOff();
+ CreateNewEntry( rInfo );
+}
+
+void ScHTMLTable::DataOn( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo, true );
+ if( mpParentTable && !mbPreFormText ) // no cells allowed in global and preformatted tables
+ {
+ // read needed options from the <td> tag
+ ScHTMLSize aSpanSize( 1, 1 );
+ ::std::auto_ptr< String > pValStr, pNumStr;
+ for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+ {
+ switch( aIter->GetToken() )
+ {
+ case HTML_O_COLSPAN:
+ aSpanSize.mnCols = static_cast< sal_uInt16 >( bound( aIter->GetString().ToInt32(), 1L, 256L ) );
+ break;
+ case HTML_O_ROWSPAN:
+ aSpanSize.mnRows = static_cast< sal_uInt16 >( bound( aIter->GetString().ToInt32(), 1L, 256L ) );
+ break;
+ case HTML_O_SDVAL:
+ pValStr.reset( new String( aIter->GetString() ) );
+ break;
+ case HTML_O_SDNUM:
+ pNumStr.reset( new String( aIter->GetString() ) );
+ break;
+ }
+ }
+
+ ImplDataOn( aSpanSize );
+ ProcessFormatOptions( *mpDataItemSet, rInfo );
+ CreateNewEntry( rInfo );
+ mpCurrEntry->pValStr = pValStr.release();
+ mpCurrEntry->pNumStr = pNumStr.release();
+ }
+ else
+ CreateNewEntry( rInfo );
+}
+
+void ScHTMLTable::DataOff( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo, true );
+ if( mpParentTable && !mbPreFormText ) // no cells allowed in global and preformatted tables
+ ImplDataOff();
+ CreateNewEntry( rInfo );
+}
+
+void ScHTMLTable::BodyOn( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo );
+ if( !mpParentTable )
+ {
+ ImplRowOn();
+ ProcessFormatOptions( *mpRowItemSet, rInfo );
+ ImplDataOn( ScHTMLSize( 1, 1 ) );
+ }
+ CreateNewEntry( rInfo );
+}
+
+void ScHTMLTable::BodyOff( const ImportInfo& rInfo )
+{
+ PushEntry( rInfo );
+ if( !mpParentTable )
+ {
+ ImplDataOff();
+ ImplRowOff();
+ }
+ CreateNewEntry( rInfo );
+}
+
+sal_uInt16 ScHTMLTable::GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos ) const
+{
+ const ScSizeVec& rSizes = maSizes[ eOrient ];
+ return (nCellPos < rSizes.size()) ? rSizes[ nCellPos ] : 0;
+}
+
+sal_uInt16 ScHTMLTable::GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellBegin, sal_uInt16 nCellEnd ) const
+{
+ sal_uInt16 nSize = 0;
+ for( sal_uInt16 nCellPos = nCellBegin; nCellPos < nCellEnd; ++nCellPos )
+ nSize += GetDocSize( eOrient, nCellPos );
+ return nSize;
+}
+
+sal_uInt16 ScHTMLTable::GetDocSize( ScHTMLOrient eOrient ) const
+{
+ return GetDocSize( eOrient, 0, maSize.Get( eOrient ) );
+}
+
+sal_uInt16 ScHTMLTable::GetDocPos( ScHTMLOrient eOrient, sal_uInt16 nCellPos ) const
+{
+ return maDocBasePos.Get( eOrient ) + GetDocSize( eOrient, 0, nCellPos );
+}
+
+ScHTMLPos ScHTMLTable::GetDocPos( const ScHTMLPos& rCellPos ) const
+{
+ return ScHTMLPos( GetDocPos( tdCol, rCellPos.mnCol ), GetDocPos( tdRow, rCellPos.mnRow ) );
+}
+
+void ScHTMLTable::GetDocRange( ScRange& rRange ) const
+{
+ rRange.aStart = rRange.aEnd = maDocBasePos.MakeAddr();
+ rRange.aEnd.Move( GetDocSize( tdCol ) - 1, GetDocSize( tdRow ) - 1, 0 );
+}
+
+void ScHTMLTable::ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const
+{
+ DBG_ASSERT( pDoc, "ScHTMLTable::ApplyCellBorders - no document" );
+ if( pDoc && mbBorderOn )
+ {
+ const sal_uInt16 nLastCol = maSize.mnCols - 1;
+ const sal_uInt16 nLastRow = maSize.mnRows - 1;
+ const sal_uInt16 nOuterLine = DEF_LINE_WIDTH_2;
+ const sal_uInt16 nInnerLine = DEF_LINE_WIDTH_0;
+ SvxBorderLine aOuterLine, aInnerLine;
+ aOuterLine.SetColor( Color( COL_BLACK ) );
+ aOuterLine.SetOutWidth( nOuterLine );
+ aInnerLine.SetColor( Color( COL_BLACK ) );
+ aInnerLine.SetOutWidth( nInnerLine );
+ SvxBoxItem aBorderItem;
+
+ for( sal_uInt16 nCol = 0; nCol <= nLastCol; ++nCol )
+ {
+ SvxBorderLine* pLeftLine = (nCol == 0) ? &aOuterLine : &aInnerLine;
+ SvxBorderLine* pRightLine = (nCol == nLastCol) ? &aOuterLine : &aInnerLine;
+ sal_uInt16 nCellCol1 = GetDocPos( tdCol, nCol ) + rFirstPos.Col();
+ sal_uInt16 nCellCol2 = nCellCol1 + GetDocSize( tdCol, nCol ) - 1;
+ for( sal_uInt16 nRow = 0; nRow <= nLastRow; ++nRow )
+ {
+ SvxBorderLine* pTopLine = (nRow == 0) ? &aOuterLine : &aInnerLine;
+ SvxBorderLine* pBottomLine = (nRow == nLastRow) ? &aOuterLine : &aInnerLine;
+ sal_uInt16 nCellRow1 = GetDocPos( tdRow, nRow ) + rFirstPos.Row();
+ sal_uInt16 nCellRow2 = nCellRow1 + GetDocSize( tdRow, nRow ) - 1;
+ for( sal_uInt16 nCellCol = nCellCol1; nCellCol <= nCellCol2; ++nCellCol )
+ {
+ aBorderItem.SetLine( (nCellCol == nCellCol1) ? pLeftLine : 0, BOX_LINE_LEFT );
+ aBorderItem.SetLine( (nCellCol == nCellCol2) ? pRightLine : 0, BOX_LINE_RIGHT );
+ for( sal_uInt16 nCellRow = nCellRow1; nCellRow <= nCellRow2; ++nCellRow )
+ {
+ aBorderItem.SetLine( (nCellRow == nCellRow1) ? pTopLine : 0, BOX_LINE_TOP );
+ aBorderItem.SetLine( (nCellRow == nCellRow2) ? pBottomLine : 0, BOX_LINE_BOTTOM );
+ pDoc->ApplyAttr( nCellCol, nCellRow, rFirstPos.Tab(), aBorderItem );
+ }
+ }
+ }
+ }
+ }
+
+ for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ aIter->ApplyCellBorders( pDoc, rFirstPos );
+}
+
+
+// ----------------------------------------------------------------------------
+
+bool ScHTMLTable::IsEmptyCell() const
+{
+ return mpCurrEntryList && mpCurrEntryList->empty();
+}
+
+bool ScHTMLTable::IsSpaceCharInfo( const ImportInfo& rInfo )
+{
+ return (rInfo.nToken == HTML_TEXTTOKEN) && (rInfo.aText.Len() == 1) && (rInfo.aText.GetChar( 0 ) == ' ');
+}
+
+ScHTMLEntry* ScHTMLTable::CreateEntry() const
+{
+ return new ScHTMLEntry( GetCurrItemSet() );
+}
+
+void ScHTMLTable::CreateNewEntry( const ImportInfo& rInfo )
+{
+ DBG_ASSERT( !mpCurrEntry.get(), "ScHTMLTable::CreateNewEntry - old entry still present" );
+ mpCurrEntry.reset( CreateEntry() );
+ mpCurrEntry->aSel = rInfo.aSelection;
+}
+
+void ScHTMLTable::ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rpEntry )
+{
+ // HTML entry list does not own the entries
+ rEntryList.push_back( rpEntry.get() );
+ // mrEEParseList (reference to member of ScEEParser) owns the entries
+ mrEEParseList.Insert( rpEntry.release(), LIST_APPEND );
+}
+
+void ScHTMLTable::PushEntry( ScHTMLEntryPtr& rpEntry )
+{
+ if( rpEntry.get() && rpEntry->HasContents() )
+ {
+ if( mpCurrEntryList )
+ {
+ if( mbPushEmptyLine )
+ {
+ ScHTMLEntryPtr pEmptyEntry( CreateEntry() );
+ ImplPushEntryToList( *mpCurrEntryList, pEmptyEntry );
+ mbPushEmptyLine = false;
+ }
+ ImplPushEntryToList( *mpCurrEntryList, rpEntry );
+ }
+ else if( mpParentTable )
+ mpParentTable->PushEntry( rpEntry );
+ else
+ DBG_ERRORFILE( "ScHTMLTable::PushEntry - cannot push entry, no parent found" );
+ }
+}
+
+void ScHTMLTable::PushEntry( const ImportInfo& rInfo, bool bLastInCell )
+{
+ DBG_ASSERT( mpCurrEntry.get(), "ScHTMLTable::PushEntry - no current entry" );
+ if( mpCurrEntry.get() )
+ {
+ mpCurrEntry->AdjustEnd( rInfo );
+ mpCurrEntry->Strip( mrEditEngine );
+
+ // import entry always, if it is the last in cell, and cell is still empty
+ if( bLastInCell && IsEmptyCell() )
+ {
+ mpCurrEntry->SetImportAlways();
+ // don't insert empty lines before single empty entries
+ if( mpCurrEntry->IsEmpty() )
+ mbPushEmptyLine = false;
+ }
+
+ PushEntry( mpCurrEntry );
+ mpCurrEntry.reset();
+ }
+}
+
+void ScHTMLTable::PushTableEntry( ScHTMLTableId nTableId )
+{
+ DBG_ASSERT( nTableId != SC_HTML_GLOBAL_TABLE, "ScHTMLTable::PushTableEntry - cannot push global table" );
+ if( nTableId != SC_HTML_GLOBAL_TABLE )
+ {
+ ScHTMLEntryPtr pEntry( new ScHTMLEntry( maTableItemSet, nTableId ) );
+ PushEntry( pEntry );
+ }
+}
+
+ScHTMLTable* ScHTMLTable::GetExistingTable( ScHTMLTableId nTableId ) const
+{
+ ScHTMLTable* pTable = ((nTableId != SC_HTML_GLOBAL_TABLE) && mpNestedTables.get()) ?
+ mpNestedTables->FindTable( nTableId, false ) : 0;
+ DBG_ASSERT( pTable || (nTableId == SC_HTML_GLOBAL_TABLE), "ScHTMLTable::GetExistingTable - table not found" );
+ return pTable;
+}
+
+ScHTMLTable* ScHTMLTable::InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText )
+{
+ if( !mpNestedTables.get() )
+ mpNestedTables.reset( new ScHTMLTableMap( *this ) );
+ if( bPreFormText ) // enclose new preformatted table with empty lines
+ InsertLeadingEmptyLine();
+ return mpNestedTables->CreateTable( rInfo, bPreFormText );
+}
+
+ScHTMLTable* ScHTMLTable::CloseTable( const ImportInfo& rInfo )
+{
+ if( mpParentTable ) // not allowed to close global table
+ {
+ PushEntry( rInfo, mbDataOn );
+ ImplDataOff();
+ ImplRowOff();
+ mpParentTable->PushTableEntry( GetTableId() );
+ mpParentTable->CreateNewEntry( rInfo );
+ if( mbPreFormText ) // enclose preformatted table with empty lines in parent table
+ mpParentTable->InsertLeadingEmptyLine();
+ return mpParentTable;
+ }
+ return this;
+}
+
+void ScHTMLTable::InsertNewCell( const ScHTMLSize& rSpanSize )
+{
+ ScRange* pRange;
+
+ // find an unused cell
+ while( (pRange = maLockList.Find( maCurrCell.MakeAddr() )) != 0 )
+ maCurrCell.mnCol = pRange->aEnd.Col() + 1;
+ mpCurrEntryList = &maEntryMap[ maCurrCell ];
+
+ // try to find collisions, shrink existing ranges
+ sal_uInt16 nColEnd = maCurrCell.mnCol + rSpanSize.mnCols;
+ for( ScAddress aAddr( maCurrCell.MakeAddr() ); aAddr.Col() < nColEnd; aAddr.IncCol() )
+ if( (pRange = maLockList.Find( aAddr )) != 0 )
+ pRange->aEnd.SetRow( maCurrCell.mnRow - 1 );
+
+ // insert the new range into the lock list
+ ScRange aNewRange( maCurrCell.MakeAddr() );
+ aNewRange.aEnd.Move( rSpanSize.mnCols - 1, rSpanSize.mnRows - 1, 0 );
+ maLockList.Append( aNewRange );
+
+ // adjust table size
+ maSize.mnCols = ::std::max< sal_uInt16 >( maSize.mnCols, aNewRange.aEnd.Col() + 1 );
+ maSize.mnRows = ::std::max< sal_uInt16 >( maSize.mnRows, aNewRange.aEnd.Row() + 1 );
+}
+
+void ScHTMLTable::ImplRowOn()
+{
+ if( mbRowOn )
+ ImplRowOff();
+ mpRowItemSet.reset( new SfxItemSet( maTableItemSet ) );
+ maCurrCell.mnCol = 0;
+ mbRowOn = true;
+ mbDataOn = false;
+}
+
+void ScHTMLTable::ImplRowOff()
+{
+ if( mbDataOn )
+ ImplDataOff();
+ if( mbRowOn )
+ {
+ mpRowItemSet.reset();
+ ++maCurrCell.mnRow;
+ mbRowOn = mbDataOn = false;
+ }
+}
+
+void ScHTMLTable::ImplDataOn( const ScHTMLSize& rSpanSize )
+{
+ if( mbDataOn )
+ ImplDataOff();
+ if( !mbRowOn )
+ ImplRowOn();
+ mpDataItemSet.reset( new SfxItemSet( *mpRowItemSet ) );
+ InsertNewCell( rSpanSize );
+ mbDataOn = true;
+ mbPushEmptyLine = false;
+}
+
+void ScHTMLTable::ImplDataOff()
+{
+ if( mbDataOn )
+ {
+ mpDataItemSet.reset();
+ ++maCurrCell.mnCol;
+ mpCurrEntryList = 0;
+ mbDataOn = false;
+ }
+}
+
+void ScHTMLTable::ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo& rInfo )
+{
+ // special handling for table header cells
+ if( rInfo.nToken == HTML_TABLEHEADER_ON )
+ {
+ rItemSet.Put( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
+ rItemSet.Put( SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) );
+ }
+
+ for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+ {
+ switch( aIter->GetToken() )
+ {
+ case HTML_O_ALIGN:
+ {
+ SvxCellHorJustify eVal = SVX_HOR_JUSTIFY_STANDARD;
+ const String& rOptVal = aIter->GetString();
+ if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_right ) )
+ eVal = SVX_HOR_JUSTIFY_RIGHT;
+ else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_center ) )
+ eVal = SVX_HOR_JUSTIFY_CENTER;
+ else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_AL_left ) )
+ eVal = SVX_HOR_JUSTIFY_LEFT;
+ if( eVal != SVX_HOR_JUSTIFY_STANDARD )
+ rItemSet.Put( SvxHorJustifyItem( eVal, ATTR_HOR_JUSTIFY ) );
+ }
+ break;
+
+ case HTML_O_VALIGN:
+ {
+ SvxCellVerJustify eVal = SVX_VER_JUSTIFY_STANDARD;
+ const String& rOptVal = aIter->GetString();
+ if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_top ) )
+ eVal = SVX_VER_JUSTIFY_TOP;
+ else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_middle ) )
+ eVal = SVX_VER_JUSTIFY_CENTER;
+ else if( rOptVal.EqualsIgnoreCaseAscii( sHTML_VA_bottom ) )
+ eVal = SVX_VER_JUSTIFY_BOTTOM;
+ if( eVal != SVX_VER_JUSTIFY_STANDARD )
+ rItemSet.Put( SvxVerJustifyItem( eVal, ATTR_VER_JUSTIFY ) );
+ }
+ break;
+
+ case HTML_O_BGCOLOR:
+ {
+ Color aColor;
+ aIter->GetColor( aColor );
+ rItemSet.Put( SvxBrushItem( aColor, ATTR_BACKGROUND ) );
+ }
+ break;
+ }
+ }
+}
+
+void ScHTMLTable::SetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos, sal_uInt16 nSize )
+{
+ ScSizeVec& rSizes = maSizes[ eOrient ];
+ if( nCellPos >= rSizes.size() )
+ rSizes.resize( nCellPos + 1, 1 ); // expand with minimum height/width == 1
+ if( rSizes[ nCellPos ] < nSize )
+ rSizes[ nCellPos ] = nSize;
+}
+
+void ScHTMLTable::CalcNeededDocSize(
+ ScHTMLOrient eOrient, sal_uInt16 nCellPos, sal_uInt16 nCellSpan, sal_uInt16 nRealDocSize )
+{
+ sal_uInt16 nDiffSize = 0;
+ // in merged columns/rows: reduce needed size by size of leading columns
+ while( nCellSpan > 1 )
+ {
+ nDiffSize += GetDocSize( eOrient, nCellPos );
+ --nCellSpan;
+ ++nCellPos;
+ }
+ // set remaining needed size to last column/row
+ nRealDocSize -= ::std::min< sal_uInt16 >( nRealDocSize - 1, nDiffSize );
+ SetDocSize( eOrient, nCellPos, nRealDocSize );
+}
+
+
+// ----------------------------------------------------------------------------
+
+void ScHTMLTable::FillEmptyCells()
+{
+ for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ aIter->FillEmptyCells();
+
+ for( ScAddress aAddr; aAddr.Row() < maSize.mnRows; aAddr.IncRow() )
+ {
+ for( aAddr.SetCol( 0 ); aAddr.Col() < maSize.mnCols; aAddr.IncCol() )
+ {
+ if( !maLockList.Find( aAddr ) )
+ {
+ // create a range for the lock list (used to calc. cell span)
+ ScRange aRange( aAddr );
+ do
+ aRange.aEnd.IncCol();
+ while( (aRange.aEnd.Col() < maSize.mnCols) && !maLockList.Find( aRange.aEnd ) );
+ aRange.aEnd.IncCol( -1 );
+ maLockList.Append( aRange );
+
+ // insert a dummy entry
+ ScHTMLEntryPtr pEntry( CreateEntry() );
+ ImplPushEntryToList( maEntryMap[ ScHTMLPos( aAddr ) ], pEntry );
+ }
+ }
+ }
+}
+
+void ScHTMLTable::RecalcDocSize()
+{
+ // recalc table sizes recursively from inner to outer
+ for( ScHTMLTableIterator aIter( mpNestedTables.get() ); aIter.is(); ++aIter )
+ aIter->RecalcDocSize();
+
+ /* Two passes: first calculates the sizes of single columns/rows, then
+ the sizes of spanned columns/rows. This allows to fill nested tables
+ into merged cells optimally. */
+ static const sal_uInt16 PASS_SINGLE = 0;
+ static const sal_uInt16 PASS_SPANNED = 1;
+ for( sal_uInt16 nPass = PASS_SINGLE; nPass <= PASS_SPANNED; ++nPass )
+ {
+ // iterate through every table cell
+ ScHTMLEntryMap::const_iterator aMapIterEnd = maEntryMap.end();
+ for( ScHTMLEntryMap::const_iterator aMapIter = maEntryMap.begin(); aMapIter != aMapIterEnd; ++aMapIter )
+ {
+ const ScHTMLPos& rCellPos = aMapIter->first;
+ ScHTMLSize aCellSpan( GetSpan( rCellPos ) );
+
+ const ScHTMLEntryList& rEntryList = aMapIter->second;
+ ScHTMLEntryList::const_iterator aListIter;
+ ScHTMLEntryList::const_iterator aListIterEnd = rEntryList.end();
+
+ // process the dimension of the current cell in this pass?
+ // (pass is single and span is 1) or (pass is not single and span is not 1)
+ bool bProcessColWidth = ((nPass == PASS_SINGLE) == (aCellSpan.mnCols == 1));
+ bool bProcessRowHeight = ((nPass == PASS_SINGLE) == (aCellSpan.mnRows == 1));
+ if( bProcessColWidth || bProcessRowHeight )
+ {
+ ScHTMLSize aDocSize( 1, 0 ); // resulting size of the cell in document
+
+ // expand the cell size for each cell parse entry
+ for( aListIter = rEntryList.begin(); aListIter != aListIterEnd; ++aListIter )
+ {
+ ScHTMLTable* pTable = GetExistingTable( (*aListIter)->GetTableId() );
+ // find entry with maximum width
+ if( bProcessColWidth && pTable )
+ aDocSize.mnCols = ::std::max( aDocSize.mnCols, pTable->GetDocSize( tdCol ) );
+ // add up height of each entry
+ if( bProcessRowHeight )
+ aDocSize.mnRows += pTable ? pTable->GetDocSize( tdRow ) : 1;
+ }
+ if( !aDocSize.mnRows )
+ aDocSize.mnRows = 1;
+
+ if( bProcessColWidth )
+ CalcNeededDocSize( tdCol, rCellPos.mnCol, aCellSpan.mnCols, aDocSize.mnCols );
+ if( bProcessRowHeight )
+ CalcNeededDocSize( tdRow, rCellPos.mnRow, aCellSpan.mnRows, aDocSize.mnRows );
+ }
+ }
+ }
+}
+
+void ScHTMLTable::RecalcDocPos( const ScHTMLPos& rBasePos )
+{
+ maDocBasePos = rBasePos;
+ // after the previous assignment it is allowed to call GetDocPos() methods
+
+ // iterate through every table cell
+ ScHTMLEntryMap::iterator aMapIterEnd = maEntryMap.end();
+ for( ScHTMLEntryMap::iterator aMapIter = maEntryMap.begin(); aMapIter != aMapIterEnd; ++aMapIter )
+ {
+ const ScHTMLPos& rCellPos = aMapIter->first;
+ ScHTMLSize aCellSpan( GetSpan( rCellPos ) );
+ ScHTMLPos aEntryDocPos( GetDocPos( rCellPos ) );
+
+ ScHTMLEntryList& rEntryList = aMapIter->second;
+ ScHTMLEntry* pEntry = 0;
+ ScHTMLEntryList::iterator aListIterEnd = rEntryList.end();
+ for( ScHTMLEntryList::iterator aListIter = rEntryList.begin(); aListIter != aListIterEnd; ++aListIter )
+ {
+ pEntry = *aListIter;
+ if( ScHTMLTable* pTable = GetExistingTable( pEntry->GetTableId() ) )
+ {
+ pTable->RecalcDocPos( aEntryDocPos ); // recalc nested table
+ pEntry->nCol = pEntry->nRow = 0xFFFF;
+ sal_uInt16 nRows = pTable->GetDocSize( tdRow );
+
+ // use this entry to pad empty space right of table
+ if( mpParentTable ) // ... but not in global table
+ {
+ sal_uInt16 nStartCol = GetDocPos( tdCol, rCellPos.mnCol ) + pTable->GetDocSize( tdCol );
+ sal_uInt16 nNextCol = GetDocPos( tdCol, rCellPos.mnCol + 1 );
+ if( nStartCol < nNextCol )
+ {
+ pEntry->nCol = nStartCol;
+ pEntry->nRow = aEntryDocPos.mnRow;
+ pEntry->nColOverlap = nNextCol - nStartCol;
+ pEntry->nRowOverlap = nRows;
+ }
+ }
+ aEntryDocPos.mnRow += nRows;
+ }
+ else
+ {
+ pEntry->nCol = aEntryDocPos.mnCol;
+ pEntry->nRow = aEntryDocPos.mnRow;
+ if( mpParentTable ) // do not merge in global table
+ pEntry->nColOverlap = GetDocSize( tdCol, rCellPos.mnCol, rCellPos.mnCol + aCellSpan.mnCols );
+ ++aEntryDocPos.mnRow;
+ }
+ }
+
+ /* pEntry points now to last entry - test if it is the only entry in this cell.
+ Merge rows of cell with single non-table entry. */
+ if( pEntry && (pEntry == rEntryList.front()) && (pEntry->GetTableId() == SC_HTML_NO_TABLE) )
+ pEntry->nRowOverlap = GetDocSize( tdRow, rCellPos.mnRow, rCellPos.mnRow + aCellSpan.mnRows );
+ }
+}
+
+
+// ============================================================================
+
+ScHTMLGlobalTable::ScHTMLGlobalTable( SfxItemPool& rPool, EditEngine& rEditEngine, ScEEParseList& rEEParseList, ScHTMLTableId& rnUnusedId ) :
+ ScHTMLTable( rPool, rEditEngine, rEEParseList, rnUnusedId )
+{
+}
+
+ScHTMLGlobalTable::~ScHTMLGlobalTable()
+{
+}
+
+void ScHTMLGlobalTable::Recalc()
+{
+ // Fills up empty cells with a dummy entry. */
+ FillEmptyCells();
+ // recalc table sizes of all nested tables and this table
+ RecalcDocSize();
+ // recalc document positions of all entries in this table and in nested tables
+ RecalcDocPos( GetDocPos() );
+}
+
+
+// ============================================================================
+
+ScHTMLQueryParser::ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc ) :
+ ScHTMLParser( pEditEngine, pDoc ),
+ mnUnusedId( SC_HTML_GLOBAL_TABLE ),
+ mbTitleOn( false )
+{
+ mpGlobTable.reset( new ScHTMLGlobalTable( *pPool, *pEdit, *pList, mnUnusedId ) );
+ mpCurrTable = mpGlobTable.get();
+}
+
+ScHTMLQueryParser::~ScHTMLQueryParser()
+{
+}
+
+sal_uInt32 ScHTMLQueryParser::Read( SvStream& rStrm )
+{
+ SvKeyValueIteratorRef xValues;
+ SvKeyValueIterator* pAttributes = 0;
+
+ SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+ if( pObjSh && pObjSh->IsLoading() )
+ {
+ pAttributes = pObjSh->GetHeaderAttributes();
+ }
+ else
+ {
+ /* When not loading, set up fake HTTP headers to force the SfxHTMLParser
+ to use UTF8 (used when pasting from clipboard) */
+ const sal_Char* pCharSet = rtl_getBestMimeCharsetFromTextEncoding( RTL_TEXTENCODING_UTF8 );
+ if( pCharSet )
+ {
+ String aContentType = String::CreateFromAscii( "text/html; charset=" );
+ aContentType.AppendAscii( pCharSet );
+
+ xValues = new SvKeyValueIterator;
+ xValues->Append( SvKeyValue( String::CreateFromAscii( sHTML_META_content_type ), aContentType ) );
+ pAttributes = xValues;
+ }
+ }
+
+ Link aOldLink = pEdit->GetImportHdl();
+ pEdit->SetImportHdl( LINK( this, ScHTMLQueryParser, HTMLImportHdl ) );
+ sal_uInt32 nErr = pEdit->Read( rStrm, EE_FORMAT_HTML, pAttributes );
+ pEdit->SetImportHdl( aOldLink );
+
+ mpGlobTable->Recalc();
+ nColMax = mpGlobTable->GetDocSize( tdCol ) - 1;
+ nRowMax = mpGlobTable->GetDocSize( tdRow ) - 1;
+
+ return nErr;
+}
+
+const ScHTMLTable* ScHTMLQueryParser::GetGlobalTable() const
+{
+ return mpGlobTable.get();
+}
+
+
+// ----------------------------------------------------------------------------
+
+ScHTMLTable* ScHTMLQueryParser::GetTable( ScHTMLTableId nTableId ) const
+{
+ if( nTableId == SC_HTML_GLOBAL_TABLE )
+ return mpGlobTable.get();
+ ScHTMLTable* pTable = mpGlobTable->FindNestedTable( nTableId );
+ DBG_ASSERT( pTable, "ScHTMLQueryParser::GetTable - table not found" );
+ if( !pTable )
+ return mpGlobTable.get();
+ return pTable;
+}
+
+void ScHTMLQueryParser::ProcessToken( const ImportInfo& rInfo )
+{
+#ifdef DEBUG
+ HTML_TOKEN_IDS eTokenId = static_cast< HTML_TOKEN_IDS >( rInfo.nToken );
+#endif
+ switch( rInfo.nToken )
+ {
+// --- meta data ---
+ case HTML_META: MetaOn( rInfo ); break; // <meta>
+
+// --- title handling ---
+ case HTML_TITLE_ON: TitleOn( rInfo ); break; // <title>
+ case HTML_TITLE_OFF: TitleOff( rInfo ); break; // </title>
+
+// --- body handling ---
+ case HTML_BODY_ON: mpCurrTable->BodyOn( rInfo ); break; // <body>
+ case HTML_BODY_OFF: mpCurrTable->BodyOff( rInfo ); break; // </body>
+
+// --- insert text ---
+ case HTML_TEXTTOKEN: InsertText( rInfo ); break; // any text
+ case HTML_LINEBREAK: mpCurrTable->BreakOn(); break; // <br>
+ case HTML_HEAD1_ON: // <h1>
+ case HTML_HEAD2_ON: // <h2>
+ case HTML_HEAD3_ON: // <h3>
+ case HTML_HEAD4_ON: // <h4>
+ case HTML_HEAD5_ON: // <h5>
+ case HTML_HEAD6_ON: // <h6>
+ case HTML_PARABREAK_ON: mpCurrTable->HeadingOn(); break; // <p>
+
+// --- misc. contents ---
+ case HTML_ANCHOR_ON: mpCurrTable->AnchorOn(); break; // <a>
+
+// --- table handling ---
+ case HTML_TABLE_ON: TableOn( rInfo ); break; // <table>
+ case HTML_TABLE_OFF: TableOff( rInfo ); break; // </table>
+ case HTML_TABLEROW_ON: mpCurrTable->RowOn( rInfo ); break; // <tr>
+ case HTML_TABLEROW_OFF: mpCurrTable->RowOff( rInfo ); break; // </tr>
+ case HTML_TABLEHEADER_ON: // <th>
+ case HTML_TABLEDATA_ON: mpCurrTable->DataOn( rInfo ); break; // <td>
+ case HTML_TABLEHEADER_OFF: // </th>
+ case HTML_TABLEDATA_OFF: mpCurrTable->DataOff( rInfo ); break; // </td>
+ case HTML_PREFORMTXT_ON: PreOn( rInfo ); break; // <pre>
+ case HTML_PREFORMTXT_OFF: PreOff( rInfo ); break; // </pre>
+
+// --- formatting ---
+ case HTML_FONT_ON: FontOn( rInfo ); break; // <font>
+
+ case HTML_BIGPRINT_ON: // <big>
+ //! TODO: store current font size, use following size
+ mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ 3 ], 100, ATTR_FONT_HEIGHT ) );
+ break;
+ case HTML_SMALLPRINT_ON: // <small>
+ //! TODO: store current font size, use preceding size
+ mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ 0 ], 100, ATTR_FONT_HEIGHT ) );
+ break;
+
+ case HTML_BOLD_ON: // <b>
+ case HTML_STRONG_ON: // <strong>
+ mpCurrTable->PutItem( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
+ break;
+
+ case HTML_ITALIC_ON: // <i>
+ case HTML_EMPHASIS_ON: // <em>
+ case HTML_ADDRESS_ON: // <address>
+ case HTML_BLOCKQUOTE_ON: // <blockquote>
+ case HTML_BLOCKQUOTE30_ON: // <bq>
+ case HTML_CITIATION_ON: // <cite>
+ case HTML_VARIABLE_ON: // <var>
+ mpCurrTable->PutItem( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
+ break;
+
+ case HTML_DEFINSTANCE_ON: // <dfn>
+ mpCurrTable->PutItem( SvxWeightItem( WEIGHT_BOLD, ATTR_FONT_WEIGHT ) );
+ mpCurrTable->PutItem( SvxPostureItem( ITALIC_NORMAL, ATTR_FONT_POSTURE ) );
+ break;
+
+ case HTML_UNDERLINE_ON: // <u>
+ mpCurrTable->PutItem( SvxUnderlineItem( UNDERLINE_SINGLE, ATTR_FONT_UNDERLINE ) );
+ break;
+ }
+}
+
+void ScHTMLQueryParser::InsertText( const ImportInfo& rInfo )
+{
+ mpCurrTable->PutText( rInfo );
+ if( mbTitleOn )
+ maTitle.Append( rInfo.aText );
+}
+
+void ScHTMLQueryParser::FontOn( const ImportInfo& rInfo )
+{
+ for( ScHTMLOptionIterator aIter( rInfo ); aIter.is(); ++aIter )
+ {
+ switch( aIter->GetToken() )
+ {
+ case HTML_O_FACE :
+ {
+ const String& rFace = aIter->GetString();
+ String aFontName;
+ xub_StrLen nPos = 0;
+ while( nPos != STRING_NOTFOUND )
+ {
+ // font list separator: VCL = ';' HTML = ','
+ String aFName = rFace.GetToken( 0, ',', nPos );
+ aFName.EraseLeadingAndTrailingChars();
+ ScfTools::AddToken( aFontName, aFName, ';' );
+ }
+ if ( aFontName.Len() )
+ mpCurrTable->PutItem( SvxFontItem( FAMILY_DONTKNOW,
+ aFontName, EMPTY_STRING, PITCH_DONTKNOW,
+ RTL_TEXTENCODING_DONTKNOW, ATTR_FONT ) );
+ }
+ break;
+ case HTML_O_SIZE :
+ {
+ sal_uInt32 nSize = bound( aIter->GetNumber(), 1UL, SC_HTML_FONTSIZES );
+ mpCurrTable->PutItem( SvxFontHeightItem( maFontHeights[ nSize - 1 ], 100, ATTR_FONT_HEIGHT ) );
+ }
+ break;
+ case HTML_O_COLOR :
+ {
+ Color aColor;
+ aIter->GetColor( aColor );
+ mpCurrTable->PutItem( SvxColorItem( aColor, ATTR_FONT_COLOR ) );
+ }
+ break;
+ }
+ }
+}
+
+void ScHTMLQueryParser::MetaOn( const ImportInfo& rInfo )
+{
+ if( mpDoc->GetDocumentShell() )
+ {
+ sal_uInt16 nContentOpt = HTML_O_CONTENT;
+ rtl_TextEncoding eEnc = RTL_TEXTENCODING_DONTKNOW;
+ HTMLParser* pParser = static_cast< HTMLParser* >( rInfo.pParser );
+ const HTMLOptions* pOptions = pParser->GetOptions( &nContentOpt );
+ sal_uInt16 nMetaCnt = 0;
+ SfxFrameHTMLParser::ParseMetaOptions(
+ &mpDoc->GetDocumentShell()->GetDocInfo(),
+ mpDoc->GetDocumentShell()->GetHeaderAttributes(),
+ pOptions, nMetaCnt, eEnc );
+ // If the encoding is set by a META tag, it may only overwrite the
+ // current encoding if both, the current and the new encoding, are 1-BYTE
+ // encodings. Everything else cannot lead to reasonable results.
+ if( rtl_isOctetTextEncoding( eEnc ) &&
+ rtl_isOctetTextEncoding( pParser->GetSrcEncoding() ) )
+ {
+ eEnc = GetExtendedCompatibilityTextEncoding( eEnc );
+ pParser->SetSrcEncoding( eEnc );
+ }
+ }
+}
+
+void ScHTMLQueryParser::TitleOn( const ImportInfo& rInfo )
+{
+ mbTitleOn = true;
+ maTitle.Erase();
+}
+
+void ScHTMLQueryParser::TitleOff( const ImportInfo& rInfo )
+{
+ if( mbTitleOn )
+ {
+ maTitle.EraseLeadingAndTrailingChars();
+ if( maTitle.Len() && mpDoc->GetDocumentShell() )
+ mpDoc->GetDocumentShell()->GetDocInfo().SetTitle( maTitle );
+ InsertText( rInfo );
+ mbTitleOn = false;
+ }
+}
+
+void ScHTMLQueryParser::TableOn( const ImportInfo& rInfo )
+{
+ mpCurrTable = mpCurrTable->TableOn( rInfo );
+}
+
+void ScHTMLQueryParser::TableOff( const ImportInfo& rInfo )
+{
+ mpCurrTable = mpCurrTable->TableOff( rInfo );
+}
+
+void ScHTMLQueryParser::PreOn( const ImportInfo& rInfo )
+{
+ mpCurrTable = mpCurrTable->PreOn( rInfo );
+}
+
+void ScHTMLQueryParser::PreOff( const ImportInfo& rInfo )
+{
+ mpCurrTable = mpCurrTable->PreOff( rInfo );
+}
+
+
+// ----------------------------------------------------------------------------
+
+IMPL_LINK( ScHTMLQueryParser, HTMLImportHdl, const ImportInfo*, pInfo )
+{
+#ifdef DEBUG
+ HTML_TOKEN_IDS eTokenId = static_cast< HTML_TOKEN_IDS >( pInfo->nToken );
+#endif
+ switch( pInfo->eState )
+ {
+ case HTMLIMP_START:
+ break;
+
+ case HTMLIMP_NEXTTOKEN:
+ case HTMLIMP_UNKNOWNATTR:
+ ProcessToken( *pInfo );
+ break;
+
+ case HTMLIMP_INSERTPARA:
+ mpCurrTable->InsertPara( *pInfo );
+ break;
+
+ case HTMLIMP_SETATTR:
+ case HTMLIMP_INSERTTEXT:
+ case HTMLIMP_INSERTFIELD:
+ break;
+
+ case HTMLIMP_END:
+ while( mpCurrTable->GetTableId() != SC_HTML_GLOBAL_TABLE )
+ TableOff( *pInfo );
+ break;
+
+ default:
+ DBG_ERRORFILE( "ScHTMLQueryParser::HTMLImportHdl - unknown ImportInfo::eState" );
+ }
+ return 0;
+}
+
+
+// ============================================================================
+
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx
index c12705f29523..984e6c001cc8 100644
--- a/sc/source/filter/inc/XclExpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclExpChangeTrack.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XclExpChangeTrack.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:39 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx
index 2687d934ea83..309f1d532a19 100644
--- a/sc/source/filter/inc/XclImpChangeTrack.hxx
+++ b/sc/source/filter/inc/XclImpChangeTrack.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XclImpChangeTrack.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/colrowst.hxx b/sc/source/filter/inc/colrowst.hxx
index 22054edc126f..313a2eac48a5 100644
--- a/sc/source/filter/inc/colrowst.hxx
+++ b/sc/source/filter/inc/colrowst.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: colrowst.hxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/dif.hxx b/sc/source/filter/inc/dif.hxx
index 3fae570e6e1c..bc71287788ad 100644
--- a/sc/source/filter/inc/dif.hxx
+++ b/sc/source/filter/inc/dif.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dif.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:45:12 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,15 +86,17 @@ class SvNumberFormatter;
class ScDocument;
class ScPatternAttr;
-extern const sal_Char* pKeyTABLE;
-extern const sal_Char* pKeyVECTORS;
-extern const sal_Char* pKeyTUPLES;
-extern const sal_Char* pKeyDATA;
-extern const sal_Char* pKeyBOT;
-extern const sal_Char* pKeyEOD;
-extern const sal_Char* pKeyTRUE;
-extern const sal_Char* pKeyFALSE;
-extern const sal_Char* pKeyNA;
+extern const sal_Unicode pKeyTABLE[];
+extern const sal_Unicode pKeyVECTORS[];
+extern const sal_Unicode pKeyTUPLES[];
+extern const sal_Unicode pKeyDATA[];
+extern const sal_Unicode pKeyBOT[];
+extern const sal_Unicode pKeyEOD[];
+extern const sal_Unicode pKeyTRUE[];
+extern const sal_Unicode pKeyFALSE[];
+extern const sal_Unicode pKeyNA[];
+extern const sal_Unicode pKeyV[];
+extern const sal_Unicode pKey1_0[];
enum TOPIC
@@ -112,7 +114,7 @@ enum DATASET { D_BOT, D_EOD, D_NUMERIC, D_STRING, D_UNKNOWN, D_SYNT_ERROR };
class DifParser
{
public:
- ByteString aData;
+ String aData;
double fVal;
UINT32 nVector;
UINT32 nVal;
@@ -122,31 +124,10 @@ private:
SvNumberFormatter* pNumFormatter;
SvStream& rIn;
BOOL bPlain;
-#if __ALIGNMENT4 == 1
- static UINT32 nBOT;
- static UINT32 nEOD;
- static UINT32 n1_0;
- static UINT16 nV;
-#else
- static sal_Char cBOT_0;
- static sal_Char cEOD_0;
- static sal_Char c1_0_0;
- static sal_Char cBOT_1;
- static sal_Char cEOD_1;
- static sal_Char c1_0_1;
- static sal_Char cBOT_2;
- static sal_Char cEOD_2;
- static sal_Char c1_0_2;
- static sal_Char cBOT_3;
- static sal_Char cEOD_3;
- static sal_Char c1_0_3;
- static sal_Char cV_0;
- static sal_Char cV_1;
-#endif
- static inline BOOL IsBOT( const sal_Char* pRef );
- static inline BOOL IsEOD( const sal_Char* pRef );
- static inline BOOL Is1_0( const sal_Char* pRef );
+ static inline BOOL IsBOT( const sal_Unicode* pRef );
+ static inline BOOL IsEOD( const sal_Unicode* pRef );
+ static inline BOOL Is1_0( const sal_Unicode* pRef );
public:
DifParser( SvStream&, const UINT32 nOption, ScDocument&, CharSet );
@@ -154,75 +135,59 @@ public:
DATASET GetNextDataset( void );
- const sal_Char* ScanIntVal( const sal_Char* pStart, UINT32& rRet );
- BOOL ScanFloatVal( const sal_Char* pStart );
+ const sal_Unicode* ScanIntVal( const sal_Unicode* pStart, UINT32& rRet );
+ BOOL ScanFloatVal( const sal_Unicode* pStart );
- inline BOOL IsNumber( const sal_Char cChar );
- inline BOOL IsNumberEnding( const sal_Char cChar );
+ inline BOOL IsNumber( const sal_Unicode cChar );
+ inline BOOL IsNumberEnding( const sal_Unicode cChar );
- static inline BOOL IsV( const sal_Char* pRef );
+ static inline BOOL IsV( const sal_Unicode* pRef );
inline BOOL IsPlain( void ) const;
};
-inline BOOL DifParser::IsBOT( const sal_Char* pRef )
+inline BOOL DifParser::IsBOT( const sal_Unicode* pRef )
{
-#if __ALIGNMENT4 == 1
- return ( nBOT == *( ( UINT32* ) pRef ) );
-#else
- return ( pRef[ 0 ] == cBOT_0 &&
- pRef[ 1 ] == cBOT_1 &&
- pRef[ 2 ] == cBOT_2 &&
- pRef[ 3 ] == cBOT_3 );
-#endif
+ return ( pRef[ 0 ] == pKeyBOT[0] &&
+ pRef[ 1 ] == pKeyBOT[1] &&
+ pRef[ 2 ] == pKeyBOT[2] &&
+ pRef[ 3 ] == pKeyBOT[3] );
}
-inline BOOL DifParser::IsEOD( const sal_Char* pRef )
+inline BOOL DifParser::IsEOD( const sal_Unicode* pRef )
{
-#if __ALIGNMENT4 == 1
- return ( nEOD == *( ( UINT32* ) pRef ) );
-#else
- return ( pRef[ 0 ] == cEOD_0 &&
- pRef[ 1 ] == cEOD_1 &&
- pRef[ 2 ] == cEOD_2 &&
- pRef[ 3 ] == cEOD_3 );
-#endif
+ return ( pRef[ 0 ] == pKeyEOD[0] &&
+ pRef[ 1 ] == pKeyEOD[1] &&
+ pRef[ 2 ] == pKeyEOD[2] &&
+ pRef[ 3 ] == pKeyEOD[3] );
}
-inline BOOL DifParser::Is1_0( const sal_Char* pRef )
+inline BOOL DifParser::Is1_0( const sal_Unicode* pRef )
{
-#if __ALIGNMENT4 == 1
- return ( n1_0 == *( ( UINT32* ) pRef ) );
-#else
- return ( pRef[ 0 ] == c1_0_0 &&
- pRef[ 1 ] == c1_0_1 &&
- pRef[ 2 ] == c1_0_2 &&
- pRef[ 3 ] == c1_0_3 );
-#endif
+ return ( pRef[ 0 ] == pKey1_0[0] &&
+ pRef[ 1 ] == pKey1_0[1] &&
+ pRef[ 2 ] == pKey1_0[2] &&
+ pRef[ 3 ] == pKey1_0[3] );
}
-inline BOOL DifParser::IsV( const sal_Char* pRef )
+inline BOOL DifParser::IsV( const sal_Unicode* pRef )
{
-#if __ALIGNMENT4 == 1
- return ( nV == *( ( UINT16 * ) pRef ) );
-#else
- return ( pRef[ 0 ] == cV_0 &&
- pRef[ 1 ] == cV_1 );
-#endif
+ return ( pRef[ 0 ] == pKeyV[0] &&
+ pRef[ 1 ] == pKeyV[1] );
}
-inline BOOL DifParser::IsNumber( const sal_Char cChar )
+inline BOOL DifParser::IsNumber( const sal_Unicode cChar )
{
return ( cChar >= '0' && cChar <= '9' );
}
-inline BOOL DifParser::IsNumberEnding( const sal_Char cChar )
+inline BOOL DifParser::IsNumberEnding( const sal_Unicode cChar )
{
return ( cChar == 0x00 );
}
diff --git a/sc/source/filter/inc/eeparser.hxx b/sc/source/filter/inc/eeparser.hxx
index 90384518866d..e9b482a65f37 100644
--- a/sc/source/filter/inc/eeparser.hxx
+++ b/sc/source/filter/inc/eeparser.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: eeparser.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:45:12 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,13 +120,21 @@ struct ScEEParseEntry
USHORT nOffset; // HTML PixelOffset
USHORT nWidth; // HTML PixelWidth
BOOL bHasGraphic; // HTML any image loaded
+ bool bEntirePara; // TRUE = use entire paragraph, false = use selection
ScEEParseEntry( SfxItemPool* pPool ) :
aItemSet( *pPool ), pValStr( NULL ),
pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
nCol((USHORT)~0), nRow((USHORT)~0), nTab(0),
nColOverlap(1), nRowOverlap(1),
- nOffset(0), nWidth(0), bHasGraphic(FALSE)
+ nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
+ {}
+ ScEEParseEntry( const SfxItemSet& rItemSet ) :
+ aItemSet( rItemSet ), pValStr( NULL ),
+ pNumStr( NULL ), pName( NULL ), pImageList( NULL ),
+ nCol((USHORT)~0), nRow((USHORT)~0), nTab(0),
+ nColOverlap(1), nRowOverlap(1),
+ nOffset(0), nWidth(0), bHasGraphic(FALSE), bEntirePara(true)
{}
~ScEEParseEntry()
{
diff --git a/sc/source/filter/inc/excdefs.hxx b/sc/source/filter/inc/excdefs.hxx
index 1aca20f52dcc..58fc05d568e7 100644
--- a/sc/source/filter/inc/excdefs.hxx
+++ b/sc/source/filter/inc/excdefs.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excdefs.hxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,11 +70,6 @@
#define EXC_TABBUF_INVALID 0xFFFF
-// Style info =================================================================
-
-#define EXC_ROT_STACKED 0xFF
-
-
// (0x001C) NOTE ==============================================================
#define EXC_NOTE5_MAXTEXT 2048
diff --git a/sc/source/filter/inc/excdoc.hxx b/sc/source/filter/inc/excdoc.hxx
index b79baa869e4a..a1be69b8de34 100644
--- a/sc/source/filter/inc/excdoc.hxx
+++ b/sc/source/filter/inc/excdoc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excdoc.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:41 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/excform.hxx b/sc/source/filter/inc/excform.hxx
index d787fd48fca3..f6423f171812 100644
--- a/sc/source/filter/inc/excform.hxx
+++ b/sc/source/filter/inc/excform.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excform.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:42 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:04:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,7 +63,7 @@
#ifndef _EXCFORM_HXX
#define _EXCFORM_HXX
-#ifndef _XLTOOLS_HXX
+#ifndef SC_XLTOOLS_HXX
#include "xltools.hxx"
#endif
diff --git a/sc/source/filter/inc/excimp8.hxx b/sc/source/filter/inc/excimp8.hxx
index 4eee3395e38a..4f2812158d9e 100644
--- a/sc/source/filter/inc/excimp8.hxx
+++ b/sc/source/filter/inc/excimp8.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excimp8.hxx,v $
*
- * $Revision: 1.45 $
+ * $Revision: 1.46 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-10 14:05:37 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,8 +107,6 @@ class XclImpAutoFilterBuffer;
class XclImpWebQueryBuffer;
-class FilterProgressBar;
-
class ExcCondForm : private ExcRoot, private XclImpRoot
@@ -151,9 +149,6 @@ class ExcCondFormList : protected List
class ImportExcel8 : public ImportExcel
{
protected:
- XclImpObjectManager aObjManager;
- BOOL bObjSection;
-
ExcScenarioList aScenList;
XclImpPivotTableList aPivotTabList;
@@ -165,6 +160,8 @@ class ImportExcel8 : public ImportExcel
XclImpAutoFilterBuffer* pAutoFilterBuffer; // ranges for autofilter and advanced filter
+ BOOL bObjSection;
+
BOOL bHasBasic;
BOOL bFirstScl; // only one Scl-Record has to be read per chart!
@@ -225,9 +222,7 @@ class ImportExcel8 : public ImportExcel
virtual void EndAllChartObjects( void ); // -> excobj.cxx
virtual void PostDocLoad( void );
- virtual FltError ReadChart8( ScfProgressBar&, const BOOL bOwnTab );
- void CreateTmpCtrlStorage( void );
- // if possible generate a SvxMSConvertOCXControls compatibel storage
+ virtual FltError ReadChart8( ScfSimpleProgressBar&, const BOOL bOwnTab );
public:
ImportExcel8(
@@ -256,10 +251,15 @@ private:
BOOL bActive;
BOOL bHasDropDown;
BOOL bHasConflict;
+ BOOL bCriteria;
+ BOOL bAutoOrAdvanced;
+ ScRange aCriteriaRange;
+ String aFilterName;
void CreateFromDouble( String& rStr, double fVal );
void SetCellAttribs();
void InsertQueryParam();
+ void AmendAFName(const BOOL bUseUnNamed);
protected:
public:
@@ -280,13 +280,18 @@ public:
inline void Activate() { bActive = TRUE; }
void SetAdvancedRange( const ScRange* pRange );
void SetExtractPos( const ScAddress& rAddr );
- void Apply();
+ inline void SetAutoOrAdvanced() { bAutoOrAdvanced = TRUE; }
+ void Apply( const BOOL bUseUnNamed = FALSE );
+ void CreateScDBData( const BOOL bUseUnNamed );
+ void EnableRemoveFilter();
};
class XclImpAutoFilterBuffer : private List
{
private:
+ UINT16 nAFActiveCount;
+
inline XclImpAutoFilterData* _First() { return (XclImpAutoFilterData*) List::First(); }
inline XclImpAutoFilterData* _Next() { return (XclImpAutoFilterData*) List::Next(); }
@@ -294,6 +299,7 @@ private:
{ List::Insert( pData, LIST_APPEND ); }
protected:
public:
+ XclImpAutoFilterBuffer();
virtual ~XclImpAutoFilterBuffer();
void Insert( RootData* pRoot, const ScRange& rRange,
@@ -304,6 +310,8 @@ public:
XclImpAutoFilterData* GetByTab( UINT16 nTab );
BOOL HasDropDown( UINT16 nCol, UINT16 nRow, UINT16 nTab );
+ inline void IncrementActiveAF() { nAFActiveCount++; }
+ inline BOOL UseUnNamed() { return nAFActiveCount == 1; }
};
diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx
index 897f8b80d676..d2487e6eaa46 100644
--- a/sc/source/filter/inc/excrecds.hxx
+++ b/sc/source/filter/inc/excrecds.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: excrecds.hxx,v $
*
- * $Revision: 1.30 $
+ * $Revision: 1.31 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:00 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -354,34 +354,6 @@ public:
};
-//--------------------------------------------------------- class ExcDummy_XF -
-// Ersatz fuer Default XF Records
-
-class ExcDummy_XF : public ExcDummyRec
-{
-private:
- static const BYTE pMyData[];
- static const ULONG nMyLen;
-public:
- virtual ULONG GetLen( void ) const;
- virtual const BYTE* GetData( void ) const;
-};
-
-
-//------------------------------------------------------ class ExcDummy_Style -
-// Ersatz fuer Default Style Records
-
-class ExcDummy_Style : public ExcDummyRec
-{
-private:
- static const BYTE pMyData[];
- static const ULONG nMyLen;
-public:
- virtual ULONG GetLen( void ) const;
- virtual const BYTE* GetData( void ) const;
-};
-
-
//------------------------------------------------------ class ExcBundlesheet -
class ExcBundlesheetBase : public ExcRecord
@@ -493,8 +465,7 @@ protected:
const ScAddress rPos,
const ScPatternAttr* pAttr,
RootData& rRootData,
- const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND,
- BOOL bForceAltNumForm = FALSE );
+ const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND );
virtual void SaveCont( XclExpStream& rStrm );
virtual void SaveDiff( XclExpStream& rStrm );
@@ -697,6 +668,21 @@ public:
virtual UINT16 GetNum( void ) const;
};
+/*----------------------------------------------------------------------*/
+
+class ExcFmlaResultStr : public XclExpRecord
+{
+private:
+ XclExpString maResultText;
+
+public:
+
+ ExcFmlaResultStr(const XclExpString &aFmlaText);
+ virtual ~ExcFmlaResultStr();
+
+private:
+ virtual void WriteBody( XclExpStream& rStrm );
+};
//---------------------------------------------------------- class ExcFormula -
@@ -706,6 +692,7 @@ private:
sal_Char* pData;
UINT16 nFormLen;
BOOL bShrdFmla;
+ ScFormulaCell* pFCell;
virtual void SaveDiff( XclExpStream& rStrm ); // instead of SaveCont()
virtual ULONG GetDiffLen( void ) const;
@@ -716,12 +703,13 @@ public:
const ScPatternAttr *pAttr,
RootData& rRootData,
const ULONG nAltNumForm,
- BOOL bForceAltNumForm,
const ScTokenArray& rCode,
ExcArray** ppArray = NULL,
ScMatrixMode eMM = MM_NONE,
ExcShrdFmla** ppShrdFmla = NULL,
- ExcArrays* pShrdFmlas = NULL );
+ ExcArrays* pShrdFmlas = NULL,
+ ScFormulaCell* pFCell = NULL,
+ ExcFmlaResultStr **pFormulaResult = NULL);
~ExcFormula();
inline const ScAddress& GetPosition() const { return aPos; } // from ExcCell
@@ -729,6 +717,8 @@ public:
void SetTableOp( USHORT nCol, USHORT nRow ); // for TableOp export
virtual UINT16 GetNum( void ) const;
+
+ static BYTE ScErrorCodeToExc(UINT16 nErrorCode);
};
@@ -838,6 +828,7 @@ private:
void SetName( const String& rRangeName );
void SetUniqueName( const String& rRangeName );
BOOL SetBuiltInName( const String& rName, UINT8 nKey );
+ BOOL IsBuiltInAFName( const String& rName, UINT8 nKey );
virtual void SaveCont( XclExpStream& rStrm );
@@ -1076,7 +1067,6 @@ private:
public:
ExcColinfo( UINT16 nCol, UINT16 nTab, UINT16 nXF, RootData&, ExcEOutline& rOutline );
- void SetWidth( UINT16 nWidth, double fColScale );
// if expandable, delete rpExp and set to NULL
void Expand( ExcColinfo*& rpExp );
@@ -1086,68 +1076,6 @@ public:
};
-//--------------------------------------------------------------- class ExcXf -
-
-class ExcXf : public ExcRecord, protected XclExpRoot
-{
-protected:
- UINT16 nIfnt;
- UINT16 nIfmt;
-
- UINT16 nOffs8;
-
- UINT32 nIcvForeSer;
- UINT32 nIcvBackSer;
- UINT16 nFls;
-
- UINT32 nIcvTopSer;
- UINT32 nIcvBotSer;
- UINT32 nIcvLftSer;
- UINT32 nIcvRigSer;
-
- UINT16 nDgTop;
- UINT16 nDgBottom;
- UINT16 nDgLeft;
- UINT16 nDgRight;
-
- XclHorAlign eAlc;
- XclVerAlign eAlcV;
- XclTextOrient eOri;
- BOOL bFWrap;
- BOOL bFSxButton;
-
- BOOL bStyle;
-
- BOOL bAtrNum;
- BOOL bAtrFnt;
- BOOL bAtrAlc;
- BOOL bAtrBdr;
- BOOL bAtrPat;
- BOOL bAtrProt;
-
-#ifdef DBG_UTIL
- static UINT16 nObjCnt;
-#endif
-
- virtual void SaveCont( XclExpStream& rStrm );
-
-public:
- ExcXf( const XclExpRoot& rRoot,
- UINT16 nFont, UINT16 nForm, const ScPatternAttr*, BOOL& rbLineBreak,
- BOOL bStyle = FALSE );
- // rbLineBreak = TRUE erzwingt Wrap,
- // return von rbLineBreak enthaelt immer tatsaechliches Wrap
-#ifdef DBG_UTIL
- virtual ~ExcXf();
-#endif
-
- virtual UINT16 GetNum( void ) const;
- virtual ULONG GetLen( void ) const;
-
- static void ScToExcBorderLine( XclExpPalette& rPalette, const SvxBorderLine*, UINT32& rIcvSer, UINT16& rDg );
-};
-
-
//------------------------------------------------------ class ExcExterncount -
class ExcExterncount : public ExcRecord, ExcRoot
@@ -1250,68 +1178,6 @@ public:
};
-//------------------------------------------------------------ class UsedList -
-
-class UsedList : public List, public ExcEmptyRec
-{
-private:
-protected:
- UINT16 nBaseIndex;
-
-public:
- inline UsedList() {}
-
- inline void SetBaseIndex( UINT16 nNewVal ) { nBaseIndex = nNewVal; }
-
- virtual void Save( XclExpStream& rStrm );
-};
-
-
-//-------------------------------------------------------- class UsedAttrList -
-// a list of ENTRY structs
-
-class UsedAttrList : public UsedList, ExcRoot
-{
-private:
- struct ENTRY
- {
- const ScPatternAttr* pPattAttr;
- ExcXf* pXfRec;
- BOOL bLineBreak;
- ULONG nAltNumForm;
-
- inline ENTRY() : nAltNumForm( NUMBERFORMAT_ENTRY_NOT_FOUND ), pXfRec( NULL ) {}
- inline ~ENTRY() { if( pXfRec ) delete pXfRec; }
-
- inline BOOL Equal( const ScPatternAttr* p, const ULONG n ) const
- {
- return pPattAttr == p && nAltNumForm == n;
- }
- };
-
- inline ENTRY* _First() { return (ENTRY*) List::First(); }
- inline ENTRY* _Next() { return (ENTRY*) List::Next(); }
-
- XclExpFontBuffer& rFntLst;
- XclExpNumFmtBuffer& rFrmLst;
-
- void AddNewXF( const ScPatternAttr* pAttr,
- const BOOL bStyle, const BOOL bExplLineBreak,
- const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND,
- BOOL bForceAltNumForm = FALSE );
-
-public:
- UsedAttrList( RootData* pRD );
- virtual ~UsedAttrList();
- UINT16 Find( const ScPatternAttr* pSearch, const BOOL bStyle = FALSE,
- const ULONG nAltNumForm = NUMBERFORMAT_ENTRY_NOT_FOUND,
- BOOL bForceAltNumForm = FALSE );
- UINT16 FindWithLineBreak( const ScPatternAttr* pSearch );
-
- virtual void Save( XclExpStream& rStrm ); // overloaded to get ExcRecord from ENTRY
-};
-
-
// XclExpWsbool ===============================================================
class XclExpWsbool : public XclExpUInt16Record
@@ -1685,6 +1551,7 @@ public:
};
+
//--------------------------- class XclExpTableOp, class XclExpTableOpManager -
// multiple operations aka table operations (record TABLE)
diff --git a/sc/source/filter/inc/exp_op.hxx b/sc/source/filter/inc/exp_op.hxx
index 803bf2a200bc..4232eb93bde2 100644
--- a/sc/source/filter/inc/exp_op.hxx
+++ b/sc/source/filter/inc/exp_op.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: exp_op.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:42 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/fapihelper.hxx b/sc/source/filter/inc/fapihelper.hxx
index 28068cc40556..c2603a89c059 100644
--- a/sc/source/filter/inc/fapihelper.hxx
+++ b/sc/source/filter/inc/fapihelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fapihelper.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/filt_pch.hxx b/sc/source/filter/inc/filt_pch.hxx
index 9a31b219d7df..cd34460dce80 100644
--- a/sc/source/filter/inc/filt_pch.hxx
+++ b/sc/source/filter/inc/filt_pch.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filt_pch.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dr $ $Date: 2001-10-18 14:55:34 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -348,8 +348,6 @@
#include <tools/urlobj.hxx>
#include <svx/colritem.hxx>
#include <vcl/wrkwin.hxx>
-#include <fltprgrs.hxx>
-#include <excsst.hxx>
#include <excimp8.hxx>
#include <excscen.hxx>
#include <com/sun/star/frame/XFrameActionListener.hpp>
diff --git a/sc/source/filter/inc/fprogressbar.hxx b/sc/source/filter/inc/fprogressbar.hxx
index 8bfe4c50f8fb..a13096323656 100644
--- a/sc/source/filter/inc/fprogressbar.hxx
+++ b/sc/source/filter/inc/fprogressbar.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fprogressbar.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:09 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -64,21 +64,89 @@
#ifndef SC_FPROGRESSBAR_HXX
#define SC_FPROGRESSBAR_HXX
+#include "globstr.hrc"
+
#ifndef SC_FTOOLS_HXX
#include "ftools.hxx"
#endif
+class SfxObjectShell;
class ScProgress;
// ============================================================================
-/** Progress bar for complex progress representation. */
+/** Progress bar for complex progress representation.
+ @descr The progress bar contains one or more segments, each with customable
+ size. Each segment is represented by a unique identifier. While showing the
+ progress bar, several segments can be started simultaneously. The progress
+ bar displays the sum of all started segments on screen.
+
+ It is possible to create a full featured ScfProgressBar object from
+ any segment. This sub progress bar works only on that parent segment, with
+ the effect, that if the sub progress bar reaches 100%, the parent segment is
+ filled completely.
+
+ After adding segments, the progress bar has to be activated. In this step the
+ total size of all segments is calculated. Therefore it is not possible to add
+ more segments from here.
+
+ If a sub progress bar is created from a segment, and the main progress bar
+ has been started (but not the sub progress bar), it is still possible to add
+ segments to the sub progress bar. It is not allowed to get the sub progress bar
+ of a started segment. And it is not allowed to modify the segment containing
+ a sub progress bar directly.
+
+ Following a few code examples, how to use the progress bar.
+
+ Example 1: Simple progress bar (see also ScfSimpleProgressBar below).
+
+ ScfProgressBar aProgress( ... );
+ sal_Int32 nSeg = aProgress.AddSegment( 50 ); // segment with 50 steps (1 step = 2%)
+
+ aProgress.ActivateSegment( nSeg ); // start segment nSeg
+ aProgress.Progress(); // 0->1; display: 2%
+ aProgress.Progress( 9 ); // 1->9; display: 18%
+
+ Example 2: Progress bar with 2 segments.
+
+ ScfProgressBar aProgress( ... );
+ sal_Int32 nSeg1 = aProgress.AddSegment( 70 ); // segment with 70 steps
+ sal_Int32 nSeg2 = aProgress.AddSegment( 30 ); // segment with 30 steps
+ // both segments: 100 steps (1 step = 1%)
+
+ aProgress.ActivateSegment( nSeg1 ); // start first segment
+ aProgress.Progress(); // 0->1, display: 1%
+ aProgress.Progress( 3 ); // 1->3, display: 3%
+ aProgress.ActivateSegment( nSeg2 ); // start second segment
+ aProgress.Progress( 5 ); // 0->5, display: 8% (5+3 steps)
+ aProgress.ActivateSegment( nSeg1 ); // continue with first segment
+ aProgress.Progress(); // 3->4, display: 9% (5+4 steps)
+
+ Example 3: Progress bar with 2 segments, one contains a sub progress bar.
+
+ ScfProgressBar aProgress( ... );
+ sal_Int32 nSeg1 = aProgress.AddSegment( 75 ); // segment with 75 steps
+ sal_Int32 nSeg2 = aProgress.AddSegment( 25 ); // segment with 25 steps
+ // both segments: 100 steps (1 step = 1%)
+
+ aProgress.ActivateSegment( nSeg1 ); // start first segment
+ aProgress.Progress(); // 0->1, display: 1%
+
+ ScfProgressBar& rSubProgress = aProgress.GetSegmentProgressBar( nSeg2 );
+ // sub progress bar from second segment
+ sal_Int32 nSubSeg = rSubProgress.AddSegment( 5 ); // 5 steps, mapped to second segment
+ // => 1 step = 5 steps in parent = 5%
+
+ rSubProgress.ActivateSegment( nSubSeg ); // start the segment (auto activate parent segment)
+ rSubProgress.Progress(); // 0->1 (0->5 in parent); display: 6% (1+5)
+
+ // not allowed (second segment active): aProgress.Progress();
+ // not allowed (first segment not empty): aProgress.GetSegmentProgressBar( nSeg1 );
+ */
class ScfProgressBar : ScfNoCopy
{
private:
- typedef ::std::auto_ptr< ScProgress > ScProgressPtr;
-
/** Contains all data of a segment of the progress bar. */
struct ScfProgressSegment
{
@@ -92,10 +160,14 @@ private:
~ScfProgressSegment();
};
- ScfDelList< ScfProgressSegment > maSegments; /// List of progress segments.
+ typedef ::std::auto_ptr< ScProgress > ScProgressPtr;
+ typedef ScfDelList< ScfProgressSegment > ScfSegmentList;
+
+ ScfSegmentList maSegments; /// List of progress segments.
String maText; /// UI string for system progress.
ScProgressPtr mpSysProgress; /// System progress bar.
+ SfxObjectShell* mpDocShell; /// The document shell for the progress bar.
ScfProgressBar* mpParentProgress; /// Parent progress bar, if this is a segment progress bar.
ScfProgressSegment* mpParentSegment; /// Parent segment, if this is a segment progress bar.
ScfProgressSegment* mpCurrSegment; /// Current segment for progress.
@@ -107,24 +179,24 @@ private:
bool mbInProgress; /// true = progress bar started.
public:
- /** Creates a system progress bar with a resource string. */
- explicit ScfProgressBar( const String& rText );
- ~ScfProgressBar();
+ explicit ScfProgressBar( SfxObjectShell* pDocShell, const String& rText );
+ explicit ScfProgressBar( SfxObjectShell* pDocShell, sal_uInt16 nResId );
+ virtual ~ScfProgressBar();
/** Adds a new segment to the progress bar.
@return the identifier of the segment. */
- sal_uInt32 AddSegment( sal_uInt32 nSize );
+ sal_Int32 AddSegment( sal_uInt32 nSize );
/** Returns a complete progress bar for the specified segment.
@descr The progress bar can be used to create sub segments inside of the
segment. Do not delete it (done by root progress bar)!
@return A reference to an ScfProgressBar connected to the segment. */
- ScfProgressBar& GetSegmentProgressBar( sal_uInt32 nSegment );
+ ScfProgressBar& GetSegmentProgressBar( sal_Int32 nSegment );
/** Returns true, if any progress segment has been started. */
inline bool IsStarted() const { return mbInProgress; }
/** Starts the progress bar or activates another segment. */
- void ActivateSegment( sal_uInt32 nSegment );
+ void ActivateSegment( sal_Int32 nSegment );
/** Starts the progress bar (with first segment). */
inline void Activate() { ActivateSegment( 0 ); }
/** Set current segment to the specified position. */
@@ -135,15 +207,16 @@ public:
private:
/** Used to create sub progress bars. */
explicit ScfProgressBar(
- ScfProgressBar* pParProgress,
+ ScfProgressBar& rParProgress,
ScfProgressSegment* pParSegment );
- /** Returns the segment specified by list index. */
- ScfProgressSegment* GetSegment( sal_uInt32 nSegment ) const;
+ /** Initializes all members on construction. */
+ void Init( SfxObjectShell* pDocShell );
+ /** Returns the segment specified by list index. */
+ ScfProgressSegment* GetSegment( sal_Int32 nSegment ) const;
/** Activates progress bar and sets current segment. */
void SetCurrSegment( ScfProgressSegment* pSegment );
-
/** Increases mnTotalPos and calls the system progress bar. */
void IncreaseProgressBar( sal_uInt32 nDelta );
};
@@ -151,5 +224,52 @@ private:
// ============================================================================
+/** A simplified progress bar with only one segment. */
+class ScfSimpleProgressBar
+{
+private:
+ ScfProgressBar maProgress; /// The used progress bar.
+
+public:
+ explicit ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, const String& rText );
+ explicit ScfSimpleProgressBar( sal_uInt32 nSize, SfxObjectShell* pDocShell, sal_uInt16 nResId );
+
+ /** Set progress bar to the specified position. */
+ inline void Progress( sal_uInt32 nPos ) { maProgress.Progress( nPos ); }
+ /** Increase progress bar by 1. */
+ inline void Progress() { maProgress.Progress(); }
+
+private:
+ /** Initializes and starts the progress bar. */
+ void Init( sal_uInt32 nSize );
+};
+
+
+// ============================================================================
+
+/** A simplified progress bar based on the stream position of an existing stream. */
+class ScfStreamProgressBar
+{
+private:
+ typedef ::std::auto_ptr< ScfSimpleProgressBar > ScfSimpleProgressBarPtr;
+
+ ScfSimpleProgressBarPtr mpProgress; /// The used progress bar.
+ SvStream& mrStrm; /// The used stream.
+
+public:
+ explicit ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, const String& rText );
+ explicit ScfStreamProgressBar( SvStream& rStrm, SfxObjectShell* pDocShell, sal_uInt16 nResId = STR_LOAD_DOC );
+
+ /** Sets the progress bar to the current stream position. */
+ void Progress();
+
+private:
+ /** Initializes and starts the progress bar. */
+ void Init( SfxObjectShell* pDocShell, const String& rText );
+};
+
+
+// ============================================================================
+
#endif
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index 86c8c4798ec4..31545eebe12e 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftools.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:09 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,13 +83,12 @@
#include <memory>
-class SvStream;
-
-
// Global static helpers ======================================================
-/** Returns the size of a STATIC data array. */
+/** Expands to the size of a STATIC data array. */
#define STATIC_TABLE_SIZE( array ) (sizeof(array)/sizeof(*(array)))
+/** Expands to a pointer behind the last element of a STATIC data array (like STL end()). */
+#define STATIC_TABLE_END( array ) ((array)+STATIC_TABLE_SIZE(array))
// Read from bitfields --------------------------------------------------------
@@ -130,8 +129,8 @@ inline void set_flag( Type& rnBitField, Type nMask, bool bSet = true )
template< typename Type, typename InsertType >
void insert_value( Type& rnBitField, InsertType nValue, sal_uInt8 nStartBit, sal_uInt8 nBitCount )
{
- Type nMask = ((1UL << nBitCount) - 1);
- Type nNewValue = static_cast< Type >( nValue ) & nMask;
+ sal_uInt32 nMask = ((1UL << nBitCount) - 1);
+ Type nNewValue = static_cast< Type >( nValue & nMask );
(rnBitField &= ~(nMask << nStartBit)) |= (nNewValue << nStartBit);
}
@@ -196,15 +195,13 @@ class ScfNoInstance : private ScfNoCopy {};
// ============================================================================
+class SvStorage;
+class SvStorageStreamRef;
+class SvStream;
+
/** Contains static methods used anywhere in the filters. */
class ScfTools : ScfNoInstance
{
-private:
- static const String maHTMLDoc; /// Built-in name for an HTML document.
- static const String maHTMLTables; /// Built-in name for all HTML tables.
- static const String maHTMLTableIndex; /// Built-in prefix for an HTML table index.
- static const String maHTMLTableName; /// Built-in prefix for an HTML table name.
-
public:
// *** common methods ***
@@ -232,22 +229,35 @@ public:
// *** conversion of names ***
- /** Converts an Excel name to a valid Calc name.
- @param bKeepPeriod false = '.' will be converted to '_'; true = '.' leaves unmodified. */
- static void ConvertName( String& rName, bool bKeepPeriod = false );
+ /** Converts an external name to a valid Calc sheet name.
+ @descr Sheet names in Calc may contain letters, digits, underscores, and spaces
+ (space characters are not allowed at first position). */
+ static void ConvertToScSheetName( String& rName );
+ /** Converts an external name to a valid Calc defined name or database range name.
+ @descr Defined names in Calc may contain letters, digits (*), underscores, periods (*),
+ colons (*), question marks, and dollar signs.
+ (*) = not allowed at first position. */
+ static void ConvertToScDefinedName( String& rName );
+
+// *** streams and storages ***
+
+ /** Tries to open the stream with the specified name in the passed storage (read-only). */
+ static const SvStorageStreamRef OpenStorageStreamRead( SvStorage* pStorage, const String& rStrmName );
+ /** Tries to create or open a stream with the specified name in the passed storage (read/write). */
+ static const SvStorageStreamRef OpenStorageStreamWrite( SvStorage* pStorage, const String& rStrmName );
// *** byte string import operations ***
/** Reads and returns a zero terminted byte string. */
static ByteString ReadCString( SvStream& rStrm );
/** Reads and returns a zero terminted byte string. */
- static inline String ReadCString( SvStream& rStrm, CharSet eSrc )
+ inline static String ReadCString( SvStream& rStrm, CharSet eSrc )
{ return String( ReadCString( rStrm ), eSrc ); }
/** Reads and returns a zero terminted byte string and decreases a stream counter. */
static ByteString ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft );
/** Reads and returns a zero terminted byte string and decreases a stream counter. */
- static inline String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, CharSet eSrc )
+ inline static String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, CharSet eSrc )
{ return String( ReadCString( rStrm, rnBytesLeft ), eSrc ); }
/** Appends a zero terminted byte string. */
@@ -258,25 +268,29 @@ public:
// *** HTML table names <-> named range names ***
/** Returns the built-in range name for an HTML document. */
- static inline const String& GetHTMLDocName() { return maHTMLDoc; }
+ static const String& GetHTMLDocName();
/** Returns the built-in range name for all HTML tables. */
- static inline const String& GetHTMLTablesName() { return maHTMLTables; }
+ static const String& GetHTMLTablesName();
/** Returns the built-in range name for an HTML table, specified by table index. */
static String GetNameFromHTMLIndex( sal_uInt32 nIndex );
/** Returns the built-in range name for an HTML table, specified by table name. */
static String GetNameFromHTMLName( const String& rTabName );
/** Returns true, if rSource is the built-in range name for an HTML document. */
- static inline bool IsHTMLDocName( const String& rSource )
- { return rSource.EqualsIgnoreCaseAscii( maHTMLDoc ) == TRUE; }
+ static bool IsHTMLDocName( const String& rSource );
/** Returns true, if rSource is the built-in range name for all HTML tables. */
- static inline bool IsHTMLTablesName( const String& rSource )
- { return rSource.EqualsIgnoreCaseAscii( maHTMLTables ) == TRUE; }
+ static bool IsHTMLTablesName( const String& rSource );
/** Converts a built-in range name to an HTML table name.
@param rSource The string to be determined.
@param rName The HTML table name.
@return true, if conversion was successful. */
static bool GetHTMLNameFromName( const String& rSource, String& rName );
+
+private:
+ /** Returns the prefix for table index names. */
+ static const String& GetHTMLIndexPrefix();
+ /** Returns the prefix for table names. */
+ static const String& GetHTMLNamePrefix();
};
diff --git a/sc/source/filter/inc/htmlpars.hxx b/sc/source/filter/inc/htmlpars.hxx
index 541d158d2939..73563659e433 100644
--- a/sc/source/filter/inc/htmlpars.hxx
+++ b/sc/source/filter/inc/htmlpars.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: htmlpars.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dr $ $Date: 2001-04-06 12:38:30 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:03 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,12 +66,43 @@
#include <tools/stack.hxx>
#endif
+#include <memory>
+#include <vector>
+#include <list>
+#include <map>
+
#include "rangelst.hxx"
#include "eeparser.hxx"
-#define SC_HTML_FONTSIZES 7 // wie Export, HTML-Options
+const sal_uInt32 SC_HTML_FONTSIZES = 7; // wie Export, HTML-Options
#define SC_HTML_OFFSET_TOL 10 // Pixeltoleranz fuer SeekOffset
+// ============================================================================
+// BASE class for HTML parser classes
+// ============================================================================
+
+class ScHTMLTable;
+
+/** Base class for HTML parser classes. */
+class ScHTMLParser : public ScEEParser
+{
+protected:
+ sal_uInt32 maFontHeights[ SC_HTML_FONTSIZES ];
+ ScDocument* mpDoc; /// The destination document.
+
+public:
+ explicit ScHTMLParser( EditEngine* pEditEngine, ScDocument* pDoc );
+ virtual ~ScHTMLParser();
+
+ virtual sal_uInt32 Read( SvStream& rStrm ) = 0;
+
+ /** Returns the "global table" which contains the entire HTML document. */
+ virtual const ScHTMLTable* GetGlobalTable() const = 0;
+};
+
+
+// ============================================================================
+
SV_DECL_VARARR_SORT( ScHTMLColOffset, ULONG, 16, 4);
struct ScHTMLTableStackEntry
@@ -123,161 +154,20 @@ struct ScHTMLAdjustStackEntry
DECLARE_STACK( ScHTMLAdjustStack, ScHTMLAdjustStackEntry* );
-//------------------------------------------------------------------------
-
-enum ScHTMLTableDataKey { tdCol, tdRow };
-
-class ScHTMLTableDataTable;
-
-class ScHTMLTableData // data for one HTML table
-{
-private:
- String aTableName; // <TABLE ID="name">
- Table aColCount; // count of cells per HTML column
- Table aRowCount; // count of cells per HTML row
- USHORT nFirstCol; // first column index
- USHORT nFirstRow; // first row index
- USHORT nLastCol; // last column index
- USHORT nLastRow; // last row index
- USHORT nColSpan; // column spanning of the parent cell
- USHORT nRowSpan; // row spanning of the parent cell
- USHORT nDocCol; // resulting position in ScDoc
- USHORT nDocRow; // resulting position in ScDoc
- BOOL bBorderOn; // table borders
-
- ScHTMLTableDataTable* pNestedTables; // table of nested HTML tables
-
- inline Table& GetDataTable( ScHTMLTableDataKey eCRKey )
- { return (eCRKey == tdCol) ? aColCount : aRowCount; }
- inline const Table& GetDataTable( ScHTMLTableDataKey eCRKey ) const
- { return (eCRKey == tdCol) ? aColCount : aRowCount; }
-
- static USHORT GetCount( const Table& rDataTab, ULONG nIndex );
- static USHORT GetSize( const Table& rDataTab, ULONG nStart, ULONG nEnd );
-
- USHORT CalcDocPos( ScHTMLTableDataKey eCRKey, ULONG nIndex ) const;
- USHORT CalcSpan( ScHTMLTableDataKey eCRKey, ULONG nIndex, USHORT nSpan ) const;
-
- void SetMaxCount( Table& rDataTab, ULONG nIndex, USHORT nCount );
- void ChangeDocCoord( short nColDiff, short nRowDiff );
-
- void RecalcSizeDim( ScHTMLTableDataKey eCRKey );
-
-public:
- ScHTMLTableData(
- const String& rTabName,
- USHORT _nFirstCol, USHORT _nFirstRow,
- USHORT _nColSpan, USHORT _nRowSpan,
- BOOL bBorder );
- ~ScHTMLTableData();
-
- inline USHORT GetFirstCol() const { return nFirstCol; }
- inline USHORT GetFirstRow() const { return nFirstRow; }
- inline USHORT GetLastCol() const { return nLastCol; }
- inline USHORT GetLastRow() const { return nLastRow; }
- inline const String& GetTableName() const { return aTableName; }
- void GetRange( ScRange& rRange ) const;
-
- inline USHORT GetFirst( ScHTMLTableDataKey eCRKey ) const
- { return (eCRKey == tdCol) ? nFirstCol : nFirstRow; }
- inline USHORT GetLast( ScHTMLTableDataKey eCRKey ) const
- { return (eCRKey == tdCol) ? nLastCol : nLastRow; }
- inline USHORT GetDocPos( ScHTMLTableDataKey eCRKey ) const
- { return (eCRKey == tdCol) ? nDocCol : nDocRow; }
- inline USHORT GetSpan( ScHTMLTableDataKey eCRKey ) const
- { return (eCRKey == tdCol) ? nColSpan : nRowSpan; }
- inline USHORT GetCount( ScHTMLTableDataKey eCRKey, ULONG nIndex ) const
- { return GetCount( GetDataTable( eCRKey ), nIndex ); }
- inline USHORT GetSize( ScHTMLTableDataKey eCRKey ) const
- { return GetSize( GetDataTable( eCRKey ), GetFirst( eCRKey ), GetLast( eCRKey ) ); }
-
- inline USHORT CalcDocCol( ULONG nIndex ) const { return CalcDocPos( tdCol, nIndex ); }
- inline USHORT CalcDocRow( ULONG nIndex ) const { return CalcDocPos( tdRow, nIndex ); }
- inline USHORT CalcColSpan( ULONG nIndex, USHORT nSpan ) const { return CalcSpan( tdCol, nIndex, nSpan ); }
- inline USHORT CalcRowSpan( ULONG nIndex, USHORT nSpan ) const { return CalcSpan( tdRow, nIndex, nSpan ); }
-
- ScHTMLTableData* GetNestedTable( ULONG nTab ) const;
-
- ScHTMLTableData* InsertNestedTable(
- ULONG nTab, const String& rTabName,
- USHORT _nFirstCol, USHORT _nFirstRow,
- USHORT _nColSpan, USHORT _nRowSpan,
- BOOL bBorder );
- inline void SetCellCoord( USHORT nCol, USHORT nRow );
- void SetDocCoord( USHORT nCol, USHORT nRow );
-
- void RecalcSize();
- void SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos );
-};
-
-inline void ScHTMLTableData::SetCellCoord( USHORT nCol, USHORT nRow )
-{
- nLastCol = Max( nLastCol, nCol );
- nLastRow = Max( nLastRow, nRow );
-}
-
-
-
-class ScHTMLTableDataTable : private Table
-{
-private:
- ScHTMLTableData* pCurrTab;
- ULONG nCurrTab;
-
- USHORT nSearchMin1;
- USHORT nSearchMin2;
- ScHTMLTableDataKey eSearchKey;
-
- inline void _Insert( ULONG nTab, ScHTMLTableData* pTable )
- { Table::Insert( nTab, pTable ); }
-
- inline ScHTMLTableData* _Get( ULONG nTab ) const
- { return (ScHTMLTableData*) Table::Get( nTab ); }
-
- inline void SetCurrTable( ULONG nTab, ScHTMLTableData* pTab )
- { nCurrTab = nTab; pCurrTab = pTab; }
-public:
- ScHTMLTableDataTable();
- virtual ~ScHTMLTableDataTable();
-
- ScHTMLTableData* GetTable( ULONG nTab );
- inline ScHTMLTableData* GetFirst() { return (ScHTMLTableData*) Table::First(); }
- inline ScHTMLTableData* GetNext() { return (ScHTMLTableData*) Table::Next(); }
- ScHTMLTableData* GetFirstInOrder( ScHTMLTableDataKey eKey );
- ScHTMLTableData* GetNextInOrder();
-
- USHORT GetNextFreeRow( ULONG nTab );
-
- ScHTMLTableData* InsertTable(
- ULONG nTab, const String& rTabName,
- USHORT nFirstCol, USHORT nFirstRow,
- USHORT nColSpan, USHORT nRowSpan,
- BOOL bBorder, ULONG nNestedIn = 0 );
- void SetCellCoord( ULONG nTab, USHORT nCol, USHORT nRow );
- void RecalcSizes();
-
- void Recalc();
- void SetCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos );
-};
-
-//------------------------------------------------------------------------
-
+// ============================================================================
class EditEngine;
class ScDocument;
class HTMLOption;
-class ScHTMLParser : public ScEEParser
+class ScHTMLLayoutParser : public ScHTMLParser
{
private:
- ULONG aFontHeights[SC_HTML_FONTSIZES];
+ Size aPageSize;
ScHTMLTableStack aTableStack;
- Size aPageSize; // in Pixeln
String aString;
ScRangeListRef xLockedList; // je Table
- ScDocument* pDoc;
Table* pTables;
- ScHTMLTableDataTable* pTableData; // data for each HTML table
ScHTMLColOffset* pColOffset;
ScHTMLColOffset* pLocalColOffset; // je Table
ULONG nFirstTableCell; // je Table
@@ -322,28 +212,450 @@ private:
USHORT GetWidth( ScEEParseEntry* );
void SetWidths();
void Adjust();
- void AdjustNoWidthHeight();
USHORT GetWidthPixel( const HTMLOption* );
BOOL IsAtBeginningOfText( ImportInfo* );
void TableOn( ImportInfo* );
void ColOn( ImportInfo* );
+ void TableRowOn( ImportInfo* );
+ void TableRowOff( ImportInfo* );
void TableDataOn( ImportInfo* );
+ void TableDataOff( ImportInfo* );
void TableOff( ImportInfo* );
void Image( ImportInfo* );
void AnchorOn( ImportInfo* );
void FontOn( ImportInfo* );
public:
- ScHTMLParser( EditEngine*, const Size& aPageSize,
- ScDocument*, BOOL _bCalcWidthHeight );
- virtual ~ScHTMLParser();
+ ScHTMLLayoutParser( EditEngine*, const Size& aPageSize, ScDocument* );
+ virtual ~ScHTMLLayoutParser();
virtual ULONG Read( SvStream& );
+ virtual const ScHTMLTable* GetGlobalTable() const;
+};
+
+
+
+// ============================================================================
+// HTML DATA QUERY PARSER
+// ============================================================================
+
+/** Declares the orientation in or for a table: column or row. */
+enum ScHTMLOrient { tdCol = 0 , tdRow = 1 };
+
+/** Type for a unique identifier for each table. */
+typedef sal_uInt16 ScHTMLTableId;
+/** Identifier of the "global table" (the entire HTML document). */
+const ScHTMLTableId SC_HTML_GLOBAL_TABLE = 0;
+/** Used as table index for normal (non-table) entries in ScHTMLEntry structs. */
+const ScHTMLTableId SC_HTML_NO_TABLE = 0;
+
+
+// ============================================================================
+
+/** A 2D cell position in an HTML table. */
+struct ScHTMLPos
+{
+ sal_uInt16 mnCol;
+ sal_uInt16 mnRow;
+
+ inline explicit ScHTMLPos() : mnCol( 0 ), mnRow( 0 ) {}
+ inline explicit ScHTMLPos( sal_uInt16 nCol, sal_uInt16 nRow ) :
+ mnCol( nCol ), mnRow( nRow ) {}
+ inline explicit ScHTMLPos( const ScAddress& rAddr ) { Set( rAddr ); }
+
+ inline sal_uInt16 Get( ScHTMLOrient eOrient ) const
+ { return (eOrient == tdCol) ? mnCol : mnRow; }
+ inline void Set( sal_uInt16 nCol, sal_uInt16 nRow )
+ { mnCol = nCol; mnRow = nRow; }
+ inline void Set( const ScAddress& rAddr )
+ { Set( rAddr.Col(), rAddr.Row() ); }
+ inline void Move( sal_Int16 nColDiff, sal_Int16 nRowDiff )
+ { mnCol += nColDiff; mnRow += nRowDiff; }
+ inline ScAddress MakeAddr() const
+ { return ScAddress( mnCol, mnRow, 0 ); }
+};
- ScHTMLTableDataTable* GetHTMLTables() const { return pTableData; }
+inline bool operator==( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
+{
+ return (rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol == rPos2.mnCol);
+}
+
+inline bool operator<( const ScHTMLPos& rPos1, const ScHTMLPos& rPos2 )
+{
+ return (rPos1.mnRow < rPos2.mnRow) || ((rPos1.mnRow == rPos2.mnRow) && (rPos1.mnCol < rPos2.mnCol));
+}
+
+
+// ----------------------------------------------------------------------------
+
+/** A 2D cell size in an HTML table. */
+struct ScHTMLSize
+{
+ sal_uInt16 mnCols;
+ sal_uInt16 mnRows;
+
+ inline explicit ScHTMLSize() : mnCols( 0 ), mnRows( 0 ) {}
+ inline explicit ScHTMLSize( sal_uInt16 nCols, sal_uInt16 nRows ) :
+ mnCols( nCols ), mnRows( nRows ) {}
+
+ inline sal_uInt16 Get( ScHTMLOrient eOrient ) const
+ { return (eOrient == tdCol) ? mnCols : mnRows; }
+ inline void Set( sal_uInt16 nCols, sal_uInt16 nRows )
+ { mnCols = nCols; mnRows = nRows; }
+ inline void Expand( sal_Int16 nColDiff, sal_Int16 nRowDiff )
+ { mnCols += nColDiff; mnRows += nRowDiff; }
+};
+
+inline bool operator==( const ScHTMLSize& rSize1, const ScHTMLSize& rSize2 )
+{
+ return (rSize1.mnRows == rSize2.mnRows) && (rSize1.mnCols == rSize2.mnCols);
+}
+
+
+// ============================================================================
+
+/** A single entry containing a line of text or representing a table. */
+struct ScHTMLEntry : public ScEEParseEntry
+{
+private:
+ bool mbImportAlways; /// true = Always import this entry.
+
+public:
+ explicit ScHTMLEntry(
+ const SfxItemSet& rItemSet,
+ ScHTMLTableId nTableId = SC_HTML_NO_TABLE );
+
+ /** Returns true, if the selection of the entry is empty. */
+ inline bool IsEmpty() const { return !aSel.HasRange(); }
+ /** Returns true, if the entry has any content to be imported. */
+ bool HasContents() const;
+ /** Returns true, if the entry represents a table. */
+ inline bool IsTable() const { return nTab != SC_HTML_NO_TABLE; }
+ /** Returns true, if the entry represents a table. */
+ inline ScHTMLTableId GetTableId() const { return nTab; }
+
+ /** Sets or cleares the import always state. */
+ inline void SetImportAlways( bool bSet = true ) { mbImportAlways = bSet; }
+ /** Sets start point of the entry selection to the start of the import info object. */
+ void AdjustStart( const ImportInfo& rInfo );
+ /** Sets end point of the entry selection to the end of the import info object. */
+ void AdjustEnd( const ImportInfo& rInfo );
+ /** Deletes leading and trailing empty paragraphs from the entry. */
+ void Strip( const EditEngine& rEditEngine );
+};
+
+
+// ============================================================================
+
+/** This struct handles creation of unique table identifiers. */
+struct ScHTMLTableAutoId
+{
+ const ScHTMLTableId mnTableId; /// The created unique table identifier.
+ ScHTMLTableId& mrnUnusedId; /// Reference to global unused identifier variable.
+
+ /** The constructor assigns an unused identifier to member mnTableId. */
+ explicit ScHTMLTableAutoId( ScHTMLTableId& rnUnusedId );
+};
+
+
+// ----------------------------------------------------------------------------
+
+class ScHTMLTableMap;
+
+/** Stores data for one table in an HTML document.
+ @descr This class does the main work for importing an HTML document. It manages
+ the correct insertion of parse entries into the correct cells and the creation
+ of nested tables. Recalculation of resulting document size and position is done
+ recursively in all nested tables. */
+class ScHTMLTable
+{
+private:
+ typedef ::std::auto_ptr< ScHTMLTableMap > ScHTMLTableMapPtr;
+ typedef ::std::auto_ptr< SfxItemSet > SfxItemSetPtr;
+ typedef ::std::vector< sal_uInt16 > ScSizeVec;
+ typedef ::std::list< ScHTMLEntry* > ScHTMLEntryList;
+ typedef ::std::map< ScHTMLPos, ScHTMLEntryList > ScHTMLEntryMap;
+ typedef ::std::auto_ptr< ScHTMLEntry > ScHTMLEntryPtr;
+
+ ScHTMLTable* mpParentTable; /// Pointer to parent table.
+ ScHTMLTableMapPtr mpNestedTables; /// Table of nested HTML tables.
+ String maTableName; /// Table name from <table id> option.
+ ScHTMLTableAutoId maTableId; /// Unique identifier of this table.
+ SfxItemSet maTableItemSet; /// Items for the entire table.
+ SfxItemSetPtr mpRowItemSet; /// Items for the current table row.
+ SfxItemSetPtr mpDataItemSet; /// Items for the current cell.
+ ScRangeList maLockList; /// Locked cells (needed for merged cells).
+ EditEngine& mrEditEngine; /// Edit engine (from ScEEParser).
+ ScEEParseList& mrEEParseList; /// List that owns the parse entries (from ScEEParser).
+ ScHTMLEntryMap maEntryMap; /// List of entries for each cell.
+ ScHTMLEntryList* mpCurrEntryList; /// Current entry list from map for faster access.
+ ScHTMLEntryPtr mpCurrEntry; /// Working entry, not yet inserted in a list.
+ ScSizeVec maSizes[ 2 ]; /// Calc cell count of each HTML table column/row.
+ ScHTMLSize maSize; /// Size of the table.
+ ScHTMLPos maCurrCell; /// Address of current cell to fill.
+ ScHTMLPos maDocBasePos; /// Resulting base address in a Calc document.
+ bool mbBorderOn; /// true = Table borders on.
+ bool mbPreFormText; /// true = Table from preformatted text (<pre> tag).
+ bool mbRowOn; /// true = Inside of <tr> </tr>.
+ bool mbDataOn; /// true = Inside of <td> </td> or <th> </th>.
+ bool mbPushEmptyLine; /// true = Insert empty line before current entry.
+
+public:
+ /** Creates a new HTML table without content.
+ @descr Internally handles a current cell position. This position is invalid
+ until first calls of RowOn() and DataOn().
+ @param rParentTable Reference to the parent table that owns this table.
+ @param bPreFormText true = Table is based on preformatted text (<pre> tag). */
+ explicit ScHTMLTable(
+ ScHTMLTable& rParentTable,
+ const ImportInfo& rInfo,
+ bool bPreFormText );
+
+ virtual ~ScHTMLTable();
+
+ /** Returns the name of the table, specified in the TABLE tag. */
+ inline const String& GetTableName() const { return maTableName; }
+ /** Returns the unique identifier of the table. */
+ inline ScHTMLTableId GetTableId() const { return maTableId.mnTableId; }
+ /** Returns the table size. */
+ inline const ScHTMLSize& GetSize() const { return maSize; }
+ /** Returns the cell spanning of the specified cell. */
+ ScHTMLSize GetSpan( const ScHTMLPos& rCellPos );
+
+ /** Searches in all nested tables for the specified table.
+ @param nTableId Unique identifier of the table. */
+ ScHTMLTable* FindNestedTable( ScHTMLTableId nTableId ) const;
+
+ /** Puts the item into the item set of the current entry. */
+ void PutItem( const SfxPoolItem& rItem );
+ /** Inserts a text portion into current entry. */
+ void PutText( const ImportInfo& rInfo );
+ /** Inserts a new line, if in preformatted text, else does nothing. */
+ void InsertPara( const ImportInfo& rInfo );
+
+ /** Inserts a line break (<br> tag).
+ @descr Inserts the current entry regardless if it is empty. */
+ void BreakOn();
+ /** Inserts a heading line (<p> and <h*> tags). */
+ void HeadingOn();
+ /** Processes a hyperlink (<a> tag). */
+ void AnchorOn();
+
+ /** Starts a *new* table nested in this table (<table> tag).
+ @return Pointer to the new table. */
+ ScHTMLTable* TableOn( const ImportInfo& rInfo );
+ /** Closes *this* table (</table> tag).
+ @return Pointer to the parent table. */
+ ScHTMLTable* TableOff( const ImportInfo& rInfo );
+ /** Starts a *new* table based on preformatted text (<pre> tag).
+ @return Pointer to the new table. */
+ ScHTMLTable* PreOn( const ImportInfo& rInfo );
+ /** Closes *this* table based on preformatted text (</pre> tag).
+ @return Pointer to the parent table. */
+ ScHTMLTable* PreOff( const ImportInfo& rInfo );
+
+ /** Starts next row (<tr> tag).
+ @descr Cell address is invalid until first call of DataOn(). */
+ void RowOn( const ImportInfo& rInfo );
+ /** Closes the current row (<tr> tag).
+ @descr Cell address is invalid until call of RowOn() and DataOn(). */
+ void RowOff( const ImportInfo& rInfo );
+ /** Starts the next cell (<td> or <th> tag). */
+ void DataOn( const ImportInfo& rInfo );
+ /** Closes the current cell (</td> or </th> tag).
+ @descr Cell address is invalid until next call of DataOn(). */
+ void DataOff( const ImportInfo& rInfo );
+
+ /** Starts the body of the HTML document (<body> tag). */
+ void BodyOn( const ImportInfo& rInfo );
+ /** Closes the body of the HTML document (</body> tag). */
+ void BodyOff( const ImportInfo& rInfo );
+
+ /** Returns the resulting document row/column count of the specified HTML row/column. */
+ sal_uInt16 GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos ) const;
+ /** Returns the resulting document row/column count in the range [nCellBegin, nCellEnd). */
+ sal_uInt16 GetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellBegin, sal_uInt16 nCellEnd ) const;
+ /** Returns the total document row/column count in the specified direction. */
+ sal_uInt16 GetDocSize( ScHTMLOrient eOrient ) const;
+
+ /** Returns the resulting Calc position of the top left edge of the table. */
+ inline const ScHTMLPos& GetDocPos() const { return maDocBasePos; }
+ /** Calculates the resulting Calc position of the specified HTML column/row. */
+ sal_uInt16 GetDocPos( ScHTMLOrient eOrient, sal_uInt16 nCellPos = 0 ) const;
+ /** Calculates the resulting Calc position of the specified HTML cell. */
+ ScHTMLPos GetDocPos( const ScHTMLPos& rCellPos ) const;
+ /** Calculates the current Calc document area of this table. */
+ void GetDocRange( ScRange& rRange ) const;
+
+ /** Applies border formatting to the passed document. */
+ void ApplyCellBorders( ScDocument* pDoc, const ScAddress& rFirstPos ) const;
+
+private:
+ /** Returns true, if the current cell does not contain an entry yet. */
+ bool IsEmptyCell() const;
+ /** Returns the item set from cell, row, or table, depending on current state. */
+ const SfxItemSet& GetCurrItemSet() const;
+
+ /** Returns true, if import info represents a space character. */
+ static bool IsSpaceCharInfo( const ImportInfo& rInfo );
+
+ /** Creates and returns a new empty flying entry at position (0,0). */
+ ScHTMLEntry* CreateEntry() const;
+ /** Creates a new flying entry.
+ @param rInfo Contains the initial edit engine selection for the entry. */
+ void CreateNewEntry( const ImportInfo& rInfo );
+
+ /** Inserts an empty line in front of the next entry. */
+ void InsertLeadingEmptyLine();
+
+ /** Pushes the passed entry into the list of the current cell. */
+ void ImplPushEntryToList( ScHTMLEntryList& rEntryList, ScHTMLEntryPtr& rpEntry );
+ /** Tries to insert the entry into the current cell.
+ @descr If insertion is not possible (i.e., currently no cell open), the
+ entry will be inserted into the parent table. */
+ void PushEntry( ScHTMLEntryPtr& rpEntry );
+ /** Puts the current entry into the entry list, if it is not empty.
+ @param rInfo The import info struct containing the end position of the current entry.
+ @param bLastInCell true = If cell is still empty, put this entry always. */
+ void PushEntry( const ImportInfo& rInfo, bool bLastinCell = false );
+ /** Pushes a new entry into current cell which references a nested table. */
+ void PushTableEntry( ScHTMLTableId nTableId );
+
+ /** Tries to find a table from the table container.
+ @descr Assumes that the table is located in the current container or
+ that the passed table identifier is 0.
+ @param nTableId Unique identifier of the table or 0. */
+ ScHTMLTable* GetExistingTable( ScHTMLTableId nTableId ) const;
+ /** Inserts a nested table in the current cell at the specified position.
+ @param bPreFormText true = New table is based on preformatted text (<pre> tag). */
+ ScHTMLTable* InsertNestedTable( const ImportInfo& rInfo, bool bPreFormText );
+ /** Closes this table and inserts it into parent table.
+ @return Pointer to the parent table, or this, if no parent found. */
+ ScHTMLTable* CloseTable( const ImportInfo& rInfo );
+
+ /** Inserts a new cell in an unused position, starting from current cell position. */
+ void InsertNewCell( const ScHTMLSize& rSpanSize );
+
+ /** Set internal states for a new table row. */
+ void ImplRowOn();
+ /** Set internal states for leaving a table row. */
+ void ImplRowOff();
+ /** Set internal states for entering a new table cell. */
+ void ImplDataOn( const ScHTMLSize& rSpanSize );
+ /** Set internal states for leaving a table cell. */
+ void ImplDataOff();
+
+ /** Inserts additional formatting options from import info into the item set. */
+ void ProcessFormatOptions( SfxItemSet& rItemSet, const ImportInfo& rInfo );
+
+ /** Updates the document column/row size of the specified column or row.
+ @descr Only increases the present count, never decreases. */
+ void SetDocSize( ScHTMLOrient eOrient, sal_uInt16 nCellPos, sal_uInt16 nSize );
+ /** Calculates and sets the resulting size the cell needs in the document.
+ @descr Reduces the needed size in merged cells.
+ @param nCellPos The first column/row position of the (merged) cell.
+ @param nCellSpan The cell spanning in the specified orientation.
+ @param nRealDocSize The raw document size of all entries of the cell. */
+ void CalcNeededDocSize(
+ ScHTMLOrient eOrient, sal_uInt16 nCellPos,
+ sal_uInt16 nCellSpan, sal_uInt16 nRealDocSize );
+
+protected:
+ /** Creates a new HTML table without parent.
+ @descr This constructor is used to create the "global table". */
+ explicit ScHTMLTable(
+ SfxItemPool& rPool,
+ EditEngine& rEditEngine,
+ ScEEParseList& rEEParseList,
+ ScHTMLTableId& rnUnusedId );
+
+ /** Fills all empty cells in this and nested tables with dummy parse entries. */
+ void FillEmptyCells();
+ /** Recalculates the size of all columns/rows in the table, regarding nested tables. */
+ void RecalcDocSize();
+ /** Recalculates the position of all cell entries and nested tables.
+ @param rBasePos The origin of the table in the Calc document. */
+ void RecalcDocPos( const ScHTMLPos& rBasePos );
+};
+
+
+// ----------------------------------------------------------------------------
+
+/** The "global table" representing the entire HTML document. */
+class ScHTMLGlobalTable : public ScHTMLTable
+{
+public:
+ explicit ScHTMLGlobalTable(
+ SfxItemPool& rPool,
+ EditEngine& rEditEngine,
+ ScEEParseList& rEEParseList,
+ ScHTMLTableId& rnUnusedId );
+
+ virtual ~ScHTMLGlobalTable();
+
+ /** Recalculates sizes and resulting positions of all document entries. */
+ void Recalc();
};
+// ============================================================================
+
+/** The HTML parser for data queries. Focuses on data import, not on layout.
+ @descr Builds the table structure correctly, ignores extended formatting
+ like pictures or column widths. */
+class ScHTMLQueryParser : public ScHTMLParser
+{
+private:
+ typedef ::std::auto_ptr< ScHTMLGlobalTable > ScHTMLGlobalTablePtr;
+
+ String maTitle; /// The title of the document.
+ ScHTMLGlobalTablePtr mpGlobTable; /// Contains the entire imported document.
+ ScHTMLTable* mpCurrTable; /// Pointer to current table (performance).
+ ScHTMLTableId mnUnusedId; /// First unused table identifier.
+ bool mbTitleOn; /// true = Inside of <title> </title>.
+
+public:
+ explicit ScHTMLQueryParser( EditEngine* pEditEngine, ScDocument* pDoc );
+ virtual ~ScHTMLQueryParser();
+
+ virtual sal_uInt32 Read( SvStream& rStrm );
+
+ /** Returns the "global table" which contains the entire HTML document. */
+ virtual const ScHTMLTable* GetGlobalTable() const;
+
+private:
+ /** Returns the specified table (may be maGlobTable, if no real table can be found). */
+ ScHTMLTable* GetTable( ScHTMLTableId nTableId ) const;
+
+ /** Handles all possible tags in the HTML document. */
+ void ProcessToken( const ImportInfo& rInfo );
+ /** Inserts a text portion into current entry. */
+ void InsertText( const ImportInfo& rInfo );
+ /** Processes the <font> tag. */
+ void FontOn( const ImportInfo& rInfo );
+
+ /** Processes the <meta> tag. */
+ void MetaOn( const ImportInfo& rInfo );
+ /** Opens the title of the HTML document (<title> tag). */
+ void TitleOn( const ImportInfo& rInfo );
+ /** Closes the title of the HTML document (</title> tag). */
+ void TitleOff( const ImportInfo& rInfo );
+
+ /** Opens a new table at the current position. */
+ void TableOn( const ImportInfo& rInfo );
+ /** Closes the current table. */
+ void TableOff( const ImportInfo& rInfo );
+ /** Opens a new table based on preformatted text. */
+ void PreOn( const ImportInfo& rInfo );
+ /** Closes the current preformatted text table. */
+ void PreOff( const ImportInfo& rInfo );
+
+ DECL_LINK( HTMLImportHdl, const ImportInfo* );
+};
+
+
+// ============================================================================
+
#endif
diff --git a/sc/source/filter/inc/imp_op.hxx b/sc/source/filter/inc/imp_op.hxx
index e56ef6d36387..fd0d5b94423b 100644
--- a/sc/source/filter/inc/imp_op.hxx
+++ b/sc/source/filter/inc/imp_op.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imp_op.hxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-06 16:03:48 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -359,7 +359,6 @@ protected:
virtual void SetTextCell( const UINT16 nCol, const UINT16 nRow,
String& rUnconvertedText, const UINT16 nXF );
// Achtung: rUnconvertedText wird moeglicherweise veraendert
- UINT16 CalcColWidth( const UINT16 nExcColWidth );
/** Sets a margin item into an item set.
@param rItemSet The destination item set.
diff --git a/sc/source/filter/inc/lotimpop.hxx b/sc/source/filter/inc/lotimpop.hxx
index ffe2063e5d89..be02c442d78b 100644
--- a/sc/source/filter/inc/lotimpop.hxx
+++ b/sc/source/filter/inc/lotimpop.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lotimpop.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:20:43 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/namebuff.hxx b/sc/source/filter/inc/namebuff.hxx
index 2acff65591c2..dfe0b6b27ed6 100644
--- a/sc/source/filter/inc/namebuff.hxx
+++ b/sc/source/filter/inc/namebuff.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: namebuff.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dr $ $Date: 2001-10-31 10:52:49 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -77,6 +77,8 @@
#include "root.hxx"
#endif
+#include "rangenam.hxx"
+
class ScDocument;
class ScTokenArray;
class NameBuffer;
@@ -218,9 +220,9 @@ public:
inline RangeNameBuffer( RootData* p );
// Name, Definition
void Store( ByteString&, const ScTokenArray*,
- UINT16 nAltSheet = 0, const BOOL bPrintarea = FALSE );
+ UINT16 nAltSheet = 0, const RangeType eNameType = RT_ABSAREA );
void Store( String&, const ScTokenArray*,
- UINT16 nAltSheet = 0, const BOOL bPrintarea = FALSE );
+ UINT16 nAltSheet = 0, const RangeType eNameType = RT_ABSAREA );
inline UINT16 operator[]( UINT16 nExcInd ) const;
inline UINT16 GetPos( void ) const;
};
diff --git a/sc/source/filter/inc/root.hxx b/sc/source/filter/inc/root.hxx
index 38b2ecb6a6ef..d0535139d696 100644
--- a/sc/source/filter/inc/root.hxx
+++ b/sc/source/filter/inc/root.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: root.hxx,v $
*
- * $Revision: 1.26 $
+ * $Revision: 1.27 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -102,9 +102,7 @@ class XclExpUserBViewList;
class XclExpCellMerging;
class ExcNameList;
-class UsedAttrList;
class XclObjList;
-class XclNoteList;
class XclEscher;
class XclPivotCacheList;
class SfxStyleSheet;
@@ -119,7 +117,6 @@ class XclExpRoot;
struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt!
{
SvStorage* pRootStorage; // THE storage
- double fColScale; // Skalierungs-Faktoren fuer
double fRowScale; // Spaltenbreiten / Zeilenhoehen
ScDocument* pDoc;
ScRangeName* pScRangeName;
@@ -144,9 +141,6 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt!
SvStorage* pPivotCacheStorage;
XclImpPivotCacheList* pImpPivotCacheList; // pivot caches for import
- SvStorageRef xCtrlStorage; // SvxMSConvertOCXControls compatibel storage
-// SvStorage* pCtrlStorage; // SvxMSConvertOCXControls compatibel storage
-
UINT32 nCondRangeCnt;
UINT16 nLastCond;
String GetCondFormStyleName( const UINT16 nCondCnt ); // -> exctools.cxx
@@ -158,13 +152,11 @@ struct RootData // -> Inkarnation jeweils im ImportExcel-Objekt!
ExcNameList* pNameList;
ScRangeName* pScNameList; // stores range names and DB ranges
- UsedAttrList* pXFRecs;
ExcExternDup* pExtSheetCntAndRecs;
UINT16 nColMax;
UINT16 nRowMax;
// Biff8
XclObjList* pObjRecs;
- XclNoteList* pNoteRecs;
String sAddNoteText; // text to append at current note (multiple hyperlinks)
XclEscher* pEscher;
diff --git a/sc/source/filter/inc/scflt.hxx b/sc/source/filter/inc/scflt.hxx
index 74dff29b267d..898653e46795 100644
--- a/sc/source/filter/inc/scflt.hxx
+++ b/sc/source/filter/inc/scflt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scflt.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: er $ $Date: 2002-12-06 17:44:47 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -732,7 +732,7 @@ public:
};
-class FilterProgressBar;
+class ScfStreamProgressBar;
// Import-Klasse
class Sc10Import
@@ -752,7 +752,7 @@ class Sc10Import
INT16 TabCount;
USHORT nShowTab;
ScViewOptions aSc30ViewOpt;
- FilterProgressBar* pPrgrsBar;
+ ScfStreamProgressBar* pPrgrsBar;
public:
Sc10Import( SvStream& rStr, ScDocument* pDocument );
diff --git a/sc/source/filter/inc/xcl97dum.hxx b/sc/source/filter/inc/xcl97dum.hxx
index 308e98d892b5..c1a09297d36d 100644
--- a/sc/source/filter/inc/xcl97dum.hxx
+++ b/sc/source/filter/inc/xcl97dum.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97dum.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -112,28 +112,6 @@ public:
};
-class ExcDummy8_XF : public ExcDummyRec
-{
-private:
- static const BYTE pMyData[];
- static const ULONG nMyLen;
-public:
- virtual ULONG GetLen() const;
- virtual const BYTE* GetData() const;
-};
-
-
-class ExcDummy8_Style : public ExcDummyRec
-{
-private:
- static const BYTE pMyData[];
- static const ULONG nMyLen;
-public:
- virtual ULONG GetLen() const;
- virtual const BYTE* GetData() const;
-};
-
-
class ExcDummy8_UsesElfs : public ExcDummyRec
{
private:
diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx
index 952e09c6c626..9747016ad277 100644
--- a/sc/source/filter/inc/xcl97esc.hxx
+++ b/sc/source/filter/inc/xcl97esc.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97esc.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2002-12-12 11:50:27 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -73,6 +73,10 @@
#include <tools/stack.hxx>
#endif
+#ifndef SC_XLOCX_HXX
+#include "xlocx.hxx"
+#endif
+
namespace utl { class TempFile; }
// --- class XclEscherEx ---------------------------------------------
@@ -89,6 +93,9 @@ class XclEscherEx : public EscherEx
private:
List aOffsetMap;
Stack aStack;
+#if EXC_INCL_EXP_OCX
+ XclExpOcxConverter aOcxConverter; /// Export of form controls.
+#endif
RootData& rRootData;
utl::TempFile* pPicTempFile;
SvStream* pPicStrm;
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index 77942f548f63..959900a3854f 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97rec.hxx,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:07 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -228,7 +228,11 @@ protected:
UINT16 nGrbit;
BOOL bFirstOnSheet;
- XclObj( ObjType eObjType, RootData& rRoot );
+ bool mbOwnEscher; /// true = Escher part created on the fly.
+
+ /** @param bOwnEscher If set to true, this object will create its escher data.
+ See SetOwnEscher() for details. */
+ explicit XclObj( ObjType eObjType, RootData& rRoot, bool bOwnEscher = false );
// overwritten for writing MSODRAWING record
virtual void SaveCont( XclExpStream& rStrm );
@@ -252,6 +256,17 @@ public:
void SetEscherShapeType( UINT16 nType );
inline void SetEscherShapeTypeGroup() { eObjType = otGroup; }
+ /** If set to true, this object has created its own escher data. This causes the
+ function EscherEx::EndShape() to not post process this object. This is used
+ i.e. for form controls. They are not handled in the svx base code, so the
+ XclExpObjControl c'tor creates the escher data itself. The svx base code does
+ not receive the correct shape ID after the EscherEx::StartShape() call, which
+ would result in deleting the object in EscherEx::EndShape(). */
+ inline void SetOwnEscher( bool bOwnEscher = true ) { mbOwnEscher = bOwnEscher; }
+ /** Returns true, if the object has created the escher data itself.
+ See SetOwnEscher() for details. */
+ inline bool IsOwnEscher() const { return mbOwnEscher; }
+
//! actually writes ESCHER_ClientTextbox
void SetText( RootData& rRoot, const SdrTextObj& rObj );
@@ -282,7 +297,7 @@ private:
public:
XclObjComment( RootData& rRoot,
- const ScAddress& rPos, const String& rStr );
+ const ScAddress& rPos, const String& rStr, bool bVisible );
virtual ~XclObjComment();
virtual void Save( XclExpStream& rStrm );
@@ -356,6 +371,34 @@ public:
};
+// ----------------------------------------------------------------------------
+
+#if EXC_INCL_EXP_OCX
+
+/** Represents an OBJ record for a form control. */
+class XclExpObjControl : public XclObj
+{
+private:
+ String maClassName; /// Class name of the control.
+ sal_uInt32 mnStrmStart; /// Start position in 'Ctls' stream.
+ sal_uInt32 mnStrmSize; /// Size in 'Ctls' stream.
+
+public:
+ XclExpObjControl(
+ const XclRoot& rRoot,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& rxShape,
+ const String& rClassName,
+ sal_uInt32 nStrmStart, sal_uInt32 nStrmSize );
+
+ virtual sal_uInt32 GetLen() const;
+
+private:
+ virtual void SaveCont( XclExpStream& rStrm );
+};
+
+#endif
+
// --- class XclObjAny -----------------------------------------------
class XclObjAny : public XclObj
@@ -372,48 +415,45 @@ public:
};
-// --- class XclNoteList ---------------------------------------------
+// ============================================================================
-class XclNote;
-
-class XclNoteList : public List, public ExcEmptyRec
+/** Represents a NOTE record containing the author and the note object ID.
+ @descr Creates the note Escher object internally. */
+class XclExpNote : public XclExpRecord
{
private:
-public:
- XclNoteList();
- virtual ~XclNoteList();
-
- XclNote* First() { return (XclNote*) List::First(); }
- XclNote* Next() { return (XclNote*) List::Next(); }
-
- void Add( XclNote* );
-
+ XclExpString maAuthor; /// Name of the author.
+ ScAddress maPos; /// Cell address of the note.
+ sal_uInt16 mnObjId; /// Escher object ID.
+ bool mbVisible; /// true = permanently visible.
+
+public:
+ /** Constructs a NOTE record from the passed note object and/or the text.
+ @descr The additional text will be separated from the note text with an empty line.
+ Creates the Escher object containing the drawing information and the note text.
+ @param rPos The Calc cell address of the note.
+ @param pScNote The Calc note object.
+ @param rAddText Additional text appended to the note text. */
+ explicit XclExpNote(
+ const XclExpRoot& rRoot,
+ const ScAddress& rPos,
+ const ScPostIt* pScNote,
+ const String& rAddText );
+
+ /** Writes the NOTE record, if the respective Escher object is present. */
virtual void Save( XclExpStream& rStrm );
-};
-
-// --- class XclNote -------------------------------------------------
-
-class XclNote : public ExcRecord
-{
private:
- XclExpUniString aAuthor;
- ScAddress aPos;
- UINT16 nGrbit;
- UINT16 nObjId;
+ /** Writes the body of the NOTE record. */
+ virtual void WriteBody( XclExpStream& rStrm );
+};
- virtual void SaveCont( XclExpStream& rStrm );
-public:
- XclNote( RootData& rD, const ScAddress& rPos,
- const String& rNoteText, const String& rNoteAuthor );
- virtual ~XclNote();
+/** A list of NOTE record objects. */
+typedef XclExpRecordList< XclExpNote > XclExpNoteList;
- virtual void Save( XclExpStream& rStrm );
- virtual UINT16 GetNum() const;
- virtual ULONG GetLen() const;
-};
+// ============================================================================
// --- class ExcBof8_Base --------------------------------------------
@@ -490,34 +530,6 @@ public:
};
-// --- class ExcXf8 --------------------------------------------------
-
-class ExcXf8 : public ExcXf
-{
-private:
- XclTextDirection eTextDir;
- UINT16 nTrot;
- UINT16 nCIndent;
-
- UINT16 nGrbitDiag;
- UINT32 nIcvDiagSer;
- UINT16 nDgDiag;
-
- BOOL bFShrinkToFit;
- BOOL bFMergeCell;
-
- virtual void SaveCont( XclExpStream& rStrm );
-
-public:
- ExcXf8( const XclExpRoot& rRoot, UINT16 nFont, UINT16 nForm,
- const ScPatternAttr* pPattAttr,
- BOOL& rbLineBreak, BOOL bStyle = FALSE );
-
- virtual UINT16 GetNum() const;
- virtual ULONG GetLen() const;
-};
-
-
// --- class ExcBundlesheet8 -----------------------------------------
class ExcBundlesheet8 : public ExcBundlesheetBase
@@ -609,7 +621,7 @@ class ScRangeList;
struct RootData;
class XclCf;
-class XclCondFormat : public ExcEmptyRec, protected List
+class XclCondFormat : public ExcEmptyRec, protected ScfDelList< XclCf >
{
// writes multiple cf _and_ condfmt records!
private:
@@ -618,9 +630,6 @@ private:
UINT16 nTabNum;
ULONG nComplLen;
- inline XclCf* _First() { return (XclCf*) List::First(); }
- inline XclCf* _Next() { return (XclCf*) List::Next(); }
-
void WriteCondfmt( XclExpStream& rStrm );
public:
@@ -661,17 +670,10 @@ private:
UINT32 nIcvTextSer;
BOOL bHasLine;
- UINT8 nLineData1;
- UINT8 nLineData2;
- UINT32 nIcvTopSer;
- UINT32 nIcvBotSer;
- UINT32 nIcvLftSer;
- UINT32 nIcvRigSer;
+ XclExpXFBorder maBorder;
BOOL bHasPattern;
- UINT16 nPatt;
- UINT32 nIcvForeSer;
- UINT32 nIcvBackSer;
+ XclExpXFArea maArea;
virtual void SaveCont( XclExpStream& rStrm );
diff --git a/sc/source/filter/inc/xecontent.hxx b/sc/source/filter/inc/xecontent.hxx
index d55b51921696..f2f3f9804407 100644
--- a/sc/source/filter/inc/xecontent.hxx
+++ b/sc/source/filter/inc/xecontent.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xecontent.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:10 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/xehelper.hxx b/sc/source/filter/inc/xehelper.hxx
index 65589f48c50b..1db07acad757 100644
--- a/sc/source/filter/inc/xehelper.hxx
+++ b/sc/source/filter/inc/xehelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xehelper.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -316,8 +316,10 @@ class EditEngine;
&N page count
&D current date
&T current time
- &F file name without path (converted to full file name)
&A table name
+ &F file name without path
+ &Z file path without file name
+ &Z&F file path and name
&U underlining on/off
&E double underlining on/off
&S strikeout characters on/off
@@ -327,7 +329,6 @@ class EditEngine;
Known but unsupported control sequences:
&X superscript on/off
&Y subscript on/off
- &Z file path without file name
&G picture
*/
class XclExpHFConverter : protected XclExpRoot, ScfNoCopy
diff --git a/sc/source/filter/inc/xelink.hxx b/sc/source/filter/inc/xelink.hxx
index c6e2b1936211..f3ef7eddd71d 100644
--- a/sc/source/filter/inc/xelink.hxx
+++ b/sc/source/filter/inc/xelink.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xelink.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:08 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/xerecord.hxx b/sc/source/filter/inc/xerecord.hxx
index f57150df8f8c..55526628b5b9 100644
--- a/sc/source/filter/inc/xerecord.hxx
+++ b/sc/source/filter/inc/xerecord.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xerecord.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,9 @@ public:
/** Overwrite this method to do any operation while saving the record list. */
virtual void Save( XclExpStream& rStrm );
+
+ /** Calls Save(XclExpStream&) nCount times. */
+ void SaveRepeated( XclExpStream& rStrm, sal_uInt32 nCount );
};
@@ -106,7 +109,7 @@ private:
public:
/** @param nRecId The record ID of this record. May be set later with SetRecId().
@param nRecSize The predicted record size. May be set later with SetRecSize(). */
- XclExpRecord(
+ explicit XclExpRecord(
sal_uInt16 nRecId = EXC_ID_UNKNOWN,
sal_uInt32 nRecSize = 0 );
@@ -114,13 +117,15 @@ public:
/** Returns the current record ID. */
inline sal_uInt16 GetRecId() const { return mnRecId; }
- /** Sets a new record ID. */
- inline void SetRecId( sal_uInt16 nRecId ) { mnRecId = nRecId; }
-
/** Returns the current record size prediction. */
inline sal_uInt32 GetRecSize() const { return mnRecSize; }
+
+ /** Sets a new record ID. */
+ inline void SetRecId( sal_uInt16 nRecId ) { mnRecId = nRecId; }
/** Sets a new record size prediction. */
inline void SetRecSize( sal_uInt32 nRecSize ) { mnRecSize = nRecSize; }
+ /** Sets record ID and size with one call. */
+ void SetRecHeader( sal_uInt16 nRecId, sal_uInt32 nRecSize );
/** Writes the record header and calls WriteBody(). */
virtual void Save( XclExpStream& rStrm );
@@ -139,10 +144,7 @@ class XclExpEmptyRecord : public XclExpRecord
{
public:
/** @param nRecId The record ID of this record. */
- inline XclExpEmptyRecord( sal_uInt16 nRecId );
-
-private:
- void SetRecSize( sal_uInt32 );
+ inline explicit XclExpEmptyRecord( sal_uInt16 nRecId );
};
inline XclExpEmptyRecord::XclExpEmptyRecord( sal_uInt16 nRecId ) :
@@ -165,7 +167,7 @@ public:
/** @param nRecId The record ID of this record.
@param rValue The value for the record body.
@param nSize Record size. Uses sizeof( Type ), if this parameter is omitted. */
- inline XclExpValueRecord(
+ inline explicit XclExpValueRecord(
sal_uInt16 nRecId,
const Type& rValue,
sal_uInt32 nSize = sizeof( Type ) );
@@ -218,7 +220,7 @@ private:
public:
/** @param nRecId The record ID of this record.
@param nValue The value for the record body. */
- inline XclExpBoolRecord( sal_uInt16 nRecId, bool bValue ) :
+ inline explicit XclExpBoolRecord( sal_uInt16 nRecId, bool bValue ) :
XclExpRecord( nRecId, 2 ), mbValue( bValue ) {}
/** Returns the Boolean value of the record. */
@@ -234,6 +236,30 @@ private:
// ----------------------------------------------------------------------------
+/** Record which exports a memory data array. */
+class XclExpDummyRecord : public XclExpRecord
+{
+private:
+ const void* mpData; /// The record data.
+
+public:
+ /** @param nRecId The record ID of this record.
+ @param nRecData Pointer to the data array representing the record body.
+ @param nRecSize Size of the data array. */
+ explicit XclExpDummyRecord(
+ sal_uInt16 nRecId, const void* pRecData, sal_uInt32 nRecSize );
+
+ /** Sets a data array. */
+ void SetData( const void* pRecData, sal_uInt32 nRecSize );
+
+private:
+ /** Writes the body of the record. */
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+
+// ----------------------------------------------------------------------------
+
/** A record that stores a reference to an existing record object.
@descr The record object does not take ownership of the passed record. This
class should be used to insert an existing record into another record list.
@@ -244,7 +270,7 @@ protected:
XclExpRecordBase& mrRec; /// Reference to the record.
public:
- inline XclExpRefRecord( XclExpRecordBase& rRec ) : mrRec( rRec ) {}
+ inline explicit XclExpRefRecord( XclExpRecordBase& rRec ) : mrRec( rRec ) {}
/** Writes the entire record. */
virtual void Save( XclExpStream& rStrm );
diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx
index 30c6940393d8..dbf69624dc1e 100644
--- a/sc/source/filter/inc/xeroot.hxx
+++ b/sc/source/filter/inc/xeroot.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xeroot.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:09 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,7 @@ class XclExpSst;
class XclExpPalette;
class XclExpFontBuffer;
class XclExpNumFmtBuffer;
+class XclExpXFBuffer;
class XclExpTabIdBuffer;
class XclExpLinkManager;
@@ -85,6 +86,7 @@ struct XclExpRootData : public XclRootData
typedef ::std::auto_ptr< XclExpPalette > XclExpPalettePtr;
typedef ::std::auto_ptr< XclExpFontBuffer > XclExpFontBufferPtr;
typedef ::std::auto_ptr< XclExpNumFmtBuffer > XclExpNumFmtBufferPtr;
+ typedef ::std::auto_ptr< XclExpXFBuffer > XclExpXFBufferPtr;
typedef ::std::auto_ptr< XclExpTabIdBuffer > XclExpTabIdBufferPtr;
typedef ::std::auto_ptr< XclExpLinkManager > XclExpLinkManagerPtr;
@@ -93,6 +95,7 @@ struct XclExpRootData : public XclRootData
XclExpPalettePtr mpPalette; /// The color buffer.
XclExpFontBufferPtr mpFontBuffer; /// All fonts in the file.
XclExpNumFmtBufferPtr mpNumFmtBuffer; /// All number formats in the file.
+ XclExpXFBufferPtr mpXFBuffer; /// All XF records in the file.
XclExpTabIdBufferPtr mpTabIdBuffer; /// Calc->Excel sheet index conversion.
XclExpLinkManagerPtr mpLinkManager; /// Manager for internal/external links.
@@ -121,6 +124,8 @@ public:
XclExpRoot& operator=( const XclExpRoot& rRoot );
+ /** Returns this root instance - for code readability in derived classes. */
+ inline const XclExpRoot& GetRoot() const { return *this; }
/** Returns true, if URLs should be stored relative to the document location. */
inline bool IsRelUrl() const { return mrExpData.mbRelUrl; }
@@ -133,6 +138,8 @@ public:
XclExpFontBuffer& GetFontBuffer() const;
/** Returns the number format buffer. */
XclExpNumFmtBuffer& GetNumFmtBuffer() const;
+ /** Returns the cell formatting attributes buffer. */
+ XclExpXFBuffer& GetXFBuffer() const;
/** Returns the buffer for Calc->Excel sheet index conversion. */
XclExpTabIdBuffer& GetTabIdBuffer() const;
diff --git a/sc/source/filter/inc/xestream.hxx b/sc/source/filter/inc/xestream.hxx
index f876dd9e8481..14de4e71e5e8 100644
--- a/sc/source/filter/inc/xestream.hxx
+++ b/sc/source/filter/inc/xestream.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xestream.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/inc/xestyle.hxx b/sc/source/filter/inc/xestyle.hxx
index e9e56e37e0c5..9eb2f0330549 100644
--- a/sc/source/filter/inc/xestyle.hxx
+++ b/sc/source/filter/inc/xestyle.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xestyle.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:37:56 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,6 +74,9 @@
#ifndef _SVX_SVXENUM_HXX
#include <svx/svxenum.hxx>
#endif
+#ifndef _ZFORLIST_HXX
+#include <svtools/zforlist.hxx>
+#endif
#ifndef INCLUDED_SVTOOLS_NFKEYTAB_HXX
#include <svtools/nfkeytab.hxx>
#endif
@@ -112,8 +115,14 @@ enum XclColorType
// ----------------------------------------------------------------------------
/** Stores all used colors in the document.
- @descr Supports color reduction to the maximum count of the current BIFF version. */
-class XclExpPalette : public XclExpRecord, public XclDefaultPalette
+ @descr Supports color reduction to the maximum count of the current BIFF version.
+ An instance of this class collects all colors in the conversion phase of the export,
+ using the InsertColor() function. It returns a unique identidier for each passed color.
+ After the entire document is converted, the palette will be reduced to the number of
+ colors supported by the current BIFF version, using the function ReduceColors().
+ Then, in the streaming phase, the functions GetColorIndex() and GetMixedColors()
+ return the real Excel palette index for all color identifiers. */
+class XclExpPalette : public XclExpRecord, public XclDefaultPalette, protected XclExpRoot
{
private:
/** Represents an entry in a color list.
@@ -126,16 +135,16 @@ private:
private:
Color maColor; /// The color value of this palette entry.
- sal_uInt32 mnCID; /// Unique color ID (CID) for color reduction.
+ sal_uInt32 mnColorId; /// Unique color ID for color reduction.
sal_uInt32 mnWeight; /// Weighting for color reduction.
public:
- explicit XclListColor( const Color& rColor, sal_uInt32 nCID );
+ explicit XclListColor( const Color& rColor, sal_uInt32 nColorId );
/** Returns the RGB color value of the color. */
inline const Color& GetColor() const { return maColor; }
/** Returns the unique ID of the color. */
- inline sal_uInt32 GetCID() const { return mnCID; }
+ inline sal_uInt32 GetColorId() const { return mnColorId; }
/** Returns the current weighting of the color. */
inline sal_uInt32 GetWeighting() const { return mnWeight; }
/** Returns true, if this color value is greater than rColor (simple arithmetic comparison). */
@@ -151,11 +160,11 @@ private:
void Merge( const XclListColor& rColor );
};
- /** Data for each inserted original color, represented by a CID (color ID). */
- struct XclCIDData
+ /** Data for each inserted original color, represented by a color ID. */
+ struct XclColorIdData
{
- Color maColor; /// The original inserted color.
- sal_uInt32 mnIndex; /// Maps current CID to color list or export color vector.
+ Color maColor; /// The original inserted color.
+ sal_uInt32 mnIndex; /// Maps current color ID to color list or export color vector.
/** Sets the contents of this struct. */
inline void Set( const Color& rColor, sal_uInt32 nIndex ) { maColor = rColor; mnIndex = nIndex; }
};
@@ -163,27 +172,27 @@ private:
/** A color that will be written to the Excel file. */
struct XclPaletteColor
{
- Color maColor; /// Resulting color to export.
- bool mbDefault; /// true = Entry is a default color.
+ Color maColor; /// Resulting color to export.
+ bool mbDefault; /// true = Entry is a default color.
/** Sets a new color.
@param bDefault true = Color is a color from default palette. */
inline void SetColor( const Color& rColor, bool bDefault = false ) { maColor = rColor; mbDefault = bDefault; }
};
typedef ScfDelList< XclListColor > XclListColorList;
- typedef ::std::vector< XclCIDData > XclCIDDataVec;
+ typedef ::std::vector< XclColorIdData > XclColorIdDataVec;
typedef ::std::vector< XclPaletteColor > XclPaletteColorVec;
- XclListColorList maColorList; /// Working color list.
- XclCIDDataVec maCIDDataVec; /// Data of all CIDs.
- XclPaletteColorVec maPalette; /// Contains resulting colors to export.
- sal_uInt32 mnLastIx; /// Last insertion index for search opt.
+ XclListColorList maColorList; /// Working color list.
+ XclColorIdDataVec maColorIdDataVec; /// Data of all CIDs.
+ XclPaletteColorVec maPalette; /// Contains resulting colors to export.
+ sal_uInt32 mnLastIx; /// Last insertion index for search opt.
public:
explicit XclExpPalette( const XclExpRoot& rRoot );
- /** Activates the default colors for the passed BIFF version. */
- void SetBiff( XclBiff eBiff );
+ /** Activates the default colors for the current BIFF version. */
+ void OnChangeBiff();
/** Inserts the color into the list and updates weighting.
@param nAutoDefault The Excel palette index for automatic color.
@@ -196,19 +205,19 @@ public:
/** Reduces the color list to the maximum count of the current BIFF version. */
void ReduceColors();
- /** Returns the Excel palette index of the color with passed color ID (CID). */
- sal_uInt16 GetColorIndex( sal_uInt32 nCID ) const;
+ /** Returns the Excel palette index of the color with passed color ID. */
+ sal_uInt16 GetColorIndex( sal_uInt32 nColorId ) const;
/** Returns the Excel palette index of the passed color (searches for nearest color).
@param nAutoDefault The Excel palette index for automatic color. */
sal_uInt16 GetColorIndex( const Color& rColor, sal_uInt16 nAutoDefault = 0 ) const;
- /** Returns a foreground and background color for the two passed CIDs.
+ /** Returns a foreground and background color for the two passed color IDs.
@descr If rnXclPattern contains a solid pattern, this function tries to find
- the two best fitting colors and a mix pattern (25%, 50% or 75%) for nCIDForegr.
+ the two best fitting colors and a mix pattern (25%, 50% or 75%) for nForeColorId.
This will result in a better approximation to the passed foreground color. */
void GetMixedColors(
- sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt16& rnXclPattern,
- sal_uInt32 nCIDForegr, sal_uInt32 nCIDBackgr ) const;
+ sal_uInt16& rnXclForeIx, sal_uInt16& rnXclBackIx, sal_uInt8& rnXclPattern,
+ sal_uInt32 nForeColorId, sal_uInt32 nBackColorId ) const;
/** Returns the RGB color data for a (non-zero-based) Excel palette entry.
@param nDefault Is returned, if nothing else could be found. */
@@ -218,8 +227,8 @@ public:
inline Color GetColor( sal_uInt16 nXclIndex, ColorData nDefault = COL_AUTO ) const;
private:
- /** Returns the original inserted color represented by nCID. */
- const Color& GetOriginalColor( sal_uInt32 nCID ) const;
+ /** Returns the original inserted color represented by the color ID nColorId. */
+ const Color& GetOriginalColor( sal_uInt32 nColorId ) const;
/** Returns the ordered insertion index for rColor in rnIndex.
@param rbIsEqual Returns true, if the color already exists. */
@@ -271,7 +280,7 @@ class XclExpFont : public XclExpRecord, protected XclExpRoot
{
private:
XclFontData maData; /// All font attributes.
- sal_uInt32 mnCID; /// Unique color ID for text color.
+ sal_uInt32 mnColorId; /// Unique color ID for text color.
sal_uInt32 mnHash; /// Hash value for fast comparison.
bool mbHasColor; /// false = Font does not use a color (i.e. chart).
@@ -285,7 +294,7 @@ public:
inline void SetFamily( FontFamily eFamily ) { maData.mnFamily = GetXclFamily( eFamily ); }
inline void SetCharSet( rtl_TextEncoding eCharSet ) { maData.mnCharSet = GetXclCharSet( eCharSet ); }
void SetColor( const Color& rColor );
- void SetCID( sal_uInt32 nCID );
+ void SetColorId( sal_uInt32 nColorId );
void SetHeight( sal_Int32 nTwips );
inline void SetWeight( FontWeight eWeight ) { maData.mnWeight = GetXclWeight( eWeight ); }
inline void SetUnderline( FontUnderline eUnderl ) { maData.meUnderline = GetXclUnderline( eUnderl ); }
@@ -308,7 +317,7 @@ public:
/** Returns true, if this font contains a specific color (if SetColor was called before). */
inline bool HasColor() const { return mbHasColor; }
/** Returns the unique color ID of the font color from palette. */
- inline sal_uInt32 GetCID() const { return mnCID; }
+ inline sal_uInt32 GetColorId() const { return mnColorId; }
/** Converts a font family to Excel font family. */
static sal_uInt8 GetXclFamily( FontFamily eFamily );
@@ -335,14 +344,17 @@ class ScPatternAttr;
class XclExpFontBuffer : public XclExpRecordBase, protected XclExpRoot
{
private:
- XclExpRecordList< XclExpFont > maFontList; /// List of all FONT records.
- sal_uInt32 mnMaxCount; /// Maximum possible count of fonts.
+ typedef XclExpRecordList< XclExpFont > XclExpFontList;
+
+ XclExpFontList maFontList; /// List of all FONT records.
+ XclFontData maAppFont; /// Application font (for column width).
+ sal_uInt32 mnXclMaxCount; /// Maximum number of fonts.
public:
explicit XclExpFontBuffer( const XclExpRoot& rRoot );
- /** Activates the default colors for the passed BIFF version. */
- void SetBiff( XclBiff eBiff );
+ /** Finds the maximum number of fonts for the current BIFF version. */
+ void OnChangeBiff();
/** Returns the specified font from font list. */
inline const XclExpFont* GetFont( sal_uInt32 nIndex ) const
@@ -368,7 +380,7 @@ private:
/** Initializes the default fonts for the current BIFF version. */
void InitDefaultFonts();
/** Converts a list index into Excel font index. */
- sal_uInt16 GetXclIndex( sal_uInt32 nIndex );
+ sal_uInt16 GetXclIndex( sal_uInt32 nIndex ) const;
/** Tries to find the passed font and returns the current list index. */
sal_uInt32 Find( const XclExpFont& rFont );
};
@@ -402,6 +414,7 @@ private:
SvNumberFormatterPtr mpFormatter; /// Special number formatter for conversion.
NfKeywordTablePtr mpKeywordTable; /// Replacement table.
XclExpNumFmtVec maFormatMap; /// Maps core formats to Excel indexes.
+ sal_uInt32 mnStdFmt; /// Key for standard number format.
sal_uInt16 mnXclOffset; /// Offset to first user defined format.
public:
@@ -409,13 +422,16 @@ public:
virtual ~XclExpNumFmtBuffer();
- /** Sets internal data for the passed BIFF version. */
- void SetBiff( XclBiff eBiff );
+ /** Sets internal data for the current BIFF version. */
+ void OnChangeBiff();
+
+ /** Returns the core index of the current standard number format. */
+ inline sal_uInt32 GetStandardFormat() const { return mnStdFmt; }
/** Inserts a number format into the format buffer.
@param nFormatIx The core index of the number format.
@return The resulting Excel format index. */
- sal_uInt16 Insert( sal_uInt32 nFormatIx );
+ sal_uInt16 Insert( sal_uInt32 nScFormatIx );
/** Writes all FORMAT records contained in this buffer. */
virtual void Save( XclExpStream& rStrm );
@@ -432,6 +448,206 @@ private:
// XF, STYLE record - Cell formatting =========================================
+/** Contains color and line style for each cell border line. */
+struct XclExpXFBorder
+{
+ sal_uInt32 mnLeftColorId; /// Color ID for left line.
+ sal_uInt32 mnRightColorId; /// Color ID for right line.
+ sal_uInt32 mnTopColorId; /// Color ID for top line.
+ sal_uInt32 mnBottomColorId; /// Color ID for bottom line.
+ sal_uInt8 mnLeftLine; /// Style of left line.
+ sal_uInt8 mnRightLine; /// Style of right line.
+ sal_uInt8 mnTopLine; /// Style of top line.
+ sal_uInt8 mnBottomLine; /// Style of bottom line.
+
+ explicit XclExpXFBorder();
+};
+
+
+// ----------------------------------------------------------------------------
+
+/** Contains background colors and pattern. */
+struct XclExpXFArea
+{
+ sal_uInt32 mnForeColorId; /// Foreground color ID.
+ sal_uInt32 mnBackColorId; /// Background color ID.
+ sal_uInt8 mnPattern; /// Fill pattern.
+
+ explicit XclExpXFArea();
+};
+
+
+// ----------------------------------------------------------------------------
+
+class SfxStyleSheetBase;
+class SvxBoxItem;
+class SvxBorderLine;
+
+/** Represents an XF record which contains all formatting data of a cell or cell style. */
+class XclExpXF : public XclExpRecord
+{
+private:
+ typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr;
+
+ ScPatternAttrPtr mpOwnPattern; /// An own item set (used for cell styles).
+ const ScPatternAttr* mpPattern; /// Pointer to Calc item set (we do not own it).
+
+ XclExpXFBorder maBorder; /// Border line style.
+ XclExpXFArea maArea; /// Background area style.
+ XclHorAlign meHorAlign; /// Horizontal alignment.
+ XclVerAlign meVerAlign; /// Vertical alignment.
+ XclTextOrient meOrient; /// Text orientation.
+ XclTextDirection meTextDir; /// CTL text direction.
+
+ sal_uInt16 mnParent; /// Index to parent style XF.
+ sal_uInt16 mnFont; /// Excel font index.
+ sal_uInt16 mnNumFmt; /// Excel number format index.
+ sal_uInt8 mnIndent; /// Text indent.
+ sal_uInt8 mnRotation; /// Rotation angle.
+
+ bool mbCellXF; /// true = cell XF, false = style XF.
+ bool mbLocked; /// true = cell is locked.
+ bool mbHidden; /// true = formulas are hidden.
+ bool mbWrapped; /// true = wrap text on cell border.
+ bool mbProtUsed; /// true = locked/hidden flags used.
+ bool mbFontUsed; /// true = font index used.
+ bool mbFmtUsed; /// true = number format used.
+ bool mbAlignUsed; /// true = alignment used.
+ bool mbBorderUsed; /// true = border data used.
+ bool mbAreaUsed; /// true = area data used.
+
+public:
+ /** Constructs a cell XF record from the passed Calc item set.
+ @param nForcedNumFmt If not set to NUMBERFORMAT_ENTRY_NOT_FOUND, it will overwrite
+ the number format of the passed item set.
+ @param bForcedWrap true = set text wrap flag unconditionally. */
+ explicit XclExpXF(
+ const XclExpRoot& rRoot,
+ const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND,
+ bool bForceWrapped = false );
+ /** Constructs a style XF record from the passed cell style sheet. */
+ explicit XclExpXF( const XclExpRoot& rRoot, SfxStyleSheetBase& rStyleSheet );
+
+ /** Returns true, if the passed cell formatting is represented by this XF record.
+ @descr Searches for cell XFs only. */
+ bool Equals(
+ const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt,
+ bool bForceWrapped ) const;
+
+ /** Sets the border line styles from the item set into the passed struct. */
+ static void GetBorder(
+ XclExpXFBorder& rBorder,
+ XclExpPalette& rPalette,
+ const ScPatternAttr& rPattern );
+
+ /** Sets the area styles from the brush item into the passed struct. */
+ static void GetArea(
+ XclExpXFArea& rArea,
+ XclExpPalette& rPalette,
+ const ScPatternAttr& rPattern );
+
+private:
+ /** Fills all members from the passed item set. */
+ void Init(
+ const XclExpRoot& rRoot,
+ const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND,
+ bool bForceWrapped = false );
+
+ /** Returns the bits specifying the used attributes.
+ @descr In cell XFs a set bit means a used attribute, in style XF a cleared
+ bit means a used attribute. This method regards the cell/style state.
+ @return The mask based on bit 0 (not yet bit-shifted as needed for export). */
+ sal_uInt8 GetUsedAttribMask() const;
+
+ void WriteBody5( XclExpStream& rStrm );
+ void WriteBody8( XclExpStream& rStrm );
+
+ /** Writes the contents of the XF record. */
+ virtual void WriteBody( XclExpStream& rStrm );
+
+ /** Reads the passed border line struct and converts to Excel line style and color. */
+ static void GetBorderLine(
+ sal_uInt8& rnXclLine, sal_uInt32& rnColorId,
+ XclExpPalette& rPalette, const SvxBorderLine* pLine );
+};
+
+
+// ----------------------------------------------------------------------------
+
+/** Represents a STYLE record containing the name of a user-defined cell style. */
+class XclExpStyle : public XclExpRecord
+{
+private:
+ String maName; /// Name of the cell style.
+ sal_uInt16 mnXFIndex; /// Index to XF record with style formatting.
+
+public:
+ explicit XclExpStyle( const String& rName, sal_uInt16 nXFIndex );
+
+private:
+ /** Writes the contents of the STYLE record. */
+ virtual void WriteBody( XclExpStream& rStrm );
+};
+
+
+// ----------------------------------------------------------------------------
+
+/** Stores all XF records (cell formats) in the document. */
+class XclExpXFBuffer : public XclExpRecordBase, protected XclExpRoot
+{
+private:
+ typedef XclExpRecordList< XclExpXF > XclExpXFList;
+ typedef XclExpRecordList< XclExpStyle > XclExpStyleList;
+
+ XclExpXFList maXFList; /// List of all XF records.
+ XclExpStyleList maStyleList; /// List of all STYLE records.
+ sal_uInt32 mnXclMaxCount; /// Maximum number of XF records.
+ sal_uInt16 mnXclOffset; /// Offset to first user defined XF.
+
+public:
+ explicit XclExpXFBuffer( const XclExpRoot& rRoot );
+
+ /** Inserts all user-defined styles into the XF record list. */
+ void InsertUserStyles();
+
+ /** Finds or creates a cell XF record for the passed item set.
+ @param bForceWrapped true = cell contains hard newlines.
+ In this case the text wrap flag must be set in the XF record.
+ @return The resulting Excel XF record index. */
+ sal_uInt16 Insert( const ScPatternAttr* pPattern, bool bForceWrapped = false );
+ /** Finds or creates a cell XF record for the passed item set, with custom number format.
+ @param nForcedNumFmt The number format to be exported, i.e. formula result type.
+ This format will always overwrite the cell's number format.
+ @return The resulting Excel XF record index. */
+ sal_uInt16 Insert( const ScPatternAttr* pPattern, sal_uInt32 nForcedNumFmt );
+ /** Inserts the passed cell style. Creates a style XF record and a STYLE record.
+ @return The resulting Excel XF record index. */
+ sal_uInt16 InsertStyle( SfxStyleSheetBase& rStyleSheet );
+
+ /** Writes all XF records contained in this buffer. */
+ virtual void Save( XclExpStream& rStrm );
+
+private:
+ /** Converts a list index into Excel XF index. */
+ sal_uInt16 GetXclIndex( sal_uInt32 nIndex ) const;
+
+ /** Tries to find the XF record containing the passed format or inserts a new record.
+ @return The Excel XF index. */
+ sal_uInt16 InsertCellXF(
+ const ScPatternAttr* pPattern,
+ sal_uInt32 nForcedNumFmt = NUMBERFORMAT_ENTRY_NOT_FOUND,
+ bool bForceWrapped = false );
+
+ void WriteDefaultXFs5( XclExpStream& rStrm );
+ void WriteDefaultXFs8( XclExpStream& rStrm );
+
+ void WriteDefaultStyles5( XclExpStream& rStrm );
+};
+
+
// ============================================================================
#endif
diff --git a/sc/source/filter/inc/xicontent.hxx b/sc/source/filter/inc/xicontent.hxx
index 0a0f449d5a37..c8b611391865 100644
--- a/sc/source/filter/inc/xicontent.hxx
+++ b/sc/source/filter/inc/xicontent.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xicontent.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:14 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:10 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -185,7 +185,7 @@ class XclImpValidation : ScfNoInstance
{
public:
/** Reads a DVAL record and sets marks the dropdown arrow control to be ignored. */
- static void ReadDval( XclImpStream& rStrm, XclImpRoot& rRoot );
+ static void ReadDval( XclImpStream& rStrm );
/** Reads a DV record and inserts validation data into the document. */
static void ReadDv( XclImpStream& rStrm, ExcelToSc& rFmlaConv );
};
diff --git a/sc/source/filter/inc/xihelper.hxx b/sc/source/filter/inc/xihelper.hxx
index 56cb73fc453c..182dfb995f1d 100644
--- a/sc/source/filter/inc/xihelper.hxx
+++ b/sc/source/filter/inc/xihelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xihelper.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:14 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:11 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -168,8 +168,10 @@ struct XclFontData;
&N page count
&D current date
&T current time
- &F file name without path (converted to full file name)
&A table name
+ &F file name without path (see also &Z&F)
+ &Z file path without file name (converted to full file name, see also &Z&F)
+ &Z&F file path and name
&U underlining on/off
&E double underlining on/off
&S strikeout characters on/off
@@ -179,7 +181,6 @@ struct XclFontData;
&fontheight set font height in points ('fontheight' is a decimal value)
Known but unsupported control sequences:
- &Z file path without file name
&G picture
*/
class XclImpHFConverter : protected XclImpRoot, ScfNoCopy
diff --git a/sc/source/filter/inc/xilink.hxx b/sc/source/filter/inc/xilink.hxx
index b04a4567f01a..e0561886b91a 100644
--- a/sc/source/filter/inc/xilink.hxx
+++ b/sc/source/filter/inc/xilink.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xilink.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:15 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,6 +128,7 @@ class XclImpExtName
{
private:
String maName; /// The name of the external name.
+ String maAddInName; /// The converted Calc add-in function name.
sal_uInt32 mnStorageId; /// Storage ID for OLE object storages.
XclImpExtNameType meType; /// Type of the external name.
@@ -137,6 +138,7 @@ public:
inline XclImpExtNameType GetType() const { return meType; }
inline const String& GetName() const { return maName; }
+ inline const String& GetAddInName() const { return maAddInName; }
inline sal_uInt32 GetStorageId() const { return mnStorageId; }
};
@@ -210,6 +212,7 @@ private:
String maUrl; /// URL of the external document.
sal_uInt16 mnCurrExcTab; /// Current Excel sheet index of external cells.
bool mbSelf; /// true = internal 3D references.
+ bool mbAddIn; /// true = Add-in function names.
public:
/** Reads the SUPBOOK record from stream. */
@@ -229,6 +232,8 @@ public:
/** Returns true, if this SUPBOOK contains internal 3D references. */
inline bool IsSelf() const { return mbSelf; }
+ /** Returns true, if this SUPBOOK contains add-in function names. */
+ inline bool IsAddIn() const { return mbAddIn; }
/** Returns the URL of the external document. */
inline const String& GetUrl() const { return maUrl; }
diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx
index a9df4df6d331..223703778a30 100644
--- a/sc/source/filter/inc/xiroot.hxx
+++ b/sc/source/filter/inc/xiroot.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xiroot.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:16 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,6 +79,7 @@ class XclImpXFBuffer;
class XclImpXFIndexBuffer;
class XclImpTabIdBuffer;
class XclImpLinkManager;
+class XclImpObjectManager;
class XclImpWebQueryBuffer;
/** Stores global buffers and data needed for Excel import filter. */
@@ -92,6 +93,7 @@ struct XclImpRootData : public XclRootData
typedef ::std::auto_ptr< XclImpXFIndexBuffer > XclImpXFIndexBufferPtr;
typedef ::std::auto_ptr< XclImpTabIdBuffer > XclImpTabIdBufferPtr;
typedef ::std::auto_ptr< XclImpLinkManager > XclImpLinkManagerPtr;
+ typedef ::std::auto_ptr< XclImpObjectManager > XclImpObjectManagerPtr;
typedef ::std::auto_ptr< XclImpWebQueryBuffer > XclImpWebQueryBufferPtr;
XclImpSstPtr mpSst; /// The shared string table.
@@ -105,11 +107,9 @@ struct XclImpRootData : public XclRootData
XclImpTabIdBufferPtr mpTabIdBuffer; /// Sheet creation order list.
XclImpLinkManagerPtr mpLinkManager; /// Manager for internal/external links.
+ XclImpObjectManagerPtr mpObjManager; /// All drawing objects.
XclImpWebQueryBufferPtr mpWebQBuffer; /// All web queries.
- ScfUInt32Vec maIgnoreObj; /// ID's of objects to ignore.
- bool mbIgnoreObjSorted; /// Vector of ignored objects sorted?
-
explicit XclImpRootData(
XclBiff eBiff,
ScDocument& rDocument,
@@ -132,6 +132,9 @@ public:
XclImpRoot& operator=( const XclImpRoot& rRoot );
+ /** Returns this root instance - for code readability in derived classes. */
+ inline const XclImpRoot& GetRoot() const { return *this; }
+
/** Returns the shared string table. */
XclImpSst& GetSst() const;
@@ -151,6 +154,8 @@ public:
/** Returns the link manager. */
XclImpLinkManager& GetLinkManager() const;
+ /** Returns the drawing object manager. */
+ XclImpObjectManager& GetObjectManager() const;
/** Returns the web query buffer. */
XclImpWebQueryBuffer& GetWebQueryBuffer() const;
@@ -164,11 +169,6 @@ public:
@descr See XclRoot::CheckCellRangeList for details. */
void CheckCellRangeList( ScRangeList& rRanges ) const;
- /** Sets the object with ID nObjId to be ignored on import. */
- void SetIgnoreObject( sal_uInt32 nObjId );
- /** Returns true, if the object with ID nObjId will be ignored. */
- bool IsIgnoreObject( sal_uInt32 nObjId ) const;
-
protected:
explicit XclImpRoot( XclImpRootData& rImpRootData );
diff --git a/sc/source/filter/inc/xistream.hxx b/sc/source/filter/inc/xistream.hxx
index f969713536f8..aa3396555860 100644
--- a/sc/source/filter/inc/xistream.hxx
+++ b/sc/source/filter/inc/xistream.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xistream.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:16 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:12 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,9 @@ Input stream class for Excel import
// Decryption =================================================================
+#define SC_XCL_USEDECR 0
+
+#if SC_XCL_USEDECR
/** Base class for BIFF stream decryption. */
class XclImpDecrypter : ScfNoCopy
{
@@ -146,6 +149,7 @@ public:
@return Count of bytes really read. */
virtual sal_uInt32 ReadDecrypt( SvStream& rStrm, void* pData, sal_uInt32 nBytes );
};
+#endif
// ============================================================================
@@ -231,14 +235,18 @@ class XclImpRoot;
class XclImpStream
{
private:
+#if SC_XCL_USEDECR
typedef ::std::auto_ptr< XclImpDecrypter > XclImpDecrypterPtr;
+#endif
typedef ScfDelStack< XclImpStreamPos > XclImpStreamPosStack;
private:
SvStream& mrStrm; /// Reference to the system input stream.
const XclImpRoot& mrRoot; /// Filter root data.
+#if SC_XCL_USEDECR
XclImpDecrypterPtr mpDecrypter; /// Provides methods to decrypt data.
+#endif
XclImpStreamPos maFirstRec; /// Start position of current record.
XclImpStreamPosStack maPosStack; /// Stack for record positions.
@@ -260,7 +268,9 @@ private:
sal_uInt32 mnRecLeft; /// Count of bytes left in current record.
bool mbCont; /// Automatic CONTINUE lookup on/off.
+#if SC_XCL_USEDECR
bool mbUseDecr; /// Usage of decryption.
+#endif
bool mbValidRec; /// Read state: false = no record available.
bool mbValid; /// Read state: false = record overread.
bool mbWarnings; /// Enable/disable assertions.
@@ -296,11 +306,13 @@ public:
@param bWarnMode false = no overread assertions. */
inline void SetWarningMode( bool bWarnMode ) { mbWarnings = bWarnMode; }
+#if SC_XCL_USEDECR
/** Enables decryption of record contents for the rest of the stream.
@descr Stream takes ownership of the decrypter object. */
void EnableDecryption( XclImpDecrypter* pDecrypter );
/** Switches usage of current decryption algorithm on/off. */
void UseDecryption( bool bUse );
+#endif
/** Pushes current position on user position stack.
@descr This stack is emptied at every start of a new record. */
@@ -452,8 +464,10 @@ public:
inline sal_uInt32 GetStreamSize() const { return mnStreamSize; }
private:
+#if SC_XCL_USEDECR
/** Initializes the key/stream offset of the decrypter. */
inline void SetDecrypterOffset( sal_uInt16 nRecSize );
+#endif
/** Reads and decrypts a sal_Int8 value. */
void ReadAtom( sal_Int8& rnValue );
@@ -605,11 +619,13 @@ inline void XclImpStream::IgnoreByteString( bool b16BitLen )
// ----------------------------------------------------------------------------
+#if SC_XCL_USEDECR
inline void XclImpStream::SetDecrypterOffset( sal_uInt16 nRecSize )
{
if( mpDecrypter.get() )
mpDecrypter->SetOffset( nRecSize );
}
+#endif
// ============================================================================
diff --git a/sc/source/filter/inc/xistyle.hxx b/sc/source/filter/inc/xistyle.hxx
index c5a82429e1f5..ad80a1ac0ff1 100644
--- a/sc/source/filter/inc/xistyle.hxx
+++ b/sc/source/filter/inc/xistyle.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xistyle.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:17 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,7 +99,7 @@ and a container for XF indexes for every used cell in a sheet.
/** Stores the default colors for the current BIFF version and the contents of
a PALETTE record. */
-class XclImpPalette : public XclDefaultPalette
+class XclImpPalette : public XclDefaultPalette, protected XclImpRoot
{
private:
typedef ::std::vector< ColorData > ColorDataVec;
@@ -109,6 +109,9 @@ private:
public:
explicit XclImpPalette( const XclImpRoot& rRoot );
+ /** Activates the default colors for the current BIFF version. */
+ void OnChangeBiff();
+
/** Returns the RGB color data for a (non-zero-based) Excel palette entry.
@descr First looks for a color read from file, then looks for a default color.
@param nDefault Is returned, if nothing else could be found. */
@@ -164,13 +167,12 @@ public:
inline const XclFontData& GetFontData() const { return maData; }
/** Returns true, if the font contains superscript or subscript. */
inline bool HasEscapement() const { return maData.meEscapem != xlEscNone; }
+ /** Returns the width of the '0' character on current printer (twips). */
+ long GetCharWidth() const;
/** Reads a FONT record for all BIFF versions. */
void ReadFont( XclImpStream& rStrm );
- /** Calculates a column scaling factor using the current printer settings. */
- double CalcColumnScale() const;
-
/** Fills all font properties to the item set.
@param rItemSet The destination item set.
@param eMode The type of which IDs. */
@@ -217,13 +219,16 @@ class XclImpFontBuffer : protected XclImpRoot, ScfNoCopy
{
private:
ScfDelList< XclImpFont > maFontList; /// List of all FONT records in the Excel file.
+ XclFontData maAppFont; /// Application font (for column width).
public:
- inline explicit XclImpFontBuffer( const XclImpRoot& rRoot ) : XclImpRoot( rRoot ) {}
+ explicit XclImpFontBuffer( const XclImpRoot& rRoot );
/** Returns the object that stores all contents of a FONT record. */
inline const XclImpFont* GetFont( sal_uInt16 nFontIndex ) const
{ return maFontList.GetObject( nFontIndex ); }
+ /** Returns the application font data of this file, needed i.e. for column width. */
+ inline const XclFontData& GetAppFontData() const { return maAppFont; }
/** Reads a FONT record. */
void ReadFont( XclImpStream& rStrm );
@@ -246,7 +251,7 @@ class XclImpNumFmtBuffer : protected XclImpRoot, ScfNoCopy
{
private:
ScfUInt32Vec maKeyVec; /// Array of SvNumberFomatter format keys.
- sal_uInt32 mnDefault; /// Key for default format.
+ sal_uInt32 mnStdFmt; /// Key for standard number format.
public:
explicit XclImpNumFmtBuffer( const XclImpRoot& rRoot );
@@ -269,40 +274,66 @@ private:
// XF, STYLE record - Cell formatting =========================================
-struct XclImpXFBorder;
-struct XclImpXFArea;
+/** Contains color and line style for each cell border line. */
+struct XclImpXFBorder
+{
+ sal_uInt16 mnLeftColor; /// Index to color for left line.
+ sal_uInt16 mnRightColor; /// Index to color for right line.
+ sal_uInt16 mnTopColor; /// Index to color for top line.
+ sal_uInt16 mnBottomColor; /// Index to color for bottom line.
+ sal_uInt8 mnLeftLine; /// Style of left line.
+ sal_uInt8 mnRightLine; /// Style of right line.
+ sal_uInt8 mnTopLine; /// Style of top line.
+ sal_uInt8 mnBottomLine; /// Style of bottom line.
+};
+
+
+// ----------------------------------------------------------------------------
+
+/** Contains background colors and pattern. */
+struct XclImpXFArea
+{
+ sal_uInt16 mnForeColor; /// Index to foreground color.
+ sal_uInt16 mnBackColor; /// Index to background color.
+ sal_uInt8 mnPattern; /// Fill pattern.
+};
+
+
+// ----------------------------------------------------------------------------
+
class SvxBorderLine;
-/** Contains all data of a XF record and an ScPatternAttr (SetItem). */
+/** Contains all data of a XF record and a Calc item set. */
class XclImpXF : protected XclImpRoot, ScfNoCopy
{
private:
typedef ::std::auto_ptr< ScPatternAttr > ScPatternAttrPtr;
- typedef ::std::auto_ptr< XclImpXFBorder > XclImpXFBorderPtr;
- typedef ::std::auto_ptr< XclImpXFArea > XclImpXFAreaPtr;
- ScPatternAttrPtr mpPattern; /// Calc SetItem.
- XclImpXFBorderPtr mpBorder; /// Border line style.
- XclImpXFAreaPtr mpArea; /// Background area style.
+ mutable ScPatternAttrPtr mpPattern; /// Calc item set.
+ XclImpXFBorder maBorder; /// Border line style.
+ XclImpXFArea maArea; /// Background area style.
XclHorAlign meHorAlign; /// Horizontal alignment.
XclVerAlign meVerAlign; /// Vertical alignment.
- XclTextWrap meWrap; /// Automatic line break.
XclTextOrient meOrient; /// Text orientation.
XclTextDirection meTextDir; /// CTL text direction.
- sal_uInt8 mnRotation; /// Rotation angle.
- sal_uInt32 mnValFormat; /// Id for value format.
- sal_uInt16 mnIndent; /// Text indent.
- sal_uInt16 mnFont; /// Index to font record.
sal_uInt16 mnParent; /// Index to parent style XF.
+ sal_uInt32 mnNumFmt; /// Id for value format.
+ sal_uInt16 mnFont; /// Index to font record.
+ sal_uInt16 mnIndent; /// Text indent.
+ sal_uInt8 mnRotation; /// Rotation angle.
- bool mbCellXF; /// true = cell XF, sal_False = style XF.
+ bool mbCellXF; /// true = cell XF, false = style XF.
bool mbLocked; /// true = cell is locked.
bool mbHidden; /// true = formulas are hidden.
- bool mbFontValid; /// mnFont != parent->mnFont?
- bool mbFmtValid; /// mnValFormat != parent->mnValFormat?
- bool mbProtValid; /// mbLocked != parent->mbLocked or mbHidden != parent->mbHidden?
+ bool mbWrapped; /// true = automatic line break.
+ bool mbProtUsed; /// true = locked/hidden flags used.
+ bool mbFontUsed; /// true = font index used.
+ bool mbFmtUsed; /// true = number format used.
+ bool mbAlignUsed; /// true = alignment used.
+ bool mbBorderUsed; /// true = border data used.
+ bool mbAreaUsed; /// true = area data used.
public:
explicit XclImpXF( const XclImpRoot& rRoot );
@@ -311,9 +342,9 @@ public:
/** Reads an XF record. */
void ReadXF( XclImpStream& rStrm );
- /** Creates a Calc SetItem containing an item set with all cell properties.
- @return A read-only reference to the SetItem stored internally. */
- const ScPatternAttr& GetPattern();
+ /** Creates a Calc item set containing an item set with all cell properties.
+ @return A read-only reference to the item set stored internally. */
+ const ScPatternAttr& GetPattern() const;
inline bool IsCellXF() const { return mbCellXF; }
inline bool IsStyleXF() const { return !IsCellXF(); }
@@ -322,34 +353,27 @@ public:
inline XclVerAlign GetVerAlign() const { return meVerAlign; }
inline sal_uInt16 GetFont() const { return mnFont; }
- /** Inserts Excel border line styles into the item set. */
+ /** Inserts the border line styles into the item set. */
static void SetBorder(
- SfxItemSet& rItemSet, const XclImpPalette& rPalette,
- sal_uInt8 nXclLeftLine, sal_uInt16 nXclLeftColor,
- sal_uInt8 nXclRightLine, sal_uInt16 nXclRightColor,
- sal_uInt8 nXclTopLine, sal_uInt16 nXclTopColor,
- sal_uInt8 nXclBottomLine, sal_uInt16 nXclBottomColor );
+ SfxItemSet& rItemSet,
+ const XclImpPalette& rPalette,
+ const XclImpXFBorder& rBorder );
- /** Inserts an Excel area style into the item set. */
+ /** Inserts the area style into the item set. */
static void SetArea(
- SfxItemSet& rItemSet, const XclImpPalette& rPalette,
- sal_uInt8 nXclPattern,
- sal_uInt16 nXclForeColor, sal_uInt16 nXclBackColor );
+ SfxItemSet& rItemSet,
+ const XclImpPalette& rPalette,
+ const XclImpXFArea& rArea );
private:
- /** Creates and returns the border data struct. */
- XclImpXFBorder& GetBorder();
- /** Creates and returns the area data struct. */
- XclImpXFArea& GetArea();
-
void ReadXF2( XclImpStream& rStrm );
void ReadXF3( XclImpStream& rStrm );
void ReadXF4( XclImpStream& rStrm );
void ReadXF5( XclImpStream& rStrm );
void ReadXF8( XclImpStream& rStrm );
- /** Creates a new border line item. */
- static SvxBorderLine* CreateBorderItem(
+ /** Creates a new border line struct from passed line style. */
+ static SvxBorderLine* CreateBorderLine(
const XclImpPalette& rPalette,
sal_uInt8 nXclLine, sal_uInt16 nXclColor );
};
@@ -363,7 +387,7 @@ class XclImpXFBuffer : protected XclImpRoot, ScfNoCopy
{
private:
ScfDelList< XclImpXF > maXFList; /// List of contents of all XF record.
- ScPatternAttr maDefPattern; /// This SetItem is used if no other could be found or created.
+ ScPatternAttr maDefPattern; /// Used if no styles could be found or created.
public:
explicit XclImpXFBuffer( const XclImpRoot& rRoot );
@@ -373,9 +397,9 @@ public:
/** Reads a STYLE record. */
void ReadStyle( XclImpStream& rStrm );
- /** Creates a SetItem with all properties stored in the XF record.
- @return A read-only reference to the SetItem stored internally. */
- const ScPatternAttr& GetPattern( sal_uInt32 nXFIndex );
+ /** Creates a item set with all properties stored in the XF record.
+ @return A read-only reference to the item set stored internally. */
+ const ScPatternAttr& GetPattern( sal_uInt32 nXFIndex ) const;
/** Returns the object that stores all contents of an XF record. */
inline const XclImpXF* GetXF( sal_uInt32 nXFIndex ) const
diff --git a/sc/source/filter/inc/xlconst.hxx b/sc/source/filter/inc/xlconst.hxx
index 3106b6858bd3..b09227458898 100644
--- a/sc/source/filter/inc/xlconst.hxx
+++ b/sc/source/filter/inc/xlconst.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xlconst.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -145,15 +145,25 @@ const sal_Int32 EXC_POINTS_PER_INCH = 72;
const sal_Int32 EXC_TWIPS_PER_INCH = EXC_POINTS_PER_INCH * 20;
+// Line styles ----------------------------------------------------------------
+
+const sal_uInt8 EXC_LINE_NONE = 0x00;
+const sal_uInt8 EXC_LINE_THIN = 0x01;
+const sal_uInt8 EXC_LINE_MEDIUM = 0x02;
+const sal_uInt8 EXC_LINE_THICK = 0x05;
+const sal_uInt8 EXC_LINE_DOUBLE = 0x06;
+const sal_uInt8 EXC_LINE_HAIR = 0x07;
+
+
// Background patterns --------------------------------------------------------
-const sal_uInt16 EXC_PATT_NONE = 0x0000;
-const sal_uInt16 EXC_PATT_SOLID = 0x0001;
-const sal_uInt16 EXC_PATT_50_PERC = 0x0002;
-const sal_uInt16 EXC_PATT_75_PERC = 0x0003;
-const sal_uInt16 EXC_PATT_25_PERC = 0x0004;
-const sal_uInt16 EXC_PATT_12_5_PERC = 0x0011;
-const sal_uInt16 EXC_PATT_6_25_PERC = 0x0012;
+const sal_uInt8 EXC_PATT_NONE = 0x00;
+const sal_uInt8 EXC_PATT_SOLID = 0x01;
+const sal_uInt8 EXC_PATT_50_PERC = 0x02;
+const sal_uInt8 EXC_PATT_75_PERC = 0x03;
+const sal_uInt8 EXC_PATT_25_PERC = 0x04;
+const sal_uInt8 EXC_PATT_12_5_PERC = 0x11;
+const sal_uInt8 EXC_PATT_6_25_PERC = 0x12;
// Miscellaneous ---------------------------------------------------------------
@@ -164,6 +174,11 @@ const sal_Unicode EXC_NEWLINE = EXC_NEWLINE_CHAR;
// Records (ordered by lowest record ID) ======================================
+// (0x0007, 0x0207) STRING ----------------------------------------------------
+
+const sal_uInt16 EXC_ID_STRING = 0x0207;
+
+
// (0x0014, 0x0015) HEADER, FOOTER --------------------------------------------
const sal_uInt16 EXC_ID_HEADER = 0x0014;
@@ -211,6 +226,12 @@ const sal_uInt16 EXC_ID_VERTPAGEBREAKS = 0x001A;
const sal_uInt16 EXC_ID_HORPAGEBREAKS = 0x001B;
+// (0x001C) NOTE --------------------------------------------------------------
+
+const sal_uInt16 EXC_ID_NOTE = 0x001C;
+const sal_uInt16 EXC_NOTE_VISIBLE = 0x0002;
+
+
// (0x001E, 0x041E) FORMAT ----------------------------------------------------
const sal_uInt16 EXC_ID_FORMAT = 0x041E;
@@ -300,26 +321,43 @@ const sal_uInt8 EXC_FONTCSET_SYMBOL = 0x02;
const sal_uInt16 EXC_FONT_AUTOCOLOR = 0x7FFF;
-// (0x0043, 0x00E0) XF --------------------------------------------------------
+// (0x0043, 0x0243, 0x0443, 0x00E0) XF ----------------------------------------
+
+const sal_uInt16 EXC_ID2_XF = 0x0043;
+const sal_uInt16 EXC_ID3_XF = 0x0243;
+const sal_uInt16 EXC_ID4_XF = 0x0443;
+const sal_uInt16 EXC_ID_XF = 0x00E0;
+
+const sal_uInt16 EXC_XF_OFFSET = 21; /// Index to first user defined record.
+const sal_uInt32 EXC_XF_MAXCOUNT = 4029; /// Maximum number of user defined records.
+const sal_uInt16 EXC_XF_DEFAULTSTYLE = 0; /// Excel index to cefault style XF.
+const sal_uInt16 EXC_XF_DEFAULTCELL = 15; /// Excel index to cefault cell XF.
const sal_uInt16 EXC_XF_LOCKED = 0x0001;
const sal_uInt16 EXC_XF_HIDDEN = 0x0002;
const sal_uInt16 EXC_XF_STYLE = 0x0004;
+const sal_uInt16 EXC_XF_STYLEPARENT = 0x0FFF; /// Syles don't have a parent.
+const sal_uInt16 EXC_XF_WRAPPED = 0x0008; /// Automatic line break.
-const sal_uInt16 EXC_XF_DIFF_VALFMT = 0x0400;
-const sal_uInt16 EXC_XF_DIFF_FONT = 0x0800;
-const sal_uInt16 EXC_XF_DIFF_ALIGN = 0x1000;
-const sal_uInt16 EXC_XF_DIFF_BORDER = 0x2000;
-const sal_uInt16 EXC_XF_DIFF_AREA = 0x4000;
-const sal_uInt16 EXC_XF_DIFF_PROT = 0x8000;
+const sal_uInt8 EXC_XF_DIFF_VALFMT = 0x01;
+const sal_uInt8 EXC_XF_DIFF_FONT = 0x02;
+const sal_uInt8 EXC_XF_DIFF_ALIGN = 0x04;
+const sal_uInt8 EXC_XF_DIFF_BORDER = 0x08;
+const sal_uInt8 EXC_XF_DIFF_AREA = 0x10;
+const sal_uInt8 EXC_XF_DIFF_PROT = 0x20;
const sal_uInt8 EXC_XF2_VALFMT_MASK = 0x3F;
const sal_uInt8 EXC_XF2_LOCKED = 0x40;
const sal_uInt8 EXC_XF2_HIDDEN = 0x80;
+const sal_uInt8 EXC_XF2_LEFTLINE = 0x08;
+const sal_uInt8 EXC_XF2_RIGHTLINE = 0x10;
+const sal_uInt8 EXC_XF2_TOPLINE = 0x20;
+const sal_uInt8 EXC_XF2_BOTTOMLINE = 0x40;
const sal_uInt8 EXC_XF2_BACKGROUND = 0x80;
const sal_uInt16 EXC_XF8_SHRINKTOFIT = 0x0010;
const sal_uInt16 EXC_XF8_MERGE = 0x0020;
+const sal_uInt8 EXC_XF8_STACKED = 0xFF; /// Special rotation angle.
// (0x0059, 0x005A) XCT, CRN --------------------------------------------------
@@ -364,12 +402,6 @@ const sal_uInt16 EXC_COLOR_BIFF2_BLACK = 0;
const sal_uInt16 EXC_COLOR_BIFF2_WHITE = 1;
-// (0x0093) STYLE -------------------------------------------------------------
-
-const sal_uInt16 EXC_STYLE_BUILTIN = 0x8000;
-const sal_uInt16 EXC_STYLE_MASK = 0x0FFF;
-
-
// (0x00E9) BITMAP ------------------------------------------------------------
const sal_uInt16 EXC_ID_BITMAP = 0x00E9;
@@ -459,6 +491,13 @@ const sal_uInt32 EXC_HLINK_FRAME = 0x00000080; /// Target frame.
const sal_uInt32 EXC_HLINK_UNC = 0x00000100; /// UNC path.
+// (0x0293) STYLE -------------------------------------------------------------
+
+const sal_uInt16 EXC_ID_STYLE = 0x0293;
+const sal_uInt16 EXC_STYLE_BUILTIN = 0x8000;
+const sal_uInt16 EXC_STYLE_MASK = 0x0FFF;
+
+
// web queries ================================================================
#define EXC_WEBQRY_FILTER "calc_HTML_WebQuery"
diff --git a/sc/source/filter/inc/xlocx.hxx b/sc/source/filter/inc/xlocx.hxx
new file mode 100644
index 000000000000..9c26776c03ae
--- /dev/null
+++ b/sc/source/filter/inc/xlocx.hxx
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * $RCSfile: xlocx.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:13 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// ============================================================================
+
+#ifndef SC_XLOCX_HXX
+#define SC_XLOCX_HXX
+
+#ifndef _MSOCXIMEX_HXX
+#include <svx/msocximex.hxx>
+#endif
+
+#ifndef SC_XLROOT_HXX
+#include "xlroot.hxx"
+#endif
+
+const int EXC_INCL_EXP_OCX = 1; /// 1 = Compile with OCX export.
+
+// OCX controls ===============================================================
+
+/** Converter base class for import and export of OXC controls.
+ @descr The purpose of this class is to manage all the draw pages occuring in a
+ spreadsheet document. Derived classes implement import or export of the controls. */
+class XclOcxConverter : protected SvxMSConvertOCXControls, public XclRoot
+{
+protected:
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent > XFormComponentRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > XShapeRef;
+ typedef ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > XDrawPageRef;
+
+private:
+ sal_uInt16 mnCurrTab; /// Stores sheet index of an object for GetDrawPage().
+ sal_uInt16 mnCachedTab; /// Sheet index of cached draw page.
+
+protected:
+ explicit XclOcxConverter( const XclRoot& rRoot );
+ virtual ~XclOcxConverter();
+
+ /** Sets the sheet index of the currently processed object. GetDrawPage() needs this. */
+ void SetCurrTab( sal_uInt16 nTab );
+
+private:
+ /** Returns the current draw page. */
+ virtual const XDrawPageRef& GetDrawPage();
+};
+
+
+// ----------------------------------------------------------------------------
+
+class XclImpEscherOle;
+
+/** Converter for import of OXC controls. */
+class XclImpOcxConverter : public XclOcxConverter
+{
+private:
+ SvStorageStreamRef mxStrm; /// The 'Ctls' strem.
+
+public:
+ explicit XclImpOcxConverter( const XclRoot& rRoot );
+
+ /** Reads the form control data of the passed control object and creates it in the document. */
+ void ReadControl( XclImpEscherOle& rObj );
+
+private:
+ /** Inserts the passed control rxFComp into the document. */
+ virtual sal_Bool InsertControl(
+ const XFormComponentRef& rxFComp,
+ const ::com::sun::star::awt::Size& rSize,
+ XShapeRef* pxShape,
+ BOOL bFloatingCtrl );
+};
+
+
+// ----------------------------------------------------------------------------
+
+#if EXC_INCL_EXP_OCX
+
+class SdrObject;
+class XclExpObjControl;
+
+/** Converter for export of OXC controls. */
+class XclExpOcxConverter : public XclOcxConverter
+{
+private:
+ SvStorageStreamRef mxStrm; /// The 'Ctls' stream.
+
+public:
+ explicit XclExpOcxConverter( const XclRoot& rRoot );
+
+ /** Creates an OBJ record for the passed form control object.
+ @descr Writes the form control data to the 'Ctls' stream. */
+ XclExpObjControl* CreateObjRec( const XShapeRef& rxShape );
+};
+
+#endif
+
+// ============================================================================
+
+#endif
+
diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx
index c2d067759f03..8133821cee92 100644
--- a/sc/source/filter/inc/xlroot.hxx
+++ b/sc/source/filter/inc/xlroot.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xlroot.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:18 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,6 +95,7 @@ struct XclRootData
LanguageType meLang; /// Document language.
ScAddress maScMaxPos; /// Highest Calc cell position.
ScAddress maXclMaxPos; /// Highest Excel cell position.
+ long mnCharWidth; /// Width of '0' in default font (twips).
sal_uInt16 mnScTab; /// Current Calc sheet index.
bool mbTruncated; /// Flag for the table truncated warning box.
@@ -104,6 +105,10 @@ struct XclRootData
::std::auto_ptr< RootData > mpRDP;//!
+#ifdef DBG_UTIL
+ sal_Int32 mnObjCnt; /// Object counter for mem leak tests.
+#endif
+
explicit XclRootData(
XclBiff eBiff,
ScDocument& rDocument,
@@ -120,8 +125,10 @@ class ScModelObj;
class SfxPrinter;
class SvNumberFormatter;
class ScRangeName;
+class SvStorage;
-/** Access to global data from other classes. */
+/** Access to global data for a filter object (imported or exported document)
+ from other classes. */
class XclRoot
{
private:
@@ -135,6 +142,8 @@ public:
RootData* mpRD;//!
+ /** Returns this root instance - for code readability in derived classes. */
+ inline const XclRoot& GetRoot() const { return *this; }
/** Returns the current BIFF version of the importer/exporter. */
inline XclBiff GetBiff() const { return mrData.meBiff; }
/** Returns the document language. */
@@ -150,9 +159,13 @@ public:
inline const String& GetBasePath() const { return mrData.maBasePath; }
/** Returns the character set to import/export byte strings. */
inline CharSet GetCharSet() const { return mrData.meCharSet; }
+ /** Returns the width of the '0' character (default font) for the current printer (twips). */
+ inline long GetCharWidth() const { return mrData.mnCharWidth; }
/** Returns the destination document (import) or source document (export). */
inline ScDocument& GetDoc() const { return mrData.mrDoc; }
+ /** Returns pointer to the destination document (import) or source document (export). */
+ inline ScDocument* GetDocPtr() const { return &mrData.mrDoc; }
/** Returns the object shell of the Calc document. May be NULL (i.e. import from clipboard). */
SfxObjectShell* GetDocShell() const;
/** Returns the object model of the Calc document. */
@@ -164,6 +177,10 @@ public:
/** Returns the defined names container of the Calc document. */
ScRangeName& GetNamedRanges() const;
+ /** Returns the OLE2 root storage of the imported/exported file.
+ @return Pointer to root storage or 0, if the file is a simple stream. */
+ SvStorage* GetRootStorage() const;
+
/** Returns the edit engine for import/export of rich strings etc. */
ScEditEngineDefaulter& GetEditEngine() const;
/** Returns the edit engine for import/export of headers/footers. */
@@ -186,6 +203,8 @@ protected:
inline void SetLanguage( LanguageType eLang ) { mrData.meLang = eLang; }
/** Sets the character set to import/export byte strings. */
inline void SetCharSet( CharSet eCharSet ) { mrData.meCharSet = eCharSet; }
+ /** Sets the width of the '0' character (default font) for the current printer (twips). */
+ inline void SetCharWidth( long nCharWidth ) { mrData.mnCharWidth = nCharWidth; }
/** Increases the current Calc sheet index by 1. */
inline void IncScTab() { ++mrData.mnScTab; }
diff --git a/sc/source/filter/inc/xlstyle.hxx b/sc/source/filter/inc/xlstyle.hxx
index c974559c4cc7..7cfccacfc9e2 100644
--- a/sc/source/filter/inc/xlstyle.hxx
+++ b/sc/source/filter/inc/xlstyle.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xlstyle.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:11:18 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,7 +72,7 @@
// Color data =================================================================
/** Stores all default colors for a specific BIFF version. */
-class XclDefaultPalette : ScfNoCopy
+class XclDefaultPalette
{
private:
const ColorData* mpColorTable; /// The table with RGB values.
@@ -83,7 +83,7 @@ public:
explicit XclDefaultPalette( XclBiff eBiff = xlBiffUnknown );
/** Activates the default colors for the passed BIFF version. */
- void SetBiff( XclBiff eBiff );
+ void SetDefaultColors( XclBiff eBiff );
/** Returns the color count in the current palette. */
inline sal_uInt32 GetColorCount() const { return mnTableSize; }
@@ -110,7 +110,7 @@ inline Color XclDefaultPalette::GetDefColor( sal_uInt16 nXclIndex, ColorData nDe
}
-// Font Data ==================================================================
+// Font data ==================================================================
/** Text underline style. */
enum XclUnderline
@@ -172,7 +172,7 @@ enum XclHorAlign
xlHAlignFill = 0x04,
xlHAlignJustify = 0x05,
xlHAlignCenterAcrSel = 0x06,
- xlHAlignParent = 0xFF
+ xlHAlignDistrib = 0x07
};
/** Vertical alignment of cell contents. */
@@ -182,8 +182,7 @@ enum XclVerAlign
xlVAlignCenter = 0x01,
xlVAlignBottom = 0x02,
xlVAlignJustify = 0x03,
- xlVAlignDistrib = 0x04,
- xlVAlignParent = 0xFF
+ xlVAlignDistrib = 0x04
};
/** Text orientation. */
@@ -193,16 +192,7 @@ enum XclTextOrient
xlTextOrientTopBottom = 0x01,
xlTextOrient90ccw = 0x02,
xlTextOrient90cw = 0x03,
- xlTextOrientRot = 0x04,
- xlTextOrientParent = 0xFF
-};
-
-/** Text wrap (automatic line break). */
-enum XclTextWrap
-{
- xlTextWrapNo = 0x00,
- xlTextWrapYes = 0x01,
- xlTextWrapParent = 0xFF
+ xlTextOrientRot = 0x04
};
/** CTL text direction. */
@@ -210,8 +200,7 @@ enum XclTextDirection
{
xlTextDirContext = 0x00,
xlTextDirLTR = 0x01,
- xlTextDirRTL = 0x02,
- xlTextDirParent = 0xFF
+ xlTextDirRTL = 0x02
};
diff --git a/sc/source/filter/inc/xltools.hxx b/sc/source/filter/inc/xltools.hxx
index 195e11382a71..8027132e6fcc 100644
--- a/sc/source/filter/inc/xltools.hxx
+++ b/sc/source/filter/inc/xltools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xltools.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:41:09 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,7 +81,7 @@
/** An enumeration for all Excel file format types (BIFF types). */
enum XclBiff
{
- xlBiff2, /// MS Excel 2.1
+ xlBiff2 = 0, /// MS Excel 2.1
xlBiff3, /// MS Excel 3.x
xlBiff4, /// MS Excel 4.x
xlBiff5, /// MS Excel 5.x
@@ -117,14 +117,12 @@ enum XclBoolError
class XclImpStream;
class XclExpStream;
-/** This struct stores a GUID (class ID) and supports reading, writing and
- comparison. */
+/** This struct stores a GUID (class ID) and supports reading, writing and comparison. */
struct XclGuid
{
- sal_uInt8 mpData[ 16 ];
+ sal_uInt8 mpData[ 16 ]; /// Stores GUID always in little endian.
explicit XclGuid();
- XclGuid( const XclGuid& rSrc );
explicit XclGuid(
sal_uInt32 nData1,
sal_uInt16 nData2, sal_uInt16 nData3,
@@ -132,8 +130,6 @@ struct XclGuid
sal_uInt8 nData43, sal_uInt8 nData44,
sal_uInt8 nData45, sal_uInt8 nData46,
sal_uInt8 nData47, sal_uInt8 nData48 );
-
- XclGuid& operator=( const XclGuid& rSrc );
};
bool operator==( const XclGuid& rCmp1, const XclGuid& rCmp2 );
@@ -172,9 +168,9 @@ public:
static bool GetRKFromDouble( sal_Int32& rnRKValue, double fValue );
/** Calculates an angle (in 1/100 of degrees) from an Excel angle value. */
- static sal_Int32 GetScRotation( sal_uInt16 nExcRot );
+ static sal_Int32 GetScRotation( sal_uInt16 nXclRot );
/** Calculates the Excel angle value from an angle in 1/100 of degrees. */
- static sal_uInt16 GetExcRotation( sal_Int32 nScRot );
+ static sal_uInt8 GetXclRotation( sal_Int32 nScRot );
/** Gets a translated error code or Boolean value from Excel error codes.
@param rfDblValue Returns 0.0 for error codes or the value of a Boolean (0.0 or 1.0).
@@ -192,6 +188,13 @@ public:
/** Returns the length in inches calculated from a length in twips. */
static double GetInchFromTwips( sal_uInt16 nTwips );
+ /** Returns the Calc column width (twips) for the passed Excel width.
+ @param nScCharWidth Width of the '0' character in Calc (twips). */
+ static sal_uInt16 GetScColumnWidth( sal_uInt16 nXclWidth, long nScCharWidth );
+ /** Returns the Excel column width for the passed Calc width (twips).
+ @param nScCharWidth Width of the '0' character in Calc (twips). */
+ static sal_uInt16 GetXclColumnWidth( sal_uInt16 nScWidth, long nScCharWidth );
+
// built-in names -------------------------------------------------------------
/** Returns an Excel built-in name used in NAME records. */
diff --git a/sc/source/filter/lotus/filter.cxx b/sc/source/filter/lotus/filter.cxx
index 56f8f8c6fea7..9fb48aaf750a 100644
--- a/sc/source/filter/lotus/filter.cxx
+++ b/sc/source/filter/lotus/filter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filter.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:45:14 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:28 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -78,7 +78,6 @@
#include "compiler.hxx"
#include "scerrors.hxx"
-#include "fltprgrs.hxx"
#include "root.hxx"
#include "lotrange.hxx"
#include "optab.h"
@@ -86,6 +85,11 @@
#include "decl.h"
#include "tool.h"
+#ifndef SC_FPROGRESSBAR_HXX
+#include "fprogressbar.hxx"
+#endif
+
+
// Konstanten ------------------------------------------------------------
const UINT16 nBOF = 0x0000;
@@ -144,7 +148,7 @@ FltError ScImportLotus123old( SvStream& aStream, ScDocument* pDocument, CharSet
InitPage(); // Seitenformat initialisieren (nur Tab 0!)
// Progressbar starten
- FilterProgressBar aPrgrsBar( aStream );
+ ScfStreamProgressBar aPrgrsBar( aStream, pDocument->GetDocumentShell() );
// Datei-Typ ermitteln
eTyp = ScanVersion( aStream );
diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx
index 595eb9c213bf..db2a7c0f12f6 100644
--- a/sc/source/filter/lotus/lotform.cxx
+++ b/sc/source/filter/lotus/lotform.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lotform.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:21:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx
index 9009abc033e8..523a6e95c030 100644
--- a/sc/source/filter/lotus/lotimpop.cxx
+++ b/sc/source/filter/lotus/lotimpop.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lotimpop.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:21:24 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx
index afcb7bfa51c0..e5c6ade5154e 100644
--- a/sc/source/filter/lotus/lotread.cxx
+++ b/sc/source/filter/lotus/lotread.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: lotread.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: vg $ $Date: 2001-05-18 12:28:04 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:29 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,9 +72,12 @@
#include "scerrors.hxx"
#include "root.hxx"
#include "lotimpop.hxx"
-#include "fltprgrs.hxx"
#include "lotattr.hxx"
+#ifndef SC_FPROGRESSBAR_HXX
+#include "fprogressbar.hxx"
+#endif
+
class ScFormulaCell;
@@ -106,7 +109,7 @@ FltError ImportLotus::Read()
pIn->Seek( nNextRec );
// Progressbar starten
- FilterProgressBar aPrgrsBar( *pIn );
+ ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
while( eAkt != S_END )
{
@@ -292,7 +295,7 @@ FltError ImportLotus::Read( SvStream& rIn )
pIn->Seek( nNextRec );
// Progressbar starten
- FilterProgressBar aPrgrsBar( *pIn );
+ ScfStreamProgressBar aPrgrsBar( *pIn, pD->GetDocumentShell() );
while( bRead )
{
diff --git a/sc/source/filter/lotus/op.cxx b/sc/source/filter/lotus/op.cxx
index 81c1069e9498..156a3ec5afa2 100644
--- a/sc/source/filter/lotus/op.cxx
+++ b/sc/source/filter/lotus/op.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: op.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: er $ $Date: 2002-12-06 17:47:41 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -68,7 +68,7 @@
//------------------------------------------------------------------------
#include <tools/solar.h>
-#include <tools/solmath.hxx>
+#include <rtl/math.hxx>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
@@ -150,7 +150,7 @@ void OP_Number( SvStream& r, UINT16 n )
r >> nFormat >> nCol >> nRow >> fValue;
- fValue = SolarMath::Round( fValue, 15 );
+ fValue = ::rtl::math::round( fValue, 15 );
ScValueCell* pZelle = new ScValueCell( fValue );
pDoc->PutCell( nCol, nRow, nTab, pZelle, ( BOOL ) TRUE );
@@ -275,7 +275,7 @@ void OP_NamedRange( SvStream& r, UINT16 n )
String aTmp( pAnsi, pLotusRoot->eCharsetQ );
- ScfTools::ConvertName( aTmp );
+ ScfTools::ConvertToScDefinedName( aTmp );
pLotusRoot->pRangeNames->Append( pRange, aTmp );
}
@@ -313,7 +313,7 @@ void OP_SymphNamedRange( SvStream& r, UINT16 n )
DosToSystem( pAnsi );
String aTmp( pAnsi, pLotusRoot->eCharsetQ );
- ScfTools::ConvertName( aTmp );
+ ScfTools::ConvertToScDefinedName( aTmp );
pLotusRoot->pRangeNames->Append( pRange, aTmp );
}
diff --git a/sc/source/filter/lotus/tool.cxx b/sc/source/filter/lotus/tool.cxx
index 3c125df9ee02..ad40e615d7d7 100644
--- a/sc/source/filter/lotus/tool.cxx
+++ b/sc/source/filter/lotus/tool.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tool.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:21:25 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -601,7 +601,7 @@ void RangeNameBufferWK3::Add( const String& rOrgName, const ComplRefData& rCRD )
static UINT16 nDouble = 0;
String aScName( rOrgName );
- ScfTools::ConvertName( aScName );
+ ScfTools::ConvertToScDefinedName( aScName );
register ENTRY* pInsert = new ENTRY( rOrgName, aScName, rCRD );
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index c7704308f5d5..84dbf893c766 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: eeimpars.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: er $ $Date: 2002-11-12 18:24:26 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -166,7 +166,7 @@ ULONG ScEEImport::Read( SvStream& rStream )
void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
{
- ScProgress* pProgress = new ScProgress( NULL,
+ ScProgress* pProgress = new ScProgress( pDoc->GetDocumentShell(),
ScGlobal::GetRscString( STR_LOAD_DOC ), pParser->Count() );
ULONG nProgress = 0;
@@ -369,7 +369,16 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
}
else
{
- String aStr( pEngine->GetText( pE->aSel.nStartPara ) );
+ String aStr;
+ if( pE->bEntirePara )
+ {
+ aStr = pEngine->GetText( pE->aSel.nStartPara );
+ }
+ else
+ {
+ aStr = pEngine->GetText( pE->aSel );
+ aStr.EraseLeadingAndTrailingChars();
+ }
const sal_Unicode cDecSepEng = '.';
const sal_Unicode cThoSepEng = ',';
if ( cDecSep != cDecSepEng
@@ -411,6 +420,12 @@ void ScEEImport::WriteToDocument( BOOL bSizeColsRows, double nOutputFactor )
}
}
}
+
+ // #105460#, #i4180# String cells can't contain tabs or linebreaks
+ // -> replace with spaces
+ aStr.SearchAndReplaceAll( (sal_Unicode)'\t', (sal_Unicode)' ' );
+ aStr.SearchAndReplaceAll( (sal_Unicode)'\n', (sal_Unicode)' ' );
+
pDoc->SetString( nCol, nRow, nTab, aStr );
}
}
diff --git a/sc/source/filter/starcalc/scflt.cxx b/sc/source/filter/starcalc/scflt.cxx
index c77fcb23e2c7..f3430c2e0b73 100644
--- a/sc/source/filter/starcalc/scflt.cxx
+++ b/sc/source/filter/starcalc/scflt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: scflt.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: er $ $Date: 2002-12-06 17:52:08 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -113,10 +113,13 @@
#include "scfobj.hxx"
#include "docoptio.hxx"
#include "viewopti.hxx"
-#include "fltprgrs.hxx"
#include "globstr.hrc"
#include "ftools.hxx"
+#ifndef SC_FPROGRESSBAR_HXX
+#include "fprogressbar.hxx"
+#endif
+
using namespace com::sun::star;
@@ -1070,7 +1073,7 @@ Sc10Import::~Sc10Import()
ULONG Sc10Import::Import()
{
- pPrgrsBar = new FilterProgressBar( rStream );
+ pPrgrsBar = new ScfStreamProgressBar( rStream, pDoc->GetDocumentShell() );
ScDocOptions aOpt = pDoc->GetDocOptions();
aOpt.SetDate( 1, 1, 1900 );
@@ -1079,19 +1082,19 @@ ULONG Sc10Import::Import()
pDoc->GetFormatTable()->ChangeNullDate( 1, 1, 1900 );
LoadFileHeader(); pPrgrsBar->Progress();
- if (!nError) { LoadFileInfo(); pPrgrsBar->Progress(); }
- if (!nError) { LoadEditStateInfo(); pPrgrsBar->Progress(); }
+ if (!nError) { LoadFileInfo(); pPrgrsBar->Progress(); }
+ if (!nError) { LoadEditStateInfo(); pPrgrsBar->Progress(); }
if (!nError) { LoadProtect(); pPrgrsBar->Progress(); }
- if (!nError) { LoadViewColRowBar(); pPrgrsBar->Progress(); }
+ if (!nError) { LoadViewColRowBar(); pPrgrsBar->Progress(); }
if (!nError) { LoadScrZoom(); pPrgrsBar->Progress(); }
if (!nError) { LoadPalette(); pPrgrsBar->Progress(); }
if (!nError) { LoadFontCollection(); pPrgrsBar->Progress(); }
if (!nError) { LoadNameCollection(); pPrgrsBar->Progress(); }
- if (!nError) { LoadPatternCollection(); pPrgrsBar->Progress(); }
+ if (!nError) { LoadPatternCollection(); pPrgrsBar->Progress(); }
if (!nError) { LoadDataBaseCollection(); pPrgrsBar->Progress(); }
if (!nError) { LoadTables(); pPrgrsBar->Progress(); }
if (!nError) { LoadObjects(); pPrgrsBar->Progress(); }
- if (!nError) { ImportNameCollection(); pPrgrsBar->Progress(); }
+ if (!nError) { ImportNameCollection(); pPrgrsBar->Progress(); }
pDoc->SetViewOptions( aSc30ViewOpt );
#ifdef DBG_UTIL
diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
index 0dc9838b6413..4ef8d9af53f6 100644
--- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XclExpChangeTrack.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:42:28 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
index 0840b12cd09c..731b60720780 100644
--- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx
+++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XclImpChangeTrack.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: dr $ $Date: 2002-11-21 12:22:29 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/xcl97/makefile.mk b/sc/source/filter/xcl97/makefile.mk
index c5296d01b87c..6a2a4b405e06 100644
--- a/sc/source/filter/xcl97/makefile.mk
+++ b/sc/source/filter/xcl97/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.10 $
+# $Revision: 1.11 $
#
-# last change: $Author: dr $ $Date: 2002-11-21 12:22:29 $
+# last change: $Author: hr $ $Date: 2003-03-26 18:05:34 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -89,6 +89,7 @@ SLOFILES = \
$(SLO)$/XclExpPivotTables.obj \
$(SLO)$/XclExpChangeTrack.obj
+
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/sc/source/filter/xcl97/xcl97dum.cxx b/sc/source/filter/xcl97/xcl97dum.cxx
index e5ac815de071..4247bfc20e2b 100644
--- a/sc/source/filter/xcl97/xcl97dum.cxx
+++ b/sc/source/filter/xcl97/xcl97dum.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97dum.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dr $ $Date: 2002-12-06 16:42:29 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -127,107 +127,6 @@ const BYTE ExcDummy8_041::pMyData[] = {
const ULONG ExcDummy8_041::nMyLen = sizeof(ExcDummy8_041::pMyData);
-// 21 default XF Records (8*)
-const BYTE ExcDummy8_XF::pMyData[] = {
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x02, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x20, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x2B, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x29, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x09, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x2C, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20,
-
- 0xe0, 0x00, 0x14, 0x00,
- 0x01, 0x00, 0x2A, 0x00, 0xF5, 0xFF, 0x20, 0x00,
- 0x00, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x20
-
-};
-const ULONG ExcDummy8_XF::nMyLen = sizeof(ExcDummy8_XF::pMyData);
-
-
-// 6 default STYLE Records (8*)
-const BYTE ExcDummy8_Style::pMyData[] = {
- 0x93, 0x02, 0x04, 0x00, 0x10, 0x80, 0x03, 0xFF,
- 0x93, 0x02, 0x04, 0x00, 0x11, 0x80, 0x06, 0xFF,
- 0x93, 0x02, 0x04, 0x00, 0x12, 0x80, 0x05, 0xFF,
- 0x93, 0x02, 0x04, 0x00, 0x00, 0x80, 0x00, 0xFF,
- 0x93, 0x02, 0x04, 0x00, 0x13, 0x80, 0x04, 0xFF,
- 0x93, 0x02, 0x04, 0x00, 0x14, 0x80, 0x07, 0xFF
-};
-const ULONG ExcDummy8_Style::nMyLen = sizeof(ExcDummy8_Style::pMyData);
-
// Natural Language Formulas Flag (8+) 0 := nein, 1:= ja
const BYTE ExcDummy8_UsesElfs::pMyData[] = {
@@ -309,32 +208,6 @@ const BYTE* ExcDummy8_041::GetData() const
-ULONG ExcDummy8_XF::GetLen() const
-{
- return nMyLen;
-}
-
-
-const BYTE* ExcDummy8_XF::GetData() const
-{
- return pMyData;
-}
-
-
-
-ULONG ExcDummy8_Style::GetLen() const
-{
- return nMyLen;
-}
-
-
-const BYTE* ExcDummy8_Style::GetData() const
-{
- return pMyData;
-}
-
-
-
ULONG ExcDummy8_UsesElfs::GetLen() const
{
return nMyLen;
diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx
index 3566c0463c23..4cff3d99a5b7 100644
--- a/sc/source/filter/xcl97/xcl97esc.cxx
+++ b/sc/source/filter/xcl97/xcl97esc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97esc.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dr $ $Date: 2002-12-12 13:14:21 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,6 +81,9 @@
#ifndef _SVDOOLE2_HXX //autogen wg. SdrOle2Obj
#include <svx/svdoole2.hxx>
#endif
+#ifndef _SVX_FMGLOB_HXX
+#include <svx/fmglob.hxx>
+#endif
#ifndef _IPOBJ_HXX //autogen wg. SvInPlaceObject
#include <so3/ipobj.hxx>
#endif
@@ -113,6 +116,9 @@
XclEscherEx::XclEscherEx( SvStream& rStrm, UINT32 nDrawings, RootData& rRoot )
:
EscherEx( rStrm, nDrawings ),
+#if EXC_INCL_EXP_OCX
+ aOcxConverter( *rRoot.pER ),
+#endif
rRootData( rRoot ),
pPicTempFile( NULL ),
pPicStrm( NULL ),
@@ -218,30 +224,41 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen
pCurrXclObj = new XclObjAny( rRootData ); // just what is it?!?
else
{
- switch ( pObj->GetObjIdentifier() )
+ pCurrXclObj = NULL;
+ sal_uInt16 nObjType = pObj->GetObjIdentifier();
+
+ if( nObjType == OBJ_OLE2 )
{
- case OBJ_OLE2 :
+ //! not-const because GetObjRef may load the OLE object
+ SvInPlaceObjectRef xObj( ((SdrOle2Obj*)pObj)->GetObjRef() );
+ if ( xObj.Is() )
{
- //! not-const because GetObjRef may load the OLE object
- SvInPlaceObjectRef xObj( ((SdrOle2Obj*)pObj)->GetObjRef() );
- if ( xObj.Is() )
- {
- SvGlobalName aObjClsId( *xObj->GetSvFactory() );
- if ( SchModuleDummy::HasID( aObjClsId ) )
- { // yes, it's a chart diagram
- rRootData.pObjRecs->Add( new XclObjChart( rRootData, rShape ) );
- pCurrXclObj = NULL; // no metafile or whatsoever
- }
- else // metafile and OLE object
- pCurrXclObj = new XclObjOle( rRootData, *pObj );
+ SvGlobalName aObjClsId( *xObj->GetSvFactory() );
+ if ( SchModuleDummy::HasID( aObjClsId ) )
+ { // yes, it's a chart diagram
+ rRootData.pObjRecs->Add( new XclObjChart( rRootData, rShape ) );
+ pCurrXclObj = NULL; // no metafile or whatsoever
}
- else // just a metafile
- pCurrXclObj = new XclObjAny( rRootData );
+ else // metafile and OLE object
+ pCurrXclObj = new XclObjOle( rRootData, *pObj );
}
- break;
- default:
+ else // just a metafile
pCurrXclObj = new XclObjAny( rRootData );
}
+ else if( nObjType == OBJ_CAPTION ) // #107540# ignore permanent note shapes
+ {
+ pCurrXclObj = NULL;
+ }
+#if EXC_INCL_EXP_OCX
+ else if( nObjType >= OBJ_FM_CONTROL )
+ {
+ pCurrXclObj = aOcxConverter.CreateObjRec( rShape );
+ if( !pCurrXclObj )
+ pCurrXclObj = new XclObjAny( rRootData ); // just a metafile
+ }
+#endif
+ else
+ pCurrXclObj = new XclObjAny( rRootData ); // just a metafile
}
if ( pCurrXclObj )
{
@@ -295,31 +312,42 @@ EscherExHostAppData* XclEscherEx::StartShape( const com::sun::star::uno::Referen
void XclEscherEx::EndShape( UINT16 nShapeType, UINT32 nShapeID )
{
- if ( !nShapeID && pCurrXclObj )
- { // shape not written
- XclObj* p = (XclObj*) rRootData.pObjRecs->Last();
- DBG_ASSERT( p == pCurrXclObj, "XclEscherEx::EndShape: what object?" );
- if ( p == pCurrXclObj )
+ // own escher data created? -> never delete such objects
+ bool bOwnEscher = pCurrXclObj && pCurrXclObj->IsOwnEscher();
+
+ // post process the current object - not for objects with own escher data
+ if( pCurrXclObj && !bOwnEscher )
+ {
+ // escher data of last shape not written? -> delete it from object list
+ if( nShapeID == 0 )
{
- rRootData.pObjRecs->Remove();
- delete pCurrXclObj;
- pCurrXclObj = NULL;
+ XclObj* pLastObj = static_cast< XclObj* >( rRootData.pObjRecs->Last() );
+ DBG_ASSERT( pLastObj == pCurrXclObj, "XclEscherEx::EndShape - wrong object" );
+ if ( pLastObj == pCurrXclObj )
+ {
+ rRootData.pObjRecs->Remove();
+ DELETEZ( pCurrXclObj );
+ }
}
- }
- if ( pCurrXclObj )
- {
- if ( pCurrAppData->IsStackedGroup() )
- pCurrXclObj->SetEscherShapeTypeGroup();
- else
+
+ if( pCurrXclObj )
{
- pCurrXclObj->SetEscherShapeType( nShapeType );
- pCurrXclObj->UpdateStopPos();
+ // set shape type
+ if ( pCurrAppData->IsStackedGroup() )
+ pCurrXclObj->SetEscherShapeTypeGroup();
+ else
+ {
+ pCurrXclObj->SetEscherShapeType( nShapeType );
+ pCurrXclObj->UpdateStopPos();
+ }
}
}
+
+ // get next object from stack
DeleteCurrAppData();
- pCurrAppData = (XclEscherHostAppData*) aStack.Pop();
- pCurrXclObj = (XclObj*) aStack.Pop();
- if ( nAdditionalText == 3 )
+ pCurrAppData = static_cast< XclEscherHostAppData* >( aStack.Pop() );
+ pCurrXclObj = static_cast< XclObj* >( aStack.Pop() );
+ if( nAdditionalText == 3 )
nAdditionalText = 0;
}
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index a96dba9da87f..7360ffa8cafe 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xcl97rec.cxx,v $
*
- * $Revision: 1.50 $
+ * $Revision: 1.51 $
*
- * last change: $Author: jmarmion $ $Date: 2002-12-13 12:06:21 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,9 +93,12 @@
#ifndef _SFXITEMSET_HXX //autogen wg. SfxItemSet
#include <svtools/itemset.hxx>
#endif
+#ifndef _SVX_UNOAPI_HXX_
+#include <svx/unoapi.hxx>
+#endif
-#ifndef _TOOLS_SOLMATH_HXX // DoubleToString()
-#include <tools/solmath.hxx>
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
#endif
#ifndef _ZFORMAT_HXX // SvNumberformat
#include <svtools/zformat.hxx>
@@ -108,6 +111,9 @@
#include "xcl97esc.hxx"
#include "excupn.hxx"
+#ifndef SC_FAPIHELPER_HXX
+#include "fapihelper.hxx"
+#endif
#ifndef SC_XECONTENT_HXX
#include "xecontent.hxx"
#endif
@@ -145,6 +151,12 @@
#include "docoptio.hxx"
#include "patattr.hxx"
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::beans::XPropertySet;
+using ::com::sun::star::drawing::XShape;
+
+
//___________________________________________________________________
// --- class XclMsodrawing_Base --------------------------------------
@@ -377,14 +389,15 @@ void XclObjList::Save( XclExpStream& rStrm )
// --- class XclObj --------------------------------------------------
-XclObj::XclObj( ObjType eType, RootData& rRoot )
+XclObj::XclObj( ObjType eType, RootData& rRoot, bool bOwnEscher )
:
pClientTextbox( NULL ),
pTxo( NULL ),
eObjType( eType ),
nObjId(0),
nGrbit( 0x6011 ), // AutoLine, AutoFill, Printable, Locked
- bFirstOnSheet( rRoot.pObjRecs->Count() == 0 )
+ bFirstOnSheet( rRoot.pObjRecs->Count() == 0 ),
+ mbOwnEscher( bOwnEscher )
{
//! first object continues the first MSODRAWING record
if ( bFirstOnSheet )
@@ -493,9 +506,9 @@ ULONG XclObj::GetLen() const
// --- class XclObjComment -------------------------------------------
-XclObjComment::XclObjComment( RootData& rRoot, const ScAddress& rPos, const String& rStr )
+XclObjComment::XclObjComment( RootData& rRoot, const ScAddress& rPos, const String& rStr, bool bVisible )
:
- XclObj( otComment, rRoot )
+ XclObj( otComment, rRoot, true )
{
nGrbit = 0; // all off: AutoLine, AutoFill, Printable, Locked
XclEscherEx* pEx = pMsodrawing->GetEscherEx();
@@ -510,7 +523,9 @@ XclObjComment::XclObjComment( RootData& rRoot, const ScAddress& rPos, const Stri
aPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x00110010 ); // bool field
aPropOpt.AddOpt( ESCHER_Prop_shadowColor, 0x00000000 );
aPropOpt.AddOpt( ESCHER_Prop_fshadowObscured, 0x00030003 ); // bool field
- aPropOpt.AddOpt( ESCHER_Prop_fPrint, 0x000A0002 ); // bool field
+ sal_uInt32 nFlags = 0x000A0000;
+ ::set_flag( nFlags, 2UL, !bVisible );
+ aPropOpt.AddOpt( ESCHER_Prop_fPrint, nFlags ); // bool field
aPropOpt.Commit( pEx->GetStream() );
XclEscherClientAnchor( rRoot.pDoc, rPos ).WriteData( *pEx );
@@ -576,7 +591,7 @@ ULONG XclObjComment::GetLen() const
// --- class XclObjDropDown ------------------------------------------
XclObjDropDown::XclObjDropDown( RootData& rRoot, const ScAddress& rPos, BOOL bFilt ) :
- XclObj( otComboBox, rRoot ),
+ XclObj( otComboBox, rRoot, true ),
bIsFiltered( bFilt )
{
SetLocked( TRUE );
@@ -875,6 +890,106 @@ ULONG XclObjOle::GetLen() const
}
+// ----------------------------------------------------------------------------
+
+#if EXC_INCL_EXP_OCX
+
+XclExpObjControl::XclExpObjControl(
+ const XclRoot& rRoot,
+ const Reference< XShape >& rxShape,
+ const String& rClassName,
+ sal_uInt32 nStrmStart, sal_uInt32 nStrmSize ) :
+ XclObj( otPicture, *rRoot.mpRD, true ),
+ maClassName( rClassName ),
+ mnStrmStart( nStrmStart ),
+ mnStrmSize( nStrmSize )
+{
+ SetAutoLine( FALSE );
+
+ XclEscherEx& rEscherEx = *pMsodrawing->GetEscherEx();
+ rEscherEx.OpenContainer( ESCHER_SpContainer );
+ rEscherEx.AddShape( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR | SHAPEFLAG_OLESHAPE );
+ Rectangle aDummyRect;
+ EscherPropertyContainer aPropOpt( rEscherEx, rEscherEx.QueryPicStream(), aDummyRect );
+ aPropOpt.AddOpt( ESCHER_Prop_FitTextToShape, 0x00080008 ); // bool field
+ aPropOpt.AddOpt( ESCHER_Prop_lineColor, 0x08000040 );
+ aPropOpt.AddOpt( ESCHER_Prop_fNoLineDrawDash, 0x00080000 ); // bool field
+
+ Reference< XPropertySet > xShapePS( rxShape, UNO_QUERY );
+ if( xShapePS.is() )
+ {
+ // meta file
+ if( aPropOpt.CreateGraphicProperties( xShapePS, String( RTL_CONSTASCII_USTRINGPARAM( "MetaFile" ) ), sal_False ) )
+ {
+ sal_uInt32 nBlipId;
+ if( aPropOpt.GetOpt( ESCHER_Prop_pib, nBlipId ) )
+ aPropOpt.AddOpt( ESCHER_Prop_pictureId, nBlipId );
+ }
+
+ // name of the control
+ ::rtl::OUString aCtrlName;
+ //! TODO - this does not work - property is empty
+ if( ::getPropValue( aCtrlName, xShapePS, PROPNAME( "Name" ) ) && aCtrlName.getLength() )
+ {
+ XclExpString aCtrlNameEx( aCtrlName, EXC_STR_FORCEUNICODE );
+ sal_uInt32 nBufferSize = aCtrlNameEx.GetBufferSize() + 2; // plus trailing zero
+ sal_uInt8* pBuffer = new sal_uInt8[ nBufferSize ];
+ aCtrlNameEx.WriteBuffer( pBuffer );
+ pBuffer[ nBufferSize - 2 ] = pBuffer[ nBufferSize - 1 ] = 0;
+ // aPropOpt takes ownership of pBuffer
+ aPropOpt.AddOpt( ESCHER_Prop_wzName, TRUE, nBufferSize, pBuffer, nBufferSize );
+ }
+ }
+
+ aPropOpt.Commit( rEscherEx.GetStream() );
+
+ if( SdrObject* pSdrObj = ::GetSdrObjectFromXShape( rxShape ) )
+ XclEscherClientAnchor( *rRoot.mpRD, *pSdrObj ).WriteData( rEscherEx );
+ rEscherEx.AddAtom( 0, ESCHER_ClientData ); // OBJ record
+ rEscherEx.CloseContainer(); // ESCHER_SpContainer
+
+ pMsodrawing->UpdateStopPos();
+}
+
+void XclExpObjControl::SaveCont( XclExpStream& rStrm )
+{
+ // ftCmo
+ XclObj::SaveCont( rStrm );
+ // ftCf (clipboard format)
+ rStrm << sal_uInt16( ftCf ) << sal_uInt16( 2 ) << sal_uInt16( 2 );
+ // ftPioGrbit
+ rStrm << sal_uInt16( ftPioGrbit ) << sal_uInt16( 2 ) << sal_uInt16( 0x0031 );
+
+ // ftPictFmla
+ XclExpString aClass( maClassName );
+ sal_uInt16 nClassNameSize = static_cast< sal_uInt16 >( aClass.GetSize() );
+ sal_uInt16 nClassNamePad = nClassNameSize & 1;
+ sal_uInt16 nFirstPartSize = 12 + nClassNameSize + nClassNamePad;
+ sal_uInt16 nPictFmlaSize = nFirstPartSize + 18;
+
+ rStrm << sal_uInt16( ftPictFmla ) << sal_uInt16( nPictFmlaSize )
+ << sal_uInt16( nFirstPartSize ) // size of first part
+ << sal_uInt16( 5 ) // formula size
+ << sal_uInt32( 0 ) // unknown ID
+ << sal_uInt8( 0x02 ) << sal_uInt32( 0 ) // tTbl token with unknown ID
+ << sal_uInt8( 3 ) // pad to word
+ << aClass; // "Forms.***.1"
+ rStrm.WriteZeroBytes( nClassNamePad ); // pad to word
+ rStrm << mnStrmStart // start in 'Ctls' stream
+ << mnStrmSize // size in 'Ctls' stream
+ << sal_uInt32( 0 ) << sal_uInt32( 0 ); // unknown
+
+ // ftEnd
+ rStrm << sal_uInt16( ftEnd ) << sal_uInt16( 0 );
+}
+
+sal_uInt32 XclExpObjControl::GetLen() const
+{
+ return 0; // calculated by XclExpStream
+}
+
+#endif
+
// --- class XclObjAny -------------------------------------------
XclObjAny::XclObjAny( RootData& rRoot )
@@ -925,81 +1040,50 @@ ULONG XclObjAny::GetLen() const
-// --- class XclNoteList ----------------------------------------------
+// ----------------------------------------------------------------------------
-XclNoteList::XclNoteList()
+XclExpNote::XclExpNote(
+ const XclExpRoot& rRoot, const ScAddress& rPos,
+ const ScPostIt* pScNote, const String& rAddText ) :
+ XclExpRecord( EXC_ID_NOTE ),
+ maPos( rPos ),
+ mnObjId( 0 ),
+ mbVisible( pScNote && pScNote->IsShown() )
{
-}
-
+ String aNoteText;
-XclNoteList::~XclNoteList()
-{
- for ( XclNote* p = First(); p; p = Next() )
+ // read strings from note object, if present
+ if( pScNote )
{
- delete p;
+ aNoteText = pScNote->GetText();
+ maAuthor.Assign( pScNote->GetAuthor() );
}
-}
-
-
-void XclNoteList::Add( XclNote* pNote )
-{
- // limitation on 64kB is done in XclObjList,
- // more notes get no ID and will not save themselfs
- Insert( pNote, LIST_APPEND );
-}
-
-void XclNoteList::Save( XclExpStream& rStrm )
-{
- for ( XclNote* p = First(); p; p = Next() )
+ // append additional text
+ if( rAddText.Len() )
{
- p->Save( rStrm );
+ if( aNoteText.Len() )
+ aNoteText.Append( EXC_NEWLINE ).Append( EXC_NEWLINE );
+ aNoteText.Append( rAddText );
}
-}
+ // create the Escher object
+ mnObjId = rRoot.mpRD->pObjRecs->Add( new XclObjComment( *rRoot.mpRD, maPos, aNoteText, mbVisible ) );
-
-// --- class XclNote -------------------------------------------------
-
-XclNote::XclNote( RootData& rRoot, const ScAddress& rPos, const String& rNoteText, const String& rNoteAuthor ) :
- aAuthor( rNoteAuthor ),
- aPos( rPos ),
- nGrbit(0)
-{
- XclObjComment* pObj = new XclObjComment( rRoot, rPos, rNoteText );
- nObjId = rRoot.pObjRecs->Add( pObj );
+ SetRecSize( 9 + maAuthor.GetSize() );
}
-
-XclNote::~XclNote()
+void XclExpNote::Save( XclExpStream& rStrm )
{
+ if( mnObjId )
+ XclExpRecord::Save( rStrm );
}
-
-void XclNote::SaveCont( XclExpStream& rStrm )
+void XclExpNote::WriteBody( XclExpStream& rStrm )
{
- rStrm << (UINT16) aPos.Row() << (UINT16) aPos.Col() << nGrbit << nObjId
- << aAuthor
- << UINT8(0); // pad byte goes here (always)
-}
-
-
-void XclNote::Save( XclExpStream& rStrm )
-{
- if ( nObjId )
- ExcRecord::Save( rStrm );
-}
-
-
-UINT16 XclNote::GetNum() const
-{
- return 0x001C;
-}
-
-
-ULONG XclNote::GetLen() const
-{
- return nObjId ? 9 + aAuthor.GetSize() : 0;
+ sal_uInt16 nFlags = mbVisible ? EXC_NOTE_VISIBLE : 0;
+ rStrm << (sal_uInt16) maPos.Row() << (sal_uInt16) maPos.Col()
+ << nFlags << mnObjId << maAuthor << sal_uInt8( 0 );
}
@@ -1074,15 +1158,14 @@ ExcLabelSst::ExcLabelSst(
ExcLabelSst::ExcLabelSst(
const ScAddress& rPos,
const ScPatternAttr* pAttr,
- RootData& rRoot,
+ RootData& rRootData,
const ScEditCell& rEdCell ) :
- ExcCell( rPos, pAttr, rRoot )
+ ExcCell( rPos, pAttr, rRootData )
{
- XclExpString* pStr = XclExpStringHelper::CreateString( *rRoot.pER, rEdCell, pAttr );
- UsedAttrList& rXFBuffer = *rRoot.pXFRecs;
- const ScPatternAttr& rAttr = pAttr ? *pAttr : *rRoot.pER->GetDoc().GetDefPattern();
- SetXF( pStr->IsWrapped() ? rXFBuffer.FindWithLineBreak( &rAttr ) : rXFBuffer.Find( &rAttr ) );
- nIsst = rRoot.pER->GetSst().Insert( pStr );
+ const XclExpRoot& rRoot = *rRootData.pER;
+ XclExpString* pString = XclExpStringHelper::CreateString( rRoot, rEdCell, pAttr );
+ SetXF( rRoot.GetXFBuffer().Insert( pAttr, pString->IsWrapped() ) );
+ nIsst = rRoot.GetSst().Insert( pString );
}
@@ -1110,113 +1193,6 @@ ULONG ExcLabelSst::GetDiffLen() const
-// --- class ExcXf8 --------------------------------------------------
-
-ExcXf8::ExcXf8( const XclExpRoot& rRoot, UINT16 nFont, UINT16 nForm, const ScPatternAttr* pPattAttr,
- BOOL& rbLineBreak, BOOL bSt ) :
- ExcXf( rRoot, nFont, nForm, pPattAttr, rbLineBreak, bSt ),
- eTextDir( xlTextDirContext ),
- nTrot( 0 ),
- nCIndent( 0 ),
- bFShrinkToFit( FALSE ),
- bFMergeCell( FALSE ),
- nGrbitDiag( 0 ),
- nIcvDiagSer( 0 ),
- nDgDiag( 0 )
-{
- if( eOri == xlTextOrientTopBottom )
- nTrot = 0x00FF;
- else if( eOri != xlTextOrientNoRot ) // see #i4378
- nTrot = (eOri == xlTextOrient90ccw) ? 90 : 180;
- else if( pPattAttr )
- nTrot = XclTools::GetExcRotation( ((const SfxInt32Item&) pPattAttr->GetItem( ATTR_ROTATE_VALUE )).GetValue() );
-
- if( pPattAttr )
- {
- nCIndent = (UINT16)((const SfxUInt16Item&) pPattAttr->GetItem( ATTR_INDENT )).GetValue();
- nCIndent += 100;
- nCIndent /= 200;
- if( nCIndent > 15 )
- nCIndent = 15;
-
- switch( (SvxFrameDirection)((const SvxFrameDirectionItem&)pPattAttr->GetItem( ATTR_WRITINGDIR )).GetValue() )
- {
- case FRMDIR_ENVIRONMENT: eTextDir = xlTextDirContext; break;
- case FRMDIR_HORI_LEFT_TOP: eTextDir = xlTextDirLTR; break;
- case FRMDIR_HORI_RIGHT_TOP: eTextDir = xlTextDirRTL; break;
- default: DBG_ERRORFILE( "ExcXf8::ExcXf8 - unknown CTL text direction" );
- }
- }
-}
-
-
-void ExcXf8::SaveCont( XclExpStream& rStrm )
-{
- register UINT16 nTmp;
- register UINT32 nTmp32;
-
- rStrm << nIfnt << nIfmt // Offs 4 + 6
- << nOffs8; // Offs 8
-
- nTmp = ( UINT16 ) eAlc; // Offs 10
- if( bFWrap )
- nTmp |= 0x0008;
- nTmp |= ( ( UINT16 ) eAlcV ) << 4;
- nTmp |= nTrot << 8;
- rStrm << nTmp;
-
- nTmp = nCIndent; // Offs 12
- if( bFShrinkToFit )
- nTmp |= 0x0010;
- if( bFMergeCell )
- nTmp |= 0x0020;
- nTmp |= ((UINT16)eTextDir) << 6;
- // Bit 9-8 reserved, Bit 15-10 fAtr... alle 0 (keine Parent Styles)
- rStrm << nTmp;
-
- nTmp = nDgLeft; // Offs 14
- nTmp |= nDgRight << 4;
- nTmp |= nDgTop << 8;
- nTmp |= nDgBottom << 12;
- rStrm << nTmp;
-
- nTmp = GetPalette().GetColorIndex( nIcvLftSer ); // Offs 16
- nTmp |= GetPalette().GetColorIndex( nIcvRigSer ) << 7;
- nTmp |= nGrbitDiag << 14;
- rStrm << nTmp;
-
- nTmp32 = GetPalette().GetColorIndex( nIcvTopSer ); // Offs 18
- nTmp32 |= (UINT32) GetPalette().GetColorIndex( nIcvBotSer ) << 7;
- nTmp32 |= (UINT32) GetPalette().GetColorIndex( nIcvDiagSer ) << 14;
- nTmp32 |= (UINT32) nDgDiag << 21;
-
- UINT16 nForeInd, nBackInd;
- GetPalette().GetMixedColors( nForeInd, nBackInd, nFls, nIcvForeSer, nIcvBackSer );
-
- nTmp32 |= (UINT32) nFls << 26;
- rStrm << nTmp32;
-
- nTmp = nForeInd | (nBackInd << 7); // Offs 22
-
- if( bFSxButton )
- nTmp |= 0x4000;
- rStrm << nTmp;
-}
-
-
-UINT16 ExcXf8::GetNum() const
-{
- return 0x00E0;
-}
-
-
-ULONG ExcXf8::GetLen() const
-{
- return 20;
-}
-
-
-
// --- class ExcBundlesheet8 -----------------------------------------
ExcBundlesheet8::ExcBundlesheet8( RootData& rRootData, UINT16 nTab ) :
@@ -1422,25 +1398,24 @@ XclCondFormat::XclCondFormat( const ScConditionalFormat& _rCF, ScRangeList* _pRL
{
pCFE = _rCF.GetEntry( n );
if( pCFE )
- List::Insert( new XclCf( *rER.pER, *pCFE ), LIST_APPEND );
+ Append( new XclCf( *rER.pER, *pCFE ) );
}
}
XclCondFormat::~XclCondFormat()
{
- if( pRL )
- delete pRL;
+ delete pRL;
}
void XclCondFormat::WriteCondfmt( XclExpStream& rStrm )
{
- DBG_ASSERT( List::Count() < 65536, "XclCondFormat::SaveCont - to much CFs!" );
+ DBG_ASSERT( Count() < 65536, "XclCondFormat::SaveCont - to much CFs!" );
rStrm.StartRecord( 0x01B0, 0 ); // real size calculated by XclExpStream
- rStrm << (UINT16) List::Count() << (UINT16) 0x0000;
+ rStrm << (UINT16) Count() << (UINT16) 0x0001;
ULONG nMinMaxPos = rStrm.GetStreamPos();
UINT16 nRowFirst = 0xFFFF;
@@ -1491,7 +1466,7 @@ void XclCondFormat::Save( XclExpStream& rStrm )
WriteCondfmt( rStrm );
// write list of CF records
- for( XclCf* pCf = _First(); pCf; pCf = _Next() )
+ for( XclCf* pCf = First(); pCf; pCf = Next() )
pCf->Save( rStrm );
}
@@ -1596,28 +1571,11 @@ XclCf::XclCf( const XclExpRoot& rRoot, const ScCondFormatEntry& r ) :
// border data
if( bHasLine )
- {
- const SvxBoxItem& rBox = ((const SvxBoxItem&)aAttr.GetItem( ATTR_BORDER ));
- UINT16 nDgTop, nDgBottom, nDgLeft, nDgRight;
-
- ExcXf::ScToExcBorderLine( rPal, rBox.GetTop(), nIcvTopSer, nDgTop );
- ExcXf::ScToExcBorderLine( rPal, rBox.GetBottom(), nIcvBotSer, nDgBottom );
- ExcXf::ScToExcBorderLine( rPal, rBox.GetLeft(), nIcvLftSer, nDgLeft );
- ExcXf::ScToExcBorderLine( rPal, rBox.GetRight(), nIcvRigSer, nDgRight );
-
- nLineData1 = (UINT8)((nDgLeft & 0x0F) | (nDgRight << 4));
- nLineData2 = (UINT8)((nDgTop & 0x0F) | (nDgBottom << 4));
- }
+ XclExpXF::GetBorder( maBorder, rPal, aAttr );
// background / foreground data
if( bHasPattern )
- {
- const SvxBrushItem& rBrushItem = (const SvxBrushItem&)aAttr.GetItem( ATTR_BACKGROUND );
- Color aColor( rBrushItem.GetColor() );
- nPatt = aColor.GetTransparency() ? 0x0000 : 0x0001;
- nIcvForeSer = rPal.InsertColor( aColor, xlColorCellArea );
- nIcvBackSer = rPal.InsertColor( Color( COL_BLACK ), xlColorCellArea );
- }
+ XclExpXF::GetArea( maArea, rPal, aAttr );
}
ScTokenArray* pScTokArry1 = r.CreateTokenArry( 0 );
@@ -1699,22 +1657,26 @@ void XclCf::SaveCont( XclExpStream& rStrm )
}
if( bHasLine )
{
- UINT16 nLineData3, nLineData4;
- nLineData3 = rPal.GetColorIndex( nIcvLftSer ) & 0x007F;
- nLineData3 |= (rPal.GetColorIndex( nIcvRigSer ) & 0x007F) << 7;
- nLineData4 = rPal.GetColorIndex( nIcvTopSer ) & 0x007F;
- nLineData4 |= (rPal.GetColorIndex( nIcvBotSer ) & 0x007F) << 7;
+ sal_uInt8 nLineData1, nLineData2;
+ sal_uInt16 nLineData3, nLineData4;
+ nLineData1 = (UINT8)((maBorder.mnLeftLine & 0x0F) | (maBorder.mnRightLine << 4));
+ nLineData2 = (UINT8)((maBorder.mnTopLine & 0x0F) | (maBorder.mnBottomLine << 4));
+ nLineData3 = rPal.GetColorIndex( maBorder.mnLeftColorId ) & 0x007F;
+ nLineData3 |= (rPal.GetColorIndex( maBorder.mnRightColorId ) & 0x007F) << 7;
+ nLineData4 = rPal.GetColorIndex( maBorder.mnTopColorId ) & 0x007F;
+ nLineData4 |= (rPal.GetColorIndex( maBorder.mnBottomColorId ) & 0x007F) << 7;
rStrm << nLineData1 << nLineData2 << nLineData3 << nLineData4
<< (UINT16)0xBA00;
}
if( bHasPattern )
{
- UINT16 nForeInd, nBackInd;
- rPal.GetMixedColors( nForeInd, nBackInd, nPatt, nIcvForeSer, nIcvBackSer );
+ sal_uInt16 nXclForeIx, nXclBackIx;
+ sal_uInt8 nPattern = maArea.mnPattern;
+ rPal.GetMixedColors( nXclForeIx, nXclBackIx, nPattern, maArea.mnForeColorId, maArea.mnBackColorId );
- UINT8 nPattData1 = (nPatt == 1) ? 0 : (UINT8) nPatt;
- UINT16 nPattData2 = ((nForeInd & 0x007F ) << 7) | (nBackInd & 0x007F);
+ UINT8 nPattData1 = (nPattern == EXC_PATT_SOLID) ? 0 : nPattern;
+ UINT16 nPattData2 = ((nXclForeIx & 0x007F ) << 7) | (nXclBackIx & 0x007F);
rStrm << (UINT8)0 << nPattData1 << nPattData2;
}
@@ -1939,9 +1901,11 @@ ExcEScenario::ExcEScenario( ScDocument& rDoc, UINT16 nTab )
if( rDoc.HasValueData( nCol, nRow, nTab ) )
{
rDoc.GetValue( nCol, nRow, nTab, fVal );
- sText.Erase();
- SolarMath::DoubleToString( sText, fVal, 'A', INT_MAX,
- ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0), TRUE );
+ sText = ::rtl::math::doubleToUString( fVal,
+ rtl_math_StringFormat_Automatic,
+ rtl_math_DecimalPlaces_Max,
+ ScGlobal::pLocaleData->getNumDecimalSep().GetChar(0),
+ TRUE );
}
else
rDoc.GetString( nCol, nRow, nTab, sText );
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index fed7ad2e9d8d..bdc878816632 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLChangeTrackingImportHelper.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: er $ $Date: 2002-04-15 11:04:14 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -900,6 +900,9 @@ void ScXMLChangeTrackingImportHelper::CreateChangeTrack(ScDocument* pTempDoc)
if (aProtect.getLength())
pTrack->SetProtection(aProtect);
+ if ( pTrack->GetLast() )
+ pTrack->SetLastSavedActionNumber(pTrack->GetLast()->GetActionNumber());
+
pDoc->SetChangeTrack(pTrack);
}
}
diff --git a/sc/source/filter/xml/XMLConverter.cxx b/sc/source/filter/xml/XMLConverter.cxx
index 90665dc11f4a..79f4c9f02cf2 100644
--- a/sc/source/filter/xml/XMLConverter.cxx
+++ b/sc/source/filter/xml/XMLConverter.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLConverter.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: sab $ $Date: 2001-11-15 11:36:12 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -725,7 +725,8 @@ void ScXMLConverter::ParseFormula(OUString& sFormula, const sal_Bool bIsFormula)
sal_Unicode chPrevious('=');
for (sal_Int32 i = 0; i < sFormula.getLength(); i++)
{
- if (sFormula[i] == '\'' && !bInDoubleQuotationMarks)
+ if (sFormula[i] == '\'' && !bInDoubleQuotationMarks &&
+ chPrevious != '\\')
bInQuotationMarks = !bInQuotationMarks;
else if (sFormula[i] == '"' && !bInQuotationMarks)
bInDoubleQuotationMarks = !bInDoubleQuotationMarks;
@@ -741,6 +742,8 @@ void ScXMLConverter::ParseFormula(OUString& sFormula, const sal_Bool bIsFormula)
sBuffer.append(sFormula[i]);
chPrevious = sFormula[i];
}
+
+ DBG_ASSERT(nCountBraces == 0, "there are some braces still open");
sFormula = sBuffer.makeStringAndClear();
}
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx
index b58baf734d61..55f669dad3d4 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.cxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLStylesExportHelper.cxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: hr $ $Date: 2002-02-08 18:28:50 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/xml/XMLStylesExportHelper.hxx b/sc/source/filter/xml/XMLStylesExportHelper.hxx
index 263d2570c203..6880b9ecf831 100644
--- a/sc/source/filter/xml/XMLStylesExportHelper.hxx
+++ b/sc/source/filter/xml/XMLStylesExportHelper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLStylesExportHelper.hxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: hr $ $Date: 2002-02-08 18:28:50 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
diff --git a/sc/source/filter/xml/XMLTableMasterPageExport.cxx b/sc/source/filter/xml/XMLTableMasterPageExport.cxx
index e82b0a865193..526e81bad44d 100644
--- a/sc/source/filter/xml/XMLTableMasterPageExport.cxx
+++ b/sc/source/filter/xml/XMLTableMasterPageExport.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: XMLTableMasterPageExport.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: sab $ $Date: 2003-03-10 11:15:27 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -136,7 +136,7 @@ void XMLTableMasterPageExport::exportHeaderFooter(const com::sun::star::uno::Ref
GetExport().AddAttribute( XML_NAMESPACE_STYLE,
XML_DISPLAY, XML_FALSE );
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
- aName, sal_True, sal_True );
+ aName, sal_True, sal_True );
if (sCenter.getLength() && !sLeft.getLength() && !sRight.getLength())
exportHeaderFooterContent( xCenter, sal_False, sal_False );
else
@@ -145,19 +145,19 @@ void XMLTableMasterPageExport::exportHeaderFooter(const com::sun::star::uno::Ref
{
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
XML_REGION_LEFT, sal_True, sal_True );
- exportHeaderFooterContent( xLeft, sal_False, sal_False );
+ exportHeaderFooterContent( xLeft, sal_False, sal_False );
}
if (sCenter.getLength())
{
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
XML_REGION_CENTER, sal_True, sal_True );
- exportHeaderFooterContent( xCenter, sal_False, sal_False );
+ exportHeaderFooterContent( xCenter, sal_False, sal_False );
}
if (sRight.getLength())
{
SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
XML_REGION_RIGHT, sal_True, sal_True );
- exportHeaderFooterContent( xRight, sal_False, sal_False );
+ exportHeaderFooterContent( xRight, sal_False, sal_False );
}
}
}
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index b637947495b3..293005ea7a6b 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlcelli.cxx,v $
*
- * $Revision: 1.70 $
+ * $Revision: 1.71 $
*
- * last change: $Author: sab $ $Date: 2002-09-26 12:08:41 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -164,9 +164,6 @@
#ifndef _DATE_HXX
#include <tools/date.hxx>
#endif
-#ifndef _TOOLS_SOLMATH_HXX
-#include <tools/solmath.hxx>
-#endif
#ifndef _ISOLANG_HXX
#include <tools/isolang.hxx>
#endif
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 51deb74f5775..3464c4a07d6c 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldrani.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: sab $ $Date: 2002-03-22 16:02:47 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -470,14 +470,14 @@ void ScXMLDatabaseRangeContext::EndElement()
xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_USEREGEX)), aTemp);
aTemp <<= aFilterOutputPosition;
xFilterPropertySet->setPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_OUTPOS)), aTemp);
- if (bFilterConditionSourceRange)
- {
- ScRange aAdvSource;
- ScUnoConversion::FillScRange( aAdvSource, aFilterConditionSourceRangeAddress );
- pDBData->SetAdvancedQuerySource(&aAdvSource);
- }
}
xSheetFilterDescriptor->setFilterFields(aFilterFields);
+ if (bFilterConditionSourceRange)
+ {
+ ScRange aAdvSource;
+ ScUnoConversion::FillScRange( aAdvSource, aFilterConditionSourceRangeAddress );
+ pDBData->SetAdvancedQuerySource(&aAdvSource);
+ }
}
if (bContainsSubTotal)
{
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 3dc869871fc1..bea415afc45a 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexprt.cxx,v $
*
- * $Revision: 1.164 $
+ * $Revision: 1.165 $
*
- * last change: $Author: sab $ $Date: 2002-12-06 05:59:14 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -185,8 +185,8 @@
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
-#ifndef _TOOLS_SOLMATH_HXX
-#include <tools/solmath.hxx>
+#ifndef INCLUDED_RTL_MATH_HXX
+#include <rtl/math.hxx>
#endif
#ifndef _ZFORLIST_HXX
#include <svtools/zforlist.hxx>
@@ -509,6 +509,21 @@ ScXMLExport::ScXMLExport(const sal_uInt16 nExportFlag) :
xRowStylesExportPropertySetMapper, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX)));
GetAutoStylePool()->AddFamily(XML_STYLE_FAMILY_TABLE_TABLE, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_NAME)),
xTableStylesExportPropertySetMapper, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_TABLE_TABLE_STYLES_PREFIX)));
+
+ if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
+ {
+ sAttrName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_NAME));
+ sAttrStyleName = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_STYLE_NAME));
+ sAttrColumnsRepeated = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_NUMBER_COLUMNS_REPEATED));
+ sAttrFormula = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_FORMULA));
+ sAttrStringValue = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_STRING_VALUE));
+ sElemCell = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_TABLE_CELL));
+ sElemCoveredCell = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_COVERED_TABLE_CELL));
+ sElemCol = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_TABLE_COLUMN));
+ sElemRow = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_TABLE_ROW));
+ sElemTab = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TABLE, GetXMLToken(XML_TABLE));
+ sElemP = GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT, GetXMLToken(XML_P));
+ }
}
@@ -840,17 +855,17 @@ void ScXMLExport::WriteSingleColumn(const sal_Int32 nRepeatColumns, const sal_In
const sal_Int32 nIndex, const sal_Bool bIsAutoStyle, const sal_Bool bIsVisible)
{
CheckAttrList();
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, *pColumnStyles->GetStyleNameByIndex(nStyleIndex));
+ AddAttribute(sAttrStyleName, *pColumnStyles->GetStyleNameByIndex(nStyleIndex));
if (!bIsVisible)
AddAttribute(XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_COLLAPSE);
if (nRepeatColumns > 1)
{
OUString sOUEndCol = OUString::valueOf(static_cast <sal_Int32> (nRepeatColumns));
- AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, sOUEndCol);
+ AddAttribute(sAttrColumnsRepeated, sOUEndCol);
}
if (nIndex != -1)
AddAttribute(XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, *pCellStyles->GetStyleNameByIndex(nIndex, bIsAutoStyle));
- SvXMLElementExport aElemR(*this, XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, sal_True, sal_True);
+ SvXMLElementExport aElemC(*this, sElemCol, sal_True, sal_True);
}
void ScXMLExport::WriteColumn(const sal_Int32 nColumn, const sal_Int32 nRepeatColumns,
@@ -1023,16 +1038,16 @@ void ScXMLExport::WriteRowContent()
else
{
if (nIndex != -1)
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, *pCellStyles->GetStyleNameByIndex(nIndex, bIsAutoStyle));
+ AddAttribute(sAttrStyleName, *pCellStyles->GetStyleNameByIndex(nIndex, bIsAutoStyle));
if (nPrevValidationIndex > -1)
AddAttribute(XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, pValidationsContainer->GetValidationName(nPrevValidationIndex));
if (nCols > 1)
{
rtl::OUStringBuffer aBuf;
GetMM100UnitConverter().convertNumber(aBuf, nCols);
- AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aBuf.makeStringAndClear());
+ AddAttribute(sAttrColumnsRepeated, aBuf.makeStringAndClear());
}
- SvXMLElementExport aElemC(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
+ SvXMLElementExport aElemC(*this, sElemCell, sal_True, sal_True);
nIndex = aRange.nIndex;
bIsAutoStyle = aRange.bIsAutoStyle;
nCols = aRange.nRepeatColumns;
@@ -1047,23 +1062,23 @@ void ScXMLExport::WriteRowContent()
{
table::CellAddress aCellAddress;
if (nIndex != -1)
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, *pCellStyles->GetStyleNameByIndex(nIndex, bIsAutoStyle));
+ AddAttribute(sAttrStyleName, *pCellStyles->GetStyleNameByIndex(nIndex, bIsAutoStyle));
if (nPrevValidationIndex > -1)
AddAttribute(XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, pValidationsContainer->GetValidationName(nPrevValidationIndex));
if (nCols > 1)
{
rtl::OUStringBuffer aBuf;
GetMM100UnitConverter().convertNumber(aBuf, nCols);
- AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, aBuf.makeStringAndClear());
+ AddAttribute(sAttrColumnsRepeated, aBuf.makeStringAndClear());
}
- SvXMLElementExport aElemC(*this, XML_NAMESPACE_TABLE, XML_TABLE_CELL, sal_True, sal_True);
+ SvXMLElementExport aElemC(*this, sElemCell, sal_True, sal_True);
}
}
void ScXMLExport::WriteRowStartTag(const sal_Int32 nRow, const sal_Int32 nIndex,
const sal_Int8 nFlag, const sal_Int32 nEqualRows)
{
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, *pRowStyles->GetStyleNameByIndex(nIndex));
+ AddAttribute(sAttrStyleName, *pRowStyles->GetStyleNameByIndex(nIndex));
if (nFlag)
if (nFlag & CR_HIDDEN)
{
@@ -1083,7 +1098,7 @@ void ScXMLExport::WriteRowStartTag(const sal_Int32 nRow, const sal_Int32 nIndex,
AddAttribute(XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME,
*pCellStyles->GetStyleNameByIndex(nCellStyleIndex,
(*pDefaults->GetRowDefaults())[nRow].bIsAutoStyle));
- StartElement( XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True);
+ StartElement( sElemRow, sal_True);
}
void ScXMLExport::OpenHeaderRows()
@@ -1200,7 +1215,7 @@ void ScXMLExport::CloseRow(const sal_Int32 nRow)
{
if (nOpenRow > -1)
{
- EndElement(XML_NAMESPACE_TABLE, XML_TABLE_ROW, sal_True);
+ EndElement(sElemRow, sal_True);
if (bHasRowHeader && nRow == aRowHeaderRange.EndRow)
{
CloseHeaderRows();
@@ -1430,8 +1445,8 @@ void ScXMLExport::_ExportContent()
{
nCurrentTable = nTable;
rtl::OUString sOUTableName = xName->getName();
- AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, sOUTableName);
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, aTableStyles[nTable]);
+ AddAttribute(sAttrName, sOUTableName);
+ AddAttribute(sAttrStyleName, aTableStyles[nTable]);
uno::Reference<util::XProtectable> xProtectable (xTable, uno::UNO_QUERY);
if (xProtectable.is())
if (xProtectable->isProtected())
@@ -1446,7 +1461,7 @@ void ScXMLExport::_ExportContent()
rtl::OUString sPrintRanges( GetPrintRanges() );
if( sPrintRanges.getLength() )
AddAttribute( XML_NAMESPACE_TABLE, XML_PRINT_RANGES, sPrintRanges );
- SvXMLElementExport aElemT(*this, XML_NAMESPACE_TABLE, XML_TABLE, sal_True, sal_True);
+ SvXMLElementExport aElemT(*this, sElemTab, sal_True, sal_True);
CheckAttrList();
WriteTableSource();
WriteScenario();
@@ -2242,7 +2257,7 @@ OUString ScXMLExport::GetPrintRanges()
void ScXMLExport::WriteCell (ScMyCell& aCell)
{
if (aCell.nStyleIndex != -1)
- AddAttribute(XML_NAMESPACE_TABLE, XML_STYLE_NAME, *pCellStyles->GetStyleNameByIndex(aCell.nStyleIndex, aCell.bIsAutoStyle));
+ AddAttribute(sAttrStyleName, *pCellStyles->GetStyleNameByIndex(aCell.nStyleIndex, aCell.bIsAutoStyle));
if (aCell.nValidationIndex > -1)
AddAttribute(XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, pValidationsContainer->GetValidationName(aCell.nValidationIndex));
sal_Bool bIsMatrix(aCell.bIsMatrixBase || aCell.bIsMatrixCovered);
@@ -2274,7 +2289,7 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
aCell.bHasDoubleValue = sal_True;
}
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- aCell.nNumberFormat, aCell.fValue, XML_NAMESPACE_TABLE);
+ aCell.nNumberFormat, aCell.fValue);
}
break;
case table::CellContentType_TEXT :
@@ -2285,7 +2300,7 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
if (sFormula[0] == '\'')
sFormula = sFormula.copy(1);
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- sFormula, aCell.sStringValue, XML_NAMESPACE_TABLE, sal_True, sal_False);
+ sFormula, aCell.sStringValue, sal_True, sal_False);
}
}
break;
@@ -2304,11 +2319,11 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
pFormulaCell->GetEnglishFormula(sFormula, sal_True);
rtl::OUString sOUFormula(sFormula.makeStringAndClear());
if (!bIsMatrix)
- AddAttribute(XML_NAMESPACE_TABLE, XML_FORMULA, sOUFormula);
+ AddAttribute(sAttrFormula, sOUFormula);
else
{
rtl::OUString sMatrixFormula = sOUFormula.copy(1, sOUFormula.getLength() - 2);
- AddAttribute(XML_NAMESPACE_TABLE, XML_FORMULA, sMatrixFormula);
+ AddAttribute(sAttrFormula, sMatrixFormula);
}
}
if (pFormulaCell->IsValue())
@@ -2321,28 +2336,29 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
if (pDoc)
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
pFormulaCell->GetStandardFormat(*pDoc->GetFormatTable(), 0),
- aCell.xCell->getValue(), XML_NAMESPACE_TABLE);
+ aCell.xCell->getValue());
}
else
GetNumberFormatAttributesExportHelper()->SetNumberFormatAttributes(
- aCell.nNumberFormat, aCell.xCell->getValue(), XML_NAMESPACE_TABLE);
+ aCell.nNumberFormat, aCell.xCell->getValue());
}
else
{
if (GetCellText(aCell))
if (aCell.sStringValue.getLength())
- AddAttribute(XML_NAMESPACE_TABLE, XML_STRING_VALUE, aCell.sStringValue);
+ AddAttribute(sAttrStringValue, aCell.sStringValue);
}
}
}
break;
}
- XMLTokenEnum nCellType;
+ rtl::OUString* pCellString = &sElemCell;
if (aCell.bIsCovered)
- nCellType = XML_COVERED_TABLE_CELL;
+ {
+ pCellString = &sElemCoveredCell;
+ }
else
{
- nCellType = XML_TABLE_CELL;
if (aCell.bIsMergedBase)
{
sal_Int32 nColumns = aCell.aMergeRange.EndColumn - aCell.aMergeRange.StartColumn + 1;
@@ -2355,7 +2371,7 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, sRows.makeStringAndClear());
}
}
- SvXMLElementExport aElemC(*this, XML_NAMESPACE_TABLE, nCellType, sal_True, sal_True);
+ SvXMLElementExport aElemC(*this, *pCellString, sal_True, sal_True);
CheckAttrList();
WriteAreaLink(aCell);
WriteAnnotation(aCell);
@@ -2374,7 +2390,7 @@ void ScXMLExport::WriteCell (ScMyCell& aCell)
}
else
{
- SvXMLElementExport aElemC(*this, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
+ SvXMLElementExport aElemC(*this, sElemP, sal_True, sal_False);
sal_Bool bPrevCharWasSpace(sal_True);
if (GetCellText(aCell))
GetTextParagraphExport()->exportText(aCell.sStringValue, bPrevCharWasSpace);
@@ -2585,7 +2601,7 @@ void ScXMLExport::WriteAnnotation(const ScMyCell& rMyCell)
{
if (sOUText2[i] == '\n')
{
- SvXMLElementExport aElemP(*this, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
+ SvXMLElementExport aElemP(*this, sElemP, sal_True, sal_False);
GetTextParagraphExport()->exportText(sTemp.makeStringAndClear(), bPrevCharWasSpace);
}
else
@@ -2594,7 +2610,7 @@ void ScXMLExport::WriteAnnotation(const ScMyCell& rMyCell)
}
if (sTemp.getLength())
{
- SvXMLElementExport aElemP(*this, XML_NAMESPACE_TEXT, XML_P, sal_True, sal_False);
+ SvXMLElementExport aElemP(*this, sElemP, sal_True, sal_False);
GetTextParagraphExport()->exportText(sTemp.makeStringAndClear(), bPrevCharWasSpace);
}
CheckAttrList();
@@ -2651,7 +2667,7 @@ void ScXMLExport::SetRepeatAttribute (const sal_Int32 nEqualCellCount)
{
sal_Int32 nTemp = nEqualCellCount + 1;
OUString sOUEqualCellCount = OUString::valueOf(nTemp);
- AddAttribute(XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, sOUEqualCellCount);
+ AddAttribute(sAttrColumnsRepeated, sOUEqualCellCount);
GetProgressBarHelper()->Increment(nEqualCellCount);
}
}
@@ -2831,7 +2847,7 @@ void ScXMLExport::WriteCalculationSettings(const uno::Reference <sheet::XSpreads
util::Date aNullDate;
aAny >>= aNullDate;
if (bCalcAsShown || bIgnoreCase || !bLookUpLabels || !bMatchWholeCell || !bUseRegularExpressions ||
- bIsIterationEnabled || nIterationCount != 100 || !SolarMath::ApproxEqual(fIterationEpsilon, 0.001) ||
+ bIsIterationEnabled || nIterationCount != 100 || !::rtl::math::approxEqual(fIterationEpsilon, 0.001) ||
aNullDate.Day != 30 || aNullDate.Month != 12 || aNullDate.Year != 1899 || nYear2000 != 1930)
{
if (bIgnoreCase)
@@ -2859,7 +2875,7 @@ void ScXMLExport::WriteCalculationSettings(const uno::Reference <sheet::XSpreads
AddAttribute(XML_NAMESPACE_TABLE, XML_DATE_VALUE, sDate.makeStringAndClear());
SvXMLElementExport aElemNullDate(*this, XML_NAMESPACE_TABLE, XML_NULL_DATE, sal_True, sal_True);
}
- if (bIsIterationEnabled || nIterationCount != 100 || !SolarMath::ApproxEqual(fIterationEpsilon, 0.001))
+ if (bIsIterationEnabled || nIterationCount != 100 || !::rtl::math::approxEqual(fIterationEpsilon, 0.001))
{
rtl::OUStringBuffer sBuffer;
if (bIsIterationEnabled)
@@ -2869,7 +2885,7 @@ void ScXMLExport::WriteCalculationSettings(const uno::Reference <sheet::XSpreads
GetMM100UnitConverter().convertNumber(sBuffer, nIterationCount);
AddAttribute(XML_NAMESPACE_TABLE, XML_STEPS, sBuffer.makeStringAndClear());
}
- if (!SolarMath::ApproxEqual(fIterationEpsilon, 0.001))
+ if (!::rtl::math::approxEqual(fIterationEpsilon, 0.001))
{
GetMM100UnitConverter().convertDouble(sBuffer, fIterationEpsilon);
AddAttribute(XML_NAMESPACE_TABLE, XML_MAXIMUM_DIFFERENCE, sBuffer.makeStringAndClear());
@@ -3068,7 +3084,7 @@ void ScXMLExport::WriteNamedExpressions(const com::sun::star::uno::Reference <co
if (xNamed.is() && xCellRangeReferrer.is())
{
rtl::OUString sOUName = xNamed->getName();
- AddAttribute(XML_NAMESPACE_TABLE, XML_NAME, sOUName);
+ AddAttribute(sAttrName, sOUName);
OUString sOUBaseCellAddress;
ScXMLConverter::GetStringFromAddress( sOUBaseCellAddress,
@@ -3286,10 +3302,7 @@ void ScXMLExport::CreateSharedData(const sal_Int32 nTableCount)
XMLNumberFormatAttributesExportHelper* ScXMLExport::GetNumberFormatAttributesExportHelper()
{
if (!pNumberFormatAttributesExportHelper)
- {
- pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier());
- pNumberFormatAttributesExportHelper->SetExport(this);
- }
+ pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier(), *this, XML_NAMESPACE_TABLE);
return pNumberFormatAttributesExportHelper;
}
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 59b0c16378fc..aa3a1ffcbe60 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexprt.hxx,v $
*
- * $Revision: 1.72 $
+ * $Revision: 1.73 $
*
- * last change: $Author: sab $ $Date: 2001-10-19 09:17:59 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -139,6 +139,17 @@ class ScXMLExport : public SvXMLExport
ScChangeTrackingExportHelper* pChangeTrackingExportHelper;
const rtl::OUString sLayerID;
const rtl::OUString sCaptionShape;
+ rtl::OUString sAttrName;
+ rtl::OUString sAttrStyleName;
+ rtl::OUString sAttrColumnsRepeated;
+ rtl::OUString sAttrFormula;
+ rtl::OUString sAttrStringValue;
+ rtl::OUString sElemCell;
+ rtl::OUString sElemCoveredCell;
+ rtl::OUString sElemCol;
+ rtl::OUString sElemRow;
+ rtl::OUString sElemTab;
+ rtl::OUString sElemP;
sal_Int32 nOpenRow;
sal_uInt16 nCurrentTable;
sal_Bool bHasRowHeader : 1;
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index e97b614261b5..077944507e3c 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlwrap.cxx,v $
*
- * $Revision: 1.48 $
+ * $Revision: 1.49 $
*
- * last change: $Author: sab $ $Date: 2002-09-26 12:08:42 $
+ * last change: $Author: hr $ $Date: 2003-03-26 18:05:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,6 +118,9 @@
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
#include <com/sun/star/lang/DisposedException.hpp>
#endif
+#ifndef _COM_SUN_STAR_PACKAGES_ZIP_ZIPIOEXCEPTION_HPP_
+#include <com/sun/star/packages/zip/ZipIOException.hpp>
+#endif
#ifndef _XMLEOHLP_HXX
#include <svx/xmleohlp.hxx>
@@ -358,6 +361,15 @@ sal_uInt32 ScXMLImportWrapper::ImportFromComponent(uno::Reference<lang::XMultiSe
nReturn = SCERR_IMPORT_FORMAT;
}
}
+ catch( packages::zip::ZipIOException& r )
+ {
+#ifdef DBG_UTIL
+ ByteString aError( "Zip exception catched while importing:\n" );
+ aError += ByteString( String( r.Message), RTL_TEXTENCODING_ASCII_US );
+ DBG_ERROR( aError.GetBuffer() );
+#endif
+ nReturn = ERRCODE_IO_BROKENPACKAGE;
+ }
catch( io::IOException& r )
{
#ifdef DBG_UTIL