diff options
author | Eike Rathke <erack@redhat.com> | 2014-05-27 01:34:37 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-05-27 01:44:03 +0200 |
commit | a1dedadbf0d87a1db24e9b336257678e059882f0 (patch) | |
tree | 2f5ef61e59ae414f786830eb8be975eed217675a /sc/inc/attarray.hxx | |
parent | 467a0d624df1a62b8fa2b28d587c0b42ea3b3e04 (diff) |
resolved fdo#79228 resync ScPatternAttr if changed in GetNeededSize()
Change-Id: Ida47df6223a20939ad5971dc00b8f3462a92dd3e
Diffstat (limited to 'sc/inc/attarray.hxx')
-rw-r--r-- | sc/inc/attarray.hxx | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 08e3c5a2d90c..9b6464b37247 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -206,6 +206,7 @@ class ScAttrIterator public: inline ScAttrIterator( const ScAttrArray* pNewArray, SCROW nStart, SCROW nEnd ); inline const ScPatternAttr* Next( SCROW& rTop, SCROW& rBottom ); + inline const ScPatternAttr* Resync( SCROW nRow, SCROW& rTop, SCROW& rBottom ); SCROW GetNextRow() const { return nRow; } }; @@ -236,6 +237,26 @@ inline const ScPatternAttr* ScAttrIterator::Next( SCROW& rTop, SCROW& rBottom ) return pRet; } +inline const ScPatternAttr* ScAttrIterator::Resync( SCROW nRowP, SCROW& rTop, SCROW& rBottom ) +{ + nRow = nRowP; + // Chances are high that the pattern changed on nRowP introduced a span + // 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) + nPos -= 2; + else if (2 <= nPos && nPos <= pArray->nCount && pArray->pData[nPos-2].nRow < nRowP && + nRowP <= pArray->pData[nPos-1].nRow) + --nPos; + else if (pArray->nCount > 0 && nRowP <= pArray->pData[0].nRow) + nPos = 0; + else + pArray->Search( nRowP, nPos ); + return Next( rTop, rBottom); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |