sc/source/core/data/table2.cxx |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

New commits:
commit a717029e217621482ef799731f945090c6d6be4b
Author:     Luboš Luňák <l.lu...@collabora.com>
AuthorDate: Wed Feb 16 09:54:54 2022 +0100
Commit:     Luboš Luňák <l.lu...@collabora.com>
CommitDate: Wed Feb 16 21:37:12 2022 +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>

diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c9672fc85eb5..864876f04ad7 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2209,15 +2209,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

Reply via email to