diff options
author | Eike Rathke <erack@redhat.com> | 2022-02-16 21:43:43 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-02-17 11:35:38 +0100 |
commit | f6b9c471cace1963e8b625ecfe2c20f5248984eb (patch) | |
tree | dcf2cedb6c36133b55ee37d773264993379592ab /sc | |
parent | d94a4767437cdb12ee92265814b8b56f13448a09 (diff) |
Handle the possible case of broadcasted row block, tdf#119083 follow-up
Though unlikely and apparently not happening, the changed ScHint
may theoretically notify for a block of rows, not just one
address. Do not join out-of-band rows to the dirty header columns.
Change-Id: I524bcbedf063fe6b5ff5b99bc984fcb9dc02b6ab
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130054
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/tool/dbdata.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 8d2d146b31d8..3042404e0eaa 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -932,15 +932,30 @@ void ScDBData::Notify( const SfxHint& rHint ) // multiple cells are affected. Expand the range to what this is // listening to. Broadcasted address outside should not happen, // but... let it trigger a refresh if. - ScRange aHeaderRange( GetHeaderArea()); + const ScRange aHeaderRange( GetHeaderArea()); + ScAddress aHintAddress( pScHint->GetStartAddress()); if (aHeaderRange.IsValid()) { mpContainer->GetDirtyTableColumnNames().Join( aHeaderRange); - if (!aHeaderRange.Contains( pScHint->GetRange())) - mpContainer->GetDirtyTableColumnNames().Join( pScHint->GetRange()); + // Header range is one row. + // The ScHint's "range" is an address with row count. + // Though broadcasted is usually only one cell, check for the + // possible case of row block and for one cell in the same row. + if (aHintAddress.Row() <= aHeaderRange.aStart.Row() + && aHeaderRange.aStart.Row() < aHintAddress.Row() + pScHint->GetRowCount()) + { + aHintAddress.SetRow( aHeaderRange.aStart.Row()); + if (!aHeaderRange.Contains( aHintAddress)) + mpContainer->GetDirtyTableColumnNames().Join( aHintAddress); + } } else - mpContainer->GetDirtyTableColumnNames().Join( pScHint->GetRange()); + { + // We need *some* range in the dirty list even without header area, + // otherwise the container would not attempt to call a refresh. + aHintAddress.SetRow( nStartRow); + mpContainer->GetDirtyTableColumnNames().Join( aHintAddress); + } } // Do not refresh column names here, which might trigger unwanted |