diff options
Diffstat (limited to 'sc/source/filter/excel/excdoc.cxx')
-rw-r--r-- | sc/source/filter/excel/excdoc.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sc/source/filter/excel/excdoc.cxx b/sc/source/filter/excel/excdoc.cxx index 5534f8e775a9..2cf2d8f580c0 100644 --- a/sc/source/filter/excel/excdoc.cxx +++ b/sc/source/filter/excel/excdoc.cxx @@ -200,17 +200,12 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) UINT16 nExcTabCount = rTabInfo.GetXclTabCount(); UINT16 nCodenames = static_cast< UINT16 >( GetExtDocOptions().GetCodeNameCount() ); - 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 ) ); - } - } + SfxObjectShell* pShell = GetDocShell(); + sal_uInt16 nWriteProtHash = pShell ? pShell->GetModifyPasswordHash() : 0; + bool bRecommendReadOnly = pShell && pShell->IsLoadReadonly(); + + if( (nWriteProtHash > 0) || bRecommendReadOnly ) + 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 ); @@ -234,7 +229,7 @@ void ExcTable::FillAsHeader( ExcBoundsheetList& rBoundsheetList ) Add( new XclExpWriteAccess ); } - Add( new XclExpFileSharing( GetRoot(), nWriteProtHash ) ); + Add( new XclExpFileSharing( GetRoot(), nWriteProtHash, bRecommendReadOnly ) ); Add( new XclExpUInt16Record( EXC_ID_CODEPAGE, nCodePage ) ); if( GetBiff() == EXC_BIFF8 ) |