Kaydet (Commit) cd779b5f authored tarafından Noel Grandin's avatar Noel Grandin

rename ScAttrEntry.nRow to nEndRow

since it's the last row that the pattern applies to

Change-Id: I80d6d5787768b1e98e958d7adc4c13c37c560ccd
Reviewed-on: https://gerrit.libreoffice.org/42211Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 3563220f
......@@ -75,9 +75,10 @@ struct ScMergePatternState
mbValidPatternId(true), mnPatternId(0) {}
};
// we store an array of these where the pattern applies to all rows up till nEndRow
struct ScAttrEntry
{
SCROW nRow;
SCROW nEndRow;
const ScPatternAttr* pPattern;
};
......@@ -267,7 +268,7 @@ inline const ScPatternAttr* ScAttrIterator::Next( SCROW& rTop, SCROW& rBottom )
if ( nPos < pArray->nCount && nRow <= nEndRow )
{
rTop = nRow;
rBottom = std::min( pArray->pData[nPos].nRow, nEndRow );
rBottom = std::min( pArray->pData[nPos].nEndRow, nEndRow );
pRet = pArray->pData[nPos].pPattern;
nRow = rBottom + 1;
++nPos;
......@@ -289,13 +290,13 @@ inline const ScPatternAttr* ScAttrIterator::Resync( SCROW nRowP, SCROW& rTop, SC
// starting right there. Assume that Next() was called so nPos already
// advanced. Another high chance is that the change extended a previous or
// next pattern. In all these cases we don't need to search.
if (3 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-3].nRow < nRowP &&
nRowP <= pArray->pData[nPos-2].nRow)
if (3 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-3].nEndRow < nRowP &&
nRowP <= pArray->pData[nPos-2].nEndRow)
nPos -= 2;
else if (2 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-2].nRow < nRowP &&
nRowP <= pArray->pData[nPos-1].nRow)
else if (2 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-2].nEndRow < nRowP &&
nRowP <= pArray->pData[nPos-1].nEndRow)
--nPos;
else if (pArray->nCount > 0 && nRowP <= pArray->pData[0].nRow)
else if (pArray->nCount > 0 && nRowP <= pArray->pData[0].nEndRow)
nPos = 0;
else
pArray->Search( nRowP, nPos );
......
......@@ -2306,7 +2306,7 @@ void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization)
else if ( nIndex < pArray->nCount )
{
const ScPatternAttr* pPattern = pArray->pData[nIndex].pPattern;
SCROW nThisEnd = pArray->pData[nIndex].nRow;
SCROW nThisEnd = pArray->pData[nIndex].nEndRow;
if ( IsDefaultItem( pPattern ) )
pPattern = nullptr;
......
......@@ -5437,7 +5437,7 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
GetItem(ATTR_MERGE_FLAG)).IsHorOverlapped();
if ( bHorOverlapped )
{
SCROW nEndRowSeg = (pAttrArray->nCount) ? pAttrArray->pData[nIndex].nRow : MAXROW;
SCROW nEndRowSeg = (pAttrArray->nCount) ? pAttrArray->pData[nIndex].nEndRow : MAXROW;
SCROW nLoopEndRow = std::min( nEndRow, nEndRowSeg );
for (SCROW nAttrRow = nAttrPos; nAttrRow <= nLoopEndRow; nAttrRow++)
{
......@@ -5452,7 +5452,7 @@ void ScDocument::ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow,
}
if ( pAttrArray->nCount )
{
nAttrPos = pAttrArray->pData[nIndex].nRow + 1;
nAttrPos = pAttrArray->pData[nIndex].nEndRow + 1;
++nIndex;
}
else
......
......@@ -491,7 +491,7 @@ void ScDocument::FillInfo(
const ScPatternAttr* pPattern = nullptr;
if ( pThisAttrArr->nCount )
{
nThisRow = pThisAttrArr->pData[nIndex].nRow; // End of range
nThisRow = pThisAttrArr->pData[nIndex].nEndRow; // End of range
pPattern = pThisAttrArr->pData[nIndex].pPattern;
}
else
......
......@@ -1376,20 +1376,20 @@ void XclImpXF::ApplyPatternToAttrList(
// First attribute range doesn't start at row 0.
bHasGap = true;
if (!rAttrs.empty() && rAttrs.back().nRow + 1 < nRow1)
if (!rAttrs.empty() && rAttrs.back().nEndRow + 1 < nRow1)
bHasGap = true;
if (bHasGap)
{
// Fill this gap with the default pattern.
ScAttrEntry aEntry;
aEntry.nRow = nRow1 - 1;
aEntry.nEndRow = nRow1 - 1;
aEntry.pPattern = rDoc.GetDefPattern();
rAttrs.push_back(aEntry);
}
ScAttrEntry aEntry;
aEntry.nRow = nRow2;
aEntry.nEndRow = nRow2;
aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(rPat));
rAttrs.push_back(aEntry);
}
......@@ -2004,10 +2004,10 @@ void XclImpXFRangeBuffer::Finalize()
pXF->ApplyPatternToAttrList(aAttrs, rStyle.mnScRow1, rStyle.mnScRow2, nForceScNumFmt);
}
if (aAttrs.empty() || aAttrs.back().nRow != MAXROW)
if (aAttrs.empty() || aAttrs.back().nEndRow != MAXROW)
{
ScAttrEntry aEntry;
aEntry.nRow = MAXROW;
aEntry.nEndRow = MAXROW;
aEntry.pPattern = rDoc.getDoc().GetDefPattern();
aAttrs.push_back(aEntry);
}
......
......@@ -472,10 +472,10 @@ void SheetDataBuffer::finalizeImport()
if ( pXf )
pXf->applyPatternToAttrList( aAttrs, rRows->mnStartRow, rRows->mnEndRow, rRows->mnNumFmt.second );
}
if (aAttrs.maAttrs.empty() || aAttrs.maAttrs.back().nRow != MAXROW)
if (aAttrs.maAttrs.empty() || aAttrs.maAttrs.back().nEndRow != MAXROW)
{
ScAttrEntry aEntry;
aEntry.nRow = MAXROW;
aEntry.nEndRow = MAXROW;
aEntry.pPattern = pDefPattern;
rDoc.getDoc().GetPool()->Put(*aEntry.pPattern);
aAttrs.maAttrs.push_back(aEntry);
......
......@@ -2051,14 +2051,14 @@ void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal
// First attribute range doesn't start at row 0.
bHasGap = true;
if (!rAttrs.maAttrs.empty() && rAttrs.maAttrs.back().nRow + 1 < nRow1)
if (!rAttrs.maAttrs.empty() && rAttrs.maAttrs.back().nEndRow + 1 < nRow1)
bHasGap = true;
if (bHasGap)
{
// Fill this gap with the default pattern.
ScAttrEntry aEntry;
aEntry.nRow = nRow1 - 1;
aEntry.nEndRow = nRow1 - 1;
aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(*rAttrs.mpDefPattern));
rAttrs.maAttrs.push_back(aEntry);
......@@ -2068,7 +2068,7 @@ void Xf::applyPatternToAttrList( AttrList& rAttrs, SCROW nRow1, SCROW nRow2, sal
}
ScAttrEntry aEntry;
aEntry.nRow = nRow2;
aEntry.nEndRow = nRow2;
aEntry.pPattern = static_cast<const ScPatternAttr*>(&rDoc.GetPool()->Put(rPat));
rAttrs.maAttrs.push_back(aEntry);
......
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