summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/cell.hxx14
-rw-r--r--sc/inc/column.hxx6
-rw-r--r--sc/inc/table.hxx6
-rw-r--r--sc/inc/token.hxx9
-rw-r--r--sc/source/core/data/cell.cxx40
-rw-r--r--sc/source/core/data/cell2.cxx26
-rw-r--r--sc/source/core/data/column3.cxx12
-rw-r--r--sc/source/core/data/document.cxx20
-rw-r--r--sc/source/core/data/table2.cxx8
-rw-r--r--sc/source/core/tool/token.cxx25
10 files changed, 116 insertions, 50 deletions
diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 2e51d8085ecc..3124ec797e83 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cell.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: er $ $Date: 2001-10-12 12:31:07 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:56:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -92,6 +92,11 @@
// set (in nScriptType) if type has not been determined yet
#define SC_SCRIPTTYPE_UNKNOWN 0x08
+// For StartListeningTo()/EndListeningTo() restricted to absolute/relative names
+#define SC_LISTENING_NAMES_REL 0x01
+#define SC_LISTENING_NAMES_ABS 0x02
+#define SC_LISTENING_EXCEPT 0x04
+
class ScDocument;
class EditTextObject;
class ScMatrix;
@@ -146,10 +151,11 @@ public:
// String- oder EditCell
static ScBaseCell* CreateTextCell( const String& rString, ScDocument* );
+ // nOnlyNames may be one or more of SC_LISTENING_NAMES_*
void StartListeningTo( ScDocument* pDoc,
- BOOL bOnlyRelNames = FALSE );
+ USHORT nOnlyNames = 0 );
void EndListeningTo( ScDocument* pDoc,
- BOOL bOnlyRelNames = FALSE,
+ USHORT nOnlyNames = 0,
ScTokenArray* pArr = NULL,
ScAddress aPos = ScAddress() );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 541a2dd3fe75..dce1559031d1 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: column.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: er $ $Date: 2001-02-13 18:51:12 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:56:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -417,7 +417,7 @@ public:
void EndListening( SfxListener& rLst, USHORT nRow );
void MoveListeners( ScBroadcasterList& rSource, USHORT nDestRow );
void StartAllListeners();
- void StartRelNameListeners();
+ void StartNameListeners( BOOL bOnlyRelNames );
void SetRelNameDirty();
void CompileDBFormula();
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index f181d4a108bb..249687b66380 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table.hxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: er $ $Date: 2001-09-05 09:41:14 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:56:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -692,7 +692,7 @@ private:
void StartListening( const ScAddress& rAddress, SfxListener* pListener );
void EndListening( const ScAddress& rAddress, SfxListener* pListener );
void StartAllListeners();
- void StartRelNameListeners();
+ void StartNameListeners( BOOL bOnlyRelNames );
void SetRelNameDirty();
USHORT FillMaxRot( RowInfo* pRowInfo, USHORT nArrCount, USHORT nX1, USHORT nX2,
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index bc3ed8d8dc40..21fa5388e3f0 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: token.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: er $ $Date: 2001-10-12 12:31:07 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:56:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,6 +171,11 @@ public:
BOOL TextEqual( const ScToken& rToken ) const;
BOOL Is3DRef() const; // reference with 3D flag set
+ // If token in RPN resulted from resolving a name and contains an absolute
+ // reference. Token must be obtained through ScTokenArray::GetNextReferenceRPN()
+ // or similar.
+ BOOL IsRPNReferenceAbsName() const;
+
static size_t GetStrLenBytes( xub_StrLen nLen )
{ return nLen * sizeof(sal_Unicode); }
static size_t GetStrLenBytes( const String& rStr )
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 34d44aeaf173..2ea2e6530db5 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cell.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: er $ $Date: 2001-10-12 12:31:57 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:59:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -243,7 +243,7 @@ void ScBaseCell::SetBroadcaster(ScBroadcasterList* pNew)
pBroadcaster = pNew;
}
-void ScBaseCell::StartListeningTo( ScDocument* pDoc, BOOL bOnlyRelNames )
+void ScBaseCell::StartListeningTo( ScDocument* pDoc, USHORT nOnlyNames )
{
if ( eCellType == CELLTYPE_FORMULA && !pDoc->IsClipOrUndo()
&& !pDoc->GetNoListening()
@@ -266,8 +266,20 @@ void ScBaseCell::StartListeningTo( ScDocument* pDoc, BOOL bOnlyRelNames )
SingleRefData& rRef1 = t->GetSingleRef();
SingleRefData& rRef2 = (eType == svDoubleRef ?
t->GetDoubleRef().Ref2 : rRef1);
- if ( !bOnlyRelNames || (bOnlyRelNames
- && (rRef1.IsRelName() || rRef2.IsRelName())))
+ BOOL bDo;
+ if ( !nOnlyNames )
+ bDo = TRUE;
+ else
+ {
+ bDo = FALSE;
+ if ( nOnlyNames & SC_LISTENING_NAMES_REL )
+ bDo |= (rRef1.IsRelName() || rRef2.IsRelName());
+ if ( nOnlyNames & SC_LISTENING_NAMES_ABS )
+ bDo |= t->IsRPNReferenceAbsName();
+ if ( nOnlyNames & SC_LISTENING_EXCEPT )
+ bDo = !bDo;
+ }
+ if ( bDo )
{
switch( eType )
{
@@ -330,7 +342,7 @@ void ScBaseCell::StartListeningTo( ScDocument* pDoc, BOOL bOnlyRelNames )
// pArr gesetzt -> Referenzen von anderer Zelle nehmen
// dann muss auch aPos uebergeben werden!
-void ScBaseCell::EndListeningTo( ScDocument* pDoc, BOOL bOnlyRelNames,
+void ScBaseCell::EndListeningTo( ScDocument* pDoc, USHORT nOnlyNames,
ScTokenArray* pArr, ScAddress aPos )
{
if ( eCellType == CELLTYPE_FORMULA && !pDoc->IsClipOrUndo()
@@ -357,8 +369,20 @@ void ScBaseCell::EndListeningTo( ScDocument* pDoc, BOOL bOnlyRelNames,
SingleRefData& rRef1 = t->GetSingleRef();
SingleRefData& rRef2 = (eType == svDoubleRef ?
t->GetDoubleRef().Ref2 : rRef1);
- if ( !bOnlyRelNames || (bOnlyRelNames
- && (rRef1.IsRelName() || rRef2.IsRelName())))
+ BOOL bDo;
+ if ( !nOnlyNames )
+ bDo = TRUE;
+ else
+ {
+ bDo = FALSE;
+ if ( nOnlyNames & SC_LISTENING_NAMES_REL )
+ bDo |= (rRef1.IsRelName() || rRef2.IsRelName());
+ if ( nOnlyNames & SC_LISTENING_NAMES_ABS )
+ bDo |= t->IsRPNReferenceAbsName();
+ if ( nOnlyNames & SC_LISTENING_EXCEPT )
+ bDo = !bDo;
+ }
+ if ( bDo )
{
switch( t->GetType() )
{
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index d6ed6caceff8..2181b7a1aba6 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cell2.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: er $ $Date: 2001-10-08 18:40:50 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:59:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -858,9 +858,9 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
bHasRelName = HasRelNameReference();
bNewRelName = (bHasRelName && eUpdateRefMode != URM_COPY);
if ( bNewListening )
- EndListeningTo( pDocument, FALSE, pOld, aOldPos );
+ EndListeningTo( pDocument, 0, pOld, aOldPos );
else if ( bNewRelName )
- EndListeningTo( pDocument, TRUE, pOld, aOldPos );
+ EndListeningTo( pDocument, SC_LISTENING_NAMES_REL, pOld, aOldPos );
// RelNameRefs werden immer mitverschoben
}
else
@@ -908,13 +908,21 @@ void ScFormulaCell::UpdateReference(UpdateRefMode eUpdateRefMode,
bNeedDirty = TRUE;
}
if ( !bInDeleteUndo )
- { // bei ChangeTrack Delete-Reject werden in InsertCol/Row die
- // Listener neu aufgesezt
+ { // In ChangeTrack Delete-Reject listeners are established in
+ // InsertCol/InsertRow
if ( bNewListening )
- StartListeningTo( pDocument );
+ {
+ if ( eUpdateRefMode == URM_INSDEL && !bIsInsert )
+ StartListeningTo( pDocument, SC_LISTENING_EXCEPT |
+ SC_LISTENING_NAMES_ABS | SC_LISTENING_NAMES_REL );
+ // Deletes establish listeners on names _after_
+ // UpdateReference and the following Delete
+ else
+ StartListeningTo( pDocument, 0 );
+ }
else if ( bNewRelName && eUpdateRefMode != URM_INSDEL )
- StartListeningTo( pDocument, TRUE );
- // bei Insert/Delete RelNameListening/SetDirty erst spaeter
+ StartListeningTo( pDocument, SC_LISTENING_NAMES_REL );
+ // Insert/Delete RelNameListening/SetDirty follows later
}
if ( bNeedDirty && (!(eUpdateRefMode == URM_INSDEL && bHasRelName) || pRangeData) )
{ // Referenzen abgeschnitten, ungueltig o.ae.?
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index c5b439b1f6f6..ad5a7e6ad1b2 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: column3.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: er $ $Date: 2001-03-14 18:05:33 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:59:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1097,20 +1097,24 @@ void ScColumn::StartAllListeners()
}
-void ScColumn::StartRelNameListeners()
+void ScColumn::StartNameListeners( BOOL bOnlyRelNames )
{
if (pItems)
+ {
+ USHORT nNameListening = (bOnlyRelNames ? SC_LISTENING_NAMES_REL :
+ SC_LISTENING_NAMES_REL | SC_LISTENING_NAMES_ABS);
for (USHORT i = 0; i < nCount; i++)
{
ScBaseCell* pCell = pItems[i].pCell;
if ( pCell->GetCellType() == CELLTYPE_FORMULA )
{
USHORT nRow = pItems[i].nRow;
- ((ScFormulaCell*)pCell)->StartListeningTo( pDocument, TRUE );
+ ((ScFormulaCell*)pCell)->StartListeningTo( pDocument, nNameListening );
if ( nRow != pItems[i].nRow )
Search( nRow, i ); // Listener eingefuegt?
}
}
+ }
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 188f0b8ebed7..92bcad6578bb 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
- * $Revision: 1.33 $
+ * $Revision: 1.34 $
*
- * last change: $Author: sab $ $Date: 2001-09-27 10:30:12 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:59:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -618,10 +618,10 @@ BOOL ScDocument::InsertRow( USHORT nStartCol, USHORT nStartTab,
StartAllListeners();
}
else
- { // RelNames wurden in UpdateReference abgehaengt
+ { // RelName listeners have been removed in UpdateReference
for (i=nStartTab; i<=nEndTab; i++)
if (pTab[i])
- pTab[i]->StartRelNameListeners();
+ pTab[i]->StartNameListeners( TRUE );
// #69592# at least all cells using range names pointing relative to the moved range must recalculate
for (i=0; i<=MAXTAB; i++)
if (pTab[i])
@@ -684,10 +684,10 @@ void ScDocument::DeleteRow( USHORT nStartCol, USHORT nStartTab,
pTab[i]->DeleteRow( nStartCol, nEndCol, nStartRow, nSize, pUndoOutline );
if ( nStartRow+nSize <= MAXROW )
- { // RelNames wurden in UpdateReference abgehaengt
+ { // Name listeners have been removed in UpdateReference
for (i=nStartTab; i<=nEndTab; i++)
if (pTab[i])
- pTab[i]->StartRelNameListeners();
+ pTab[i]->StartNameListeners( FALSE );
// #69592# at least all cells using range names pointing relative to the moved range must recalculate
for (i=0; i<=MAXTAB; i++)
if (pTab[i])
@@ -763,10 +763,10 @@ BOOL ScDocument::InsertCol( USHORT nStartRow, USHORT nStartTab,
StartAllListeners();
}
else
- { // RelNames wurden in UpdateReference abgehaengt
+ { // RelName listeners have been removed in UpdateReference
for (i=nStartTab; i<=nEndTab; i++)
if (pTab[i])
- pTab[i]->StartRelNameListeners();
+ pTab[i]->StartNameListeners( TRUE );
// #69592# at least all cells using range names pointing relative to the moved range must recalculate
for (i=0; i<=MAXTAB; i++)
if (pTab[i])
@@ -828,10 +828,10 @@ void ScDocument::DeleteCol(USHORT nStartRow, USHORT nStartTab, USHORT nEndRow, U
pTab[i]->DeleteCol( nStartCol, nStartRow, nEndRow, nSize, pUndoOutline );
if ( nStartCol+nSize <= MAXCOL )
- { // RelNames wurden in UpdateReference abgehaengt
+ { // Name listeners have been removed in UpdateReference
for (i=nStartTab; i<=nEndTab; i++)
if (pTab[i])
- pTab[i]->StartRelNameListeners();
+ pTab[i]->StartNameListeners( FALSE );
// #69592# at least all cells using range names pointing relative to the moved range must recalculate
for (i=0; i<=MAXTAB; i++)
if (pTab[i])
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c5d01ae10427..385490dc41b2 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: table2.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: er $ $Date: 2001-08-06 10:13:30 $
+ * last change: $Author: er $ $Date: 2001-10-18 08:59:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -600,10 +600,10 @@ void ScTable::StartAllListeners()
}
-void ScTable::StartRelNameListeners()
+void ScTable::StartNameListeners( BOOL bOnlyRelNames )
{
for (USHORT i=0; i<=MAXCOL; i++)
- aCol[i].StartRelNameListeners();
+ aCol[i].StartNameListeners( bOnlyRelNames );
}
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index 7083b25c79b8..4bed49433c83 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: token.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: er $ $Date: 2001-10-12 12:32:37 $
+ * last change: $Author: er $ $Date: 2001-10-18 09:03:25 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -568,7 +568,26 @@ BOOL ScToken::Is3DRef() const
}
-// virtual dummy methods
+BOOL ScToken::IsRPNReferenceAbsName() const
+{
+ if ( GetRef() == 1 && GetOpCode() == ocPush )
+ { // only in RPN and not ocColRowNameAuto or similar
+ switch ( GetType() )
+ {
+ case svDoubleRef :
+ if ( !GetSingleRef2().IsRelName() )
+ return TRUE;
+ //! fallthru
+ case svSingleRef :
+ if ( !GetSingleRef().IsRelName() )
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+
+// --- virtual dummy methods -------------------------------------------------
BYTE ScToken::GetByte() const
{