21#include <ooxml/resourceids.hxx>
46 pTableData->addCell(rHandle, pProps);
56 SAL_WARN(
"writerfilter",
"TableManager::getGridBefore called while not in table");
78 SAL_WARN(
"writerfilter",
"TableManager::getGridAfter called while not in table");
99 mTableDataStack.top()->getCurrentRow()->setCurrentGridSpan(nGridSpan, bFirstCell);
109 || nCell >= pRow->getCellCount() - pRow->getGridAfter())
116 sal_uInt32 nColumn = 0;
117 for (sal_uInt32
n = 0;
n < nCell; ++
n)
118 nColumn += pRow->getGridSpan(
n);
131 sal_uInt32 nCell = 0;
132 sal_uInt32 nGrids = 0;
134 const sal_uInt32 nMaxCell = pRow->getCellCount() - pRow->getGridAfter() - 1;
135 for (
const auto& rSpan : pRow->getGridSpans())
142 if (nCell > nMaxCell)
222 sal_Unicode nChar = data[(len - 1) * 2] + (data[(len - 1) * 2 + 1] << 8);
231 if (len > 0 && data[len - 1] == 0x7)
257 switch (rSprm.
getId())
259 case NS_ooxml::LN_tblDepth:
266 case NS_ooxml::LN_inTbl:
269 case NS_ooxml::LN_tblCell:
272 case NS_ooxml::LN_tblRow:
293 pTableData->endCell(rHandle);
310 if (pTableData !=
nullptr)
312 if (!pTableData->isCellOpen())
315 pTableData->insertCellProperties(pProps);
329 while (nTableDepthDifference > 0)
334 --nTableDepthDifference;
336 while (nTableDepthDifference < 0)
340 ++nTableDepthDifference;
386 unsigned int nRows = pTableData->getRowCount();
390 for (
unsigned int nRow = 0; nRow < nRows; ++nRow)
394 unsigned int nCells = pRowData->getCellCount();
398 for (
unsigned int nCell = 0; nCell < nCells; ++nCell)
401 pRowData->getCellProperties(nCell));
411 catch (css::uno::Exception
const&)
444 if (pTableData !=
nullptr)
462 if (pTableData !=
nullptr)
478 pTableData2->getCurrentRow()->setCurrentGridSpan(
mpUnfinishedRow->getGridSpan(
i));
480 pTableData2->getCurrentRow()->setGridBefore(
mpUnfinishedRow->getGridBefore());
481 pTableData2->getCurrentRow()->setGridAfter(
mpUnfinishedRow->getGridAfter());
491 bool bInTable =
false;
522 if (pTableData && nGridBefore > 0 && pTableData->getCurrentRow()->getCellCount() > 0)
524 const css::uno::Reference<css::text::XTextRange>& xRowStart
525 = pTableData->getCurrentRow()->getCellStart(0);
531 xRowStart->getText()->createTextCursorByRange(xRowStart);
533 for (
unsigned int i = 0;
i < nGridBefore; ++
i)
535 css::table::BorderLine2 aBorderLine;
536 aBorderLine.Color = 0;
537 aBorderLine.InnerLineWidth = 0;
538 aBorderLine.OuterLineWidth = 0;
544 pTableData->getCurrentRow()->addCell(xRowStart, pCellProperties,
548 catch (css::uno::Exception
const&)
605 , mbKeepUnfinishedRow(false)
606 , m_bTableStartsAtCellStart(false)
An SPRM: Section, Paragraph and Run Modifier.
virtual sal_uInt32 getId() const =0
Returns id of the SPRM.
virtual Value::Pointer_t getValue()=0
Returns value of the SPRM.
static TagLogger & getInstance()
void startElement(const std::string &name)
void chars(const std::string &chars)
void attribute(const std::string &name, const std::string &value)
void element(const std::string &name)
Class that holds the data of a table.
void setTableProps(TablePropertyMapPtr pProps)
void setRowProps(TablePropertyMapPtr pProps)
void setCellProps(TablePropertyMapPtr pProps)
void resetCellSpecifics()
Reset to initial state at beginning of row.
void setTableExceptionProps(TablePropertyMapPtr pProps)
void setCellEnd(bool bCellEnd)
sal_uInt32 getGridAfter(sal_uInt32 nRow)
void resolveCurrentTable()
Resolve the current table to the TableDataHandler.
void startParagraphGroup()
Handle the start of a paragraph group.
sal_uInt32 getCurrentGridBefore()
std::stack< TableData::Pointer_t > mTableDataStack
stack of table data
TablePropertyMapPtr const & getTableExceptionProps() const
const css::uno::Reference< css::text::XTextRange > & getHandle() const
void endParagraphGroup()
Handle the end of a paragraph group.
sal_uInt32 mnTableDepthNew
depth of the current cell
void setRowEnd(bool bRowEnd)
RowData::Pointer_t mpUnfinishedRow
bool m_bCellLastParaAfterAutospacing
void text(const sal_uInt8 *data, size_t len)
Handle 8 bit text at current handle.
bool m_bTableStartsAtCellStart
If this is a nested table, does it start at cell start?
virtual bool sprm(Sprm &rSprm)
Handle an SPRM at current handle.
void setInCell(bool bInCell)
void closeCell(const css::uno::Reference< css::text::XTextRange > &rHandle)
Close a cell at current level.
void setHandle(const css::uno::Reference< css::text::XTextRange > &rHandle)
TablePropertyMapPtr getTableProps()
bool isInTable()
Tells whether a table has been started or not.
virtual void insertRowProps(const TablePropertyMapPtr &pProps)
Handle properties of the current row.
void utext(const sal_uInt8 *data, size_t len)
Handle 16 bit text at current handle.
void setCurrentGridBefore(sal_uInt32 nSkipGrids)
tools::SvRef< DomainMapperTableHandler > mpTableDataHandler
handler for resolveCurrentTable
virtual void startLevel()
Start a new table level.
void openCell(const css::uno::Reference< css::text::XTextRange > &rHandle, const TablePropertyMapPtr &pProps)
Open a cell at current level.
virtual void tableExceptionProps(const TablePropertyMapPtr &pProps)
Handle table exception properties of the current row.
virtual void clearData()
let the derived class clear their table related data
virtual void insertTableProps(const TablePropertyMapPtr &pProps)
Handle properties of the current table.
bool isIgnore() const
Return if table manager has detected paragraph to ignore.
void handle(const css::uno::Reference< css::text::XTextRange > &rHandle)
Set the current handle.
void endCell()
Set flag which indicate the current handle is at the end of a cell.
void handle0x7()
Handle occurrence of character 0x7.
virtual void endLevel()
End a table level.
TablePropertyMapPtr const & getCellProps() const
void inCell()
Set flag which indicates the current handle is in a cell.
void setCurrentGridAfter(sal_uInt32 nSkipGrids)
TablePropertyMapPtr const & getRowProps() const
void setCellLastParaAfterAutospacing(bool bIsAfterAutospacing)
virtual void endOfCellAction()
Action to be carried out at the end of the last paragraph of a cell.
void setTableStartsAtCellStart(bool bTableStartsAtCellStart)
sal_uInt32 findColumn(const sal_uInt32 nRow, const sal_uInt32 nCell)
Given a zero-based row/cell, return the zero-based grid it belongs to, or SAL_MAX_UINT16 for invalid.
virtual void cellProps(const TablePropertyMapPtr &pProps)
Handle properties of the current cell.
sal_uInt32 findColumnCell(const sal_uInt32 nRow, const sal_uInt32 nCol)
Given a zero-based row/col, return the zero-based cell describing that grid, or SAL_MAX_UINT16 for in...
void setCurrentGridSpan(sal_uInt32 nGridSpan, bool bFirstCell=false)
virtual void endOfRowAction()
Action to be carried out at the end of the "table row" paragraph.
void setHandler(const tools::SvRef< DomainMapperTableHandler > &pTableDataHandler)
Set handler for resolveCurrentTable.
sal_uInt32 mnTableDepth
depth of the previous cell
void endRow()
Set flag indication the current handle is at the end of a row.
std::vector< sal_uInt32 > getCurrentGridSpans()
void ensureOpenCell(const TablePropertyMapPtr &pProps)
Ensure a cell is open at the current level.
sal_uInt32 getGridBefore(sal_uInt32 nRow)
void cellDepth(sal_uInt32 nDepth)
Set the table depth of the current cell.
#define TOOLS_WARN_EXCEPTION(area, stream)
#define SAL_WARN(area, stream)
std::string XTextRangeToString(uno::Reference< text::XTextRange > const &textRange)