summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sc/inc/document.hxx2
-rw-r--r--sc/inc/drwlayer.hxx2
-rw-r--r--sc/source/core/data/documen9.cxx4
-rw-r--r--sc/source/core/data/drwlayer.cxx19
-rw-r--r--sc/source/ui/docshell/docfunc.cxx17
-rw-r--r--sc/source/ui/view/viewfunc.cxx11
6 files changed, 44 insertions, 11 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index dff46dffd699..be7630b13461 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1469,7 +1469,7 @@ public:
bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = nullptr );
void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- const ScMarkData& rMark );
+ const ScMarkData& rMark, bool bAnchored = false );
void DeleteObjectsInSelection( const ScMarkData& rMark );
void DeleteArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark,
diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx
index 48741497ac0e..1713d3b94120 100644
--- a/sc/inc/drwlayer.hxx
+++ b/sc/inc/drwlayer.hxx
@@ -143,7 +143,7 @@ public:
bool HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow );
void DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
- SCCOL nCol2,SCROW nRow2 );
+ SCCOL nCol2,SCROW nRow2, bool bAnchored = false );
void DeleteObjectsInSelection( const ScMarkData& rMark );
void CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rectangle& rRange );
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 5433142df41a..179b54eae0f3 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -260,7 +260,7 @@ bool ScDocument::DrawGetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer )
}
void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
- const ScMarkData& rMark )
+ const ScMarkData& rMark, bool bAnchored)
{
if (!mpDrawLayer)
return;
@@ -269,7 +269,7 @@ void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR
ScMarkData::const_iterator itr = rMark.begin(), itrEnd = rMark.end();
for (; itr != itrEnd && *itr < nTabCount; ++itr)
if (maTabs[*itr])
- mpDrawLayer->DeleteObjectsInArea( *itr, nCol1, nRow1, nCol2, nRow2 );
+ mpDrawLayer->DeleteObjectsInArea( *itr, nCol1, nRow1, nCol2, nRow2, bAnchored);
}
void ScDocument::DeleteObjectsInSelection( const ScMarkData& rMark )
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 8739d3b195c0..7dc7c6a4e62c 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1359,7 +1359,7 @@ bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
}
void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
- SCCOL nCol2,SCROW nRow2 )
+ SCCOL nCol2,SCROW nRow2, bool bAnchored )
{
OSL_ENSURE( pDoc, "ScDrawLayer::DeleteObjectsInArea without document" );
if ( !pDoc )
@@ -1389,8 +1389,17 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
if (!IsNoteCaption( pObject ))
{
tools::Rectangle aObjRect = pObject->GetCurrentBoundRect();
- if ( aDelRect.IsInside( aObjRect ) )
- ppObj[nDelCount++] = pObject;
+ if (aDelRect.IsInside(aObjRect))
+ {
+ if (bAnchored)
+ {
+ ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObject);
+ if(aAnchorType == SCA_CELL || aAnchorType == SCA_CELL_RESIZE)
+ ppObj[nDelCount++] = pObject;
+ }
+ else
+ ppObj[nDelCount++] = pObject;
+ }
}
pObject = aIter.Next();
@@ -1447,8 +1456,8 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
{
tools::Rectangle aObjRect = pObject->GetCurrentBoundRect();
ScRange aRange = pDoc->GetRange(nTab, aObjRect);
- bool bObjectInMarkArea
- = aMarkBound.IsInside(aObjRect) && rMark.IsAllMarked(aRange);
+ bool bObjectInMarkArea =
+ aMarkBound.IsInside(aObjRect) && rMark.IsAllMarked(aRange);
const ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObject);
ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObject);
bool bObjectAnchoredToMarkedCell
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 518410f25f47..76bdf089c85d 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -2487,6 +2487,23 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
rDocShell.UpdatePaintExt( nExtFlags, nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr );
}
+ switch (eCmd)
+ {
+ case DelCellCmd::CellsUp:
+ case DelCellCmd::CellsLeft:
+ rDoc.DeleteObjectsInArea(nStartCol, nStartRow, nEndCol, nEndRow, aMark, true);
+ break;
+ case DelCellCmd::Rows:
+ rDoc.DeleteObjectsInArea(0, nStartRow, MAXCOL, nEndRow, aMark, true);
+ break;
+ case DelCellCmd::Cols:
+ rDoc.DeleteObjectsInArea(nStartCol, 0, nEndCol, MAXROW, aMark, true);
+ break;
+ default:
+ break;
+ }
+
+
bool bUndoOutline = false;
switch (eCmd)
{
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 6fdad679cb30..50fd5ed32d87 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1840,15 +1840,22 @@ void ScViewFunc::DeleteMulti( bool bRows )
}
std::vector<sc::ColRowSpan>::const_reverse_iterator ri = aSpans.rbegin(), riEnd = aSpans.rend();
+ aFuncMark.SelectOneTable(nTab);
for (; ri != riEnd; ++ri)
{
SCCOLROW nEnd = ri->mnEnd;
SCCOLROW nStart = ri->mnStart;
if (bRows)
- rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, nStart, static_cast<SCSIZE>(nEnd-nStart+1) );
+ {
+ rDoc.DeleteObjectsInArea(0, nStart, MAXCOL, nEnd, aFuncMark, true);
+ rDoc.DeleteRow(0, nTab, MAXCOL, nTab, nStart, static_cast<SCSIZE>(nEnd - nStart + 1));
+ }
else
- rDoc.DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) );
+ {
+ rDoc.DeleteObjectsInArea(nStart, 0, nEnd, MAXROW, aFuncMark, true);
+ rDoc.DeleteCol(0, nTab, MAXROW, nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd - nStart + 1));
+ }
}
if (bNeedRefresh)