It's safe to remove the check since CreateCell is only called by CreateContentAction, CreateGeneratedActions and SetDependencies in the same file and those in turn are only called by CreateChangeTrack only if pDoc is not NULL. --- .../filter/xml/XMLChangeTrackingImportHelper.cxx | 33 +++++++++----------- 1 files changed, 15 insertions(+), 18 deletions(-)
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx index 7a9b81e..562a5a4 100644 --- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx +++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx @@ -77,26 +77,23 @@ ScMyCellInfo::~ScMyCellInfo() ScBaseCell* ScMyCellInfo::CreateCell(ScDocument* pDoc) { - if (pDoc) + if (!pCell && !sFormula.isEmpty() && !sFormulaAddress.isEmpty()) { - if (!pCell && !sFormula.isEmpty() && !sFormulaAddress.isEmpty()) - { - ScAddress aPos; - sal_Int32 nOffset(0); - ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); - pCell = new ScFormulaCell(pDoc, aPos, sFormula, eGrammar, nMatrixFlag); - static_cast<ScFormulaCell*>(pCell)->SetMatColsRows(static_cast<SCCOL>(nMatrixCols), static_cast<SCROW>(nMatrixRows)); - } + ScAddress aPos; + sal_Int32 nOffset(0); + ScRangeStringConverter::GetAddressFromString(aPos, sFormulaAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nOffset); + pCell = new ScFormulaCell(pDoc, aPos, sFormula, eGrammar, nMatrixFlag); + static_cast<ScFormulaCell*>(pCell)->SetMatColsRows(static_cast<SCCOL>(nMatrixCols), static_cast<SCROW>(nMatrixRows)); + } - if ((nType == NUMBERFORMAT_DATE || nType == NUMBERFORMAT_TIME) && sInputString.Len() == 0) - { - sal_uInt32 nFormat(0); - if (nType == NUMBERFORMAT_DATE) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); - else if (nType == NUMBERFORMAT_TIME) - nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_TIME, ScGlobal::eLnge ); - pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); - } + if ((nType == NUMBERFORMAT_DATE || nType == NUMBERFORMAT_TIME) && sInputString.Len() == 0) + { + sal_uInt32 nFormat(0); + if (nType == NUMBERFORMAT_DATE) + nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_DATE, ScGlobal::eLnge ); + else if (nType == NUMBERFORMAT_TIME) + nFormat = pDoc->GetFormatTable()->GetStandardFormat( NUMBERFORMAT_TIME, ScGlobal::eLnge ); + pDoc->GetFormatTable()->GetInputLineString(fValue, nFormat, sInputString); } return pCell ? pCell->CloneWithoutNote( *pDoc ) : 0;
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice