summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-13 19:44:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-14 09:54:55 +0200
commit8e20041296f39c3447289064f65b83a36f3c2bf1 (patch)
treee9782fb4f3f2c1a976fa757440b17e6869d707ae
parent74712cf10154c52a01388c3e59759c43396048ba (diff)
readSheet always dereferences it ScDocument*
Change-Id: I7e41db07756d1f838eabc797c6d92c2f81a1856b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102604 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sc/source/filter/inc/qpro.hxx2
-rw-r--r--sc/source/filter/qpro/qpro.cxx36
2 files changed, 19 insertions, 19 deletions
diff --git a/sc/source/filter/inc/qpro.hxx b/sc/source/filter/inc/qpro.hxx
index ae74b8246f7b..bd8b52f416f8 100644
--- a/sc/source/filter/inc/qpro.hxx
+++ b/sc/source/filter/inc/qpro.hxx
@@ -52,7 +52,7 @@ public:
ErrCode parse( ScDocument *pDoc );
ErrCode import( ScDocument *pDoc ); //parse + CalcAfterLoad
- ErrCode readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pStyle );
+ ErrCode readSheet( SCTAB nTab, ScDocument& rDoc, ScQProStyle *pStyle );
};
#endif
diff --git a/sc/source/filter/qpro/qpro.cxx b/sc/source/filter/qpro/qpro.cxx
index 73dd66f19473..c24ba49584ee 100644
--- a/sc/source/filter/qpro/qpro.cxx
+++ b/sc/source/filter/qpro/qpro.cxx
@@ -34,7 +34,7 @@
#include <scdll.hxx>
#include <memory>
-ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pStyle )
+ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument& rDoc, ScQProStyle *pStyle )
{
ErrCode eRet = ERRCODE_NONE;
sal_uInt8 nCol, nDummy;
@@ -55,9 +55,9 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSty
{
OUString aLabel(readString(nLen - 7));
nStyle = nStyle >> 3;
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->EnsureTable(nTab);
- pDoc->SetTextCell(ScAddress(nCol,nRow,nTab), aLabel);
+ pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
+ rDoc.EnsureTable(nTab);
+ rDoc.SetTextCell(ScAddress(nCol,nRow,nTab), aLabel);
}
else
eRet = SCERR_IMPORT_FORMAT;
@@ -71,16 +71,16 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSty
case 0x000c: // Blank cell
mpStream->ReadUChar( nCol ).ReadUChar( nDummy ).ReadUInt16( nRow ).ReadUInt16( nStyle );
nStyle = nStyle >> 3;
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
+ pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
break;
case 0x000d:{ // Integer cell
sal_Int16 nValue;
mpStream->ReadUChar( nCol ).ReadUChar( nDummy ).ReadUInt16( nRow ).ReadUInt16( nStyle ).ReadInt16( nValue );
nStyle = nStyle >> 3;
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), static_cast<double>(nValue));
+ pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
+ rDoc.EnsureTable(nTab);
+ rDoc.SetValue(ScAddress(nCol,nRow,nTab), static_cast<double>(nValue));
}
break;
@@ -88,9 +88,9 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSty
double nValue;
mpStream->ReadUChar( nCol ).ReadUChar( nDummy ).ReadUInt16( nRow ).ReadUInt16( nStyle ).ReadDouble( nValue );
nStyle = nStyle >> 3;
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->EnsureTable(nTab);
- pDoc->SetValue(ScAddress(nCol,nRow,nTab), nValue);
+ pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
+ rDoc.EnsureTable(nTab);
+ rDoc.SetValue(ScAddress(nCol,nRow,nTab), nValue);
}
break;
@@ -108,17 +108,17 @@ ErrCode ScQProReader::readSheet( SCTAB nTab, ScDocument* pDoc, ScQProStyle *pSty
ScAddress aAddr( nCol, nRow, nTab );
std::unique_ptr<ScTokenArray> pArray;
- QProToSc aConv(*mpStream, pDoc->GetSharedStringPool(), aAddr);
- if (ConvErr::OK != aConv.Convert( *pDoc, pArray ))
+ QProToSc aConv(*mpStream, rDoc.GetSharedStringPool(), aAddr);
+ if (ConvErr::OK != aConv.Convert( rDoc, pArray ))
eRet = SCERR_IMPORT_FORMAT;
else
{
- ScFormulaCell* pFormula = new ScFormulaCell(pDoc, aAddr, std::move(pArray));
+ ScFormulaCell* pFormula = new ScFormulaCell(&rDoc, aAddr, std::move(pArray));
nStyle = nStyle >> 3;
pFormula->AddRecalcMode( ScRecalcMode::ONLOAD_ONCE );
- pStyle->SetFormat( pDoc, nCol, nRow, nTab, nStyle );
- pDoc->EnsureTable(nTab);
- pDoc->SetFormulaCell(ScAddress(nCol,nRow,nTab), pFormula);
+ pStyle->SetFormat( &rDoc, nCol, nRow, nTab, nStyle );
+ rDoc.EnsureTable(nTab);
+ rDoc.SetFormulaCell(ScAddress(nCol,nRow,nTab), pFormula);
}
}
break;
@@ -187,7 +187,7 @@ ErrCode ScQProReader::parse( ScDocument *pDoc )
else
pDoc->InsertTab( nTab, aName );
}
- eRet = readSheet( nTab, pDoc, pStyleElement.get() );
+ eRet = readSheet( nTab, *pDoc, pStyleElement.get() );
nTab++;
}
break;