summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/filter/inc/XclExpChangeTrack.hxx3
-rw-r--r--sc/source/filter/xcl97/XclExpChangeTrack.cxx36
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