Kaydet (Commit) 3e85d9c6 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

workaround problems with row import, fdo#58539

This fixes another crash with gnome#627150

Change-Id: Ibd259c77f8df04b52c9fee0699e0edd1ad30e94e
üst 6e26f941
...@@ -97,6 +97,7 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport, ...@@ -97,6 +97,7 @@ ScXMLTableRowContext::ScXMLTableRowContext( ScXMLImport& rImport,
break;*/ break;*/
} }
} }
mnLastRow = GetScImport().GetTables().GetCurrentRow() + nRepeatedRows;
GetScImport().GetTables().AddRow(); GetScImport().GetTables().AddRow();
GetScImport().GetTables().SetRowStyle(sCellStyleName); GetScImport().GetTables().SetRowStyle(sCellStyleName);
} }
...@@ -154,6 +155,12 @@ void ScXMLTableRowContext::EndElement() ...@@ -154,6 +155,12 @@ void ScXMLTableRowContext::EndElement()
} }
SCTAB nSheet = rXMLImport.GetTables().GetCurrentSheet(); SCTAB nSheet = rXMLImport.GetTables().GetCurrentSheet();
sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow()); sal_Int32 nCurrentRow(rXMLImport.GetTables().GetCurrentRow());
if(nCurrentRow != mnLastRow)
{
// this document is most likely invalid in some way
SAL_WARN("sc", "we did not generate enough rows in the cell import!!");
nCurrentRow = mnLastRow;
}
uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet()); uno::Reference<sheet::XSpreadsheet> xSheet(rXMLImport.GetTables().GetCurrentXSheet());
if(xSheet.is()) if(xSheet.is())
{ {
......
...@@ -29,6 +29,8 @@ class ScXMLTableRowContext : public SvXMLImportContext ...@@ -29,6 +29,8 @@ class ScXMLTableRowContext : public SvXMLImportContext
rtl::OUString sStyleName; rtl::OUString sStyleName;
rtl::OUString sVisibility; rtl::OUString sVisibility;
sal_Int32 nRepeatedRows; sal_Int32 nRepeatedRows;
sal_Int32 mnLastRow; // to workaround problems with the cell import, can be removed when the cell
// always adds enough rows
bool bHasCell; bool bHasCell;
const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); } const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
......
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