Resolves: tdf#158223 Revert "fix" for tdf#156174 and follow-up
... introducing a real fix. commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a CommitDate: Tue Jul 25 15:04:01 2023 +0200 tdf#156174 sc DBData: fix regression of database ranges just cured a symptom by removing a condition that shouldn't had been removed, instead of getting to the real cause of an odd reference update. Shrinking the end of a sheet reference range and thus moving it one before the previously referenced relative position is only possible if the deleted sheet actually touches the referenced range, which here the start value points to and thus checking ref>=start+delta is not necessary and subtracting 1 even harms. This is different from deleting columns or rows where the start value points behind the deleted area of moving the following area. Change-Id: If9ae5dd6f6ae5cd248ad5d999f1aa7577d4ec035 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160374 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
This commit is contained in:
parent
8286c9ebe4
commit
f35b540279
@ -25,12 +25,12 @@
|
||||
#include <osl/diagnose.h>
|
||||
|
||||
template< typename R, typename S, typename U >
|
||||
static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask )
|
||||
static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true )
|
||||
{
|
||||
bool bCut = false;
|
||||
if ( rRef >= nStart )
|
||||
rRef = sal::static_int_cast<R>( rRef + nDelta );
|
||||
else if ( nDelta < 0 && rRef >= nStart + nDelta )
|
||||
else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta )
|
||||
rRef = nStart + nDelta; //TODO: limit ???
|
||||
if ( rRef < 0 )
|
||||
{
|
||||
@ -46,12 +46,12 @@ static bool lcl_MoveStart( R& rRef, U nStart, S nDelta, U nMask )
|
||||
}
|
||||
|
||||
template< typename R, typename S, typename U >
|
||||
static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask )
|
||||
static bool lcl_MoveEnd( R& rRef, U nStart, S nDelta, U nMask, bool bShrink = true )
|
||||
{
|
||||
bool bCut = false;
|
||||
if ( rRef >= nStart )
|
||||
rRef = sal::static_int_cast<R>( rRef + nDelta );
|
||||
else if ( nDelta < 0 && rRef >= nStart + nDelta )
|
||||
else if ( nDelta < 0 && bShrink && rRef >= nStart + nDelta )
|
||||
rRef = nStart + nDelta - 1; //TODO: limit ???
|
||||
if (rRef < 0)
|
||||
{
|
||||
@ -284,9 +284,14 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* pDoc, UpdateRefMode eUpdat
|
||||
SCTAB nMaxTab = pDoc->GetTableCount() - 1;
|
||||
nMaxTab = sal::static_int_cast<SCTAB>(nMaxTab + nDz); // adjust to new count
|
||||
bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
|
||||
bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
|
||||
bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
|
||||
if ( bCut1 || bCut2 )
|
||||
bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab, false /*bShrink*/);
|
||||
bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab, false /*bShrink*/);
|
||||
if ( theTab2 < theTab1 )
|
||||
{
|
||||
eRet = UR_INVALID;
|
||||
theTab2 = theTab1;
|
||||
}
|
||||
else if ( bCut1 || bCut2 )
|
||||
eRet = UR_UPDATED;
|
||||
if ( bExp )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user