Kaydet (Commit) dc83b3ae authored tarafından Michael Stahl's avatar Michael Stahl

Revert "fftester: non-contiguous cells"

This reverts commit 9accbfa0.

... and the code change of "avoid crashing on load of fdo54724-1.rtf"
commit 4ee3eabd.

It's much simpler to detect early in convertToTable that there is a
row with no cells in it, which should not be allowed.

Change-Id: Iff6d235b29514edd57cc55addeefb24242595d88
üst 424d48d3
......@@ -1181,7 +1181,6 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
++aRg.aEnd;
}
bool bFailure = false;
{
// TODO: this is not Undo-able - only good enough for file import
......@@ -1189,17 +1188,11 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
SwNodeIndex const prev(rTableNodes.begin()->begin()->aStart, -1);
SwNodeIndex const* pPrev(&prev);
// pPrev could point to non-textnode now
for (auto row = rTableNodes.begin(); row != rTableNodes.end() && !bFailure; ++row)
for (auto row = rTableNodes.begin(); row != rTableNodes.end(); ++row)
{
for (auto cell = row->begin(); cell != row->end(); ++cell)
{
bFailure = (SwNodeIndex(*pPrev, +1) != cell->aStart);
if (bFailure)
{
SAL_WARN("sw.core", "cell start is not directly after previous cell end");
break;
}
assert(SwNodeIndex(*pPrev, +1) == cell->aStart);
SwPaM pam(cell->aStart, 0, *pPrev,
(pPrev->GetNode().IsContentNode())
? pPrev->GetNode().GetContentNode()->Len() : 0);
......@@ -1219,9 +1212,6 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> >
GetIDocumentUndoRedo().DoUndo(bUndo);
if (bFailure)
return nullptr;
// Create the Box/Line/Table construct
SwTableBoxFormat* pBoxFormat = MakeTableBoxFormat();
SwTableLineFormat* pLineFormat = MakeTableLineFormat();
......
......@@ -2230,20 +2230,23 @@ throw (lang::IllegalArgumentException, uno::RuntimeException, std::exception)
pTableRanges[nRow].getConstArray();
const sal_Int32 nCells(pTableRanges[nRow].getLength());
if (0 == nCells) // this would lead to no pLastCell below
{ // and make it impossible to detect node gaps
bExcept = true;
break;
}
for (sal_Int32 nCell = 0; nCell < nCells; ++nCell)
{
SwNodeRange *pLastCell;
if (nCell == 0 && nRow == 0)
{
pLastCell = nullptr;
}
else
{
std::vector<SwNodeRange>& rRowOfPrevCell = nCell ? aRowNodes : *aTableNodes.rbegin();
pLastCell = !rRowOfPrevCell.empty() ? &*rRowOfPrevCell.rbegin() : nullptr;
}
SwNodeRange *const pLastCell(
(nCell == 0)
? ((nRow == 0)
? nullptr
: &*aTableNodes.rbegin()->rbegin())
: &*aRowNodes.rbegin());
m_pImpl->ConvertCell(pRow[nCell], aRowNodes, pLastCell, bExcept);
}
assert(bExcept || !aRowNodes.empty());
aTableNodes.push_back(aRowNodes);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment