summaryrefslogtreecommitdiff
path: root/sc/source/filter/excel/excdoc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/filter/excel/excdoc.cxx')
-rw-r--r--sc/source/filter/excel/excdoc.cxx59
1 files changed, 43 insertions, 16 deletions
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx
index d1b08b9cfc68..c72d165c7972 100644
--- a/sc/source/filter/excel/excdoc.cxx
+++ b/sc/source/filter/excel/excdoc.cxx
@@ -144,12 +144,12 @@ static void lcl_AddWorkbookProtection( XclExpRecordList<>& aRecList, ExcTable& s
}
#endif
-static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, ExcTable& self, SCTAB mnScTab )
+static void lcl_AddScenariosAndFilters( XclExpRecordList<>& aRecList, const XclExpRoot& rRoot, SCTAB nScTab )
{
// Scenarios
- aRecList.AppendNewRecord( new ExcEScenarioManager( self.GetDoc(), mnScTab ) );
+ aRecList.AppendNewRecord( new ExcEScenarioManager( rRoot, nScTab ) );
// filter
- aRecList.AppendRecord( self.GetFilterManager().CreateRecord( mnScTab ) );
+ aRecList.AppendRecord( rRoot.GetFilterManager().CreateRecord( nScTab ) );
}
@@ -205,20 +205,47 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
rR.pObjRecs = NULL; // per sheet
+ sal_uInt16 nWriteProtHash = 0;
+ if( SfxObjectShell* pDocShell = GetDocShell() )
+ {
+ ScfPropertySet aPropSet( pDocShell->GetModel() );
+ sal_Int32 nApiHash = 0;
+ if( aPropSet.GetProperty( nApiHash, CREATE_OUSTRING( "WriteProtectionPassword" ) ) && (0 < nApiHash) && (nApiHash <= SAL_MAX_UINT16) )
+ {
+ nWriteProtHash = static_cast< sal_uInt16 >( nApiHash );
+ Add( new XclExpEmptyRecord( EXC_ID_WRITEPROT ) );
+ }
+ }
+
+ // TODO: correct codepage for BIFF5?
+ sal_uInt16 nCodePage = XclTools::GetXclCodePage( (GetBiff() <= EXC_BIFF5) ? RTL_TEXTENCODING_MS_1252 : RTL_TEXTENCODING_UNICODE );
+
if( GetBiff() <= EXC_BIFF5 )
+ {
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEHDR ) );
+ Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
+ Add( new XclExpEmptyRecord( EXC_ID_TOOLBARHDR ) );
+ Add( new XclExpEmptyRecord( EXC_ID_TOOLBAREND ) );
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) );
Add( new ExcDummy_00 );
+ }
else
{
- if ( IsDocumentEncrypted() )
- Add( new XclExpFilePass(GetRoot()) );
-
- Add( new XclExpInterfaceHdr );
- Add( new XclExpMMS );
- Add( new XclExpInterfaceEnd );
+ if( IsDocumentEncrypted() )
+ Add( new XclExpFilePass( GetRoot() ) );
+ Add( new XclExpInterfaceHdr( nCodePage ) );
+ Add( new XclExpUInt16Record( EXC_ID_MMS, 0 ) );
+ Add( new XclExpEmptyRecord( EXC_ID_INTERFACEEND ) );
Add( new XclExpWriteAccess );
- Add( new XclExpCodePage );
- Add( new XclExpDSF );
- Add( new XclExpExcel9File );
+ }
+
+ Add( new XclExpFileSharing( GetRoot(), nWriteProtHash ) );
+ Add( new XclExpUInt16Record( EXC_ID_CODEPAGE, nCodePage ) );
+
+ if( GetBiff() == EXC_BIFF8 )
+ {
+ Add( new XclExpBoolRecord( EXC_ID_DSF, false ) );
+ Add( new XclExpEmptyRecord( EXC_ID_XL9FILE ) );
rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
Add( rR.pTabId );
if( HasVbaStorage() )
@@ -228,10 +255,10 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList )
if( rCodeName.Len() )
Add( new XclCodename( rCodeName ) );
}
-
- Add( new XclExpFnGroupCount );
}
+ Add( new XclExpUInt16Record( EXC_ID_FNGROUPCOUNT, 14 ) );
+
// erst Namen- und Tabellen-Eintraege aufbauen
String aName;
@@ -473,7 +500,7 @@ void ExcTable::FillAsTable( size_t nCodeNameIdx )
aRecList.AppendRecord( CreateRecord( EXC_ID_EXTERNSHEET ) );
if ( eBiff == EXC_BIFF8 )
- lcl_AddScenariosAndFilters( aRecList, *this, mnScTab );
+ lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
// cell table: DEFCOLWIDTH, COLINFO, DIMENSIONS, ROW, cell records
aRecList.AppendRecord( mxCellTable );
@@ -585,7 +612,7 @@ void ExcTable::FillAsXmlTable( size_t nCodeNameIdx )
// web queries
Add( new XclExpWebQueryBuffer( GetRoot() ) );
- lcl_AddScenariosAndFilters( aRecList, *this, mnScTab );
+ lcl_AddScenariosAndFilters( aRecList, GetRoot(), mnScTab );
// MERGEDCELLS record, generated by the cell table
aRecList.AppendRecord( mxCellTable->CreateRecord( EXC_ID_MERGEDCELLS ) );