[Libreoffice-commits] core.git: sw/source
Bjoern Michaelsen
bjoern.michaelsen at libreoffice.org
Mon Sep 18 20:45:51 UTC 2017
sw/source/core/unocore/unotext.cxx | 38 +++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
New commits:
commit e6b7ad06c6c99ff9bc3f814cfe9a5d44714a4ac1
Author: Bjoern Michaelsen <bjoern.michaelsen at libreoffice.org>
Date: Sun Sep 17 23:13:39 2017 +0200
use some C++11 and check for incomplete merges (lcl_MergeCells)
Change-Id: Id58762bb4914cdbb358bfd8afb916647c964d38b
Reviewed-on: https://gerrit.libreoffice.org/42399
Tested-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen at libreoffice.org>
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 70d3b682deb9..b0e0f051aed7 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2070,35 +2070,21 @@ lcl_ApplyCellProperties(
static void
lcl_MergeCells(std::vector<VerticallyMergedCell> & rMergedCells)
{
- if (rMergedCells.size())
+ for(auto& aMergedCell : rMergedCells)
{
- std::vector<VerticallyMergedCell>::iterator aMergedIter =
- rMergedCells.begin();
- while (aMergedIter != rMergedCells.end())
+ // the first of the cells gets the number of cells set as RowSpan
+ // the others get the inverted number of remaining merged cells
+ // (3,-2,-1)
+ sal_Int32 nCellCount = static_cast<sal_Int32>(aMergedCell.aCells.size());
+ if(nCellCount<2)
{
- sal_Int32 nCellCount =
- static_cast<sal_Int32>(aMergedIter->aCells.size());
- std::vector<uno::Reference< beans::XPropertySet > >::iterator
- aCellIter = aMergedIter->aCells.begin();
- bool bFirstCell = true;
- // the first of the cells gets the number of cells set as RowSpan
- // the others get the inverted number of remaining merged cells
- // (3,-2,-1)
- while (aCellIter != aMergedIter->aCells.end())
- {
- (*aCellIter)->setPropertyValue(
- UNO_NAME_ROW_SPAN,
- uno::makeAny(nCellCount));
- if (bFirstCell)
- {
- nCellCount *= -1;
- bFirstCell = false;
- }
- ++nCellCount;
- ++aCellIter;
- }
- ++aMergedIter;
+ SAL_WARN("sw.uno", "incomplete vertical cell merge");
+ continue;
}
+ aMergedCell.aCells.front()->setPropertyValue(UNO_NAME_ROW_SPAN, uno::makeAny(nCellCount--));
+ nCellCount*=-1;
+ for(auto pxPSet = aMergedCell.aCells.begin()+1; nCellCount<0; ++pxPSet, ++nCellCount)
+ (*pxPSet)->setPropertyValue(UNO_NAME_ROW_SPAN, uno::makeAny(nCellCount));
}
}
More information about the Libreoffice-commits
mailing list