diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-07-29 16:18:05 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-07-29 17:21:32 -0400 |
commit | 7b13c6d96407b7f4c0c578693bd3b9629015489c (patch) | |
tree | 6714a734434f5533c95bc015d78471de8d4560fd /sc | |
parent | dbe2da93340cb0b693f49afc93812199a39bb118 (diff) |
Bring this logic from ScViewFaunc::DeleteContents to ScDocFunc's.
To make the bug reported in fdo#80846 reproducible.
Change-Id: Iec400f26c6c6af9ae3bd0afd4fce75939ab1e23d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index adce8084a87b..d41caeeffeb9 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -628,6 +628,9 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags, aMultiMark ); } + // To keep track of all non-empty cells within the deleted area. + boost::shared_ptr<ScSimpleUndo::DataSpansType> pDataSpans; + if ( bRecord ) { pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); @@ -645,6 +648,27 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags, // note captions are handled in drawing undo nUndoDocFlags |= IDF_NOCAPTIONS; rDoc.CopyToDocument( aExtendedRange, nUndoDocFlags, bMulti, pUndoDoc, &aMultiMark ); + + pDataSpans.reset(new ScSimpleUndo::DataSpansType); + + ScMarkData::iterator it = aMultiMark.begin(), itEnd = aMultiMark.end(); + for (; it != itEnd; ++it) + { + SCTAB nTab = *it; + + SCCOL nCol1 = aMarkRange.aStart.Col(), nCol2 = aMarkRange.aEnd.Col(); + SCROW nRow1 = aMarkRange.aStart.Row(), nRow2 = aMarkRange.aEnd.Row(); + + std::pair<ScSimpleUndo::DataSpansType::iterator,bool> r = + pDataSpans->insert(nTab, new sc::ColumnSpanSet(false)); + + if (r.second) + { + ScSimpleUndo::DataSpansType::iterator it2 = r.first; + sc::ColumnSpanSet* pSet = it2->second; + pSet->scan(rDoc, nTab, nCol1, nRow1, nCol2, nRow2, true); + } + } } //! HideAllCursors(); // falls Zusammenfassung aufgehoben wird @@ -652,9 +676,13 @@ bool ScDocFunc::DeleteContents( const ScMarkData& rMark, sal_uInt16 nFlags, // add undo action after drawing undo is complete (objects and note captions) if( bRecord ) - rDocShell.GetUndoManager()->AddUndoAction( - new ScUndoDeleteContents( &rDocShell, aMultiMark, aExtendedRange, - pUndoDoc, bMulti, nFlags, bDrawUndo ) ); + { + ScUndoDeleteContents* pUndo = + new ScUndoDeleteContents( + &rDocShell, aMultiMark, aExtendedRange, pUndoDoc, bMulti, nFlags, bDrawUndo); + rDocShell.GetUndoManager()->AddUndoAction(pUndo); + pUndo->SetDataSpans(pDataSpans); + } if (!AdjustRowHeight( aExtendedRange )) rDocShell.PostPaint( aExtendedRange, PAINT_GRID, nExtFlags ); |