summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-16 09:54:54 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-17 09:14:19 +0100
commit5bdf7c93abd15dc422586228186e822096ce1517 (patch)
tree749bc8b350c9bf8b9a284d75ff05d5a3bff6701f
parentsw: layout: allow keep-with-next paragraph with fly to move back (diff)
downloadcore-5bdf7c93abd15dc422586228186e822096ce1517.tar.gz
core-5bdf7c93abd15dc422586228186e822096ce1517.zip
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> (cherry picked from commit a717029e217621482ef799731f945090c6d6be4b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130015 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sc/source/core/data/table2.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index f78a17fe3eed..027e61d0ab7b 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2217,15 +2217,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