diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-07-03 21:19:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-07-04 10:08:39 +0200 |
commit | 650ab6e645c51aaffc8dc5e638295d6da74d44ff (patch) | |
tree | bf307ca3a184a9a3ef77494d5848c20c7f71649f /sc | |
parent | d1fc1c326470461def5ab092a311afee31950880 (diff) |
crashtesting: assert on exporting fdo68105-1.ods to xls
and ooo101471-3.ods to xls
Change-Id: Ieb5339664a2bb647e8a09a44e60cad651bf65247
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153933
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/inc/XclExpChangeTrack.hxx | 3 | ||||
-rw-r--r-- | sc/source/filter/xcl97/XclExpChangeTrack.cxx | 36 |
2 files changed, 38 insertions, 1 deletions
diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx index a6cdeff93cab..b23b6f8cdcaf 100644 --- a/sc/source/filter/inc/XclExpChangeTrack.hxx +++ b/sc/source/filter/inc/XclExpChangeTrack.hxx @@ -305,6 +305,7 @@ public: void InitFillup(); sal_uInt16 GetId( sal_uInt16 nIndex ) const; + bool HasId( sal_uInt16 nIndex ) const; void Remove(); sal_uInt16 GetBufferCount() const @@ -465,6 +466,8 @@ struct XclExpChTrData void Write( XclExpStream& rStrm, const XclExpChTrTabIdBuffer& rTabIdBuffer ); + + bool UsesDeletedTab(const XclExpChTrTabIdBuffer& rTabIdBuffer) const; }; // XclExpChTrCellContent - changed cell content diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 24da37109d29..9c22af8a6420 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -577,6 +577,11 @@ sal_uInt16 XclExpChTrTabIdBuffer::GetId( sal_uInt16 nIndex ) const return pBuffer[ nIndex ]; } +bool XclExpChTrTabIdBuffer::HasId( sal_uInt16 nIndex ) const +{ + return nIndex < nBufSize; +} + void XclExpChTrTabIdBuffer::Remove() { OSL_ENSURE( pBuffer.get() <= pLast, "XclExpChTrTabIdBuffer::Remove - buffer empty" ); @@ -807,6 +812,31 @@ void XclExpChTrData::Write( XclExpStream& rStrm, const XclExpChTrTabIdBuffer& rT } } +static bool lcl_IsDeletedTab(const XclExpChTrTabIdBuffer& rTabIdBuffer, sal_uInt16 nIndex) +{ + return !rTabIdBuffer.HasId(nIndex); +} + +bool XclExpChTrData::UsesDeletedTab(const XclExpChTrTabIdBuffer& rTabIdBuffer) const +{ + if (nType != EXC_CHTR_TYPE_FORMULA) + return false; + + for( const auto& rLogEntry : maRefLog ) + { + if (rLogEntry.mpUrl && rLogEntry.mpFirstTab) + continue; + if (lcl_IsDeletedTab(rTabIdBuffer, rLogEntry.mnFirstXclTab)) + return true; + bool bSingleTab = rLogEntry.mnFirstXclTab == rLogEntry.mnLastXclTab; + if (!bSingleTab) + continue; + if (lcl_IsDeletedTab(rTabIdBuffer, rLogEntry.mnLastXclTab)) + return true; + } + return false; +} + XclExpChTrCellContent::XclExpChTrCellContent( const ScChangeActionContent& rAction, const XclExpRoot& rRoot, @@ -934,7 +964,11 @@ void XclExpChTrCellContent::GetCellData( bool XclExpChTrCellContent::UsesDeletedTab() const { - return IsDeletedTab(aPosition.Tab()); + if (IsDeletedTab(aPosition.Tab())) + return true; + if (pOldData && pOldData->UsesDeletedTab(rIdBuffer)) + return true; + return pNewData && pNewData->UsesDeletedTab(rIdBuffer); } void XclExpChTrCellContent::SaveActionData( XclExpStream& rStrm ) const |