summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/TableManager.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'writerfilter/source/dmapper/TableManager.cxx')
-rw-r--r--writerfilter/source/dmapper/TableManager.cxx48
1 files changed, 34 insertions, 14 deletions
diff --git a/writerfilter/source/dmapper/TableManager.cxx b/writerfilter/source/dmapper/TableManager.cxx
index b9384b9e08df..facae6e8b48e 100644
--- a/writerfilter/source/dmapper/TableManager.cxx
+++ b/writerfilter/source/dmapper/TableManager.cxx
@@ -408,23 +408,43 @@ void TableManager::endRow()
TagLogger::getInstance().element("tablemanager.endRow");
#endif
TableData::Pointer_t pTableData = mTableDataStack.top();
+ sal_uInt32 nGridBefore = mpTableDataHandler->getDomainMapperImpl().getTableManager().getCurrentGridBefore();
+ sal_uInt32 nGridAfter = mpTableDataHandler->getDomainMapperImpl().getTableManager().getCurrentGridAfter();
- // Add borderless w:gridBefore cell(s) to the row
- if (pTableData)
+ // Add borderless w:gridBefore and w:gridAfter cell(s) to the row
+ if (pTableData && (nGridBefore > 0 || nGridAfter > 0))
{
- sal_uInt32 nGridBefore = mpTableDataHandler->getDomainMapperImpl().getTableManager().getCurrentGridBefore();
- for (unsigned int i = 0; i < nGridBefore; ++i)
+ css::table::BorderLine2 aBorderLine;
+ aBorderLine.Color = 0;
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ TablePropertyMapPtr pCellProperties(new TablePropertyMap);
+ pCellProperties->Insert(PROP_TOP_BORDER, css::uno::makeAny(aBorderLine));
+ pCellProperties->Insert(PROP_LEFT_BORDER, css::uno::makeAny(aBorderLine));
+ pCellProperties->Insert(PROP_BOTTOM_BORDER, css::uno::makeAny(aBorderLine));
+ pCellProperties->Insert(PROP_RIGHT_BORDER, css::uno::makeAny(aBorderLine));
+ if (nGridBefore > 0)
{
- css::table::BorderLine2 aBorderLine;
- aBorderLine.Color = 0;
- aBorderLine.InnerLineWidth = 0;
- aBorderLine.OuterLineWidth = 0;
- TablePropertyMapPtr pCellProperties(new TablePropertyMap);
- pCellProperties->Insert(PROP_TOP_BORDER, css::uno::makeAny(aBorderLine));
- pCellProperties->Insert(PROP_LEFT_BORDER, css::uno::makeAny(aBorderLine));
- pCellProperties->Insert(PROP_BOTTOM_BORDER, css::uno::makeAny(aBorderLine));
- pCellProperties->Insert(PROP_RIGHT_BORDER, css::uno::makeAny(aBorderLine));
- pTableData->getCurrentRow()->addCell(pTableData->getCurrentRow()->getCellStart(0), pCellProperties, /*bAddBefore=*/true);
+ const css::uno::Reference<css::text::XTextRange>& rFirstCellStartHandle = pTableData->getCurrentRow()->getCellStart(0);
+ for (unsigned int i = 0; i < nGridBefore; ++i)
+ pTableData->getCurrentRow()->addCell(rFirstCellStartHandle, pCellProperties, /*bAddBefore=*/true);
+ }
+ if (nGridAfter > 0)
+ {
+ const css::uno::Reference<css::text::XTextRange>& rEndCellEndHandle = pTableData->getCurrentRow()->getCellEnd(pTableData->getCurrentRow()->getCellCount()-1);
+ auto xCursor(rEndCellEndHandle->getText()->createTextCursorByRange(rEndCellEndHandle));
+ if (!xCursor->getString().isEmpty())
+ {
+ // add a dummy character to get a right handle for gridAfter cells after the last non-empty cell, removing that later
+ xCursor->gotoEnd(false);
+ xCursor->setString("x");
+ mpTableDataHandler->getDomainMapperImpl().SetIsDummyCharAddedForTableRowGridAfter(true);
+ }
+ for (unsigned int i = 0; i < nGridAfter; ++i)
+ {
+ pTableData->getCurrentRow()->addCell(xCursor, pCellProperties, /*bAddBefore=*/false);
+ pTableData->getCurrentRow()->endCell(xCursor);
+ }
}
}