cui/source/tabpages/align.cxx | 32 cui/source/tabpages/border.cxx | 4 cui/source/tabpages/borderconn.cxx | 6 include/sfx2/controlwrapper.hxx | 10 include/sfx2/itemconnect.hxx | 54 - include/svx/nbdtmg.hxx | 61 - include/ucbhelper/simpleinteractionrequest.hxx | 39 sc/inc/attarray.hxx | 2 sc/inc/column.hxx | 38 sc/inc/dociter.hxx | 26 sc/inc/document.hxx | 12 sc/inc/global.hxx | 95 +- sc/inc/table.hxx | 18 sc/inc/xmlwrap.hxx | 21 sc/qa/unit/helper/qahelper.cxx | 2 sc/source/core/data/attarray.cxx | 43 - sc/source/core/data/column.cxx | 6 sc/source/core/data/column2.cxx | 8 sc/source/core/data/compressedarray.cxx | 7 sc/source/core/data/dociter.cxx | 22 sc/source/core/data/documen9.cxx | 2 sc/source/core/data/document.cxx | 85 -- sc/source/core/data/fillinfo.cxx | 4 sc/source/core/data/table1.cxx | 22 sc/source/core/data/table2.cxx | 45 - sc/source/core/data/table5.cxx | 16 sc/source/core/inc/interpre.hxx | 4 sc/source/core/tool/interpr1.cxx | 24 sc/source/core/tool/interpr4.cxx | 4 sc/source/core/tool/interpr6.cxx | 32 sc/source/filter/excel/colrowst.cxx | 4 sc/source/filter/excel/xetable.cxx | 4 sc/source/filter/lotus/lotimpop.cxx | 2 sc/source/filter/rtf/eeimpars.cxx | 2 sc/source/filter/xml/xmlwrap.cxx | 12 sc/source/ui/docshell/arealink.cxx | 2 sc/source/ui/docshell/dbdocfun.cxx | 4 sc/source/ui/docshell/docfunc.cxx | 46 - sc/source/ui/docshell/docsh.cxx | 4 sc/source/ui/docshell/docsh3.cxx | 7 sc/source/ui/docshell/olinefun.cxx | 2 sc/source/ui/undo/undoblk.cxx | 8 sc/source/ui/undo/undoblk3.cxx | 8 sc/source/ui/unoobj/cellsuno.cxx | 20 sc/source/ui/unoobj/docuno.cxx | 12 sc/source/ui/unoobj/funcuno.cxx | 2 sc/source/ui/unoobj/warnpassword.cxx | 20 sc/source/ui/vba/vbarange.cxx | 8 sc/source/ui/view/cellsh.cxx | 8 sc/source/ui/view/dbfunc3.cxx | 2 sc/source/ui/view/gridwin.cxx | 6 sc/source/ui/view/gridwin2.cxx | 8 sc/source/ui/view/gridwin4.cxx | 4 sc/source/ui/view/hdrcont.cxx | 4 sc/source/ui/view/output.cxx | 20 sc/source/ui/view/output2.cxx | 16 sc/source/ui/view/printfun.cxx | 6 sc/source/ui/view/select.cxx | 2 sc/source/ui/view/tabview2.cxx | 10 sc/source/ui/view/viewdata.cxx | 2 sc/source/ui/view/viewfun2.cxx | 4 sc/source/ui/view/viewfun3.cxx | 4 sc/source/ui/view/viewfunc.cxx | 16 sd/source/ui/func/fuolbull.cxx | 2 sd/source/ui/view/drviewsf.cxx | 4 sfx2/source/dialog/itemconnect.cxx | 30 svx/source/sidebar/nbdtmg.cxx | 677 ----------------- svx/source/sidebar/nbdtmgfact.cxx | 15 sw/source/uibase/shells/textsh1.cxx | 6 sw/source/uibase/shells/txtnum.cxx | 6 ucb/source/ucp/webdav-neon/webdavcontent.cxx | 11 ucb/source/ucp/webdav/webdavcontent.cxx | 10 ucbhelper/source/provider/simpleinteractionrequest.cxx | 71 - 73 files changed, 522 insertions(+), 1333 deletions(-)
New commits: commit 833156c6a6aa3603adf69384e63f01dbe8cb1f80 Author: Noel Grandin <[email protected]> Date: Fri Sep 23 16:26:21 2016 +0200 convert CR flags to typed_flags_set Change-Id: I20f602eedc72581e22f18c514d8f406690844c28 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 079d120..79e5b83 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1719,11 +1719,11 @@ public: SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, bool bShow); SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, bool bShow); SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow); - SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags ); - SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags ); + SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, CRFlags nNewFlags ); + SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, CRFlags nNewFlags ); - SC_DLLPUBLIC sal_uInt8 GetColFlags( SCCOL nCol, SCTAB nTab ) const; - SC_DLLPUBLIC sal_uInt8 GetRowFlags( SCROW nRow, SCTAB nTab ) const; + SC_DLLPUBLIC CRFlags GetColFlags( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC CRFlags GetRowFlags( SCROW nRow, SCTAB nTab ) const; SC_DLLPUBLIC void GetAllRowBreaks(std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const; SC_DLLPUBLIC void GetAllColBreaks(std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 3a2d99b..df030e7 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -119,21 +119,26 @@ namespace sc #define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE ) // flags for columns / rows - // FILTERED always together with HIDDEN - // FILTERED and MANUALSIZE only valid for rows -const sal_uInt8 CR_HIDDEN = 1; -const sal_uInt8 CR_MANUALBREAK = 8; -const sal_uInt8 CR_FILTERED = 16; -const sal_uInt8 CR_MANUALSIZE = 32; -const sal_uInt8 CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE); +enum class CRFlags : sal_uInt8 { + // Filtered always together with Hidden + // Filtered and ManualSize only valid for rows + NONE = 0x00, + Hidden = 0x01, + ManualBreak = 0x02, + Filtered = 0x04, + ManualSize = 0x08, + All = Hidden | ManualBreak | Filtered | ManualSize +}; +namespace o3tl { + template<> struct typed_flags<CRFlags> : is_typed_flags<CRFlags, 0x0f> {}; +} enum class ScBreakType { NONE = 0x00, Page = 0x01, Manual = 0x02 }; -namespace o3tl -{ +namespace o3tl { template<> struct typed_flags<ScBreakType> : is_typed_flags<ScBreakType, 0x03> {}; } diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 88ef6be..419d8bd 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -146,8 +146,8 @@ private: sal_uInt16* pColWidth; std::unique_ptr<ScFlatUInt16RowSegments> mpRowHeights; - sal_uInt8* pColFlags; - ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags; + CRFlags* pColFlags; + ScBitMaskCompressedArray< SCROW, CRFlags>* pRowFlags; std::unique_ptr<ScFlatBoolColSegments> mpHiddenCols; std::unique_ptr<ScFlatBoolRowSegments> mpHiddenRows; std::unique_ptr<ScFlatBoolColSegments> mpFilteredCols; @@ -748,8 +748,8 @@ public: void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow); void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow); - void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags ); - void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags ); + void SetRowFlags( SCROW nRow, CRFlags nNewFlags ); + void SetRowFlags( SCROW nStartRow, SCROW nEndRow, CRFlags nNewFlags ); /// @return the index of the last row with any set flags (auto-pagebreak is ignored). SCROW GetLastFlaggedRow() const; @@ -761,10 +761,10 @@ public: bool IsDataFiltered(SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, SCROW nRowEnd) const; bool IsDataFiltered(const ScRange& rRange) const; - sal_uInt8 GetColFlags( SCCOL nCol ) const; - sal_uInt8 GetRowFlags( SCROW nRow ) const; + CRFlags GetColFlags( SCCOL nCol ) const; + CRFlags GetRowFlags( SCROW nRow ) const; - const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const + const ScBitMaskCompressedArray< SCROW, CRFlags> * GetRowFlagsArray() const { return pRowFlags; } bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow ); diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 7153c4b..e46de2b 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -728,7 +728,7 @@ void ScBootstrapFixture::miscRowHeightsTest( TestParam* aTestValues, unsigned in int nHeight = sc::TwipsToHMM( rDoc.GetRowHeight(nRow, nTab, false) ); if ( bCheckOpt ) { - bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize); CPPUNIT_ASSERT_EQUAL(aTestValues[ index ].pData[ i ].bOptimal, bOpt); } CPPUNIT_ASSERT_EQUAL(nExpectedHeight, nHeight); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index b99c6c6..d4fa874 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -942,7 +942,7 @@ void ScColumn::GetOptimalHeight( { // only calculate the cell height when it's used later (#37928#) - if (rCxt.isForceAutoSize() || !(pDocument->GetRowFlags(nRow, nTab) & CR_MANUALSIZE) ) + if (rCxt.isForceAutoSize() || !(pDocument->GetRowFlags(nRow, nTab) & CRFlags::ManualSize) ) { aOptions.pPattern = pPattern; const ScPatternAttr* pOldPattern = pPattern; diff --git a/sc/source/core/data/compressedarray.cxx b/sc/source/core/data/compressedarray.cxx index 9f1e647..5cbcb60 100644 --- a/sc/source/core/data/compressedarray.cxx +++ b/sc/source/core/data/compressedarray.cxx @@ -19,6 +19,7 @@ #include "compressedarray.hxx" #include "address.hxx" +#include "global.hxx" #include <algorithm> @@ -392,7 +393,7 @@ A ScBitMaskCompressedArray<A,D>::GetLastAnyBitAccess( const D& rBitMask ) const size_t nIndex = this->nCount-1; while (true) { - if ((this->pData[nIndex].aValue & rBitMask) != 0) + if (this->pData[nIndex].aValue & rBitMask) { nEnd = this->pData[nIndex].nEnd; break; // while @@ -414,7 +415,7 @@ A ScBitMaskCompressedArray<A,D>::GetLastAnyBitAccess( const D& rBitMask ) const // === Force instantiation of specializations ================================ -template class ScCompressedArray< SCROW, sal_uInt8>; // flags, base class -template class ScBitMaskCompressedArray< SCROW, sal_uInt8>; // flags +template class ScCompressedArray< SCROW, CRFlags>; // flags, base class +template class ScBitMaskCompressedArray< SCROW, CRFlags>; // flags /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index b8b0c15..96269cb 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4253,32 +4253,32 @@ void ScDocument::ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, bool bShow) maTabs[nTab]->ShowRows( nRow1, nRow2, bShow ); } -void ScDocument::SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags ) +void ScDocument::SetRowFlags( SCROW nRow, SCTAB nTab, CRFlags nNewFlags ) { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) maTabs[nTab]->SetRowFlags( nRow, nNewFlags ); } -void ScDocument::SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags ) +void ScDocument::SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, CRFlags nNewFlags ) { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) maTabs[nTab]->SetRowFlags( nStartRow, nEndRow, nNewFlags ); } -sal_uInt8 ScDocument::GetColFlags( SCCOL nCol, SCTAB nTab ) const +CRFlags ScDocument::GetColFlags( SCCOL nCol, SCTAB nTab ) const { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) return maTabs[nTab]->GetColFlags( nCol ); OSL_FAIL("wrong table number"); - return 0; + return CRFlags::NONE; } -sal_uInt8 ScDocument::GetRowFlags( SCROW nRow, SCTAB nTab ) const +CRFlags ScDocument::GetRowFlags( SCROW nRow, SCTAB nTab ) const { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) return maTabs[nTab]->GetRowFlags( nRow ); OSL_FAIL("wrong table number"); - return 0; + return CRFlags::NONE; } void ScDocument::GetAllRowBreaks(set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const @@ -4535,13 +4535,13 @@ SCCOL ScDocument::GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) { - sal_uInt8 nStartFlags = maTabs[nTab]->GetColFlags(nStart); + CRFlags nStartFlags = maTabs[nTab]->GetColFlags(nStart); sal_uInt16 nStartWidth = maTabs[nTab]->GetOriginalWidth(nStart); for (SCCOL nCol = nStart + 1; nCol <= MAXCOL; nCol++) { - if (((nStartFlags & CR_MANUALBREAK) != (maTabs[nTab]->GetColFlags(nCol) & CR_MANUALBREAK)) || + if (((nStartFlags & CRFlags::ManualBreak) != (maTabs[nTab]->GetColFlags(nCol) & CRFlags::ManualBreak)) || (nStartWidth != maTabs[nTab]->GetOriginalWidth(nCol)) || - ((nStartFlags & CR_HIDDEN) != (maTabs[nTab]->GetColFlags(nCol) & CR_HIDDEN)) ) + ((nStartFlags & CRFlags::Hidden) != (maTabs[nTab]->GetColFlags(nCol) & CRFlags::Hidden)) ) return nCol; } return MAXCOL+1; @@ -4554,7 +4554,7 @@ SCROW ScDocument::GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab]) return 0; - const ScBitMaskCompressedArray<SCROW, sal_uInt8>* pRowFlagsArray = maTabs[nTab]->GetRowFlagsArray(); + const ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlagsArray = maTabs[nTab]->GetRowFlagsArray(); if (!pRowFlagsArray) return 0; @@ -4565,10 +4565,10 @@ SCROW ScDocument::GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const SCROW nFlagsEndRow; SCROW nHiddenEndRow; SCROW nHeightEndRow; - sal_uInt8 nFlags; + CRFlags nFlags; bool bHidden; sal_uInt16 nHeight; - sal_uInt8 nStartFlags = nFlags = pRowFlagsArray->GetValue( nStart, nIndex, nFlagsEndRow); + CRFlags nStartFlags = nFlags = pRowFlagsArray->GetValue( nStart, nIndex, nFlagsEndRow); bool bStartHidden = bHidden = maTabs[nTab]->RowHidden( nStart, nullptr, &nHiddenEndRow); sal_uInt16 nStartHeight = nHeight = maTabs[nTab]->GetRowHeight( nStart, nullptr, &nHeightEndRow, false); SCROW nRow; @@ -4581,8 +4581,8 @@ SCROW ScDocument::GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart) const if (nHeightEndRow < nRow) nHeight = maTabs[nTab]->GetRowHeight( nRow, nullptr, &nHeightEndRow, false); - if (((nStartFlags & CR_MANUALBREAK) != (nFlags & CR_MANUALBREAK)) || - ((nStartFlags & CR_MANUALSIZE) != (nFlags & CR_MANUALSIZE)) || + if (((nStartFlags & CRFlags::ManualBreak) != (nFlags & CRFlags::ManualBreak)) || + ((nStartFlags & CRFlags::ManualSize) != (nFlags & CRFlags::ManualSize)) || (bStartHidden != bHidden) || (nStartHeight != nHeight)) return nRow; diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index b17f7aa..a38889d 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -167,7 +167,7 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase bool SetOptimalHeightsToRows( sc::RowHeightContext& rCxt, OptimalHeightsFuncObjBase& rFuncObj, - ScBitMaskCompressedArray<SCROW, sal_uInt8>* pRowFlags, SCROW nStartRow, SCROW nEndRow ) + ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, SCROW nStartRow, SCROW nEndRow ) { bool bChanged = false; SCROW nRngStart = 0; @@ -178,21 +178,21 @@ bool SetOptimalHeightsToRows( { size_t nIndex; SCROW nRegionEndRow; - sal_uInt8 nRowFlag = pRowFlags->GetValue( i, nIndex, nRegionEndRow ); + CRFlags nRowFlag = pRowFlags->GetValue( i, nIndex, nRegionEndRow ); if ( nRegionEndRow > nEndRow ) nRegionEndRow = nEndRow; SCSIZE nMoreRows = nRegionEndRow - i; // additional equal rows after first - bool bAutoSize = ((nRowFlag & CR_MANUALSIZE) == 0); + bool bAutoSize = !(nRowFlag & CRFlags::ManualSize); if (bAutoSize || rCxt.isForceAutoSize()) { if (nExtraHeight) { if (bAutoSize) - pRowFlags->SetValue( i, nRegionEndRow, nRowFlag | CR_MANUALSIZE); + pRowFlags->SetValue( i, nRegionEndRow, nRowFlag | CRFlags::ManualSize); } else if (!bAutoSize) - pRowFlags->SetValue( i, nRegionEndRow, nRowFlag & ~CR_MANUALSIZE); + pRowFlags->SetValue( i, nRegionEndRow, nRowFlag & ~CRFlags::ManualSize); for (SCSIZE nInner = i; nInner <= i + nMoreRows; ++nInner) { @@ -293,19 +293,19 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, if (bColInfo) { pColWidth = new sal_uInt16[ MAXCOL+1 ]; - pColFlags = new sal_uInt8[ MAXCOL+1 ]; + pColFlags = new CRFlags[ MAXCOL+1 ]; for (SCCOL i=0; i<=MAXCOL; i++) { pColWidth[i] = STD_COL_WIDTH; - pColFlags[i] = 0; + pColFlags[i] = CRFlags::NONE; } } if (bRowInfo) { mpRowHeights.reset(new ScFlatUInt16RowSegments(ScGlobal::nStdRowHeight)); - pRowFlags = new ScBitMaskCompressedArray< SCROW, sal_uInt8>( MAXROW, 0); + pRowFlags = new ScBitMaskCompressedArray<SCROW, CRFlags>( MAXROW, CRFlags::NONE); } if ( pDocument->IsDocVisible() ) diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 78dd198..33227ca 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -159,11 +159,11 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE if (mpRowHeights && pRowFlags) { mpRowHeights->insertSegment(nStartRow, nSize); - sal_uInt8 nNewFlags = pRowFlags->Insert( nStartRow, nSize); + CRFlags nNewFlags = pRowFlags->Insert( nStartRow, nSize); // only copy manual size flag, clear all others - if (nNewFlags && (nNewFlags != CR_MANUALSIZE)) + if (nNewFlags != CRFlags::NONE && (nNewFlags != CRFlags::ManualSize)) pRowFlags->SetValue( nStartRow, nStartRow + nSize - 1, - nNewFlags & CR_MANUALSIZE); + nNewFlags & CRFlags::ManualSize); } if (pOutlineTable) @@ -522,7 +522,7 @@ void ScTable::CopyToClip( if (pRowFlags && pTable->pRowFlags && mpRowHeights && pTable->mpRowHeights) { - pTable->pRowFlags->CopyFromAnded( *pRowFlags, 0, nRow2, CR_MANUALSIZE); + pTable->pRowFlags->CopyFromAnded( *pRowFlags, 0, nRow2, CRFlags::ManualSize); pTable->CopyRowHeight(*this, 0, nRow2, 0); } @@ -679,13 +679,13 @@ void ScTable::CopyFromClip( pRowFlags && pTable->pRowFlags) { CopyRowHeight(*pTable, nRow1, nRow2, -nDy); - // Must copy CR_MANUALSIZE bit too, otherwise pRowHeight doesn't make sense + // Must copy CRFlags::ManualSize bit too, otherwise pRowHeight doesn't make sense for (SCROW j=nRow1; j<=nRow2; j++) { - if ( pTable->pRowFlags->GetValue(j-nDy) & CR_MANUALSIZE ) - pRowFlags->OrValue( j, CR_MANUALSIZE); + if ( pTable->pRowFlags->GetValue(j-nDy) & CRFlags::ManualSize ) + pRowFlags->OrValue( j, CRFlags::ManualSize); else - pRowFlags->AndValue( j, sal::static_int_cast<sal_uInt8>(~CR_MANUALSIZE)); + pRowFlags->AndValue( j, ~CRFlags::ManualSize); } } @@ -2842,9 +2842,9 @@ void ScTable::SetManualHeight( SCROW nStartRow, SCROW nEndRow, bool bManual ) if (ValidRow(nStartRow) && ValidRow(nEndRow) && pRowFlags) { if (bManual) - pRowFlags->OrValue( nStartRow, nEndRow, CR_MANUALSIZE); + pRowFlags->OrValue( nStartRow, nEndRow, CRFlags::ManualSize); else - pRowFlags->AndValue( nStartRow, nEndRow, sal::static_int_cast<sal_uInt8>(~CR_MANUALSIZE)); + pRowFlags->AndValue( nStartRow, nEndRow, ~CRFlags::ManualSize); } else { @@ -3241,7 +3241,7 @@ bool ScTable::IsDataFiltered(const ScRange& rRange) const rRange.aEnd.Col(), rRange.aEnd.Row()); } -void ScTable::SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags ) +void ScTable::SetRowFlags( SCROW nRow, CRFlags nNewFlags ) { if (ValidRow(nRow) && pRowFlags) pRowFlags->SetValue( nRow, nNewFlags); @@ -3251,7 +3251,7 @@ void ScTable::SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags ) } } -void ScTable::SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags ) +void ScTable::SetRowFlags( SCROW nStartRow, SCROW nEndRow, CRFlags nNewFlags ) { if (ValidRow(nStartRow) && ValidRow(nEndRow) && pRowFlags) pRowFlags->SetValue( nStartRow, nEndRow, nNewFlags); @@ -3261,20 +3261,20 @@ void ScTable::SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags ) } } -sal_uInt8 ScTable::GetColFlags( SCCOL nCol ) const +CRFlags ScTable::GetColFlags( SCCOL nCol ) const { if (ValidCol(nCol) && pColFlags) return pColFlags[nCol]; else - return 0; + return CRFlags::NONE; } -sal_uInt8 ScTable::GetRowFlags( SCROW nRow ) const +CRFlags ScTable::GetRowFlags( SCROW nRow ) const { if (ValidRow(nRow) && pRowFlags) return pRowFlags->GetValue(nRow); else - return 0; + return CRFlags::NONE; } SCROW ScTable::GetLastFlaggedRow() const @@ -3282,7 +3282,7 @@ SCROW ScTable::GetLastFlaggedRow() const SCROW nLastFound = 0; if (pRowFlags) { - SCROW nRow = pRowFlags->GetLastAnyBitAccess( sal::static_int_cast<sal_uInt8>(CR_ALL) ); + SCROW nRow = pRowFlags->GetLastAnyBitAccess( CRFlags::All ); if (ValidRow(nRow)) nLastFound = nRow; } @@ -3314,7 +3314,7 @@ SCCOL ScTable::GetLastChangedCol() const SCCOL nLastFound = 0; for (SCCOL nCol = 1; nCol <= MAXCOL; nCol++) - if ((pColFlags[nCol] & CR_ALL) || (pColWidth[nCol] != STD_COL_WIDTH)) + if ((pColFlags[nCol] & CRFlags::All) || (pColWidth[nCol] != STD_COL_WIDTH)) nLastFound = nCol; return nLastFound; @@ -3341,7 +3341,6 @@ bool ScTable::UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, bool bShow ) { if (pOutlineTable && pColFlags) { - ScBitMaskCompressedArray< SCCOLROW, sal_uInt8> aArray( MAXCOL, pColFlags, MAXCOLCOUNT); return pOutlineTable->GetColArray().ManualAction( nStartCol, nEndCol, bShow, *this, true ); } else diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index eb35dd0..3ac1d04 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -940,17 +940,17 @@ SCROW ScTable::CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const bool ScTable::IsManualRowHeight(SCROW nRow) const { - return (pRowFlags->GetValue(nRow) & CR_MANUALSIZE) != 0; + return bool(pRowFlags->GetValue(nRow) & CRFlags::ManualSize); } namespace { void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& rRowSegments, - sal_uInt8* pColFlags, ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags, const sal_uInt8 nFlagMask) + CRFlags* pColFlags, ScBitMaskCompressedArray< SCROW, CRFlags>* pRowFlags, const CRFlags nFlagMask) { using ::sal::static_int_cast; - sal_uInt8 nFlagMaskComplement = static_int_cast<sal_uInt8>(~nFlagMask); + CRFlags nFlagMaskComplement = ~nFlagMask; pRowFlags->AndValue(0, MAXROW, nFlagMaskComplement); for (SCCOL i = 0; i <= MAXCOL; ++i) @@ -1000,7 +1000,7 @@ void ScTable::SyncColRowFlags() { using ::sal::static_int_cast; - sal_uInt8 nManualBreakComplement = static_int_cast<sal_uInt8>(~CR_MANUALBREAK); + CRFlags nManualBreakComplement = ~CRFlags::ManualBreak; // Manual breaks. pRowFlags->AndValue(0, MAXROW, nManualBreakComplement); @@ -1011,19 +1011,19 @@ void ScTable::SyncColRowFlags() { for (set<SCROW>::const_iterator itr = maRowManualBreaks.begin(), itrEnd = maRowManualBreaks.end(); itr != itrEnd; ++itr) - pRowFlags->OrValue(*itr, CR_MANUALBREAK); + pRowFlags->OrValue(*itr, CRFlags::ManualBreak); } if (!maColManualBreaks.empty()) { for (set<SCCOL>::const_iterator itr = maColManualBreaks.begin(), itrEnd = maColManualBreaks.end(); itr != itrEnd; ++itr) - pColFlags[*itr] |= CR_MANUALBREAK; + pColFlags[*itr] |= CRFlags::ManualBreak; } // Hidden flags. - lcl_syncFlags(*mpHiddenCols, *mpHiddenRows, pColFlags, pRowFlags, CR_HIDDEN); - lcl_syncFlags(*mpFilteredCols, *mpFilteredRows, pColFlags, pRowFlags, CR_FILTERED); + lcl_syncFlags(*mpHiddenCols, *mpHiddenRows, pColFlags, pRowFlags, CRFlags::Hidden); + lcl_syncFlags(*mpFilteredCols, *mpFilteredRows, pColFlags, pRowFlags, CRFlags::Filtered); } void ScTable::SetPageSize( const Size& rSize ) diff --git a/sc/source/filter/excel/colrowst.cxx b/sc/source/filter/excel/colrowst.cxx index 59694f5..59dd1b0 100644 --- a/sc/source/filter/excel/colrowst.cxx +++ b/sc/source/filter/excel/colrowst.cxx @@ -220,7 +220,7 @@ void XclImpColRowSettings::Convert( SCTAB nScTab ) rDoc.SetRowHeightOnly( 0, MAXROW, nScTab, mnDefHeight ); if( ::get_flag( mnDefRowFlags, EXC_DEFROW_UNSYNCED ) ) // first access to row flags, do not ask for old flags - rDoc.SetRowFlags( 0, MAXROW, nScTab, CR_MANUALSIZE ); + rDoc.SetRowFlags( 0, MAXROW, nScTab, CRFlags::ManualSize ); maRowHeights.build_tree(); if (!maRowHeights.is_tree_valid()) @@ -295,7 +295,7 @@ void XclImpColRowSettings::ConvertHiddenFlags( SCTAB nScTab ) if( GetBiff() == EXC_BIFF8 ) { const XclImpAutoFilterData* pFilter = GetFilterManager().GetByTab( nScTab ); - // #i70026# use IsFiltered() to set the CR_FILTERED flag for active filters only + // #i70026# use IsFiltered() to set the CRFlags::Filtered flag for active filters only if( pFilter && pFilter->IsActive() && pFilter->IsFiltered() ) { nFirstFilterScRow = pFilter->StartRow(); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index c5ab7de..f0c1096 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -1858,8 +1858,8 @@ XclExpRow::XclExpRow( const XclExpRoot& rRoot, sal_uInt32 nXclRow, // *** Row flags *** ------------------------------------------------------ - sal_uInt8 nRowFlags = GetDoc().GetRowFlags( nScRow, nScTab ); - bool bUserHeight = ::get_flag< sal_uInt8 >( nRowFlags, CR_MANUALSIZE ); + CRFlags nRowFlags = GetDoc().GetRowFlags( nScRow, nScTab ); + bool bUserHeight( nRowFlags & CRFlags::ManualSize ); bool bHidden = GetDoc().RowHidden(nScRow, nScTab); ::set_flag( mnFlags, EXC_ROW_UNSYNCED, bUserHeight ); ::set_flag( mnFlags, EXC_ROW_HIDDEN, bHidden ); diff --git a/sc/source/filter/lotus/lotimpop.cxx b/sc/source/filter/lotus/lotimpop.cxx index a48cefe..1d27861 100644 --- a/sc/source/filter/lotus/lotimpop.cxx +++ b/sc/source/filter/lotus/lotimpop.cxx @@ -317,7 +317,7 @@ void ImportLotus::RowPresentation( sal_uInt16 nRecLen ) nHeight *= 20; // -> 32 * TWIPS nHeight /= 32; // -> TWIPS - pD->SetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab), pD->GetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab) ) | CR_MANUALSIZE ); + pD->SetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab), pD->GetRowFlags( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab) ) | CRFlags::ManualSize ); pD->SetRowHeight( static_cast<SCROW> (nRow), static_cast<SCTAB> (nLTab), nHeight ); } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 85714d4..721084d 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3474,15 +3474,15 @@ bool ScDocFunc::SetWidthOrHeight( bool bAll = ( eMode==SC_SIZE_OPTIMAL ); if (!bAll) { - // fuer alle eingeblendeten CR_MANUALSIZE loeschen, + // fuer alle eingeblendeten CRFlags::ManualSize loeschen, // dann SetOptimalHeight mit bShrink = FALSE for (SCROW nRow=nStartNo; nRow<=nEndNo; nRow++) { - sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab); + CRFlags nOld = rDoc.GetRowFlags(nRow,nTab); SCROW nLastRow = -1; bool bHidden = rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow); - if ( !bHidden && ( nOld & CR_MANUALSIZE ) ) - rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE ); + if ( !bHidden && ( nOld & CRFlags::ManualSize ) ) + rDoc.SetRowFlags( nRow, nTab, nOld & ~CRFlags::ManualSize ); } } diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 9c0e21a..ed61de7 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -870,10 +870,10 @@ void ScUndoAutoFormat::Redo() // as SC_SIZE_VISOPT for (SCROW nRow=nStartY; nRow<=nEndY; nRow++) { - sal_uInt8 nOld = rDoc.GetRowFlags(nRow,nTab); + CRFlags nOld = rDoc.GetRowFlags(nRow,nTab); bool bHidden = rDoc.RowHidden(nRow, nTab); - if ( !bHidden && ( nOld & CR_MANUALSIZE ) ) - rDoc.SetRowFlags( nRow, nTab, nOld & ~CR_MANUALSIZE ); + if ( !bHidden && ( nOld & CRFlags::ManualSize ) ) + rDoc.SetRowFlags( nRow, nTab, nOld & ~CRFlags::ManualSize ); } rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index c578928..d090955 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8822,7 +8822,7 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE else if ( pEntry->nWID == SC_WID_UNO_OWIDTH ) { //! momentan immer gesetzt ??!?! - bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CRFlags::ManualSize); rAny <<= bOpt; } else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE ) @@ -8975,7 +8975,7 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr } else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT ) { - bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize); rAny <<= bOpt; } else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE ) diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c128693..5800a43 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -3743,7 +3743,7 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty } else if ( aPropertyName == SC_UNONAME_OWIDTH ) { - bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetColFlags( nStartCol, nTab ) & CRFlags::ManualSize); aAny <<= bOpt; } else if ( aPropertyName == SC_UNONAME_NEWPAGE ) @@ -4017,7 +4017,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam } else if ( aPropertyName == SC_UNONAME_OHEIGHT ) { - bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CR_MANUALSIZE); + bool bOpt = !(rDoc.GetRowFlags( nStartRow, nTab ) & CRFlags::ManualSize); aAny <<= bOpt; } else if ( aPropertyName == SC_UNONAME_NEWPAGE ) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 069f7e4..e6e75b2 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1949,7 +1949,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA // no vertical clipping when printing cells with optimal height, // except when font size is from conditional formatting. if ( eType != OUTTYPE_PRINTER || - ( mpDoc->GetRowFlags( nCellY, nTab ) & CR_MANUALSIZE ) || + ( mpDoc->GetRowFlags( nCellY, nTab ) & CRFlags::ManualSize ) || ( aVars.HasCondHeight() ) ) bVClip = true; } @@ -3031,7 +3031,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) // except when font size is from conditional formatting. //! Allow clipping when vertically merged? if ( eType != OUTTYPE_PRINTER || - ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) || + ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CRFlags::ManualSize ) || ( rParam.mpCondSet && SfxItemState::SET == rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT) ) ) bClip = true; @@ -3243,7 +3243,7 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize, // except when font size is from conditional formatting. //! Allow clipping when vertically merged? if ( eType != OUTTYPE_PRINTER || - ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) || + ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CRFlags::ManualSize ) || ( rParam.mpCondSet && SfxItemState::SET == rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT) ) ) bClip = true; @@ -4006,7 +4006,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) // except when font size is from conditional formatting. //! Allow clipping when vertically merged? if ( eType != OUTTYPE_PRINTER || - ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) || + ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CRFlags::ManualSize ) || ( rParam.mpCondSet && SfxItemState::SET == rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT) ) ) bClip = true; @@ -4352,7 +4352,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // except when font size is from conditional formatting. //! Allow clipping when vertically merged? if ( eType != OUTTYPE_PRINTER || - ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CR_MANUALSIZE ) || + ( mpDoc->GetRowFlags( rParam.mnCellY, nTab ) & CRFlags::ManualSize ) || ( rParam.mpCondSet && SfxItemState::SET == rParam.mpCondSet->GetItemState(ATTR_FONT_HEIGHT) ) ) bClip = true; diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index cbc64bd..fda2dbb 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1367,7 +1367,7 @@ void ScViewData::EditGrowY( bool bInitial ) // to be clipped before extending to following rows, to avoid obscuring cells for // reference input (next row is likely to be useful in formulas). long nAllowedExtra = SC_GROWY_SMALL_EXTRA; - if ( nEditEndRow == nEditRow && !( pDoc->GetRowFlags( nEditRow, nTabNo ) & CR_MANUALSIZE ) && + if ( nEditEndRow == nEditRow && !( pDoc->GetRowFlags( nEditRow, nTabNo ) & CRFlags::ManualSize ) && pEngine->GetParagraphCount() <= 1 ) { // If the (only) paragraph starts with a '=', it's a formula. diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 5b5c3ca..091f948 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1942,7 +1942,7 @@ void ScViewFunc::SetWidthOrHeight( bool bAll = ( eMode==SC_SIZE_OPTIMAL ); if (!bAll) { - // delete CR_MANUALSIZE for all in range, + // delete CRFlags::ManualSize for all in range, // then SetOptimalHeight with bShrink = FALSE for (SCROW nRow = nStartNo; nRow <= nEndNo; ++nRow) { @@ -1953,9 +1953,9 @@ void ScViewFunc::SetWidthOrHeight( continue; } - sal_uInt8 nOld = rDoc.GetRowFlags(nRow, nTab); - if (nOld & CR_MANUALSIZE) - rDoc.SetRowFlags(nRow, nTab, nOld & ~CR_MANUALSIZE); + CRFlags nOld = rDoc.GetRowFlags(nRow, nTab); + if (nOld & CRFlags::ManualSize) + rDoc.SetRowFlags(nRow, nTab, nOld & ~CRFlags::ManualSize); } } commit 606077ed58dfbc133d99a6a38a8aabf552a687bb Author: Noel Grandin <[email protected]> Date: Fri Sep 23 15:30:33 2016 +0200 convert HASATTR constants to typed_flags_set Remove unused constant RTL. Inline PAINTEXT constant since it is only used in one place. Change-Id: I7b2c15e7579fc5bc475d00fe714f17592bd5e2a1 diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index c1f5c2a..c24f658 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -155,7 +155,7 @@ public: bool Search( SCROW nRow, SCSIZE& nIndex ) const; - bool HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const; + bool HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const; bool IsMerged( SCROW nRow ) const; bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, SCCOL& rPaintCol, SCROW& rPaintRow, diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 2041ce7..621a65b 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -210,31 +210,31 @@ public: void DeleteContent( SCROW nRow, bool bBroadcast = true ); void FreeAll(); void FreeNotes(); - void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern ); + void Swap( ScColumn& rOther, SCROW nRow1, SCROW nRow2, bool bPattern ); - bool HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const; - bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const; - bool IsMerged( SCROW nRow ) const; - bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, + bool HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const; + bool HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const; + bool IsMerged( SCROW nRow ) const; + bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, SCCOL& rPaintCol, SCROW& rPaintRow, bool bRefresh ); - bool IsEmptyData() const; - bool IsEmptyAttr() const; - bool IsEmpty() const; + bool IsEmptyData() const; + bool IsEmptyAttr() const; + bool IsEmpty() const; // data only: - bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; - SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; - bool HasDataAt(SCROW nRow) const; - bool HasVisibleDataAt(SCROW nRow) const; - SCROW GetFirstDataPos() const; - SCROW GetLastDataPos() const; - SCROW GetLastDataPos( SCROW nLastRow ) const; - bool GetPrevDataPos(SCROW& rRow) const; - bool GetNextDataPos(SCROW& rRow) const; - void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster) - void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const; + bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow) const; + SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; + bool HasDataAt(SCROW nRow) const; + bool HasVisibleDataAt(SCROW nRow) const; + SCROW GetFirstDataPos() const; + SCROW GetLastDataPos() const; + SCROW GetLastDataPos( SCROW nLastRow ) const; + bool GetPrevDataPos(SCROW& rRow) const; + bool GetNextDataPos(SCROW& rRow) const; + void FindDataAreaPos(SCROW& rRow, bool bDown) const; // (without Broadcaster) + void FindUsed( SCROW nStartRow, SCROW nEndRow, mdds::flat_segment_tree<SCROW, bool>& rUsed ) const; SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const; sc::MatrixEdge GetBlockMatrixEdges(SCROW nRow1, SCROW nRow2, sc::MatrixEdge nMask ) const; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 979257e..079d120 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1158,8 +1158,8 @@ public: bool IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, - SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const; - SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const; + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask ) const; + SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, HasAttrFlags nMask ) const; SC_DLLPUBLIC void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab, const ::editeng::SvxBorderLine** ppLeft, diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 7ccf940..3a2d99b 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -172,22 +172,26 @@ enum class ScPasteFunc { NONE, ADD, SUB, MUL, DIV }; // bits for HasAttr -#define HASATTR_LINES 1 -#define HASATTR_MERGED 2 -#define HASATTR_OVERLAPPED 4 -#define HASATTR_PROTECTED 8 -#define HASATTR_SHADOW 16 -#define HASATTR_NEEDHEIGHT 32 -#define HASATTR_SHADOW_RIGHT 64 -#define HASATTR_SHADOW_DOWN 128 -#define HASATTR_AUTOFILTER 256 -#define HASATTR_CONDITIONAL 512 -#define HASATTR_ROTATE 1024 -#define HASATTR_NOTOVERLAPPED 2048 -#define HASATTR_RTL 4096 -#define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment - -#define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL ) +enum class HasAttrFlags { + NONE = 0x0000, + Lines = 0x0001, + Merged = 0x0002, + Overlapped = 0x0004, + Protected = 0x0008, + Shadow = 0x0010, + NeedHeight = 0x0020, + ShadowRight = 0x0040, + ShadowDown = 0x0080, + AutoFilter = 0x0100, + Conditional = 0x0200, + Rotate = 0x0400, + NotOverlapped = 0x0800, + RightOrCenter = 0x1000, // right or centered logical alignment +}; +namespace o3tl { + template<> struct typed_flags<HasAttrFlags> : is_typed_flags<HasAttrFlags, 0x1fff> {}; +} + #define EMPTY_OUSTRING ScGlobal::GetEmptyOUString() diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index d987071..88ef6be 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -588,8 +588,8 @@ public: void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 ); - bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const; - bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const; + bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask ) const; + bool HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const; bool IsMerged( SCCOL nCol, SCROW nRow ) const; bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW& rEndRow, diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index f122b28..a2aadcc 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1192,7 +1192,7 @@ void ScAttrArray::ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInf // Test if field contains specific attribute -bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const +bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const { SCSIZE nStartIndex; SCSIZE nEndIndex; @@ -1203,46 +1203,46 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const for (SCSIZE i=nStartIndex; i<=nEndIndex && !bFound; i++) { const ScPatternAttr* pPattern = pData[i].pPattern; - if ( nMask & HASATTR_MERGED ) + if ( nMask & HasAttrFlags::Merged ) { const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>( &pPattern->GetItem( ATTR_MERGE ) ); if ( pMerge->GetColMerge() > 1 || pMerge->GetRowMerge() > 1 ) bFound = true; } - if ( nMask & ( HASATTR_OVERLAPPED | HASATTR_NOTOVERLAPPED | HASATTR_AUTOFILTER ) ) + if ( nMask & ( HasAttrFlags::Overlapped | HasAttrFlags::NotOverlapped | HasAttrFlags::AutoFilter ) ) { const ScMergeFlagAttr* pMergeFlag = static_cast<const ScMergeFlagAttr*>( &pPattern->GetItem( ATTR_MERGE_FLAG ) ); - if ( (nMask & HASATTR_OVERLAPPED) && pMergeFlag->IsOverlapped() ) + if ( (nMask & HasAttrFlags::Overlapped) && pMergeFlag->IsOverlapped() ) bFound = true; - if ( (nMask & HASATTR_NOTOVERLAPPED) && !pMergeFlag->IsOverlapped() ) + if ( (nMask & HasAttrFlags::NotOverlapped) && !pMergeFlag->IsOverlapped() ) bFound = true; - if ( (nMask & HASATTR_AUTOFILTER) && pMergeFlag->HasAutoFilter() ) + if ( (nMask & HasAttrFlags::AutoFilter) && pMergeFlag->HasAutoFilter() ) bFound = true; } - if ( nMask & HASATTR_LINES ) + if ( nMask & HasAttrFlags::Lines ) { const SvxBoxItem* pBox = static_cast<const SvxBoxItem*>( &pPattern->GetItem( ATTR_BORDER ) ); if ( pBox->GetLeft() || pBox->GetRight() || pBox->GetTop() || pBox->GetBottom() ) bFound = true; } - if ( nMask & HASATTR_SHADOW ) + if ( nMask & HasAttrFlags::Shadow ) { const SvxShadowItem* pShadow = static_cast<const SvxShadowItem*>( &pPattern->GetItem( ATTR_SHADOW ) ); if ( pShadow->GetLocation() != SVX_SHADOW_NONE ) bFound = true; } - if ( nMask & HASATTR_CONDITIONAL ) + if ( nMask & HasAttrFlags::Conditional ) { bool bContainsCondFormat = !static_cast<const ScCondFormatItem&>(pPattern->GetItem( ATTR_CONDITIONAL )).GetCondFormatData().empty(); if ( bContainsCondFormat ) bFound = true; } - if ( nMask & HASATTR_PROTECTED ) + if ( nMask & HasAttrFlags::Protected ) { const ScProtectionAttr* pProtect = static_cast<const ScProtectionAttr*>( &pPattern->GetItem( ATTR_PROTECTION ) ); @@ -1285,7 +1285,7 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const if(bFoundTemp) bFound = true; } - if ( nMask & HASATTR_ROTATE ) + if ( nMask & HasAttrFlags::Rotate ) { const SfxInt32Item* pRotate = static_cast<const SfxInt32Item*>( &pPattern->GetItem( ATTR_ROTATE_VALUE ) ); @@ -1295,7 +1295,7 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const if ( nAngle != 0 && nAngle != 9000 && nAngle != 27000 ) bFound = true; } - if ( nMask & HASATTR_NEEDHEIGHT ) + if ( nMask & HasAttrFlags::NeedHeight ) { if (pPattern->GetCellOrientation() != SVX_ORIENTATION_STANDARD) bFound = true; @@ -1310,26 +1310,19 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const else if (static_cast<const SfxInt32Item&>(pPattern->GetItem( ATTR_ROTATE_VALUE )).GetValue()) bFound = true; } - if ( nMask & ( HASATTR_SHADOW_RIGHT | HASATTR_SHADOW_DOWN ) ) + if ( nMask & ( HasAttrFlags::ShadowRight | HasAttrFlags::ShadowDown ) ) { const SvxShadowItem* pShadow = static_cast<const SvxShadowItem*>( &pPattern->GetItem( ATTR_SHADOW )); SvxShadowLocation eLoc = pShadow->GetLocation(); - if ( nMask & HASATTR_SHADOW_RIGHT ) + if ( nMask & HasAttrFlags::ShadowRight ) if ( eLoc == SVX_SHADOW_TOPRIGHT || eLoc == SVX_SHADOW_BOTTOMRIGHT ) bFound = true; - if ( nMask & HASATTR_SHADOW_DOWN ) + if ( nMask & HasAttrFlags::ShadowDown ) if ( eLoc == SVX_SHADOW_BOTTOMLEFT || eLoc == SVX_SHADOW_BOTTOMRIGHT ) bFound = true; } - if ( nMask & HASATTR_RTL ) - { - const SvxFrameDirectionItem& rDirection = - static_cast<const SvxFrameDirectionItem&>( pPattern->GetItem( ATTR_WRITINGDIR ) ); - if ( rDirection.GetValue() == FRMDIR_HORI_RIGHT_TOP ) - bFound = true; - } - if ( nMask & HASATTR_RIGHTORCENTER ) + if ( nMask & HasAttrFlags::RightOrCenter ) { // called only if the sheet is LTR, so physical=logical alignment can be assumed SvxCellHorJustify eHorJust = (SvxCellHorJustify) @@ -2118,7 +2111,7 @@ void ScAttrArray::DeleteArea(SCROW nStartRow, SCROW nEndRow) { RemoveAreaMerge( nStartRow, nEndRow ); // remove from combined flags - if ( !HasAttrib( nStartRow, nEndRow, HASATTR_OVERLAPPED | HASATTR_AUTOFILTER) ) + if ( !HasAttrib( nStartRow, nEndRow, HasAttrFlags::Overlapped | HasAttrFlags::AutoFilter) ) SetPatternArea( nStartRow, nEndRow, pDocument->GetDefPattern() ); else DeleteAreaSafe( nStartRow, nEndRow ); // leave merge flags @@ -2261,7 +2254,7 @@ void ScAttrArray::CopyAreaSafe( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttr SCROW nDestStart = std::max((long)((long)nStartRow + nDy), (long) 0); SCROW nDestEnd = std::min((long)((long)nEndRow + nDy), (long) MAXROW); - if ( !rAttrArray.HasAttrib( nDestStart, nDestEnd, HASATTR_OVERLAPPED ) ) + if ( !rAttrArray.HasAttrib( nDestStart, nDestEnd, HasAttrFlags::Overlapped ) ) { CopyArea( nStartRow+nDy, nEndRow+nDy, nDy, rAttrArray ); return; diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index dfe343e..95959b9 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -302,12 +302,12 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const return false; } -bool ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const +bool ScColumn::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) const { return pAttrArray->HasAttrib( nRow1, nRow2, nMask ); } -bool ScColumn::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const +bool ScColumn::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const { bool bFound = false; @@ -1831,7 +1831,7 @@ bool ScColumn::TestCopyScenarioTo( const ScColumn& rDestCol ) const while (pPattern && bOk) { if ( static_cast<const ScMergeFlagAttr&>(pPattern->GetItem( ATTR_MERGE_FLAG )).IsScenario() ) - if ( rDestCol.pAttrArray->HasAttrib( nStart, nEnd, HASATTR_PROTECTED ) ) + if ( rDestCol.pAttrArray->HasAttrib( nStart, nEnd, HasAttrFlags::Protected ) ) bOk = false; pPattern = aAttrIter.Next( nStart, nEnd ); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 6003565..b99c6c6 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -983,7 +983,7 @@ bool ScColumn::GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& r if (!bInSel && it != maCells.end() && eType != sc::element_type_empty) { if ( (eType == sc::element_type_string || eType == sc::element_type_edittext) && - !(HasAttrib( nRow, nRow, HASATTR_PROTECTED) && + !(HasAttrib( nRow, nRow, HasAttrFlags::Protected) && pDocument->IsTabProtected(nTab)) ) return true; } @@ -1002,7 +1002,7 @@ bool ScColumn::GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& r it = maCells.position(it, nRow).first; eType = it->type; if ( (eType == sc::element_type_string || eType == sc::element_type_edittext) && - !(HasAttrib( nRow, nRow, HASATTR_PROTECTED) && + !(HasAttrib( nRow, nRow, HasAttrFlags::Protected) && pDocument->IsTabProtected(nTab)) ) return true; else @@ -1014,7 +1014,7 @@ bool ScColumn::GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& r it = maCells.position(it, nRow).first; eType = it->type; if ( (eType == sc::element_type_string || eType == sc::element_type_edittext) && - !(HasAttrib( nRow, nRow, HASATTR_PROTECTED) && + !(HasAttrib( nRow, nRow, HasAttrFlags::Protected) && pDocument->IsTabProtected(nTab)) ) return true; else diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 4ad9532..176b0c4 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -456,7 +456,7 @@ bool ScDocument::IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, if (!IsBlockEmpty( nTab, nStartCol, nStartRow, nEndCol, nEndRow )) return false; - if (HasAttrib(ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), HASATTR_LINES)) + if (HasAttrib(ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), HasAttrFlags::Lines)) // We want to print sheets with borders even if there is no cell content. return false; diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 48e762c..b8b0c15 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -1717,7 +1717,7 @@ bool ScDocument::HasPartOfMerged( const ScRange& rRange ) SCROW nEndY = rRange.aEnd.Row(); if (HasAttrib( nStartX, nStartY, nTab, nEndX, nEndY, nTab, - HASATTR_MERGED | HASATTR_OVERLAPPED )) + HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { ExtendMerge( nStartX, nStartY, nEndX, nEndY, nTab ); ExtendOverlapped( nStartX, nStartY, nEndX, nEndY, nTab ); @@ -5066,9 +5066,9 @@ void ScDocument::GetSelectionFrame( const ScMarkData& rMark, } bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, - SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask ) const { - if ( nMask & HASATTR_ROTATE ) + if ( nMask & HasAttrFlags::Rotate ) { // Is attribute used in document? // (as in fillinfo) @@ -5093,44 +5093,17 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, } } if (!bAnyItem) - nMask &= ~HASATTR_ROTATE; + nMask &= ~HasAttrFlags::Rotate; } - if ( nMask & HASATTR_RTL ) - { - // first check if right-to left is in the pool at all - // (the same item is used in cell and page format) - - ScDocumentPool* pPool = xPoolHelper->GetDocPool(); - - bool bHasRtl = false; - sal_uInt32 nDirCount = pPool->GetItemCount2( ATTR_WRITINGDIR ); - for (sal_uInt32 nItem=0; nItem<nDirCount; nItem++) - { - const SfxPoolItem* pItem = pPool->GetItem2( ATTR_WRITINGDIR, nItem ); - if ( pItem && static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue() == FRMDIR_HORI_RIGHT_TOP ) - { - bHasRtl = true; - break; - } - } - if (!bHasRtl) - nMask &= ~HASATTR_RTL; - } - - if (!nMask) + if (nMask == HasAttrFlags::NONE) return false; bool bFound = false; for (SCTAB i=nTab1; i<=nTab2 && !bFound && i < static_cast<SCTAB>(maTabs.size()); i++) if (maTabs[i]) { - if ( nMask & HASATTR_RTL ) - { - if ( GetEditTextDirection(i) == EE_HTEXTDIR_R2L ) // sheet default - bFound = true; - } - if ( nMask & HASATTR_RIGHTORCENTER ) + if ( nMask & HasAttrFlags::RightOrCenter ) { // On a RTL sheet, don't start to look for the default left value // (which is then logically right), instead always assume true. @@ -5147,7 +5120,7 @@ bool ScDocument::HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, return bFound; } -bool ScDocument::HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const +bool ScDocument::HasAttrib( const ScRange& rRange, HasAttrFlags nMask ) const { return HasAttrib( rRange.aStart.Col(), rRange.aStart.Row(), rRange.aStart.Tab(), rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(), @@ -5524,14 +5497,14 @@ void ScDocument::ExtendTotalMerge( ScRange& rRange ) const { ScRange aTest = aExt; aTest.aStart.SetRow( rRange.aEnd.Row() + 1 ); - if ( HasAttrib( aTest, HASATTR_NOTOVERLAPPED ) ) + if ( HasAttrib( aTest, HasAttrFlags::NotOverlapped ) ) aExt.aEnd.SetRow(rRange.aEnd.Row()); } if ( aExt.aEnd.Col() > rRange.aEnd.Col() ) { ScRange aTest = aExt; aTest.aStart.SetCol( rRange.aEnd.Col() + 1 ); - if ( HasAttrib( aTest, HASATTR_NOTOVERLAPPED ) ) + if ( HasAttrib( aTest, HasAttrFlags::NotOverlapped ) ) aExt.aEnd.SetCol(rRange.aEnd.Col()); } diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index d74ea57..9f2ebca 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -435,9 +435,9 @@ void ScDocument::FillInfo( SCCOL nRotMax = nCol2; if ( bAnyItem && HasAttrib( 0, nRow1, nTab, MAXCOL, nRow2+1, nTab, - HASATTR_ROTATE | HASATTR_CONDITIONAL ) ) + HasAttrFlags::Rotate | HasAttrFlags::Conditional ) ) { - //TODO: check Conditionals also for HASATTR_ROTATE ???? + //TODO: check Conditionals also for HasAttrFlags::Rotate ???? OSL_ENSURE( nArrCount>2, "nArrCount too small" ); FindMaxRotCol( nTab, &pRowInfo[1], nArrCount-1, nCol1, nCol2 ); diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 2da7c76..b17f7aa 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1223,7 +1223,7 @@ bool ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark, if (!ValidCol(nCol) || !ValidRow(nRow)) return false; - if (pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED)) + if (pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Overlapped)) // Skip an overlapped cell. return false; @@ -1271,7 +1271,7 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY, bool bUp = ( nMovY < 0 ); nRow = rMark.GetNextMarked( nCol, nRow, bUp ); while ( ValidRow(nRow) && - (RowHidden(nRow) || pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED)) ) + (RowHidden(nRow) || pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Overlapped)) ) { // skip hidden rows (see above) nRow += nMovY; @@ -1301,7 +1301,7 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY, nRow = 0; nRow = rMark.GetNextMarked( nCol, nRow, bUp ); while ( ValidRow(nRow) && - (RowHidden(nRow) || pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_OVERLAPPED)) ) + (RowHidden(nRow) || pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Overlapped)) ) { // skip hidden rows (see above) nRow += nMovY; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 341eeea..78dd198 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -1904,7 +1904,7 @@ const ScPatternAttr* ScTable::GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, S return nullptr; } -bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const +bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, HasAttrFlags nMask ) const { bool bFound = false; for (SCCOL i=nCol1; i<=nCol2 && !bFound; i++) @@ -1912,7 +1912,7 @@ bool ScTable::HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal return bFound; } -bool ScTable::HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const +bool ScTable::HasAttribSelection( const ScMarkData& rMark, HasAttrFlags nMask ) const { std::vector<sc::ColRowSpan> aSpans = rMark.GetMarkedColSpans(); @@ -2220,7 +2220,7 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, bIsEditable = false; else if ( IsProtected() && !pDocument->IsScenario(nTab) ) { - bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HASATTR_PROTECTED ); + bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HasAttrFlags::Protected ); if (!bIsEditable) { // An enhanced protection permission may override the attribute. @@ -2295,7 +2295,7 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark, { ScRangeList aRanges; rMark.FillRangeListWithMarks( &aRanges, false ); - bIsEditable = !HasAttribSelection( rMark, HASATTR_PROTECTED ); + bIsEditable = !HasAttribSelection( rMark, HasAttrFlags::Protected ); if (!bIsEditable) { // An enhanced protection permission may override the attribute. diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index d9dd73e..97b2e32 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -149,7 +149,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu if ( nRow <= nOverlapRowMax ) { while ( nCol <= MAXCOL && mpDoc->HasAttrib( nCol, nRow, nTab, - nCol, nRow, nTab, HASATTR_OVERLAPPED ) ) + nCol, nRow, nTab, HasAttrFlags::Overlapped ) ) { nCol++; nMergeColAdd++; diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 5329d7c..006cac2 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -372,7 +372,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, rSrcDoc.CopyToClip(aClipParam, &aClipDoc, &aSourceMark, false, false); if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, - HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { //! ResetAttrib am Dokument !!! diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 4137625..ee3f8e6 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -522,7 +522,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, if ( aLocalParam.bIncludePattern && rDoc.HasAttrib( aLocalParam.nCol1, nStartRow , nTab, aLocalParam.nCol2, aLocalParam.nRow2, nTab, - HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { // Merge-Attribute wuerden beim Sortieren durcheinanderkommen if (!bApi) @@ -979,7 +979,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, } if (rDoc.HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab, - rParam.nCol2, rParam.nRow2, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) + rParam.nCol2, rParam.nRow2, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { if (!bApi) rDocShell.ErrorMessage(STR_MSSG_INSERTCELLS_0); // nicht in zusammengefasste einfuegen diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index ef5430a..85714d4 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -812,7 +812,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con new ScUndoEnterData(&rDocShell, rPos, aOldValues, rText, nullptr)); } - if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HASATTR_NEEDHEIGHT ) ) + if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HasAttrFlags::NeedHeight ) ) AdjustRowHeight( ScRange(rPos) ); rDocShell.PostPaintCell( rPos ); @@ -831,7 +831,7 @@ bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteract ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo = rDoc.IsUndoEnabled(); - bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT); + bool bHeight = rDoc.HasAttrib(rPos, HasAttrFlags::NeedHeight); ScCellValue aOldVal; if (bUndo) @@ -899,7 +899,7 @@ bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo = rDoc.IsUndoEnabled(); - bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT); + bool bHeight = rDoc.HasAttrib(rPos, HasAttrFlags::NeedHeight); ScCellValue aOldVal; if (bUndo) @@ -936,7 +936,7 @@ bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr, ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo = rDoc.IsUndoEnabled(); - bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT); + bool bHeight = rDoc.HasAttrib(rPos, HasAttrFlags::NeedHeight); ScCellValue aOldVal; if (bUndo) @@ -988,7 +988,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo ScDocument& rDoc = rDocShell.GetDocument(); bool bUndo = rDoc.IsUndoEnabled(); - bool bHeight = rDoc.HasAttrib(rPos, HASATTR_NEEDHEIGHT); + bool bHeight = rDoc.HasAttrib(rPos, HasAttrFlags::NeedHeight); ScCellValue aOldVal; if (bUndo) @@ -1722,7 +1722,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, ScRange aExtendMergeRange( aTargetRange ); - if( aTargetRange.aStart == aTargetRange.aEnd && rDoc.HasAttrib(aTargetRange, HASATTR_MERGED) ) + if( aTargetRange.aStart == aTargetRange.aEnd && rDoc.HasAttrib(aTargetRange, HasAttrFlags::Merged) ) { rDoc.ExtendMerge( aExtendMergeRange ); rDoc.ExtendOverlapped( aExtendMergeRange ); @@ -1800,7 +1800,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, for (; itr != itrEnd && nTabCount; ++itr) { i = *itr; - if( rDoc.HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + if( rDoc.HasAttrib( nMergeTestStartCol, nMergeTestStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { if (eCmd==INS_CELLSRIGHT) bNeedRefresh = true; @@ -1905,7 +1905,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, for( ::std::vector<ScRange>::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); ++iIter ) { ScRange aRange( *iIter ); - if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) ) + if( rDoc.HasAttrib( aRange, HasAttrFlags::Overlapped | HasAttrFlags::Merged ) ) { UnmergeCells( aRange, true ); } @@ -1991,7 +1991,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, while( !qIncreaseRange.empty() ) { ScRange aRange = qIncreaseRange.back(); - if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) ) + if( !rDoc.HasAttrib( aRange, HasAttrFlags::Overlapped | HasAttrFlags::Merged ) ) { switch (eCmd) { @@ -2166,7 +2166,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, ScRange aExtendMergeRange( rRange ); - if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HASATTR_MERGED) ) + if( rRange.aStart == rRange.aEnd && rDoc.HasAttrib(rRange, HasAttrFlags::Merged) ) { rDoc.ExtendMerge( aExtendMergeRange ); rDoc.ExtendOverlapped( aExtendMergeRange ); @@ -2233,7 +2233,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, for (; itr != itrEnd && *itr < nTabCount; ++itr) { SCTAB i = *itr; - if ( rDoc.HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HASATTR_MERGED | HASATTR_OVERLAPPED )) + if ( rDoc.HasAttrib( nUndoStartCol, nUndoStartRow, i, nMergeTestEndCol, nMergeTestEndRow, i, HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { SCCOL nMergeStartCol = nUndoStartCol; SCROW nMergeStartRow = nUndoStartRow; @@ -2340,7 +2340,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, for( ::std::vector<ScRange>::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); ++iIter ) { ScRange aRange( *iIter ); - if( rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) ) + if( rDoc.HasAttrib( aRange, HasAttrFlags::Overlapped | HasAttrFlags::Merged ) ) { UnmergeCells( aRange, true ); } @@ -2513,7 +2513,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, break; } - if( !rDoc.HasAttrib( aRange, HASATTR_OVERLAPPED | HASATTR_MERGED ) ) + if( !rDoc.HasAttrib( aRange, HasAttrFlags::Overlapped | HasAttrFlags::Merged ) ) { ScCellMergeOption aMergeOption(aRange); MergeCells( aMergeOption, false, true, true ); @@ -2708,7 +2708,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, if (bClipOver && !bCut) if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab, - HASATTR_MERGED | HASATTR_OVERLAPPED )) + HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { // "Zusammenfassen nicht verschachteln !" if (!bApi) rDocShell.ErrorMessage(STR_MSSG_MOVEBLOCKTO_0); @@ -2766,7 +2766,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, if (bClipOver) if (rDoc.HasAttrib( nDestCol,nDestRow,nDestTab, nUndoEndCol,nUndoEndRow,nDestEndTab, - HASATTR_MERGED | HASATTR_OVERLAPPED )) + HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { rDoc.CopyFromClip( rSource, aSourceMark, InsertDeleteFlags::ALL, nullptr, pClipDoc ); for (nTab=nStartTab; nTab<=nEndTab; nTab++) @@ -4707,7 +4707,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo } if ( rDoc.HasAttrib( nStartCol, nStartRow, *itr, nEndCol, nEndRow, *itr, - HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { // "Zusammenfassen nicht verschachteln !" if (!bApi) @@ -4822,7 +4822,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord ) { SCTAB nTab = *itr; ScRange aRange = rOption.getSingleRange(nTab); - if ( !rDoc.HasAttrib(aRange, HASATTR_MERGED) ) + if ( !rDoc.HasAttrib(aRange, HasAttrFlags::Merged) ) continue; ScRange aExtended = aRange; diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index e236620..13fb414 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -152,7 +152,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI if ( ( nExtFlags & SC_PF_WHOLEROWS ) || aDocument.HasAttrib( nCol1,nRow1,nTab1, - MAXCOL,nRow2,nTab2, HASATTR_ROTATE | HASATTR_RIGHTORCENTER ) ) + MAXCOL,nRow2,nTab2, HasAttrFlags::Rotate | HasAttrFlags::RightOrCenter ) ) { nCol1 = 0; nCol2 = MAXCOL; @@ -198,7 +198,8 @@ void ScDocShell::PostPaintExtras() void ScDocShell::UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ) { - if ( ( rExtFlags & SC_PF_LINES ) == 0 && aDocument.HasAttrib( rRange, HASATTR_PAINTEXT ) ) + if ( ( rExtFlags & SC_PF_LINES ) == 0 && + aDocument.HasAttrib( rRange, HasAttrFlags::Lines | HasAttrFlags::Shadow | HasAttrFlags::Conditional ) ) { // If the range contains lines, shadow or conditional formats, // set SC_PF_LINES to include one extra cell in all directions. @@ -208,7 +209,7 @@ void ScDocShell::UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ) if ( ( rExtFlags & SC_PF_WHOLEROWS ) == 0 && ( rRange.aStart.Col() != 0 || rRange.aEnd.Col() != MAXCOL ) && - aDocument.HasAttrib( rRange, HASATTR_ROTATE | HASATTR_RIGHTORCENTER ) ) + aDocument.HasAttrib( rRange, HasAttrFlags::Rotate | HasAttrFlags::RightOrCenter ) ) { // If the range contains (logically) right- or center-aligned cells, // or rotated cells, set SC_PF_WHOLEROWS to paint the whole rows. diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx index ce3410e..8c8643e 100644 --- a/sc/source/ui/docshell/olinefun.cxx +++ b/sc/source/ui/docshell/olinefun.cxx @@ -65,7 +65,7 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab, nEndRow = nEnd; } if (rDoc.HasAttrib( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab, - HASATTR_MERGED | HASATTR_OVERLAPPED )) + HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { nStartCol = 0; nStartRow = 0; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index c7bd629..2d7c7b2 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -197,7 +197,7 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) for( i=0; i<nCount; i++ ) { if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i], - aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED ) ) + aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HasAttrFlags::Merged ) ) { SCCOL nEndCol = aWorkRange.aEnd.Col(); SCROW nEndRow = aWorkRange.aEnd.Row(); @@ -417,7 +417,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) for( i=0; i<nCount; i++ ) { if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i], - aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + aWorkRange.aEnd.Col(), aWorkRange.aEnd.Row(), pTabs[i], HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { // #i51445# old merge flag attributes must be deleted also for single cells, // not only for whole columns/rows @@ -1235,7 +1235,7 @@ void ScUndoDragDrop::DoUndo( ScRange aRange ) rDoc.DeleteAreaTab( aRange, nDelFlags ); pRefUndoDoc->CopyToDocument(aRange, nUndoFlags, false, rDoc); - if ( rDoc.HasAttrib( aRange, HASATTR_MERGED ) ) + if ( rDoc.HasAttrib( aRange, HasAttrFlags::Merged ) ) rDoc.ExtendMerge( aRange, true ); aPaintRange.aEnd.SetCol( std::max( aPaintRange.aEnd.Col(), aRange.aEnd.Col() ) ); @@ -1691,7 +1691,7 @@ void ScUndoSelectionStyle::DoChange( const bool bUndo ) SetViewMarkData( aMarkData ); ScRange aWorkRange( aRange ); - if ( rDoc.HasAttrib( aWorkRange, HASATTR_MERGED ) ) // Merged cells? + if ( rDoc.HasAttrib( aWorkRange, HasAttrFlags::Merged ) ) // Merged cells? rDoc.ExtendMerge( aWorkRange, true ); sal_uInt16 nExtFlags = 0; diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 6f52603..9c0e21a 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -392,7 +392,7 @@ void ScUndoSelectionAttr::DoChange( const bool bUndo ) SetViewMarkData( aMarkData ); ScRange aEffRange( aRangeCover ); - if ( rDoc.HasAttrib( aEffRange, HASATTR_MERGED ) ) // merged cells? + if ( rDoc.HasAttrib( aEffRange, HasAttrFlags::Merged ) ) // merged cells? rDoc.ExtendMerge( aEffRange ); sal_uInt16 nExtFlags = 0; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 722de40..c578928 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -5379,7 +5379,7 @@ sal_Bool SAL_CALL ScCellRangeObj::getIsMerged() throw(uno::RuntimeException, std { SolarMutexGuard aGuard; ScDocShell* pDocSh = GetDocShell(); - return pDocSh && pDocSh->GetDocument().HasAttrib( aRange, HASATTR_MERGED ); + return pDocSh && pDocSh->GetDocument().HasAttrib( aRange, HasAttrFlags::Merged ); } // XCellSeries diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index afbe709..31f2e1ea 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -157,7 +157,7 @@ static bool lcl_CopyData( ScDocument* pSrcDoc, const ScRange& rSrcRange, pSrcDoc->CopyToClip(aClipParam, pClipDoc.get(), &aSourceMark, false, false); if ( pClipDoc->HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, - HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { ScPatternAttr aPattern( pSrcDoc->GetPool() ); aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 72bc3ff..70f0f9b 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1348,7 +1348,7 @@ util::TriState lclGetMergedState( const uno::Reference< table::XCellRange >& rxC of a merged range is part of this range are not covered. */ ScRange aScRange; ScUnoConversion::FillScRange( aScRange, aRangeAddr ); - bool bHasMerged = getDocumentFromRange( rxCellRange ).HasAttrib( aScRange, HASATTR_MERGED | HASATTR_OVERLAPPED ); + bool bHasMerged = getDocumentFromRange( rxCellRange ).HasAttrib( aScRange, HasAttrFlags::Merged | HasAttrFlags::Overlapped ); return bHasMerged ? util::TriState_INDETERMINATE : util::TriState_NO; } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index c104203..bb8dd9d 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -385,7 +385,7 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord, } if (rDoc.HasAttrib( rParam.nCol1, rParam.nRow1+1, nTab, - rParam.nCol2, rParam.nRow2, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) + rParam.nCol2, rParam.nRow2, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped )) { ErrorMessage(STR_MSSG_INSERTCELLS_0); // do not insert into merged return; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b36b3af..2f4776b 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1567,7 +1567,7 @@ bool ScGridWindow::IsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB nTab, S // to the left, there is no cell that would contain (potentially // overrunning) text - if (nNonEmptyX < 0 || pDoc->HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED)) + if (nNonEmptyX < 0 || pDoc->HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped)) return false; double nPPTX = pViewData->GetPPTX(); @@ -2257,7 +2257,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) bool bEditAllowed = true; if ( pProtect && pProtect->isProtected() ) { - bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED); + bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected); bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); @@ -2963,7 +2963,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) if ( pProtect && pProtect->isProtected() ) { // This sheet is protected. Check if a context menu is allowed on this cell. - bool bCellProtected = pDoc->HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HASATTR_PROTECTED); + bool bCellProtected = pDoc->HasAttrib(nCellX, nCellY, nTab, nCellX, nCellY, nTab, HasAttrFlags::Protected); bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); bool bSelUnprotected = pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 2e60997..2fd9925 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -626,13 +626,13 @@ bool ScHeaderControl::IsSelectionAllowed(SCCOLROW nPos) const { // row header SCROW nRPos = static_cast<SCROW>(nPos); - bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, MAXCOL, nRPos, nTab, HASATTR_PROTECTED); + bCellsProtected = pDoc->HasAttrib(0, nRPos, nTab, MAXCOL, nRPos, nTab, HasAttrFlags::Protected); } else { // column header SCCOL nCPos = static_cast<SCCOL>(nPos); - bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, MAXROW, nTab, HASATTR_PROTECTED); + bCellsProtected = pDoc->HasAttrib(nCPos, 0, nTab, nCPos, MAXROW, nTab, HasAttrFlags::Protected); } bool bSelProtected = pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index c981c63..069f7e4 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1537,7 +1537,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA if ( nTempX < nX1 && !IsEmptyCellText( pThisRowInfo, nTempX, nY ) && - !mpDoc->HasAttrib( nTempX,nY,nTab, nX1,nY,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + !mpDoc->HasAttrib( nTempX,nY,nTab, nX1,nY,nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { nCellX = nTempX; bDoCell = true; @@ -1556,7 +1556,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA if ( nTempX > nX && !IsEmptyCellText( pThisRowInfo, nTempX, nY ) && - !mpDoc->HasAttrib( nTempX,nY,nTab, nX,nY,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + !mpDoc->HasAttrib( nTempX,nY,nTab, nX,nY,nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { nCellX = nTempX; bDoCell = true; @@ -4530,7 +4530,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) if ( nTempX > nX && !IsEmptyCellText( pThisRowInfo, nTempX, nY ) && - !mpDoc->HasAttrib( nTempX,nY,nTab, nX,nY,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + !mpDoc->HasAttrib( nTempX,nY,nTab, nX,nY,nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { nCellX = nTempX; bDoCell = true; diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index cd8e05a..a23fba0 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -721,10 +721,10 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew ) } if ( nEndCol < MAXCOL && pDoc->HasAttrib( - nEndCol,nStartRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HASATTR_SHADOW_RIGHT ) ) + nEndCol,nStartRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowRight ) ) ++nEndCol; if ( nEndRow < MAXROW && pDoc->HasAttrib( - nStartCol,nEndRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HASATTR_SHADOW_DOWN ) ) + nStartCol,nEndRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowDown ) ) ++nEndRow; if (!bChangeCol) nEndCol = nOldEndCol; diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index e81a275..8f1f92d 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -427,7 +427,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, bool bScrol if ( bSkipProtected && bSkipUnprotected ) return false; - bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED); + bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Protected); if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) ) // Don't select this cell! return false; diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 42b843c..275002c 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -51,7 +51,7 @@ namespace { bool isCellQualified(ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) { bool bCellProtected = pDoc->HasAttrib( - nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_PROTECTED); + nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Protected); if (bCellProtected && !bSelectLocked) return false; @@ -744,9 +744,9 @@ void ScTabView::SkipCursorHorizontal(SCsCOL& rCurX, SCsROW& rCurY, SCsCOL nOldX, { bSkipCell = pDoc->ColHidden(rCurX, nTab) || pDoc->IsHorOverlapped(rCurX, rCurY, nTab); if (bSkipProtected && !bSkipCell) - bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HASATTR_PROTECTED); + bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected); if (bSkipUnprotected && !bSkipCell) - bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HASATTR_PROTECTED); + bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected); if (bSkipCell) { @@ -804,9 +804,9 @@ void ScTabView::SkipCursorVertical(SCsCOL& rCurX, SCsROW& rCurY, SCsROW nOldY, S SCROW nLastRow = -1; bSkipCell = pDoc->RowHidden(rCurY, nTab, nullptr, &nLastRow) || pDoc->IsVerOverlapped( rCurX, rCurY, nTab ); if (bSkipProtected && !bSkipCell) - bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HASATTR_PROTECTED); + bSkipCell = pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected); if (bSkipUnprotected && !bSkipCell) - bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HASATTR_PROTECTED); + bSkipCell = !pDoc->HasAttrib(rCurX, rCurY, nTab, rCurX, rCurY, nTab, HasAttrFlags::Protected); if (bSkipCell) { diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 2342999..630dbad 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1055,7 +1055,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter ) } if ( rDoc.HasAttrib( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab, - HASATTR_MERGED | HASATTR_OVERLAPPED ) ) + HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { // "Don't nest merging !" ErrorMessage(STR_MSSG_MERGECELLS_0); return false; @@ -1138,7 +1138,7 @@ bool ScViewFunc::TestRemoveMerge() if (GetViewData().GetSimpleArea( aRange ) == SC_MARK_SIMPLE) { ScDocument* pDoc = GetViewData().GetDocument(); - if ( pDoc->HasAttrib( aRange, HASATTR_MERGED ) ) + if ( pDoc->HasAttrib( aRange, HasAttrFlags::Merged ) ) bMerged = true; } return bMerged; diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 88d1f14..6ef87ad 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -802,7 +802,7 @@ bool ScViewFunc::PasteOnDrawObjectLinked( } static bool lcl_SelHasAttrib( ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, - const ScMarkData& rTabSelection, sal_uInt16 nMask ) + const ScMarkData& rTabSelection, HasAttrFlags nMask ) { ScMarkData::const_iterator itr = rTabSelection.begin(), itrEnd = rTabSelection.end(); for (; itr != itrEnd; ++itr) @@ -1185,7 +1185,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, } if (bClipOver) - if (lcl_SelHasAttrib( pDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HASATTR_OVERLAPPED )) + if (lcl_SelHasAttrib( pDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped )) { // "Cell merge not possible if cells already merged" ScDocAttrIterator aIter( pDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow ); const ScPatternAttr* pPattern = nullptr; diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index e43ef8a..5b5c3ca 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1773,7 +1773,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) aMarkRange.aStart.SetRow(GetViewData().GetCurY()); aMarkRange.aStart.SetTab(GetViewData().GetTabNo()); aMarkRange.aEnd = aMarkRange.aStart; - if ( pDoc->HasAttrib( aMarkRange, HASATTR_MERGED ) ) + if ( pDoc->HasAttrib( aMarkRange, HasAttrFlags::Merged ) ) { aFuncMark.SetMarkArea( aMarkRange ); } @@ -2061,7 +2061,7 @@ void ScViewFunc::SetWidthOrHeight( { if (rDoc.HasAttrib( static_cast<SCCOL>(nStart),0,nTab, static_cast<SCCOL>(nEnd),MAXROW,nTab, - HASATTR_MERGED | HASATTR_OVERLAPPED )) + HasAttrFlags::Merged | HasAttrFlags::Overlapped )) nStart = 0; if (nStart > 0) // go upwards because of Lines and cursor --nStart; @@ -2070,7 +2070,7 @@ void ScViewFunc::SetWidthOrHeight( } else { - if (rDoc.HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HASATTR_MERGED | HASATTR_OVERLAPPED )) + if (rDoc.HasAttrib( 0,nStart,nTab, MAXCOL,nEnd,nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped )) nStart = 0; if (nStart != 0) --nStart; @@ -2265,7 +2265,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) if ( bAnyEdit ) { UpdateEditView(); - if ( rDoc.HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HASATTR_NEEDHEIGHT ) ) + if ( rDoc.HasAttrib( nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::NeedHeight ) ) { ScInputHandler* pHdl = pScMod->GetInputHdl( GetViewData().GetViewShell() ); if (pHdl) commit 5d944079fa264777293a869e38e38424edceedfa Author: Noel Grandin <[email protected]> Date: Fri Sep 23 14:56:27 2016 +0200 convert SUBTOTAL constants to typed_flags_set Change-Id: If3d7f874d11de1eac53dc37c3e86667236db493e diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 21f5ffc..cb24ad1 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -54,12 +54,12 @@ class ScValueIterator // walk through all values in an area const ScAttrArray* pAttrArray; sal_uLong nNumFormat; // for CalcAsShown sal_uLong nNumFmtIndex; - ScAddress maStartPos; - ScAddress maEndPos; - SCCOL mnCol; - SCTAB mnTab; + ScAddress maStartPos; + ScAddress maEndPos; + SCCOL mnCol; + SCTAB mnTab; SCROW nAttrEndRow; - sal_uInt16 mnSubTotalFlags; + SubtotalFlags mnSubTotalFlags; short nNumFmtType; bool bNumValid; bool bCalcAsShown; @@ -82,7 +82,7 @@ class ScValueIterator // walk through all values in an area public: ScValueIterator( - ScDocument* pDocument, const ScRange& rRange, sal_uInt16 nSubTotalFlags = 0x00, + ScDocument* pDocument, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE, bool bTextAsZero = false ); void GetCurNumFmtInfo( short& nType, sal_uLong& nIndex ); @@ -204,13 +204,13 @@ class ScCellIterator { typedef std::pair<sc::CellStoreType::const_iterator, size_t> PositionType; - ScDocument* mpDoc; - ScAddress maStartPos; - ScAddress maEndPos; - ScAddress maCurPos; + ScDocument* mpDoc; + ScAddress maStartPos; + ScAddress maEndPos; + ScAddress maCurPos; - PositionType maCurColPos; - sal_uInt16 mnSubTotalFlags; + PositionType maCurColPos; + SubtotalFlags mnSubTotalFlags; ScRefCellValue maCurCell; @@ -224,7 +224,7 @@ class ScCellIterator bool getCurrent(); public: - ScCellIterator( ScDocument* pDoc, const ScRange& rRange, sal_uInt16 nSubTotalFlags = 0x00 ); + ScCellIterator( ScDocument* pDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags = SubtotalFlags::NONE ); const ScAddress& GetPos() const { return maCurPos; } diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 7eda980..7ccf940 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -220,15 +220,20 @@ enum class ScScenarioFlags{ // scenario flags Value = 32, Protected = 64 }; -namespace o3tl -{ +namespace o3tl { template<> struct typed_flags<ScScenarioFlags> : is_typed_flags<ScScenarioFlags, 127> {}; } -#define SUBTOTAL_IGN_NESTED_ST_AG 0x08 -#define SUBTOTAL_IGN_ERR_VAL 0x04 -#define SUBTOTAL_IGN_HIDDEN 0x02 -#define SUBTOTAL_IGN_FILTERED 0x01 +enum class SubtotalFlags { + NONE = 0x00, + IgnoreNestedStAg = 0x08, + IgnoreErrVal = 0x04, + IgnoreHidden = 0x02, + IgnoreFiltered = 0x01 +}; +namespace o3tl { + template<> struct typed_flags<SubtotalFlags> : is_typed_flags<SubtotalFlags, 0x0f> {}; +} enum class ScCloneFlags{ /** Default cell clone flags: do not start listening, do not adjust 3D refs to diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index ed39123..325145a 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -96,7 +96,7 @@ void ScAttrArray_IterGetNumberFormat( sal_uLong& nFormat, const ScAttrArray*& rp } ScValueIterator::ScValueIterator( ScDocument* pDocument, const ScRange& rRange, - sal_uInt16 nSubTotalFlags, bool bTextZero ) + SubtotalFlags nSubTotalFlags, bool bTextZero ) : pDoc(pDocument) , pAttrArray(nullptr) , nNumFormat(0) // Initialized in GetNumberFormat @@ -190,9 +190,9 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr) SCROW nCurRow = GetRow(); SCROW nLastRow; // Skip all filtered or hidden rows, depending on mnSubTotalFlags - if ( ( ( mnSubTotalFlags & SUBTOTAL_IGN_FILTERED ) && + if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) && pDoc->RowFiltered( nCurRow, mnTab, nullptr, &nLastRow ) ) || - ( ( mnSubTotalFlags & SUBTOTAL_IGN_HIDDEN ) && + ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) && pDoc->RowHidden( nCurRow, mnTab, nullptr, &nLastRow ) ) ) { SetPos(nLastRow+1); @@ -218,7 +218,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr) case sc::element_type_formula: { ScFormulaCell& rCell = *sc::formula_block::at(*maCurPos.first->data, maCurPos.second); - if ( ( mnSubTotalFlags & SUBTOTAL_IGN_NESTED_ST_AG ) && rCell.IsSubTotal() ) + if ( ( mnSubTotalFlags & SubtotalFlags::IgnoreNestedStAg ) && rCell.IsSubTotal() ) { // Skip subtotal formula cells. IncPos(); @@ -227,7 +227,7 @@ bool ScValueIterator::GetThis(double& rValue, FormulaError& rErr) if (rCell.GetErrorOrValue(rErr, rValue)) { - if ( rErr != FormulaError::NONE && ( mnSubTotalFlags & SUBTOTAL_IGN_ERR_VAL ) ) + if ( rErr != FormulaError::NONE && ( mnSubTotalFlags & SubtotalFlags::IgnoreErrVal ) ) { IncPos(); break; @@ -834,7 +834,7 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next() return &maEntries[mnIndex++]; } -ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, sal_uInt16 nSubTotalFlags ) : +ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, SubtotalFlags nSubTotalFlags ) : mpDoc(pDoc), maStartPos(rRange.aStart), maEndPos(rRange.aEnd), @@ -949,9 +949,9 @@ bool ScCellIterator::getCurrent() SCROW nLastRow; // Skip all filtered or hidden rows, depending on mSubTotalFlags - if ( ( ( mnSubTotalFlags & SUBTOTAL_IGN_FILTERED ) && + if ( ( ( mnSubTotalFlags & SubtotalFlags::IgnoreFiltered ) && pCol->GetDoc().RowFiltered(maCurPos.Row(), maCurPos.Tab(), nullptr, &nLastRow) ) || - ( ( mnSubTotalFlags & SUBTOTAL_IGN_HIDDEN ) && + ( ( mnSubTotalFlags & SubtotalFlags::IgnoreHidden ) && pCol->GetDoc().RowHidden(maCurPos.Row(), maCurPos.Tab(), nullptr, &nLastRow) ) ) { setPos(nLastRow+1); @@ -960,12 +960,12 @@ bool ScCellIterator::getCurrent() if (maCurColPos.first->type == sc::element_type_formula) { - if ( mnSubTotalFlags ) + if ( mnSubTotalFlags != SubtotalFlags::NONE ) { ScFormulaCell* pCell = sc::formula_block::at(*maCurColPos.first->data, maCurColPos.second); // Skip formula cells with Subtotal formulae or errors, depending on mnSubTotalFlags ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
