sc/source/core/data/table2.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
New commits: commit 44dc896c7878ffe972c7c16df61f311f2e240a0e Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Wed Feb 16 09:54:54 2022 +0100 Commit: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> CommitDate: Fri Jun 23 19:29:06 2023 +0100 for unallocated columns check default column attributes (tdf#132057) The problem was that this was returning false for the protected attribute just because a column was not allocated, but the default attributes had the flag set (so if the column had been allocated first it would have the flag set too). Change-Id: I2ef1ef40cafb7e8fc6f7b561c0a376af63f2ad26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129984 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> (cherry picked from commit a717029e217621482ef799731f945090c6d6be4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130015 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 5bdf7c93abd15dc422586228186e822096ce1517) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130018 diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 2085e623f932..0af4861983cb 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2059,15 +2059,12 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, S bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask ) const { - if ( nCol1 >= aCol.size() ) - return false; - if ( nCol2 >= aCol.size() ) - nCol2 = aCol.size() - 1; // Rows above range, doesn't contains flags - - bool bFound = false; - for (SCCOL i=nCol1; i<=nCol2 && !bFound; i++) - bFound |= aCol[i].HasAttrib( nRow1, nRow2, nMask ); - return bFound; + for(SCCOL nCol = nCol1; nCol <= nCol2 && nCol < aCol.size(); ++nCol ) + if( aCol[nCol].HasAttrib( nRow1, nRow2, nMask )) + return true; + if( nCol2 >= aCol.size()) + return aDefaultColAttrArray.HasAttrib( nRow1, nRow2, nMask ); + return false; } bool ScTable::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const