diff options
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/inc/drwlayer.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/documen9.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 19 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/view/viewfunc.cxx | 11 |
6 files changed, 44 insertions, 11 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index d36db2e6fef4..dd59a74c44e4 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1512,7 +1512,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 143868c0e6ce..9f8268be03b8 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 d5146ed509ad..d873b820c31f 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -248,7 +248,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; @@ -259,7 +259,7 @@ void ScDocument::DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCR if (rTab >= nTabCount) break; if (maTabs[rTab]) - mpDrawLayer->DeleteObjectsInArea( rTab, nCol1, nRow1, nCol2, nRow2 ); + mpDrawLayer->DeleteObjectsInArea( rTab, nCol1, nRow1, nCol2, nRow2, bAnchored); } } diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 90f92296534c..f27af11fc71a 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1360,7 +1360,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 ) @@ -1390,8 +1390,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(); @@ -1449,8 +1458,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 d8c475bc2bc0..1df41fa5903c 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -2492,6 +2492,23 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, rDocShell.UpdatePaintExt( nExtFlags, nStartCol, nStartRow, rTab, nEndCol, nEndRow, rTab ); } + 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 991e3637480f..ec73df529d72 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1838,15 +1838,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) |