diff options
-rw-r--r-- | sc/inc/column.hxx | 11 | ||||
-rw-r--r-- | sc/inc/document.hxx | 5 | ||||
-rw-r--r-- | sc/inc/drwlayer.hxx | 3 | ||||
-rw-r--r-- | sc/inc/table.hxx | 6 | ||||
-rw-r--r-- | sc/source/core/data/column.cxx | 59 | ||||
-rw-r--r-- | sc/source/core/data/column2.cxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/column4.cxx | 16 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 23 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 2 |
12 files changed, 180 insertions, 19 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index ff65fbc3b3a0..67dbda8dc8dd 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -29,6 +29,7 @@ #include "mtvelements.hxx" #include <formula/types.hxx> #include <svl/zforlist.hxx> +#include <svx/svdobj.hxx> #include "attarray.hxx" #include <set> @@ -226,11 +227,13 @@ public: // data only: bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; - bool HasDataAt(SCROW nRow) const; + bool HasDataAt(SCROW nRow, bool bConsiderCellNotes=false, + bool bConsiderCellDrawObjects=false) const; bool HasVisibleDataAt(SCROW nRow) const; SCROW GetFirstDataPos() const; SCROW GetLastDataPos() const; - SCROW GetLastDataPos( SCROW nLastRow ) const; + SCROW GetLastDataPos( SCROW nLastRow, bool bConsiderCellNotes=false, + bool bConsiderCellDrawObjects=false ) const; bool GetPrevDataPos(SCROW& rRow) const; bool GetNextDataPos(SCROW& rRow) const; void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster) @@ -626,6 +629,10 @@ public: void UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 ); + void UpdateDrawObjects( std::vector<std::vector<SdrObject*>>& pObjects, SCROW nRowStart, SCROW nRowEnd ); + void UpdateDrawObjectsForRow( std::vector<SdrObject*>& pObjects, SCCOL nTargetCol, SCROW nTargetRow ); + bool IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; + void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ); static void JoinNewFormulaCell( const sc::CellStoreType::position_type& aPos, ScFormulaCell& rCell ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index d8dfb21dc05b..d8a47d600e19 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1311,6 +1311,8 @@ public: If TRUE, do not adjust the left column. @param bConsiderCellNotes If TRUE, consider the presence of cell notes besides data. + @param bConsiderCellDrawObjects + If TRUE, consider the presence of draw objects anchored to the cell. @returns true if there is any data, false if not. */ @@ -1318,7 +1320,8 @@ public: SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, bool bStickyTopRow = false, bool bStickyLeftCol = false, - bool bConsiderCellNotes = false ) const; + bool bConsiderCellNotes = false, + bool bConsiderCellDrawObjects = false ) const; /** * Return the last non-empty row position in given columns that's no diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 3da85abe939a..8f33dbebf721 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -104,7 +104,6 @@ private: void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, SCCOL nDx,SCROW nDy, bool bUpdateNoteCaptionPos ); - void RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ); void ResizeLastRectFromAnchor( const SdrObject* pObj, ScDrawObjData& rData, bool bUseLogicRect, bool bNegativePage, bool bCanResize, bool bHiddenAsZero = true ); public: @@ -141,6 +140,7 @@ public: void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, SCCOL nDx,SCROW nDy, bool bInsDel, bool bUpdateNoteCaptionPos ); + void RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ); bool HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow ); @@ -182,6 +182,7 @@ public: static void SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab ); static void UpdateCellAnchorFromPositionEnd( const SdrObject &rObj, ScDrawObjData &rAnchor, const ScDocument &rDoc, SCTAB nTab, bool bUseLogicRect = true ); static ScAnchorType GetAnchorType( const SdrObject& ); + std::vector<SdrObject*> GetObjectsAnchoredToCell(const ScAddress& rPos); // positions for detektive lines static ScDrawObjData* GetObjData( SdrObject* pObj, bool bCreate=false ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 8f84fd475782..ac1b6f406fca 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -578,9 +578,11 @@ public: bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, - bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes ) const; + bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes, + bool bConsiderCellDrawObjects ) const; - SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const; + SCROW GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow, + bool bConsiderCellNotes = false, bool bConsiderCellDrawObjects = false ) const; SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ) const; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 16e2dd089d20..a9b074458af8 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -46,6 +46,8 @@ #include <refhint.hxx> #include <stlalgorithm.hxx> #include <formulagroup.hxx> +#include <userdat.hxx> +#include <drwlayer.hxx> #include <svl/poolcach.hxx> #include <svl/zforlist.hxx> @@ -1892,6 +1894,63 @@ void ScColumn::UpdateNoteCaptions( SCROW nRow1, SCROW nRow2 ) sc::ProcessNote(maCellNotes.begin(), maCellNotes, nRow1, nRow2, aFunc); } +void ScColumn::UpdateDrawObjects(std::vector<std::vector<SdrObject*>>& pObjects, SCROW nRowStart, SCROW nRowEnd) +{ + int nObj = 0; + for (SCROW nCurrentRow = nRowStart; nCurrentRow <= nRowEnd; nCurrentRow++, nObj++) + { + if (pObjects[nObj].empty()) + continue; // No draw objects in this row + + UpdateDrawObjectsForRow(pObjects[nObj], nCol, nCurrentRow); + } +} + +void ScColumn::UpdateDrawObjectsForRow( std::vector<SdrObject*>& pObjects, SCCOL nTargetCol, SCROW nTargetRow ) +{ + for (auto &pObject : pObjects) + { + // Get anchor data + ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObject, false); + if (!pObjData) + continue; + const ScAddress aOldStart = pObjData->maStart; + const ScAddress aOldEnd = pObjData->maEnd; + + // Set start address + ScAddress aNewStart = ScAddress(nTargetCol, nTargetRow, nTab); + pObjData->maStart = aNewStart; + + // Set end address + const SCCOL nObjectColSpan = aOldEnd.Col() - aOldStart.Col(); + const SCROW nObjectRowSpan = aOldEnd.Row() - aOldStart.Row(); + ScAddress aNewEnd = aNewStart; + aNewEnd.IncRow(nObjectRowSpan); + aNewEnd.IncCol(nObjectColSpan); + pObjData->maEnd = aNewEnd; + + // Update draw object according to new anchor + ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer(); + if (pDrawLayer) + pDrawLayer->RecalcPos(pObject, *pObjData, false, false); + } +} + +bool ScColumn::IsDrawObjectsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const +{ + ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer(); + if (!pDrawLayer) + return true; + + for (SCROW nCurrentRow = nStartRow; nCurrentRow <= nEndRow; nCurrentRow++) + { + ScAddress aCell(nCol, nCurrentRow, nTab); + if (!pDrawLayer->GetObjectsAnchoredToCell(aCell).empty()) + return false; + } + return true; +} + void ScColumn::SwapCol(ScColumn& rCol) { maBroadcasters.swap(rCol.maBroadcasters); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index f381e01d7c39..75da42621238 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -1303,9 +1303,17 @@ SCROW ScColumn::GetLastDataPos() const return MAXROW - static_cast<SCROW>(it->size); } -SCROW ScColumn::GetLastDataPos( SCROW nLastRow ) const +SCROW ScColumn::GetLastDataPos( SCROW nLastRow, bool bConsiderCellNotes, + bool bConsiderCellDrawObjects ) const { sc::CellStoreType::const_position_type aPos = maCells.position(nLastRow); + + if (bConsiderCellNotes && !IsNotesEmptyBlock(nLastRow, nLastRow)) + return nLastRow; + + if (bConsiderCellDrawObjects && !IsDrawObjectsEmptyBlock(nLastRow, nLastRow)) + return nLastRow; + if (aPos.first->type != sc::element_type_empty) return nLastRow; @@ -3015,8 +3023,14 @@ void ScColumn::FindDataAreaPos(SCROW& rRow, bool bDown) const rRow = nLastRow; } -bool ScColumn::HasDataAt(SCROW nRow) const +bool ScColumn::HasDataAt(SCROW nRow, bool bConsiderCellNotes, bool bConsiderCellDrawObjects) const { + if (bConsiderCellNotes && !IsNotesEmptyBlock(nRow, nRow)) + return true; + + if (bConsiderCellDrawObjects && !IsDrawObjectsEmptyBlock(nRow, nRow)) + return true; + return maCells.get_type(nRow) != sc::element_type_empty; } diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx index 61c46a0e49f0..a99a78564c7f 100644 --- a/sc/source/core/data/column4.cxx +++ b/sc/source/core/data/column4.cxx @@ -29,6 +29,7 @@ #include <scitems.hxx> #include <cellform.hxx> #include <sharedformula.hxx> +#include <drwlayer.hxx> #include <svl/sharedstringpool.hxx> #include <o3tl/make_unique.hxx> @@ -1097,6 +1098,21 @@ void ScColumn::Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern ) SetPattern(nRow, *pPat2); rOther.SetPattern(nRow, *pPat1); } + + // Update draw object anchors + ScDrawLayer* pDrawLayer = GetDoc()->GetDrawLayer(); + if (pDrawLayer) + { + ScAddress aThisCellPos(GetCol(), nRow, GetTab()); + ScAddress aOtherCellPos(rOther.GetCol(), nRow, GetTab()); + std::vector<SdrObject*> pThisColObjects = pDrawLayer->GetObjectsAnchoredToCell(aThisCellPos); + std::vector<SdrObject*> pOtherColObjects = pDrawLayer->GetObjectsAnchoredToCell(aOtherCellPos); + if (!pThisColObjects.empty()) + UpdateDrawObjectsForRow(pThisColObjects, rOther.GetCol(), nRow); + if (!pOtherColObjects.empty()) + rOther.UpdateDrawObjectsForRow(pOtherColObjects, GetCol(), nRow); + + } } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 46ddb669ad04..ea48500ad16b 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1104,7 +1104,8 @@ bool ScDocument::ShrinkToDataArea(SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow bool ScDocument::ShrinkToUsedDataArea( bool& o_bShrunk, SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, - bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes ) const + bool bStickyTopRow, bool bStickyLeftCol, bool bConsiderCellNotes, + bool bConsiderCellDrawObjects ) const { if (!ValidTab(nTab) || nTab >= static_cast<SCTAB> (maTabs.size()) || !maTabs[nTab]) { @@ -1112,7 +1113,7 @@ bool ScDocument::ShrinkToUsedDataArea( bool& o_bShrunk, SCTAB nTab, SCCOL& rStar return false; } return maTabs[nTab]->ShrinkToUsedDataArea( o_bShrunk, rStartCol, rStartRow, rEndCol, rEndRow, - bColumnsOnly, bStickyTopRow, bStickyLeftCol, bConsiderCellNotes ); + bColumnsOnly, bStickyTopRow, bStickyLeftCol, bConsiderCellNotes, bConsiderCellDrawObjects ); } SCROW ScDocument::GetLastDataRow( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index f4b94965aa97..3d5507bea459 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1994,6 +1994,29 @@ ScAnchorType ScDrawLayer::GetAnchorType( const SdrObject &rObj ) return ScDrawLayer::GetObjData(const_cast<SdrObject*>(&rObj)) ? SCA_CELL : SCA_PAGE; } +std::vector<SdrObject*> ScDrawLayer::GetObjectsAnchoredToCell(const ScAddress& rCell) +{ + SdrPage* pPage = GetPage(static_cast<sal_uInt16>(rCell.Tab())); + if (!pPage || pPage->GetObjCount() < 1) + return std::vector<SdrObject*>(); + + std::vector<SdrObject*> pObjects; + SdrObjListIter aIter( *pPage, SdrIterMode::Flat ); + SdrObject* pObject = aIter.Next(); + ScDrawObjData* pObjData; + while (pObject) + { + if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently + { + pObjData = GetObjData(pObject); + if (pObjData && pObjData->maStart == rCell) // Object is anchored to this cell + pObjects.push_back(pObject); + } + pObject = aIter.Next(); + } + return pObjects; +} + ScDrawObjData* ScDrawLayer::GetNonRotatedObjData( SdrObject* pObj, bool bCreate ) { sal_uInt16 nCount = pObj ? pObj->GetUserDataCount() : 0; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index d8be03909d21..428dbc41b081 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -925,7 +925,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly, bool bStickyTopRow, bool bStickyLeftCol, - bool bConsiderCellNotes ) const + bool bConsiderCellNotes, bool bConsiderCellDrawObjects ) const { rStartCol = std::min<SCCOL>( rStartCol, aCol.size()-1 ); // check for rEndCol is done below. @@ -961,6 +961,10 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS { if (bConsiderCellNotes && !aCol[rEndCol].IsNotesEmptyBlock( rStartRow, rEndRow )) break; + + if (bConsiderCellDrawObjects && !aCol[rEndCol].IsDrawObjectsEmptyBlock( rStartRow, rEndRow )) + break; + --rEndCol; o_bShrunk = true; } @@ -977,6 +981,9 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS if (bConsiderCellNotes && !aCol[rStartCol].IsNotesEmptyBlock( rStartRow, rEndRow )) break; + if (bConsiderCellDrawObjects && !aCol[rStartCol].IsDrawObjectsEmptyBlock( rStartRow, rEndRow )) + break; + ++rStartCol; o_bShrunk = true; } @@ -994,7 +1001,7 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS bool bFound = false; for (SCCOL i=rStartCol; i<=rEndCol && !bFound; i++) { - if (aCol[i].HasDataAt( rStartRow)) + if (aCol[i].HasDataAt( rStartRow, bConsiderCellNotes, bConsiderCellDrawObjects)) bFound = true; } if (!bFound) @@ -1009,7 +1016,8 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS while (rStartRow < rEndRow) { - SCROW nLastDataRow = GetLastDataRow( rStartCol, rEndCol, rEndRow); + SCROW nLastDataRow = GetLastDataRow( rStartCol, rEndCol, rEndRow, + bConsiderCellNotes, bConsiderCellDrawObjects); if (0 <= nLastDataRow && nLastDataRow < rEndRow) { rEndRow = std::max( rStartRow, nLastDataRow); @@ -1022,10 +1030,12 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS return rStartCol != rEndCol || (bColumnsOnly ? !aCol[rStartCol].IsEmptyBlock( rStartRow, rEndRow) : - (rStartRow != rEndRow || aCol[rStartCol].HasDataAt( rStartRow))); + (rStartRow != rEndRow || + aCol[rStartCol].HasDataAt( rStartRow, bConsiderCellNotes, bConsiderCellDrawObjects))); } -SCROW ScTable::GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const +SCROW ScTable::GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow, + bool bConsiderCellNotes, bool bConsiderCellDrawObjects ) const { if ( !IsColValid( nCol1 ) || !ValidCol( nCol2 ) ) return -1; @@ -1035,7 +1045,7 @@ SCROW ScTable::GetLastDataRow( SCCOL nCol1, SCCOL nCol2, SCROW nLastRow ) const SCROW nNewLastRow = 0; for (SCCOL i = nCol1; i <= nCol2; ++i) { - SCROW nThis = aCol[i].GetLastDataPos(nLastRow); + SCROW nThis = aCol[i].GetLastDataPos(nLastRow, bConsiderCellNotes, bConsiderCellDrawObjects); if (nNewLastRow < nThis) nNewLastRow = nThis; } diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 2f52aee82720..06c7b8919db4 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -22,6 +22,7 @@ #include <unotools/textsearch.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> +#include <svx/svdobj.hxx> #include <unotools/charclass.hxx> #include <unotools/collatorwrapper.hxx> #include <stdlib.h> @@ -63,6 +64,7 @@ #include <listenerquery.hxx> #include <bcaslot.hxx> #include <reordermap.hxx> +#include <drwlayer.hxx> #include <svl/sharedstringpool.hxx> @@ -226,9 +228,10 @@ public: ScRefCellValue maCell; const sc::CellTextAttr* mpAttr; const ScPostIt* mpNote; + std::vector<SdrObject*> maDrawObjects; const ScPatternAttr* mpPattern; - Cell() : mpAttr(nullptr), mpNote(nullptr), mpPattern(nullptr) {} + Cell() : mpAttr(nullptr), mpNote(nullptr), maDrawObjects(), mpPattern(nullptr) {} }; struct Row @@ -414,7 +417,7 @@ public: namespace { void initDataRows( - ScSortInfoArray& rArray, const ScTable& rTab, ScColContainer& rCols, + ScSortInfoArray& rArray, ScTable& rTab, ScColContainer& rCols, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bPattern, bool bHiddenFiltered ) { @@ -437,6 +440,17 @@ void initDataRows( rCell.maCell = rCol.GetCellValue(aBlockPos, nRow); rCell.mpAttr = rCol.GetCellTextAttr(aBlockPos, nRow); rCell.mpNote = rCol.GetCellNote(aBlockPos, nRow); + ScDrawLayer* pDrawLayer = rTab.GetDoc().GetDrawLayer(); + if (pDrawLayer) + { + ScAddress aCellPos(nCol, nRow, rTab.GetTab()); + std::vector<SdrObject*> pObjects = pDrawLayer->GetObjectsAnchoredToCell(aCellPos); + rCell.maDrawObjects = pObjects; + } + else + { + SAL_WARN("sc", "Could not retrieve anchored images, no DrawLayer available"); + } if (!bUniformPattern && bPattern) rCell.mpPattern = rCol.GetPattern(nRow); @@ -547,6 +561,7 @@ struct SortedColumn sc::CellTextAttrStoreType maCellTextAttrs; sc::BroadcasterStoreType maBroadcasters; sc::CellNoteStoreType maCellNotes; + std::vector<std::vector<SdrObject*>> maCellDrawObjects; PatRangeType maPatterns; PatRangeType::const_iterator miPatternPos; @@ -559,6 +574,7 @@ struct SortedColumn maCellTextAttrs(nTopEmptyRows), maBroadcasters(nTopEmptyRows), maCellNotes(nTopEmptyRows), + maCellDrawObjects(), maPatterns(0, MAXROWCOUNT, nullptr), miPatternPos(maPatterns.begin()) {} @@ -790,6 +806,9 @@ void fillSortedColumnArray( else rNoteStore.push_back_empty(); + // Add cell anchored images + aSortedCols.at(j).get()->maCellDrawObjects.push_back(rCell.maDrawObjects); + if (rCell.mpPattern) aSortedCols.at(j).get()->setPattern(aCellPos.Row(), rCell.mpPattern); } @@ -1102,6 +1121,9 @@ void ScTable::SortReorderByRow( aCol[nThisCol].UpdateNoteCaptions(nRow1, nRow2); } + // Update draw object positions + aCol[nThisCol].UpdateDrawObjects(aSortedCols[i].get()->maCellDrawObjects, nRow1, nRow2); + { // Get all row spans where the pattern is not NULL. std::vector<PatternSpan> aSpans = @@ -1301,6 +1323,9 @@ void ScTable::SortReorderByRowRefUpdate( aCol[nThisCol].UpdateNoteCaptions(nRow1, nRow2); } + // Update draw object positions + aCol[nThisCol].UpdateDrawObjects(aSortedCols[i].get()->maCellDrawObjects, nRow1, nRow2); + { // Get all row spans where the pattern is not NULL. std::vector<PatternSpan> aSpans = diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index a46413200225..125d915d36cc 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -516,7 +516,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, bool bShrunk = false; rDoc.ShrinkToUsedDataArea( bShrunk, nTab, aLocalParam.nCol1, aLocalParam.nRow1, aLocalParam.nCol2, aLocalParam.nRow2, false, aLocalParam.bByRow, !aLocalParam.bByRow, - aLocalParam.bIncludeComments ); + aLocalParam.bIncludeComments, true ); SCROW nStartRow = aLocalParam.nRow1; if (aLocalParam.bByRow && aLocalParam.bHasHeader && nStartRow < aLocalParam.nRow2) |