Kaydet (Commit) 20e64b60 authored tarafından Caolán McNamara's avatar Caolán McNamara

fix assert on exporting ooo106020-1.odt to docx

the dread msword column limit

Change-Id: Icbf7fc396de62286d523516da815dabf62336567
üst 994bb22c
...@@ -858,6 +858,14 @@ DECLARE_OOXMLEXPORT_TEST(fdo60957, "fdo60957-2.docx") ...@@ -858,6 +858,14 @@ DECLARE_OOXMLEXPORT_TEST(fdo60957, "fdo60957-2.docx")
assertXPath(pXmlDoc, "//w:tbl", 2); assertXPath(pXmlDoc, "//w:tbl", 2);
} }
//This has more cells than msword supports, we must balance the
//number of cell start and ends
DECLARE_OOXMLEXPORT_TEST(testOO106020, "ooo106020-1.odt")
{
if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
assertXPath(pXmlDoc, "//w:tbl", 1);
}
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -688,16 +688,18 @@ void DocxAttributeOutput::EndSdtBlock() ...@@ -688,16 +688,18 @@ void DocxAttributeOutput::EndSdtBlock()
m_pSerializer->endElementNS( XML_w, XML_sdt ); m_pSerializer->endElementNS( XML_w, XML_sdt );
} }
#define MAX_CELL_IN_WORD 62
void DocxAttributeOutput::SyncNodelessCells(ww8::WW8TableNodeInfoInner::Pointer_t pInner, sal_Int32 nCell, sal_uInt32 nRow) void DocxAttributeOutput::SyncNodelessCells(ww8::WW8TableNodeInfoInner::Pointer_t pInner, sal_Int32 nCell, sal_uInt32 nRow)
{ {
sal_Int32 nOpenCell = lastOpenCell.back(); sal_Int32 nOpenCell = lastOpenCell.back();
if (nOpenCell != -1 && nOpenCell != nCell) if (nOpenCell != -1 && nOpenCell != nCell && nOpenCell < MAX_CELL_IN_WORD)
EndTableCell(pInner, nOpenCell, nRow); EndTableCell(pInner, nOpenCell, nRow);
sal_Int32 nClosedCell = lastClosedCell.back(); sal_Int32 nClosedCell = lastClosedCell.back();
for (sal_Int32 i = nClosedCell+1; i < nCell; ++i) for (sal_Int32 i = nClosedCell+1; i < nCell; ++i)
{ {
if (i >= 62) //words limit if (i >= MAX_CELL_IN_WORD)
break; break;
if (i == 0) if (i == 0)
...@@ -725,11 +727,11 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe ...@@ -725,11 +727,11 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
// so simply if there are more columns, don't close the last one msoffice will handle // so simply if there are more columns, don't close the last one msoffice will handle
// and merge the contents of the remaining ones into it (since we don't close the cell // and merge the contents of the remaining ones into it (since we don't close the cell
// here, following ones will not be opened) // here, following ones will not be opened)
const bool limitWorkaround = (nCell >= 62 && !pInner->isEndOfLine()); const bool limitWorkaround = (nCell >= MAX_CELL_IN_WORD && !pInner->isEndOfLine());
const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround; const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround;
const bool bEndRow = pInner->isEndOfLine(); const bool bEndRow = pInner->isEndOfLine();
if ( bEndCell ) if (bEndCell)
{ {
while (pInner->getDepth() < m_tableReference->m_nTableDepth) while (pInner->getDepth() < m_tableReference->m_nTableDepth)
{ {
......
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