diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-08 15:36:24 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-08 14:14:21 +0000 |
commit | 9cea9137b2534da4056f72d3c8a07f85a02f85be (patch) | |
tree | d287ce5d07ac1edf28a90a9cc48c0fd161d1db10 /svx/source/table/svdotable.cxx | |
parent | 4501272cd2fee3534ef34b07a85aa0d26b7cae68 (diff) |
tdf#100269 svx: fix undo of table column resize
SdrTableObjImpl::LayoutTable() assumed no re-layout is needed in case
the total width of the table and the number of columns is the same, but
undo of resize is a situation where we also need to check the individual
widths of the columns, otherwise layout won't be up to date.
Change-Id: Ia5ebb05af79dda1c0d8c5bb10e7f37f81ee1d035
Reviewed-on: https://gerrit.libreoffice.org/26061
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'svx/source/table/svdotable.cxx')
-rw-r--r-- | svx/source/table/svdotable.cxx | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 36fa94ff6d2f..d9a48be97106 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -222,6 +222,8 @@ public: void dispose(); sal_Int32 getColumnCount() const; + /// Get widths of the columns in the table. + std::vector<sal_Int32> getColumnWidths() const; sal_Int32 getRowCount() const; void DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset ); @@ -249,6 +251,7 @@ private: static WritingMode lastLayoutMode; static sal_Int32 lastRowCount; static sal_Int32 lastColCount; + static std::vector<sal_Int32> lastColWidths; }; SdrTableObjImpl* SdrTableObjImpl::lastLayoutTable = nullptr; @@ -259,6 +262,7 @@ bool SdrTableObjImpl::lastLayoutFitHeight; WritingMode SdrTableObjImpl::lastLayoutMode; sal_Int32 SdrTableObjImpl::lastRowCount; sal_Int32 SdrTableObjImpl::lastColCount; +std::vector<sal_Int32> SdrTableObjImpl::lastColWidths; SdrTableObjImpl::SdrTableObjImpl() : mpTableObj( nullptr ) @@ -671,6 +675,15 @@ sal_Int32 SdrTableObjImpl::getColumnCount() const return mxTable.is() ? mxTable->getColumnCount() : 0; } +std::vector<sal_Int32> SdrTableObjImpl::getColumnWidths() const +{ + std::vector<sal_Int32> aRet; + + if (mxTable.is()) + aRet = mxTable->getColumnWidths(); + + return aRet; +} sal_Int32 SdrTableObjImpl::getRowCount() const { @@ -691,7 +704,8 @@ void SdrTableObjImpl::LayoutTable( Rectangle& rArea, bool bFitWidth, bool bFitHe || lastLayoutFitWidth != bFitWidth || lastLayoutFitHeight != bFitHeight || lastLayoutMode != writingMode || lastRowCount != getRowCount() - || lastColCount != getColumnCount() ) + || lastColCount != getColumnCount() + || lastColWidths != getColumnWidths() ) { lastLayoutTable = this; lastLayoutInputRectangle = rArea; @@ -700,6 +714,9 @@ void SdrTableObjImpl::LayoutTable( Rectangle& rArea, bool bFitWidth, bool bFitHe lastLayoutMode = writingMode; lastRowCount = getRowCount(); lastColCount = getColumnCount(); + // Column resize, when the total width and column count of the + // table is unchanged, but re-layout is still needed. + lastColWidths = getColumnWidths(); TableModelNotifyGuard aGuard( mxTable.get() ); mpLayouter->LayoutTable( rArea, bFitWidth, bFitHeight ); lastLayoutResultRectangle = rArea; |