[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - sc/source
Eike Rathke
erack at redhat.com
Mon Jun 29 16:11:43 PDT 2015
sc/source/core/data/bcaslot.cxx | 3 ++-
sc/source/core/inc/refupdat.hxx | 7 ++++++-
sc/source/core/tool/lookupcache.cxx | 2 +-
sc/source/core/tool/refupdat.cxx | 34 ++++++++++++++++++++++++++++------
4 files changed, 37 insertions(+), 9 deletions(-)
New commits:
commit dc8df727a472778a5eaf34663224c9220b44b470
Author: Eike Rathke <erack at redhat.com>
Date: Tue Jun 30 00:22:22 2015 +0200
introduce ScRefUpdateRes UR_STICKY
Some callers of ScRefUpdate::Update() rely on a return value
!=UR_NOTHING if rows or columns are inserted or deleted or moved, so
simply ignoring the entire columns/rows cases is not possible even if
the ranges actually don't change. Instead, return UR_STICKY that may
allow to further differentiate in future.
Change-Id: Iba6c1e5eb1a33d39ef677ef1de2f2d296bf504f1
(cherry picked from commit 9a21a20fb21e22d7a9ab336b41a253fb565eb1b0)
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index f63d7db..2174216 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -1069,7 +1069,8 @@ void ScBroadcastAreaSlotMachine::UpdateBroadcastAreas(
{
aRange = ScRange( theCol1,theRow1,theTab1, theCol2,theRow2,theTab2 );
pArea->UpdateRange( aRange );
- pArea->GetBroadcaster().Broadcast( ScAreaChangedHint( aRange ) ); // for DDE
+ // For DDE and ScLookupCache
+ pArea->GetBroadcaster().Broadcast( ScAreaChangedHint( aRange ) );
}
// insert to slots
diff --git a/sc/source/core/inc/refupdat.hxx b/sc/source/core/inc/refupdat.hxx
index 20455ad..84c5eed 100644
--- a/sc/source/core/inc/refupdat.hxx
+++ b/sc/source/core/inc/refupdat.hxx
@@ -31,7 +31,12 @@ class ScRange;
enum ScRefUpdateRes {
UR_NOTHING = 0, // keine Anpassungen
UR_UPDATED = 1, // Anpassungen erfolgt
- UR_INVALID = 2 // Referenz wurde ungueltig
+ UR_INVALID = 2, // Referenz wurde ungueltig
+ UR_STICKY = 3 /**< Not updated because the reference is sticky,
+ but would had been updated if it wasn't. For
+ entire columns/rows. Essentially the same as
+ not UR_NOTHING for the caller but allows
+ differentiation. */
};
class ScRefUpdate
diff --git a/sc/source/core/tool/lookupcache.cxx b/sc/source/core/tool/lookupcache.cxx
index 2d9aca6..8fed640 100644
--- a/sc/source/core/tool/lookupcache.cxx
+++ b/sc/source/core/tool/lookupcache.cxx
@@ -111,7 +111,7 @@ void ScLookupCache::Notify( const SfxHint& rHint )
if (!mpDoc->IsInDtorClear())
{
const ScHint* p = dynamic_cast<const ScHint*>(&rHint);
- if (p && (p->GetId() & SC_HINT_DATACHANGED))
+ if ((p && (p->GetId() & SC_HINT_DATACHANGED)) || dynamic_cast<const ScAreaChangedHint*>(&rHint))
{
mpDoc->RemoveLookupCache( *this);
delete this;
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 6aa2c3f..8ca5373 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -208,8 +208,7 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eUpdateRefMo
{
bool bExpand = pDoc->IsExpandRefs();
if ( nDx && (theRow1 >= nRow1) && (theRow2 <= nRow2) &&
- (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
- !(theCol1 == 0 && theCol2 == MAXCOL) )
+ (theTab1 >= nTab1) && (theTab2 <= nTab2))
{
bool bExp = (bExpand && IsExpand( theCol1, theCol2, nCol1, nDx ));
bCut1 = lcl_MoveStart( theCol1, nCol1, nDx, MAXCOL );
@@ -226,10 +225,15 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eUpdateRefMo
Expand( theCol1, theCol2, nCol1, nDx );
eRet = UR_UPDATED;
}
+ if (eRet != UR_NOTHING && oldCol1 == 0 && oldCol2 == MAXCOL)
+ {
+ eRet = UR_STICKY;
+ theCol1 = oldCol1;
+ theCol2 = oldCol2;
+ }
}
if ( nDy && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
- (theTab1 >= nTab1) && (theTab2 <= nTab2) &&
- !(theRow1 == 0 && theRow2 == MAXROW) )
+ (theTab1 >= nTab1) && (theTab2 <= nTab2))
{
bool bExp = (bExpand && IsExpand( theRow1, theRow2, nRow1, nDy ));
bCut1 = lcl_MoveStart( theRow1, nRow1, nDy, MAXROW );
@@ -246,6 +250,12 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eUpdateRefMo
Expand( theRow1, theRow2, nRow1, nDy );
eRet = UR_UPDATED;
}
+ if (eRet != UR_NOTHING && oldRow1 == 0 && oldRow2 == MAXROW)
+ {
+ eRet = UR_STICKY;
+ theRow1 = oldRow1;
+ theRow2 = oldRow2;
+ }
}
if ( nDz && (theCol1 >= nCol1) && (theCol2 <= nCol2) &&
(theRow1 >= nRow1) && (theRow2 <= nRow2) )
@@ -274,19 +284,31 @@ ScRefUpdateRes ScRefUpdate::Update( ScDocument* pDoc, UpdateRefMode eUpdateRefMo
if ((theCol1 >= nCol1-nDx) && (theRow1 >= nRow1-nDy) && (theTab1 >= nTab1-nDz) &&
(theCol2 <= nCol2-nDx) && (theRow2 <= nRow2-nDy) && (theTab2 <= nTab2-nDz))
{
- if ( nDx && !(theCol1 == 0 && theCol2 == MAXCOL) )
+ if ( nDx )
{
bCut1 = lcl_MoveItCut( theCol1, nDx, MAXCOL );
bCut2 = lcl_MoveItCut( theCol2, nDx, MAXCOL );
if ( bCut1 || bCut2 )
eRet = UR_UPDATED;
+ if (eRet != UR_NOTHING && oldCol1 == 0 && oldCol2 == MAXCOL)
+ {
+ eRet = UR_STICKY;
+ theCol1 = oldCol1;
+ theCol2 = oldCol2;
+ }
}
- if ( nDy && !(theRow1 == 0 && theRow2 == MAXROW) )
+ if ( nDy )
{
bCut1 = lcl_MoveItCut( theRow1, nDy, MAXROW );
bCut2 = lcl_MoveItCut( theRow2, nDy, MAXROW );
if ( bCut1 || bCut2 )
eRet = UR_UPDATED;
+ if (eRet != UR_NOTHING && oldRow1 == 0 && oldRow2 == MAXROW)
+ {
+ eRet = UR_STICKY;
+ theRow1 = oldRow1;
+ theRow2 = oldRow2;
+ }
}
if ( nDz )
{
More information about the Libreoffice-commits
mailing list