diff options
author | Luboš Luňák <l.lunak@collabora.com> | 2022-02-16 09:54:54 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@collabora.com> | 2022-02-16 21:37:12 +0100 |
commit | a717029e217621482ef799731f945090c6d6be4b (patch) | |
tree | e3e207bdec815510a9bc0571cbcf27e52f362e18 | |
parent | 980b91d5c850099766bf32dfe28880df8873c046 (diff) |
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.lunak@collabora.com>
-rw-r--r-- | sc/source/core/data/table2.cxx | 15 |
1 files changed, 6 insertions, 9 deletions
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 |