[Libreoffice-commits] core.git: sc/source
Aron Budea (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 25 10:43:55 UTC 2019
sc/source/filter/excel/colrowst.cxx | 23 ++++++++++++-----------
sc/source/filter/excel/excform.cxx | 10 ++++++----
sc/source/filter/excel/excform8.cxx | 2 +-
sc/source/filter/excel/impop.cxx | 20 ++++++++++----------
sc/source/filter/excel/xeformula.cxx | 2 +-
sc/source/filter/excel/xicontent.cxx | 8 ++++----
sc/source/filter/excel/xipage.cxx | 4 ++--
sc/source/filter/excel/xipivot.cxx | 8 ++++----
sc/source/filter/excel/xistyle.cxx | 19 ++++++++++---------
sc/source/filter/excel/xlescher.cxx | 8 ++++----
sc/source/filter/excel/xlroot.cxx | 2 +-
11 files changed, 55 insertions(+), 51 deletions(-)
New commits:
commit 1bca91f086be08c41e51f5f7cc7616ce8c5cb799
Author: Aron Budea <aron.budea at collabora.com>
AuthorDate: Fri Oct 25 08:21:38 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Oct 25 12:43:11 2019 +0200
sc: rowcol: tdf#50916 convert filter/excel for the most part
Change-Id: I8ae255de6fcd9d7fd379a48fb7e84adcbf7fa4ff
TODO: pieces in frmbase.cxx, xestream.cxx and xistyle.cxx
Reviewed-on: https://gerrit.libreoffice.org/81486
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx
index fb8e3e1c3836..b0e7495485a9 100644
--- a/sc/source/filter/excel/colrowst.cxx
+++ b/sc/source/filter/excel/colrowst.cxx
@@ -64,12 +64,13 @@ void XclImpColRowSettings::SetDefWidth( sal_uInt16 nDefWidth, bool bStdWidthRec
void XclImpColRowSettings::SetWidthRange( SCCOL nCol1, SCCOL nCol2, sal_uInt16 nWidth )
{
- nCol2 = ::std::min( nCol2, MAXCOL );
+ ScDocument& rDoc = GetDoc();
+ nCol2 = ::std::min( nCol2, rDoc.MaxCol() );
if (nCol2 == 256)
// In BIFF8, the column range is 0-255, and the use of 256 probably
// means the range should extend to the max column if the loading app
// support columns beyond 255.
- nCol2 = MAXCOL;
+ nCol2 = rDoc.MaxCol();
nCol1 = ::std::min( nCol1, nCol2 );
maColWidths.insert_back(nCol1, nCol2+1, nWidth);
@@ -89,7 +90,7 @@ void XclImpColRowSettings::HideCol( SCCOL nCol )
void XclImpColRowSettings::HideColRange( SCCOL nCol1, SCCOL nCol2 )
{
- nCol2 = ::std::min( nCol2, MAXCOL );
+ nCol2 = ::std::min( nCol2, GetDoc().MaxCol() );
nCol1 = ::std::min( nCol1, nCol2 );
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
@@ -167,7 +168,7 @@ void XclImpColRowSettings::SetDefaultXF( SCCOL nCol1, SCCOL nCol2, sal_uInt16 nX
/* assign the default column formatting here to ensure that
explicit cell formatting is not overwritten. */
OSL_ENSURE( (nCol1 <= nCol2) && ValidCol( nCol2 ), "XclImpColRowSettings::SetDefaultXF - invalid column index" );
- nCol2 = ::std::min( nCol2, MAXCOL );
+ nCol2 = ::std::min( nCol2, GetDoc().MaxCol() );
nCol1 = ::std::min( nCol1, nCol2 );
XclImpXFRangeBuffer& rXFRangeBuffer = GetXFRangeBuffer();
for( SCCOL nCol = nCol1; nCol <= nCol2; ++nCol )
@@ -184,7 +185,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
// column widths ----------------------------------------------------------
maColWidths.build_tree();
- for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol)
+ for (SCCOL nCol = 0; nCol <= rDoc.MaxCol(); ++nCol)
{
sal_uInt16 nWidth = mnDefWidth;
if (GetColFlag(nCol, ExcColRowFlags::Used))
@@ -208,10 +209,10 @@ void XclImpColRowSettings::Convert( SCTAB nScTab )
// row heights ------------------------------------------------------------
// #i54252# set default row height
- rDoc.SetRowHeightOnly( 0, MAXROW, nScTab, mnDefHeight );
+ rDoc.SetRowHeightOnly( 0, rDoc.MaxRow(), nScTab, mnDefHeight );
if( ::get_flag( mnDefRowFlags, EXC_DEFROW_UNSYNCED ) )
// first access to row flags, do not ask for old flags
- rDoc.SetRowFlags( 0, MAXROW, nScTab, CRFlags::ManualSize );
+ rDoc.SetRowFlags( 0, rDoc.MaxRow(), nScTab, CRFlags::ManualSize );
maRowHeights.build_tree();
if (!maRowHeights.is_tree_valid())
@@ -273,7 +274,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
ScDocument& rDoc = GetDoc();
// hide the columns
- for( SCCOL nCol : rDoc.GetColumnsRange(nScTab, 0, MAXCOL) )
+ for( SCCOL nCol : rDoc.GetColumnsRange(nScTab, 0, rDoc.MaxCol()) )
if (GetColFlag(nCol, ExcColRowFlags::Hidden))
rDoc.ShowCol( nCol, nScTab, false );
@@ -294,7 +295,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
// In case the excel row limit is lower than calc's, use the visibility of
// the last row and extend it to calc's last row.
SCROW nLastXLRow = GetRoot().GetXclMaxPos().Row();
- if (nLastXLRow < MAXROW)
+ if (nLastXLRow < rDoc.MaxRow())
{
bool bHidden = false;
if (!maHiddenRows.search(nLastXLRow, bHidden).second)
@@ -326,8 +327,8 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab )
}
// #i47438# if default row format is hidden, hide remaining rows
- if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < MAXROW) )
- rDoc.ShowRows( mnLastScRow + 1, MAXROW, nScTab, false );
+ if( ::get_flag( mnDefRowFlags, EXC_DEFROW_HIDDEN ) && (mnLastScRow < rDoc.MaxRow()) )
+ rDoc.ShowRows( mnLastScRow + 1, rDoc.MaxRow(), nScTab, false );
}
void XclImpColRowSettings::ApplyColFlag(SCCOL nCol, ExcColRowFlags nNewVal)
diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 74718130b7b4..a8397ee17607 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1745,19 +1745,21 @@ void ExcelToSc::SetError( ScFormulaCell &rCell, const ConvErr eErr )
void ExcelToSc::SetComplCol( ScComplexRefData &rCRD )
{
ScSingleRefData &rSRD = rCRD.Ref2;
+ ScDocument& rDoc = GetDocImport().getDoc();
if( rSRD.IsColRel() )
- rSRD.SetRelCol(MAXCOL - aEingPos.Col());
+ rSRD.SetRelCol(rDoc.MaxCol() - aEingPos.Col());
else
- rSRD.SetAbsCol(MAXCOL);
+ rSRD.SetAbsCol(rDoc.MaxCol());
}
void ExcelToSc::SetComplRow( ScComplexRefData &rCRD )
{
ScSingleRefData &rSRD = rCRD.Ref2;
+ ScDocument& rDoc = GetDocImport().getDoc();
if( rSRD.IsRowRel() )
- rSRD.SetRelRow(MAXROW - aEingPos.Row());
+ rSRD.SetRelRow(rDoc.MaxRow() - aEingPos.Row());
else
- rSRD.SetAbsRow(MAXROW);
+ rSRD.SetAbsRow(rDoc.MaxRow());
}
void ExcelToSc::ReadExtensionArray( unsigned int n, XclImpStream& aIn )
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 4ac2697093f0..8c9d0f7191ec 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -1466,7 +1466,7 @@ void ExcelToSc8::ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nC, ScSingleRefData
rSRD.SetRelRow(nRelRow);
}
else
- rSRD.SetAbsRow(std::min( static_cast<SCROW>(nRow), MAXROW));
+ rSRD.SetAbsRow(std::min( static_cast<SCROW>(nRow), GetDoc().MaxRow()));
}
else
{
diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx
index 03c6c73706f4..5c0f1c8acadc 100644
--- a/sc/source/filter/excel/impop.cxx
+++ b/sc/source/filter/excel/impop.cxx
@@ -481,8 +481,8 @@ void ImportExcel::Columndefault()
nColMac--;
- if( nColMac > MAXCOL )
- nColMac = static_cast<sal_uInt16>(MAXCOL);
+ if( nColMac > pD->MaxCol() )
+ nColMac = static_cast<sal_uInt16>(pD->MaxCol());
for( sal_uInt16 nCol = nColMic ; nCol <= nColMac ; nCol++ )
{
@@ -583,8 +583,8 @@ void ImportExcel::Colwidth()
nColWidth = aIn.ReaduInt16();
//TODO: add a check for the unlikely case of changed MAXCOL (-> XclImpAddressConverter)
-// if( nColLast > MAXCOL )
-// nColLast = static_cast<sal_uInt16>(MAXCOL);
+// if( nColLast > pD->MaxCol() )
+// nColLast = static_cast<sal_uInt16>(pD->MaxCol());
sal_uInt16 nScWidth = XclTools::GetScColumnWidth( nColWidth, GetCharWidth() );
pColRowBuff->SetWidthRange( nColFirst, nColLast, nScWidth );
@@ -662,11 +662,11 @@ void ImportExcel::Colinfo()
nXF = aIn.ReaduInt16();
nOpt = aIn.ReaduInt16();
- if( nColFirst > MAXCOL )
+ if( nColFirst > pD->MaxCol() )
return;
- if( nColLast > MAXCOL )
- nColLast = static_cast<sal_uInt16>(MAXCOL);
+ if( nColLast > pD->MaxCol() )
+ nColLast = static_cast<sal_uInt16>(pD->MaxCol());
bool bHidden = ::get_flag( nOpt, EXC_COLINFO_HIDDEN );
bool bCollapsed = ::get_flag( nOpt, EXC_COLINFO_COLLAPSED );
@@ -1131,7 +1131,7 @@ void ImportExcel::TableOp()
else
{
bTabTruncated = true;
- GetTracer().TraceInvalidRow(nLastRow, MAXROW);
+ GetTracer().TraceInvalidRow(nLastRow, pD->MaxRow());
}
}
@@ -1332,13 +1332,13 @@ void ImportExcel::PostDocLoad()
while( p )
{
- if( p->aStart.Col() == 0 && p->aEnd.Col() == MAXCOL && bRowVirgin )
+ if( p->aStart.Col() == 0 && p->aEnd.Col() == pD->MaxCol() && bRowVirgin )
{
pD->SetRepeatRowRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
bRowVirgin = false;
}
- if( p->aStart.Row() == 0 && p->aEnd.Row() == MAXROW && bColVirgin )
+ if( p->aStart.Row() == 0 && p->aEnd.Row() == pD->MaxRow() && bColVirgin )
{
pD->SetRepeatColRange( n, std::unique_ptr<ScRange>(new ScRange(*p)) );
bColVirgin = false;
diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx
index 57c2d71585ca..0068d9bda709 100644
--- a/sc/source/filter/excel/xeformula.cxx
+++ b/sc/source/filter/excel/xeformula.cxx
@@ -596,7 +596,7 @@ void XclExpFmlaCompImpl::Init( XclFormulaType eType, const ScTokenArray& rScTokA
{
// clone the passed token array, convert references relative to current cell position
mxData->mxOwnScTokArr = rScTokArr.Clone();
- ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, &GetDocRef(), *pScBasePos, MAXCOL, MAXROW );
+ ScCompiler::MoveRelWrap( *mxData->mxOwnScTokArr, &GetDocRef(), *pScBasePos, GetDocRef().MaxCol(), GetDocRef().MaxRow() );
// don't remember pScBasePos in mxData->mpScBasePos, shared formulas use real relative refs
}
break;
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 686fac1ae423..f2d3b67dc1a2 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -448,10 +448,10 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm )
{
const ScRange & rScRange = aRowScRanges[ i ];
ScRange aDataRange( rScRange );
- if( aDataRange.aEnd.Col() < MAXCOL )
+ if( aDataRange.aEnd.Col() < rDoc.MaxCol() )
{
aDataRange.aStart.SetCol( aDataRange.aEnd.Col() + 1 );
- aDataRange.aEnd.SetCol( MAXCOL );
+ aDataRange.aEnd.SetCol( rDoc.MaxCol() );
}
else if( aDataRange.aStart.Col() > 0 )
{
@@ -470,10 +470,10 @@ void XclImpLabelranges::ReadLabelranges( XclImpStream& rStrm )
{
const ScRange & rScRange = aColScRanges[ i ];
ScRange aDataRange( rScRange );
- if( aDataRange.aEnd.Row() < MAXROW )
+ if( aDataRange.aEnd.Row() < rDoc.MaxRow() )
{
aDataRange.aStart.SetRow( aDataRange.aEnd.Row() + 1 );
- aDataRange.aEnd.SetRow( MAXROW );
+ aDataRange.aEnd.SetRow( rDoc.MaxRow() );
}
else if( aDataRange.aStart.Row() > 0 )
{
diff --git a/sc/source/filter/excel/xipage.cxx b/sc/source/filter/excel/xipage.cxx
index e5a27f1a68d4..29110f79b363 100644
--- a/sc/source/filter/excel/xipage.cxx
+++ b/sc/source/filter/excel/xipage.cxx
@@ -375,14 +375,14 @@ void XclImpPageSettings::Finalize()
for( const auto& rHorPageBreak : maData.maHorPageBreaks )
{
SCROW nScRow = static_cast< SCROW >( rHorPageBreak );
- if( nScRow <= MAXROW )
+ if( nScRow <= rDoc.MaxRow() )
rDoc.SetRowBreak(nScRow, nScTab, false, true);
}
for( const auto& rVerPageBreak : maData.maVerPageBreaks )
{
SCCOL nScCol = static_cast< SCCOL >( rVerPageBreak );
- if( nScCol <= MAXCOL )
+ if( nScCol <= rDoc.MaxCol() )
rDoc.SetColBreak(nScCol, nScTab, false, true);
}
}
diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx
index 62a9e10ff2dd..3661667e6e6d 100644
--- a/sc/source/filter/excel/xipivot.cxx
+++ b/sc/source/filter/excel/xipivot.cxx
@@ -755,7 +755,7 @@ void XclImpPivotCache::ReadPivotCacheStream( const XclImpStream& rStrm )
else
aOrigFields.push_back( xCurrField );
// insert field name into generated source data, field remembers its column index
- if( bGenerateSource && (nFieldScCol <= MAXCOL) )
+ if( bGenerateSource && (nFieldScCol <= rDoc.MaxCol()) )
xCurrField->WriteFieldNameToSource( nFieldScCol++, nScTab );
}
// do not read items into invalid/postponed fields
@@ -767,7 +767,7 @@ void XclImpPivotCache::ReadPivotCacheStream( const XclImpStream& rStrm )
case EXC_ID_SXINDEXLIST:
// read index list and insert all items into generated source data
- if( bGenerateSource && (nItemScRow <= MAXROW) && (++nItemScRow <= MAXROW) )
+ if( bGenerateSource && (nItemScRow <= rDoc.MaxRow()) && (++nItemScRow <= rDoc.MaxRow()) )
{
for( const auto& rxOrigField : aOrigFields )
{
@@ -794,12 +794,12 @@ void XclImpPivotCache::ReadPivotCacheStream( const XclImpStream& rStrm )
// read postponed item
aPostpFields[ nPostpIdx ]->ReadItem( aPCStrm );
// write item to source
- if( bGenerateSource && (nItemScRow <= MAXROW) )
+ if( bGenerateSource && (nItemScRow <= rDoc.MaxRow()) )
{
// start new row, if there are only postponed fields
if( aOrigFields.empty() && (nPostpIdx == 0) )
++nItemScRow;
- if( nItemScRow <= MAXROW )
+ if( nItemScRow <= rDoc.MaxRow() )
aPostpFields[ nPostpIdx ]->WriteLastOrigItemToSource( nItemScRow, nScTab );
}
// get index of next postponed field
diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx
index 0a833ee34807..dea7ab2886c5 100644
--- a/sc/source/filter/excel/xistyle.cxx
+++ b/sc/source/filter/excel/xistyle.cxx
@@ -1976,7 +1976,8 @@ void XclImpXFRangeBuffer::SetMerge( SCCOL nScCol1, SCROW nScRow1, SCCOL nScCol2,
void XclImpXFRangeBuffer::Finalize()
{
- ScDocumentImport& rDoc = GetDocImport();
+ ScDocumentImport& rDocImport = GetDocImport();
+ ScDocument& rDoc = rDocImport.getDoc();
SCTAB nScTab = GetCurrScTab();
// apply patterns
@@ -2005,11 +2006,11 @@ void XclImpXFRangeBuffer::Finalize()
pXF->ApplyPatternToAttrVector(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt);
}
- if (aAttrs.empty() || aAttrs.back().nEndRow != MAXROW)
+ if (aAttrs.empty() || aAttrs.back().nEndRow != rDoc.MaxRow())
{
ScAttrEntry aEntry;
- aEntry.nEndRow = MAXROW;
- aEntry.pPattern = rDoc.getDoc().GetDefPattern();
+ aEntry.nEndRow = rDoc.MaxRow();
+ aEntry.pPattern = rDoc.GetDefPattern();
aAttrs.push_back(aEntry);
}
@@ -2018,7 +2019,7 @@ void XclImpXFRangeBuffer::Finalize()
ScDocumentImport::Attrs aAttrParam;
aAttrParam.mvData.swap(aAttrs);
aAttrParam.mbLatinNumFmtOnly = false; // when unsure, set it to false.
- rDoc.setAttrEntries(nScTab, nScCol, std::move(aAttrParam));
+ rDocImport.setAttrEntries(nScTab, nScCol, std::move(aAttrParam));
}
++nScCol;
}
@@ -2043,13 +2044,13 @@ void XclImpXFRangeBuffer::Finalize()
SetBorderLine( rRange, nScTab, SvxBoxItemLine::BOTTOM );
// do merge
if( bMultiCol || bMultiRow )
- rDoc.getDoc().DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
+ rDoc.DoMerge( nScTab, rStart.Col(), rStart.Row(), rEnd.Col(), rEnd.Row() );
// #i93609# merged range in a single row: test if manual row height is needed
if( !bMultiRow )
{
- bool bTextWrap = rDoc.getDoc().GetAttr( rStart, ATTR_LINEBREAK )->GetValue();
- if( !bTextWrap && (rDoc.getDoc().GetCellType( rStart ) == CELLTYPE_EDIT) )
- if (const EditTextObject* pEditObj = rDoc.getDoc().GetEditText(rStart))
+ bool bTextWrap = rDoc.GetAttr( rStart, ATTR_LINEBREAK )->GetValue();
+ if( !bTextWrap && (rDoc.GetCellType( rStart ) == CELLTYPE_EDIT) )
+ if (const EditTextObject* pEditObj = rDoc.GetEditText(rStart))
bTextWrap = pEditObj->GetParagraphCount() > 1;
if( bTextWrap )
GetOldRoot().pColRowBuff->SetManualRowHeight( rStart.Row() );
diff --git a/sc/source/filter/excel/xlescher.cxx b/sc/source/filter/excel/xlescher.cxx
index 09d831d914b8..283c8e60a019 100644
--- a/sc/source/filter/excel/xlescher.cxx
+++ b/sc/source/filter/excel/xlescher.cxx
@@ -144,10 +144,10 @@ tools::Rectangle XclObjAnchor::GetRect( const XclRoot& rRoot, SCTAB nScTab, MapU
ScDocument& rDoc = rRoot.GetDoc();
double fScale = lclGetTwipsScale( eMapUnit );
tools::Rectangle aRect(
- lclGetXFromCol(rDoc, nScTab, std::min<SCCOL>(maFirst.mnCol, MAXCOL), mnLX, fScale),
- lclGetYFromRow(rDoc, nScTab, std::min<SCROW>(maFirst.mnRow, MAXROW), mnTY, fScale),
- lclGetXFromCol(rDoc, nScTab, std::min<SCCOL>(maLast.mnCol, MAXCOL), mnRX + 1, fScale),
- lclGetYFromRow(rDoc, nScTab, std::min<SCROW>(maLast.mnRow, MAXROW), mnBY, fScale));
+ lclGetXFromCol(rDoc, nScTab, std::min<SCCOL>(maFirst.mnCol, rDoc.MaxCol()), mnLX, fScale),
+ lclGetYFromRow(rDoc, nScTab, std::min<SCROW>(maFirst.mnRow, rDoc.MaxRow()), mnTY, fScale),
+ lclGetXFromCol(rDoc, nScTab, std::min<SCCOL>(maLast.mnCol, rDoc.MaxCol()), mnRX + 1, fScale),
+ lclGetYFromRow(rDoc, nScTab, std::min<SCROW>(maLast.mnRow, rDoc.MaxRow()), mnBY, fScale));
// adjust coordinates in mirrored sheets
if( rDoc.IsLayoutRTL( nScTab ) )
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index 3f559b285703..d8ace493905a 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -92,7 +92,7 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
meDocLang( Application::GetSettings().GetLanguageTag().getLanguageType() ),
meUILang( Application::GetSettings().GetUILanguageTag().getLanguageType() ),
mnDefApiScript( ApiScriptType::LATIN ),
- maScMaxPos( MAXCOL, MAXROW, MAXTAB ),
+ maScMaxPos( mrDoc.MaxCol(), mrDoc.MaxRow(), MAXTAB ),
maXclMaxPos( EXC_MAXCOL2, EXC_MAXROW2, EXC_MAXTAB2 ),
maMaxPos( EXC_MAXCOL2, EXC_MAXROW2, EXC_MAXTAB2 ),
mxFontPropSetHlp( new XclFontPropSetHelper ),
More information about the Libreoffice-commits
mailing list