sc/source/core/data/column3.cxx  |   34 +++++++++++++++++++++-------------
 sc/source/core/data/dpoutput.cxx |    5 +++++
 2 files changed, 26 insertions(+), 13 deletions(-)

New commits:
commit 41e92ab2b7a8fcb7f5738f656bdac47bc0847f29
Author: Kohei Yoshida <kohei.yosh...@suse.com>
Date:   Thu Jan 26 15:47:52 2012 -0500

    fdo#44143: Keep cells with broadcasters alive during deletion.
    
    Or else it would partially break formula reference chain.

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 73c0bbb..9a96323 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -35,6 +35,7 @@
 #include <sfx2/objsh.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
+#include <svl/broadcast.hxx>
 
 #include "scitems.hxx"
 #include "column.hxx"
@@ -404,14 +405,25 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE 
nEndIndex, sal_uInt16 nDe
             if (bDelete)
             {
                 // try to create a replacement note cell, if note or 
broadcaster exists
-                ScNoteCell* pNoteCell = 0;
-                if (eCellType != CELLTYPE_NOTE)
+                ScNoteCell* pNoteCell = NULL;
+                SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
+                bool bKeepBC = pBC && pBC->HasListeners();
+                if (eCellType == CELLTYPE_NOTE)
+                {
+                    if (bKeepBC)
+                    {
+                        // We need to keep this "note" cell to keep the 
broadcaster.
+                        pNoteCell = static_cast<ScNoteCell*>(pOldCell);
+                        if (bDeleteNote)
+                            pOldCell->DeleteNote();
+                    }
+                }
+                else
                 {
                     // do not rescue note if it has to be deleted according to 
passed flags
                     ScPostIt* pNote = bDeleteNote ? 0 : 
pOldCell->ReleaseNote();
                     // #i99844# do not release broadcaster from old cell, it 
still has to notify deleted content
-                    SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
-                    if( pNote || pBC )
+                    if (pNote || bKeepBC)
                         pNoteCell = new ScNoteCell( pNote, pBC );
                 }
 
@@ -437,9 +449,12 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE 
nEndIndex, sal_uInt16 nDe
                     aHint.GetAddress().SetRow( nOldRow );
                     aHint.SetCell( pOldCell );
                     pDocument->Broadcast( aHint );
-                    // #i99844# after broadcasting, old cell has to forget the 
broadcaster (owned by pNoteCell)
-                    pOldCell->ReleaseBroadcaster();
-                    pOldCell->Delete();
+                    if (pNoteCell != pOldCell)
+                    {
+                        // #i99844# after broadcasting, old cell has to forget 
the broadcaster (owned by pNoteCell)
+                        pOldCell->ReleaseBroadcaster();
+                        pOldCell->Delete();
+                    }
                 }
             }
             else
commit ded70d46dceae53fed54888172a135cb2adc80de
Author: Eike Rathke <er...@redhat.com>
Date:   Fri Jan 27 13:44:30 2012 +0100

    Revert "fdo#44143: Keep cells with broadcasters alive during deletion."
    
    This reverts commit af70bc00c6714eb8695babdf5af07416552f7034.
    
    To be replaced by a better solution.

diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 8bd0a45..73c0bbb 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -35,7 +35,6 @@
 #include <sfx2/objsh.hxx>
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
-#include <svl/broadcast.hxx>
 
 #include "scitems.hxx"
 #include "column.hxx"
@@ -415,12 +414,6 @@ void ScColumn::DeleteRange( SCSIZE nStartIndex, SCSIZE 
nEndIndex, sal_uInt16 nDe
                     if( pNote || pBC )
                         pNoteCell = new ScNoteCell( pNote, pBC );
                 }
-                else
-                {
-                    SvtBroadcaster* pBC = pOldCell->GetBroadcaster();
-                    if (pBC && pBC->HasListeners())
-                        pNoteCell = new ScNoteCell(pOldCell->ReleaseNote(), 
pBC);
-                }
 
                 // remove cell entry in cell item list
                 SCROW nOldRow = maItems[nIdx].nRow;
diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx
index ccec280..32179e3 100644
--- a/sc/source/core/data/dpoutput.cxx
+++ b/sc/source/core/data/dpoutput.cxx
@@ -973,6 +973,11 @@ void ScDPOutput::Output()
     if ( bSizeOverflow || bResultsError )   // does output area exceed sheet 
limits?
         return;                             // nothing
 
+    //  clear whole (new) output area
+    //! when modifying table, clear old area
+    //! include IDF_OBJECTS ???
+    pDoc->DeleteAreaTab( aStartPos.Col(), aStartPos.Row(), nTabEndCol, 
nTabEndRow, nTab, IDF_ALL );
+
     if ( bDoFilter )
         lcl_DoFilterButton( pDoc, aStartPos.Col(), aStartPos.Row(), nTab );
 
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to