summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-12-20 11:30:36 +0100
committerEike Rathke <erack@redhat.com>2018-01-23 00:46:19 +0100
commit3a2a430ae8e2c1647c18d8904477949f6e2e7941 (patch)
tree83b6deb61d9aa9fcec2f93aa204b4075f1ef1baa /sc/inc
parent3d30a39ee92678f6a4e71bd450fc044636adedab (diff)
tdf#98931 Consider cell-anchored images when sorting
This makes images/draw objects anchored to cells move as any other content when sorting cells. Works for sorting rows and columns. Also fixes a bug where notes attached to cells were not sorted when sorting columns. Change-Id: Id9a56a15f776d5adbe382a9bca167bff48b69a0c Reviewed-on: https://gerrit.libreoffice.org/46838 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/column.hxx11
-rw-r--r--sc/inc/document.hxx5
-rw-r--r--sc/inc/drwlayer.hxx3
-rw-r--r--sc/inc/table.hxx6
4 files changed, 19 insertions, 6 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;