From 233df63c540f4431ae67693021309ccb66b8f764 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 18 May 2016 11:56:40 +0200 Subject: Convert SC_MF to scoped enum Change-Id: I3089006b502e33710bfb2564f051ebf2892ad08a Reviewed-on: https://gerrit.libreoffice.org/25085 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/attarray.hxx | 6 ++--- sc/inc/attrib.hxx | 48 +++++++++++++++++++++---------------- sc/inc/column.hxx | 5 ++-- sc/inc/document.hxx | 5 ++-- sc/inc/table.hxx | 4 ++-- sc/qa/unit/ucalc.cxx | 2 +- sc/source/core/data/attarray.cxx | 30 +++++++++++------------ sc/source/core/data/attrib.cxx | 8 +++---- sc/source/core/data/column.cxx | 6 ++--- sc/source/core/data/column2.cxx | 4 ++-- sc/source/core/data/documen3.cxx | 14 +++++------ sc/source/core/data/document.cxx | 10 ++++---- sc/source/core/data/dpobject.cxx | 10 ++++---- sc/source/core/data/dpoutput.cxx | 14 +++++------ sc/source/core/data/fillinfo.cxx | 26 ++++++++++---------- sc/source/core/data/table2.cxx | 10 ++++---- sc/source/filter/excel/excimp8.cxx | 4 ++-- sc/source/filter/excel/exctools.cxx | 2 +- sc/source/filter/excel/xipivot.cxx | 18 +++++++------- sc/source/filter/rtf/eeimpars.cxx | 6 ++--- sc/source/filter/xml/xmldpimp.cxx | 12 +++++----- sc/source/filter/xml/xmldrani.cxx | 2 +- sc/source/filter/xml/xmlsceni.cxx | 2 +- sc/source/ui/docshell/dbdocfun.cxx | 2 +- sc/source/ui/docshell/docfunc.cxx | 14 +++++------ sc/source/ui/docshell/docsh5.cxx | 6 ++--- sc/source/ui/undo/undobase.cxx | 2 +- sc/source/ui/undo/undoblk.cxx | 4 ++-- sc/source/ui/undo/undodat.cxx | 4 ++-- sc/source/ui/unoobj/cellsuno.cxx | 2 +- sc/source/ui/unoobj/datauno.cxx | 4 ++-- sc/source/ui/vba/vbaworksheet.cxx | 4 ++-- sc/source/ui/view/dbfunc.cxx | 18 +++++++------- sc/source/ui/view/output.cxx | 4 ++-- sc/source/ui/view/output2.cxx | 12 +++++----- sc/source/ui/view/viewdata.cxx | 2 +- sc/source/ui/view/viewfun2.cxx | 2 +- sc/source/ui/view/viewfunc.cxx | 2 +- 38 files changed, 170 insertions(+), 160 deletions(-) diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx index 04aab80355f1..afff019bbde6 100644 --- a/sc/inc/attarray.hxx +++ b/sc/inc/attarray.hxx @@ -150,8 +150,8 @@ public: SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, const ScMarkArray* pMarkArray = nullptr) const; - bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); - bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ); + bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ); bool Search( SCROW nRow, SCSIZE& nIndex ) const; @@ -187,7 +187,7 @@ public: void DeleteArea( SCROW nStartRow, SCROW nEndRow ); void MoveTo( SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray ); void CopyArea( - SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags = 0) const; + SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, ScMF nStripFlags = ScMF::NONE) const; void DeleteHardAttr( SCROW nStartRow, SCROW nEndRow ); diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index 2fcb3fcc4ca5..a3374e8c4ec2 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -23,22 +23,28 @@ #include #include #include +#include #include "scdllapi.h" #include "global.hxx" #include "address.hxx" - // flags for cells hidden by merge - // and control for auto filter -#define SC_MF_HOR 0x0001 -#define SC_MF_VER 0x0002 -#define SC_MF_AUTO 0x0004 /// autofilter arrow -#define SC_MF_BUTTON 0x0008 /// field button for datapilot -#define SC_MF_SCENARIO 0x0010 -#define SC_MF_BUTTON_POPUP 0x0020 /// dp button with popup arrow -#define SC_MF_HIDDEN_MEMBER 0x0040 /// dp field button with presence of hidden member -#define SC_MF_DP_TABLE 0x0080 /// dp table output - -#define SC_MF_ALL 0x00FF +// flags for cells hidden by merge +// and control for auto filter +enum class ScMF { + NONE = 0x0000, + Hor = 0x0001, + Ver = 0x0002, + Auto = 0x0004, /// autofilter arrow + Button = 0x0008, /// field button for datapilot + Scenario = 0x0010, + ButtonPopup = 0x0020, /// dp button with popup arrow + HiddenMember = 0x0040, /// dp field button with presence of hidden member + DpTable = 0x0080, /// dp table output + All = 0x00FF +}; +namespace o3tl { + template<> struct typed_flags : is_typed_flags {}; +} class EditTextObject; namespace editeng { class SvxBorderLine; } @@ -77,21 +83,23 @@ class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item { public: ScMergeFlagAttr(); - ScMergeFlagAttr(sal_Int16 nFlags); + ScMergeFlagAttr(ScMF nFlags); virtual ~ScMergeFlagAttr(); SfxPoolItem * Clone(SfxItemPool * pPool) const override; - bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; } - bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; } - bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; } + ScMF GetValue() const { return (ScMF) SfxInt16Item::GetValue(); } + + bool IsHorOverlapped() const { return bool( GetValue() & ScMF::Hor ); } + bool IsVerOverlapped() const { return bool( GetValue() & ScMF::Ver ); } + bool IsOverlapped() const { return bool( GetValue() & ( ScMF::Hor | ScMF::Ver ) ); } - bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; } + bool HasAutoFilter() const { return bool( GetValue() & ScMF::Auto ); } - bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; } + bool IsScenario() const { return bool( GetValue() & ScMF::Scenario ); } - bool HasPivotButton() const; - bool HasPivotPopupButton() const; + bool HasPivotButton() const; + bool HasPivotPopupButton() const; }; class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 9a7e3cebf599..9754e5acb109 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -102,6 +102,7 @@ struct ScRefCellValue; struct ScCellValue; class ScDocumentImport; class ScHint; +enum class ScMF; struct ScNeededSizeOptions { @@ -479,8 +480,8 @@ public: SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, bool bUp, bool bInSelection, const ScMarkData& rMark) const; - bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); - bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ); + bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ); void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich ); void RemoveProtected( SCROW nStartRow, SCROW nEndRow ); diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 108c0c55798c..5696f260f789 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -48,6 +48,7 @@ #include "markdata.hxx" enum class SvtScriptType; +enum class ScMF; namespace editeng { class SvxBorderLine; } namespace formula { struct VectorRefArray; } namespace svl { @@ -1630,10 +1631,10 @@ public: SC_DLLPUBLIC bool ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, - SCTAB nTab, sal_Int16 nFlags ); + SCTAB nTab, ScMF nFlags ); SC_DLLPUBLIC bool RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, - SCTAB nTab, sal_Int16 nFlags ); + SCTAB nTab, ScMF nFlags ); SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr ); SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 3906e707c7da..b6e69c172e5b 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -649,8 +649,8 @@ public: bool IsStyleSheetUsed( const ScStyleSheet& rStyle ) const; - bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags ); - bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags ); + bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags ); + bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScMF nFlags ); void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = nullptr ); void DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast = true ); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index e92fd6f4345d..9cecaccf510c 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -2899,7 +2899,7 @@ void Test::testAutofilter() pDBData->GetArea(aRange); m_pDoc->ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO); + aRange.aStart.Tab(), ScMF::Auto); //create the query param ScQueryParam aParam; diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index d7c1f3027004..d22b868f0a22 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1388,13 +1388,13 @@ bool ScAttrArray::ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, { if ( nMergeEndCol > nThisCol ) pDocument->ApplyFlagsTab( nThisCol+1, nThisRow, nMergeEndCol, pData[i].nRow, - nTab, SC_MF_HOR ); + nTab, ScMF::Hor ); if ( nMergeEndRow > nThisRow ) pDocument->ApplyFlagsTab( nThisCol, nThisRow+1, nThisCol, nMergeEndRow, - nTab, SC_MF_VER ); + nTab, ScMF::Ver ); if ( nMergeEndCol > nThisCol && nMergeEndRow > nThisRow ) pDocument->ApplyFlagsTab( nThisCol+1, nThisRow+1, nMergeEndCol, nMergeEndRow, - nTab, SC_MF_HOR | SC_MF_VER ); + nTab, ScMF::Hor | ScMF::Ver ); Search( nThisRow, i ); // Data changed Search( nStartRow, nStartIndex ); @@ -1525,11 +1525,11 @@ void ScAttrArray::SetPatternAreaSafe( SCROW nStartRow, SCROW nEndRow, } } -bool ScAttrArray::ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ) +bool ScAttrArray::ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) { const ScPatternAttr* pOldPattern; - sal_Int16 nOldValue; + ScMF nOldValue; SCSIZE nIndex; SCROW nRow; SCROW nThisRow; @@ -1561,11 +1561,11 @@ bool ScAttrArray::ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ) return bChanged; } -bool ScAttrArray::RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ) +bool ScAttrArray::RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) { const ScPatternAttr* pOldPattern; - sal_Int16 nOldValue; + ScMF nOldValue; SCSIZE nIndex; SCROW nRow; SCROW nThisRow; @@ -2056,8 +2056,8 @@ void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize ) } // Don't duplicate the merge flags in the inserted row. - // #i108488# SC_MF_SCENARIO has to be allowed. - RemoveFlags( nStartRow, nStartRow+nSize-1, SC_MF_HOR | SC_MF_VER | SC_MF_AUTO | SC_MF_BUTTON ); + // #i108488# ScMF::Scenario has to be allowed. + RemoveFlags( nStartRow, nStartRow+nSize-1, ScMF::Hor | ScMF::Ver | ScMF::Auto | ScMF::Button ); } void ScAttrArray::DeleteRow( SCROW nStartRow, SCSIZE nSize ) @@ -2104,7 +2104,7 @@ void ScAttrArray::DeleteRow( SCROW nStartRow, SCSIZE nSize ) // Below does not follow the pattern to detect pressure ranges; // instead, only remove merge flags. - RemoveFlags( MAXROW-nSize+1, MAXROW, SC_MF_HOR | SC_MF_VER | SC_MF_AUTO ); + RemoveFlags( MAXROW-nSize+1, MAXROW, ScMF::Hor | ScMF::Ver | ScMF::Auto ); } void ScAttrArray::DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex ) @@ -2190,7 +2190,7 @@ void ScAttrArray::MoveTo(SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray * Copy between documents (Clipboard) */ void ScAttrArray::CopyArea( - SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, sal_Int16 nStripFlags) const + SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, ScMF nStripFlags) const { nStartRow -= nDy; // Source nEndRow -= nDy; @@ -2216,15 +2216,15 @@ void ScAttrArray::CopyArea( pNewPattern = static_cast( &pDestDocPool->GetDefaultItem( ATTR_PATTERN )); } - else if ( nStripFlags ) + else if ( nStripFlags != ScMF::NONE ) { std::unique_ptr pTmpPattern(new ScPatternAttr( *pOldPattern )); - sal_Int16 nNewFlags = 0; - if ( nStripFlags != SC_MF_ALL ) + ScMF nNewFlags = ScMF::NONE; + if ( nStripFlags != ScMF::All ) nNewFlags = static_cast(pTmpPattern->GetItem(ATTR_MERGE_FLAG)). GetValue() & ~nStripFlags; - if ( nNewFlags ) + if ( nNewFlags != ScMF::NONE ) pTmpPattern->GetItemSet().Put( ScMergeFlagAttr( nNewFlags ) ); else pTmpPattern->GetItemSet().ClearItem( ATTR_MERGE_FLAG ); diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx index 4341943b7a30..5b6c9227ec47 100644 --- a/sc/source/core/data/attrib.cxx +++ b/sc/source/core/data/attrib.cxx @@ -134,8 +134,8 @@ ScMergeFlagAttr::ScMergeFlagAttr(): { } -ScMergeFlagAttr::ScMergeFlagAttr(sal_Int16 nFlags): - SfxInt16Item(ATTR_MERGE_FLAG, nFlags) +ScMergeFlagAttr::ScMergeFlagAttr(ScMF nFlags): + SfxInt16Item(ATTR_MERGE_FLAG, static_cast(nFlags)) { } @@ -150,12 +150,12 @@ SfxPoolItem * ScMergeFlagAttr::Clone(SfxItemPool *) const bool ScMergeFlagAttr::HasPivotButton() const { - return (GetValue() & SC_MF_BUTTON) != 0; + return bool(static_cast(GetValue()) & ScMF::Button); } bool ScMergeFlagAttr::HasPivotPopupButton() const { - return (GetValue() & SC_MF_BUTTON_POPUP) != 0; + return bool(static_cast(GetValue()) & ScMF::ButtonPopup); } /** diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index 80a0d7944e12..f846028af0f7 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -668,12 +668,12 @@ bool ScColumn::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const return pAttrArray->IsStyleSheetUsed( rStyle, true/*bGatherAllStyles*/ ); } -bool ScColumn::ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ) +bool ScColumn::ApplyFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) { return pAttrArray->ApplyFlags( nStartRow, nEndRow, nFlags ); } -bool ScColumn::RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ) +bool ScColumn::RemoveFlags( SCROW nStartRow, SCROW nEndRow, ScMF nFlags ) { return pAttrArray->RemoveFlags( nStartRow, nEndRow, nFlags ); } @@ -1022,7 +1022,7 @@ void ScColumn::CopyToClip( sc::CopyToClipContext& rCxt, SCROW nRow1, SCROW nRow2, ScColumn& rColumn ) const { pAttrArray->CopyArea( nRow1, nRow2, 0, *rColumn.pAttrArray, - rCxt.isKeepScenarioFlags() ? (SC_MF_ALL & ~SC_MF_SCENARIO) : SC_MF_ALL ); + rCxt.isKeepScenarioFlags() ? (ScMF::All & ~ScMF::Scenario) : ScMF::All ); { CopyToClipHandler aFunc(*this, rColumn, rCxt.getBlockPosition(rColumn.nTab, rColumn.nCol), rCxt.isCloneNotes()); diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 0e559307efa9..19a7aede99f5 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -560,8 +560,8 @@ long ScColumn::GetNeededSize( // 20 * nZoom/100 // Conditional formatting is not interesting here - sal_Int16 nFlags = static_cast(pPattern->GetItem(ATTR_MERGE_FLAG)).GetValue(); - if (nFlags & SC_MF_AUTO) + ScMF nFlags = static_cast(pPattern->GetItem(ATTR_MERGE_FLAG)).GetValue(); + if (nFlags & ScMF::Auto) nValue += (rZoomX.GetNumerator()*20)/rZoomX.GetDenominator(); } return nValue; diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 2618eb151521..c38714dfccb7 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -289,7 +289,7 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, bool bRemove aOldRange.aEnd.SetRow(aOldRange.aStart.Row()); RemoveFlagsTab( aOldRange.aStart.Col(), aOldRange.aStart.Row(), aOldRange.aEnd.Col(), aOldRange.aEnd.Row(), - aOldRange.aStart.Tab(), SC_MF_AUTO ); + aOldRange.aStart.Tab(), ScMF::Auto ); RepaintRange( aOldRange ); } } @@ -1447,7 +1447,7 @@ bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) { SCCOL nCol; SCROW nRow; - sal_Int16 nFlag; + ScMF nFlag; ScQueryParam aParam; pDBData->GetQueryParam( aParam ); @@ -1459,7 +1459,7 @@ bool ScDocument::HasAutoFilter( SCCOL nCurCol, SCROW nCurRow, SCTAB nCurTab ) GetAttr( nCol, nRow, nCurTab, ATTR_MERGE_FLAG ))-> GetValue(); - if ( (nFlag & SC_MF_AUTO) == 0 ) + if ( !(nFlag & ScMF::Auto) ) bHasAutoFilter = false; } } @@ -2004,11 +2004,11 @@ void ScDocument::DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, ApplyAttr( nStartCol, nStartRow, nTab, aAttr ); if ( nEndCol > nStartCol ) - ApplyFlagsTab( nStartCol+1, nStartRow, nEndCol, nStartRow, nTab, SC_MF_HOR ); + ApplyFlagsTab( nStartCol+1, nStartRow, nEndCol, nStartRow, nTab, ScMF::Hor ); if ( nEndRow > nStartRow ) - ApplyFlagsTab( nStartCol, nStartRow+1, nStartCol, nEndRow, nTab, SC_MF_VER ); + ApplyFlagsTab( nStartCol, nStartRow+1, nStartCol, nEndRow, nTab, ScMF::Ver ); if ( nEndCol > nStartCol && nEndRow > nStartRow ) - ApplyFlagsTab( nStartCol+1, nStartRow+1, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); + ApplyFlagsTab( nStartCol+1, nStartRow+1, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); // Remove all covered notes (removed captions are collected by drawing undo if active) InsertDeleteFlags nDelFlag = InsertDeleteFlags::NOTE | (bDeleteCaptions ? InsertDeleteFlags::NONE : InsertDeleteFlags::NOCAPTIONS); @@ -2029,7 +2029,7 @@ void ScDocument::RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ) SCCOL nEndCol = nCol + pAttr->GetColMerge() - 1; SCROW nEndRow = nRow + pAttr->GetRowMerge() - 1; - RemoveFlagsTab( nCol, nRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); + RemoveFlagsTab( nCol, nRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); const ScMergeAttr* pDefAttr = static_cast( &xPoolHelper->GetDocPool()->GetDefaultItem( ATTR_MERGE )); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 78ed21f57b6b..f5ad18c25d6f 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -4874,7 +4874,7 @@ bool ScDocument::IsStyleSheetUsed( const ScStyleSheet& rStyle ) const } bool ScDocument::ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, sal_Int16 nFlags ) + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags ) { if (ValidTab(nTab) && nTab < static_cast(maTabs.size())) if (maTabs[nTab]) @@ -4885,7 +4885,7 @@ bool ScDocument::ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow, } bool ScDocument::RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow, - SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, sal_Int16 nFlags ) + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, ScMF nFlags ) { if (ValidTab(nTab) && nTab < static_cast(maTabs.size())) if (maTabs[nTab]) @@ -5526,7 +5526,7 @@ bool ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow, // Delete Autofilter - bool bChange = RemoveFlagsTab( nStartCol,nStartRow, nEndCol,nEndRow, nTab, SC_MF_AUTO ); + bool bChange = RemoveFlagsTab( nStartCol,nStartRow, nEndCol,nEndRow, nTab, ScMF::Auto ); // Set Autofilter @@ -5542,7 +5542,7 @@ bool ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow, nDBStartCol<=nEndCol && nDBEndCol>=nStartCol ) { if (ApplyFlagsTab( nDBStartCol,nDBStartRow, nDBEndCol,nDBStartRow, - nDBTab, SC_MF_AUTO )) + nDBTab, ScMF::Auto )) bChange = true; } } @@ -5560,7 +5560,7 @@ bool ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow, nDBStartCol<=nEndCol && nDBEndCol>=nStartCol ) { if (ApplyFlagsTab( nDBStartCol,nDBStartRow, nDBEndCol,nDBStartRow, - nDBTab, SC_MF_AUTO )) + nDBTab, ScMF::Auto )) bChange = true; } } diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 5b4e9d6fb35e..531ab8176a0b 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -911,7 +911,7 @@ void ScDPObject::Output( const ScAddress& rPos ) aOutRange.aStart.Tab(), InsertDeleteFlags::ALL ); pDoc->RemoveFlagsTab( aOutRange.aStart.Col(), aOutRange.aStart.Row(), aOutRange.aEnd.Col(), aOutRange.aEnd.Row(), - aOutRange.aStart.Tab(), SC_MF_AUTO ); + aOutRange.aStart.Tab(), ScMF::Auto ); CreateOutput(); // create xSource and pOutput if not already done @@ -923,7 +923,7 @@ void ScDPObject::Output( const ScAddress& rPos ) aOutRange = pOutput->GetOutputRange(); const ScAddress& s = aOutRange.aStart; const ScAddress& e = aOutRange.aEnd; - pDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE); + pDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable); } ScRange ScDPObject::GetOutputRangeByType( sal_Int32 nType ) @@ -3473,7 +3473,7 @@ void ScDPCollection::CopyToTab( SCTAB nOld, SCTAB nNew ) e.SetTab(nNew); ScDPObject* pNew = new ScDPObject(rObj); pNew->SetOutRange(aOutRange); - mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE); + mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable); aAdded.push_back(std::unique_ptr(pNew)); } @@ -3595,7 +3595,7 @@ void ScDPCollection::FreeTable(ScDPObject* pDPObj) const ScRange& rOutRange = pDPObj->GetOutRange(); const ScAddress& s = rOutRange.aStart; const ScAddress& e = rOutRange.aEnd; - mpDoc->RemoveFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE); + mpDoc->RemoveFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable); TablesType::iterator itr = maTables.begin(), itrEnd = maTables.end(); for (; itr != itrEnd; ++itr) { @@ -3613,7 +3613,7 @@ bool ScDPCollection::InsertNewTable(ScDPObject* pDPObj) const ScRange& rOutRange = pDPObj->GetOutRange(); const ScAddress& s = rOutRange.aStart; const ScAddress& e = rOutRange.aEnd; - mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), SC_MF_DP_TABLE); + mpDoc->ApplyFlagsTab(s.Col(), s.Row(), e.Col(), e.Row(), s.Tab(), ScMF::DpTable); maTables.push_back(std::unique_ptr(pDPObj)); return true; diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 60b0311068d2..d62739effd55 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -839,21 +839,21 @@ void ScDPOutput::FieldCell( lcl_SetFrame( pDoc,nTab, nCol,nRow, nCol,nRow, 20 ); // For field button drawing - sal_uInt16 nMergeFlag = 0; + ScMF nMergeFlag = ScMF::NONE; if (rData.mbHasHiddenMember) - nMergeFlag |= SC_MF_HIDDEN_MEMBER; + nMergeFlag |= ScMF::HiddenMember; if (rData.mbPageDim) { - nMergeFlag |= SC_MF_BUTTON_POPUP; - pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, SC_MF_BUTTON); + nMergeFlag |= ScMF::ButtonPopup; + pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, ScMF::Button); pDoc->ApplyFlagsTab(nCol+1, nRow, nCol+1, nRow, nTab, nMergeFlag); } else { - nMergeFlag |= SC_MF_BUTTON; + nMergeFlag |= ScMF::Button; if (!rData.mbDataLayout) - nMergeFlag |= SC_MF_BUTTON_POPUP; + nMergeFlag |= ScMF::ButtonPopup; pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, nMergeFlag); } @@ -863,7 +863,7 @@ void ScDPOutput::FieldCell( static void lcl_DoFilterButton( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab ) { pDoc->SetString( nCol, nRow, nTab, ScGlobal::GetRscString(STR_CELL_FILTER) ); - pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, SC_MF_BUTTON); + pDoc->ApplyFlagsTab(nCol, nRow, nCol, nRow, nTab, ScMF::Button); } void ScDPOutput::CalcSizes() diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx index c50f0ede5378..8cd7534ade82 100644 --- a/sc/source/core/data/fillinfo.cxx +++ b/sc/source/core/data/fillinfo.cxx @@ -82,10 +82,10 @@ static void lcl_GetMergeRange( SCsCOL nX, SCsROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = static_cast(pDoc->GetAttr( + ScMF nOverlap = static_cast(pDoc->GetAttr( rStartX, rStartY, nTab, ATTR_MERGE_FLAG ))->GetValue(); - bHOver = ((nOverlap & SC_MF_HOR) != 0); - bVOver = ((nOverlap & SC_MF_VER) != 0); + bHOver = bool(nOverlap & ScMF::Hor); + bVOver = bool(nOverlap & ScMF::Ver); } } @@ -105,9 +105,9 @@ static void lcl_GetMergeRange( SCsCOL nX, SCsROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = static_cast(pDoc->GetAttr( + ScMF nOverlap = static_cast(pDoc->GetAttr( rStartX, rStartY, nTab, ATTR_MERGE_FLAG ))->GetValue(); - bVOver = ((nOverlap & SC_MF_VER) != 0); + bVOver = bool(nOverlap & ScMF::Ver); } } @@ -534,15 +534,15 @@ void ScDocument::FillInfo( const ScMergeAttr* pMergeAttr = static_cast( &pPattern->GetItem(ATTR_MERGE)); bool bMerged = ( pMergeAttr != pDefMerge && *pMergeAttr != *pDefMerge ); - sal_uInt16 nOverlap = static_cast( &pPattern->GetItemSet(). + ScMF nOverlap = static_cast( &pPattern->GetItemSet(). Get(ATTR_MERGE_FLAG))->GetValue(); - bool bHOverlapped = ((nOverlap & SC_MF_HOR) != 0); - bool bVOverlapped = ((nOverlap & SC_MF_VER) != 0); - bool bAutoFilter = ((nOverlap & SC_MF_AUTO) != 0); - bool bPivotButton = ((nOverlap & SC_MF_BUTTON) != 0); - bool bScenario = ((nOverlap & SC_MF_SCENARIO) != 0); - bool bPivotPopupButton = ((nOverlap & SC_MF_BUTTON_POPUP) != 0); - bool bFilterActive = ((nOverlap & SC_MF_HIDDEN_MEMBER) != 0); + bool bHOverlapped(nOverlap & ScMF::Hor); + bool bVOverlapped(nOverlap & ScMF::Ver); + bool bAutoFilter(nOverlap & ScMF::Auto); + bool bPivotButton(nOverlap & ScMF::Button); + bool bScenario(nOverlap & ScMF::Scenario); + bool bPivotPopupButton(nOverlap & ScMF::ButtonPopup); + bool bFilterActive(nOverlap & ScMF::HiddenMember); if (bMerged||bHOverlapped||bVOverlapped) bAnyMerged = true; // internal diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index f5da41e63509..479c17a8e6c4 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -338,7 +338,7 @@ void ScTable::InsertCol( aCol[nStartCol-1].CopyToColumn(aCxt, nStartRow, nEndRow, InsertDeleteFlags::ATTRIB, false, aCol[nStartCol+i] ); aCol[nStartCol+i].RemoveFlags( nStartRow, nEndRow, - SC_MF_HOR | SC_MF_VER | SC_MF_AUTO ); + ScMF::Hor | ScMF::Ver | ScMF::Auto ); aCol[nStartCol+i].ClearItems( nStartRow, nEndRow, nWhichArray ); } } @@ -910,8 +910,8 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, const ScMergeFlagAttr& rOldFlag = static_cast(rSet.Get(ATTR_MERGE_FLAG)); if (rOldFlag.IsOverlapped()) { - sal_Int16 nNewFlags = rOldFlag.GetValue() & ~( SC_MF_HOR | SC_MF_VER ); - if ( nNewFlags ) + ScMF nNewFlags = rOldFlag.GetValue() & ~ScMF( ScMF::Hor | ScMF::Ver ); + if ( nNewFlags != ScMF::NONE ) rNewSet.Put( ScMergeFlagAttr( nNewFlags ) ); else rNewSet.ClearItem( ATTR_MERGE_FLAG ); @@ -2614,7 +2614,7 @@ void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRem } bool ScTable::ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, - sal_Int16 nFlags ) + ScMF nFlags ) { bool bChanged = false; if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow)) @@ -2624,7 +2624,7 @@ bool ScTable::ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW } bool ScTable::RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, - sal_Int16 nFlags ) + ScMF nFlags ) { bool bChanged = false; if (ValidColRow(nStartCol, nStartRow) && ValidColRow(nEndCol, nEndRow)) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 9abfdd546ddd..71551f452e99 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -540,8 +540,8 @@ void XclImpAutoFilterData::SetCellAttribs() ScDocument& rDoc = pExcRoot->pIR->GetDoc(); for ( SCCOL nCol = StartCol(); nCol <= EndCol(); nCol++ ) { - sal_Int16 nFlag = static_cast( rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG ))->GetValue(); - rDoc.ApplyAttr( nCol, StartRow(), Tab(), ScMergeFlagAttr( nFlag | SC_MF_AUTO) ); + ScMF nFlag = static_cast( rDoc.GetAttr( nCol, StartRow(), Tab(), ATTR_MERGE_FLAG ))->GetValue(); + rDoc.ApplyAttr( nCol, StartRow(), Tab(), ScMergeFlagAttr( nFlag | ScMF::Auto) ); } } diff --git a/sc/source/filter/excel/exctools.cxx b/sc/source/filter/excel/exctools.cxx index 0b3fe117e1b0..d4876fef6633 100644 --- a/sc/source/filter/excel/exctools.cxx +++ b/sc/source/filter/excel/exctools.cxx @@ -238,7 +238,7 @@ void ExcScenario::Apply( const XclImpRoot& rRoot, const bool bLast ) sal_uInt16 nRow = iter->nRow; OUString aVal = iter->GetValue(); - r.ApplyFlagsTab( nCol, nRow, nCol, nRow, nNewTab, SC_MF_SCENARIO ); + r.ApplyFlagsTab( nCol, nRow, nCol, nRow, nNewTab, ScMF::Scenario ); r.SetString( nCol, nRow, nNewTab, aVal ); } diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 0bd13a5325b1..11fe5a15bde4 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -1471,12 +1471,12 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD vector::const_iterator itr = aFieldBtns.begin(), itrEnd = aFieldBtns.end(); for (; itr != itrEnd; ++itr) { - rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), SC_MF_BUTTON); + rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), ScMF::Button); - sal_uInt16 nMFlag = SC_MF_BUTTON_POPUP; + ScMF nMFlag = ScMF::ButtonPopup; OUString aName = rDoc.GetString(itr->Col(), itr->Row(), itr->Tab()); if (rSaveData.HasInvisibleMember(aName)) - nMFlag |= SC_MF_HIDDEN_MEMBER; + nMFlag |= ScMF::HiddenMember; rDoc.ApplyFlagsTab(itr->Col()+1, itr->Row(), itr->Col()+1, itr->Row(), itr->Tab(), nMFlag); } @@ -1490,12 +1490,12 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD vector::const_iterator itDim = aFieldDims.begin(); for (; itr != itrEnd; ++itr, ++itDim) { - sal_Int16 nMFlag = SC_MF_BUTTON; + ScMF nMFlag = ScMF::Button; const ScDPSaveDimension* pDim = *itDim; if (pDim->HasInvisibleMember()) - nMFlag |= SC_MF_HIDDEN_MEMBER; + nMFlag |= ScMF::HiddenMember; if (!pDim->IsDataLayout()) - nMFlag |= SC_MF_BUTTON_POPUP; + nMFlag |= ScMF::ButtonPopup; rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag); } } @@ -1509,12 +1509,12 @@ void XclImpPivotTable::ApplyMergeFlags(const ScRange& rOutRange, const ScDPSaveD vector::const_iterator itDim = aFieldDims.begin(); for (; itr != itrEnd; ++itr, ++itDim) { - sal_Int16 nMFlag = SC_MF_BUTTON; + ScMF nMFlag = ScMF::Button; const ScDPSaveDimension* pDim = *itDim; if (pDim->HasInvisibleMember()) - nMFlag |= SC_MF_HIDDEN_MEMBER; + nMFlag |= ScMF::HiddenMember; if (!pDim->IsDataLayout()) - nMFlag |= SC_MF_BUTTON_POPUP; + nMFlag |= ScMF::ButtonPopup; rDoc.ApplyFlagsTab(itr->Col(), itr->Row(), itr->Col(), itr->Row(), itr->Tab(), nMFlag); } } diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index 2fd9abe870d8..77e0c9bc0d2d 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -291,20 +291,20 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu if ( pE->nColOverlap > 1 ) mpDoc->ApplyFlagsTab( nCol+1, nRow, nCol + pE->nColOverlap - 1, nRow, nTab, - SC_MF_HOR ); + ScMF::Hor ); if ( pE->nRowOverlap > 1 ) { nRO = nRow + pE->nRowOverlap - 1; mpDoc->ApplyFlagsTab( nCol, nRow+1, nCol, nRO , nTab, - SC_MF_VER ); + ScMF::Ver ); if ( nRO > nOverlapRowMax ) nOverlapRowMax = nRO; } if ( pE->nColOverlap > 1 && pE->nRowOverlap > 1 ) mpDoc->ApplyFlagsTab( nCol+1, nRow+1, nCol + pE->nColOverlap - 1, nRO, nTab, - SC_MF_HOR | SC_MF_VER ); + ScMF::Hor | ScMF::Ver ); } const ScStyleSheet* pStyleSheet = mpDoc->GetPattern( nCol, nRow, nTab )->GetStyleSheet(); diff --git a/sc/source/filter/xml/xmldpimp.cxx b/sc/source/filter/xml/xmldpimp.cxx index de1ec719d3fa..9f593d2c7313 100644 --- a/sc/source/filter/xml/xmldpimp.cxx +++ b/sc/source/filter/xml/xmldpimp.cxx @@ -375,16 +375,16 @@ void ScXMLDataPilotTableContext::SetButtons() { // Page dimension needs 2 buttons. - pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), SC_MF_BUTTON); + pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), ScMF::Button); - sal_Int16 nMFlag = SC_MF_BUTTON_POPUP; + ScMF nMFlag = ScMF::ButtonPopup; if (bHasHidden) - nMFlag |= SC_MF_HIDDEN_MEMBER; + nMFlag |= ScMF::HiddenMember; pDoc->ApplyFlagsTab(aScAddress.Col()+1, aScAddress.Row(), aScAddress.Col()+1, aScAddress.Row(), aScAddress.Tab(), nMFlag); } else { - sal_Int16 nMFlag = SC_MF_BUTTON; + ScMF nMFlag = ScMF::Button; if (bDataLayout) { // Data layout dimension only has a plain button with no popup. @@ -393,9 +393,9 @@ void ScXMLDataPilotTableContext::SetButtons() { // Normal dimension has a popup arrow button. if (bHasHidden) - nMFlag |= SC_MF_HIDDEN_MEMBER; + nMFlag |= ScMF::HiddenMember; - nMFlag |= SC_MF_BUTTON_POPUP; + nMFlag |= ScMF::ButtonPopup; } pDoc->ApplyFlagsTab(aScAddress.Col(), aScAddress.Row(), aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), nMFlag); diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index 61e154ff2efd..641a039cd217 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -423,7 +423,7 @@ bool setAutoFilterFlags(ScDocument& rDoc, const ScDBData& rData) rData.GetArea(aRange); rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO); + aRange.aStart.Tab(), ScMF::Auto); return false; } diff --git a/sc/source/filter/xml/xmlsceni.cxx b/sc/source/filter/xml/xmlsceni.cxx index 9e44757cee16..6259b93de4f3 100644 --- a/sc/source/filter/xml/xmlsceni.cxx +++ b/sc/source/filter/xml/xmlsceni.cxx @@ -150,7 +150,7 @@ void ScXMLTableScenarioContext::EndElement() ScRange* pRange(aScenarioRanges[ i ]); if( pRange ) pDoc->ApplyFlagsTab( pRange->aStart.Col(), pRange->aStart.Row(), - pRange->aEnd.Col(), pRange->aEnd.Row(), nCurrTable, SC_MF_SCENARIO ); + pRange->aEnd.Col(), pRange->aEnd.Row(), nCurrTable, ScMF::Scenario ); } pDoc->SetActiveScenario( nCurrTable, bIsActive ); } diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 73c0dc94595a..2fad9d99840b 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -1340,7 +1340,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi) nTab, InsertDeleteFlags::ALL ); rDoc.RemoveFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), - nTab, SC_MF_AUTO ); + nTab, ScMF::Auto ); rDoc.GetDPCollection()->FreeTable(&rDPObj); // object is deleted here diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 5642a3735aef..0ed1c8952331 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1820,14 +1820,14 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, { const ScMergeAttr* pMergeFlag = static_cast( &pPattern->GetItem(ATTR_MERGE) ); pMergeFlagAttr = static_cast( &pPattern->GetItem(ATTR_MERGE_FLAG) ); - sal_Int16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER ); - if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER ) + ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver ); + if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver ) { ScRange aRange( nTestCol, nTestRow1, i ); rDoc.ExtendOverlapped(aRange); rDoc.ExtendMerge(aRange, true); - if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR ) + if( nTestRow1 < nTestRow2 && nNewFlags == ScMF::Hor ) { for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ ) { @@ -2235,14 +2235,14 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, { const ScMergeAttr* pMergeFlag = static_cast( &pPattern->GetItem( ATTR_MERGE ) ); pMergeFlagAttr = static_cast( &pPattern->GetItem( ATTR_MERGE_FLAG ) ); - sal_Int16 nNewFlags = pMergeFlagAttr->GetValue() & ( SC_MF_HOR | SC_MF_VER ); - if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == SC_MF_HOR || nNewFlags == SC_MF_VER ) + ScMF nNewFlags = pMergeFlagAttr->GetValue() & ( ScMF::Hor | ScMF::Ver ); + if( ( pMergeFlag && pMergeFlag->IsMerged() ) || nNewFlags == ScMF::Hor || nNewFlags == ScMF::Ver ) { ScRange aRange( nTestCol, nTestRow1, i ); rDoc.ExtendOverlapped( aRange ); rDoc.ExtendMerge( aRange, true ); - if( nTestRow1 < nTestRow2 && nNewFlags == SC_MF_HOR ) + if( nTestRow1 < nTestRow2 && nNewFlags == ScMF::Hor ) { for( SCROW nTestRow = nTestRow1; nTestRow <= nTestRow2; nTestRow++ ) { @@ -4806,7 +4806,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord ) rDoc.RemoveFlagsTab( aExtended.aStart.Col(), aExtended.aStart.Row(), aExtended.aEnd.Col(), aExtended.aEnd.Row(), nTab, - SC_MF_HOR | SC_MF_VER ); + ScMF::Hor | ScMF::Ver ); rDoc.ExtendMerge( aRefresh, true ); diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index eb0869882411..84760f55f6e5 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -98,7 +98,7 @@ bool ScDocShell::IsEditable() const void ScDocShell::DBAreaDeleted( SCTAB nTab, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW /* nY2 */ ) { ScDocShellModificator aModificator( *this ); - aDocument.RemoveFlagsTab( nX1, nY1, nX2, nY1, nTab, SC_MF_AUTO ); + aDocument.RemoveFlagsTab( nX1, nY1, nX2, nY1, nTab, ScMF::Auto ); PostPaint( nX1, nY1, nTab, nX2, nY1, nTab, PAINT_GRID ); // No SetDocumentModified, as the unnamed database range might have to be restored later. // The UNO hint is broadcast directly instead, to keep UNO objects in valid state. @@ -373,7 +373,7 @@ void ScDocShell::CancelAutoDBRange() { // restore AutoFilter buttons pOldAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); - aDocument.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO ); + aDocument.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto ); PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID ); } } @@ -808,7 +808,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin aDocument.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nNewTab, aProtPattern ); ScPatternAttr aPattern( aDocument.GetPool() ); - aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) ); + aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) ); aPattern.GetItemSet().Put( ScProtectionAttr( true ) ); aDocument.ApplySelectionPattern( aPattern, aDestMark ); diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index dfdd563ec162..792cde5a05a2 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -512,7 +512,7 @@ void ScDBFuncUndo::EndUndo() { // restore AutoFilter buttons pAutoDBRange->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); - rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO ); + rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto ); pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID ); } } diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 766069ccfdf2..97d7e6fc4699 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -593,7 +593,7 @@ void ScUndoDeleteMulti::DoChange() const ScDocument& rDoc = pDocShell->GetDocument(); SCCOL nEndCol = MAXCOL; SCROW nEndRow = MAXROW; - rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); + rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true ); } @@ -2183,7 +2183,7 @@ void ScUndoRemoveMerge::Redo() rDoc.RemoveFlagsTab( maOption.mnStartCol, maOption.mnStartRow, maOption.mnEndCol, maOption.mnEndRow, nTab, - SC_MF_HOR | SC_MF_VER ); + ScMF::Hor | ScMF::Ver ); rDoc.ExtendMerge(aRange, true); diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index ad4f4aeeb40d..d85d32cf9b6f 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -938,9 +938,9 @@ void ScUndoAutoFilter::DoChange( bool bUndo ) pDBData->GetArea( nRangeTab, nRangeX1, nRangeY1, nRangeX2, nRangeY2 ); if ( bNewFilter ) - rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO ); + rDoc.ApplyFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto ); else - rDoc.RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, SC_MF_AUTO ); + rDoc.RemoveFlagsTab( nRangeX1, nRangeY1, nRangeX2, nRangeY1, nRangeTab, ScMF::Auto ); pDocShell->PostPaint( nRangeX1, nRangeY1, nRangeTab, nRangeX2, nRangeY1, nRangeTab, PAINT_GRID ); } diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 213d83f5349f..eedf02e153e0 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -7998,7 +7998,7 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::SequenceGetDocFunc().ApplyAttributes( aMarkData, aPattern, true ); } diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 2772aa2cb536..bad58331f6a6 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -2018,11 +2018,11 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue( if (bAutoFilter) rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO ); + aRange.aStart.Tab(), ScMF::Auto ); else if (!bAutoFilter) rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO ); + aRange.aStart.Tab(), ScMF::Auto ); ScRange aPaintRange(aRange.aStart, aRange.aEnd); aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row()); pDocShell->PostPaint(aPaintRange, PAINT_GRID); diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index f54360255d06..207a9ecea36d 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -427,11 +427,11 @@ void SAL_CALL ScVbaWorksheet::setAutoFilterMode( sal_Bool bAutoFilterMode ) thro if (bAutoFilterMode) rDoc.ApplyFlagsTab( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO ); + aRange.aStart.Tab(), ScMF::Auto ); else if (!bAutoFilterMode) rDoc.RemoveFlagsTab(aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aStart.Row(), - aRange.aStart.Tab(), SC_MF_AUTO ); + aRange.aStart.Tab(), ScMF::Auto ); ScRange aPaintRange(aRange.aStart, aRange.aEnd); aPaintRange.aEnd.SetRow(aPaintRange.aStart.Row()); pDocShell->PostPaint(aPaintRange, PAINT_GRID); diff --git a/sc/source/ui/view/dbfunc.cxx b/sc/source/ui/view/dbfunc.cxx index 1e6aa67d4188..a2bc7999d383 100644 --- a/sc/source/ui/view/dbfunc.cxx +++ b/sc/source/ui/view/dbfunc.cxx @@ -295,10 +295,10 @@ void ScDBFunc::ToggleAutoFilter() SCCOL nCol; SCROW nRow = aParam.nRow1; SCTAB nTab = GetViewData().GetTabNo(); - sal_Int16 nFlag; - bool bHasAuto = true; - bool bHeader = pDBData->HasHeader(); - bool bPaint = false; + ScMF nFlag; + bool bHasAuto = true; + bool bHeader = pDBData->HasHeader(); + bool bPaint = false; //! instead retrieve from DB-range? @@ -307,7 +307,7 @@ void ScDBFunc::ToggleAutoFilter() nFlag = static_cast( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); - if ( (nFlag & SC_MF_AUTO) == 0 ) + if ( !(nFlag & ScMF::Auto) ) bHasAuto = false; } @@ -319,7 +319,7 @@ void ScDBFunc::ToggleAutoFilter() { nFlag = static_cast( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); - pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); + pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag & ~ScMF::Auto ) ); } // use a list action for the AutoFilter buttons (ScUndoAutoFilter) and the filter operation @@ -374,7 +374,7 @@ void ScDBFunc::ToggleAutoFilter() { nFlag = static_cast( pDoc-> GetAttr( nCol, nRow, nTab, ATTR_MERGE_FLAG ))->GetValue(); - pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | SC_MF_AUTO ) ); + pDoc->ApplyAttr( nCol, nRow, nTab, ScMergeFlagAttr( nFlag | ScMF::Auto ) ); } pDocSh->PostPaint(ScRange(aParam.nCol1, nRow, nTab, aParam.nCol2, nRow, nTab), PAINT_GRID); @@ -417,9 +417,9 @@ void ScDBFunc::HideAutoFilter() for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++) { - sal_Int16 nFlag = static_cast( rDoc. + ScMF nFlag = static_cast( rDoc. GetAttr( nCol, nRow1, nTab, ATTR_MERGE_FLAG ))->GetValue(); - rDoc.ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~SC_MF_AUTO ) ); + rDoc.ApplyAttr( nCol, nRow1, nTab, ScMergeFlagAttr( nFlag & ~ScMF::Auto ) ); } ScRange aRange; diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 7997abddc68e..f5dedb72f36a 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -2532,14 +2532,14 @@ void ScOutputData::DrawClipMarks() long nStartPosY = nPosY; while ( nOverX > 0 && ( static_cast(mpDoc->GetAttr( - nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_HOR ) ) + nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Hor ) ) { --nOverX; nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); } while ( nOverY > 0 && ( static_cast(mpDoc->GetAttr( - nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & SC_MF_VER ) ) + nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Ver ) ) { --nOverY; nStartPosY -= nLayoutSign * (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 3f012e8857c0..fa6f4022eac5 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -944,10 +944,10 @@ bool ScOutputData::GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = static_cast(mpDoc->GetAttr( + ScMF nOverlap = static_cast(mpDoc->GetAttr( rOverX, rOverY, nTab, ATTR_MERGE_FLAG ))->GetValue(); - bHOver = ((nOverlap & SC_MF_HOR) != 0); - bVOver = ((nOverlap & SC_MF_VER) != 0); + bHOver = bool(nOverlap & ScMF::Hor); + bVOver = bool(nOverlap & ScMF::Ver); } } @@ -970,9 +970,9 @@ bool ScOutputData::GetMergeOrigin( SCCOL nX, SCROW nY, SCSIZE nArrY, } else { - sal_uInt16 nOverlap = static_cast(mpDoc->GetAttr( + ScMF nOverlap = static_cast(mpDoc->GetAttr( rOverX, rOverY, nTab, ATTR_MERGE_FLAG ))->GetValue(); - bVOver = ((nOverlap & SC_MF_VER) != 0); + bVOver = bool(nOverlap & ScMF::Ver); } } @@ -1339,7 +1339,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY // (for automatic line break: only if not formatting for printer, as in ScColumn::GetNeededSize) if ( eType==OUTTYPE_WINDOW && - ( static_cast(rPattern.GetItem(ATTR_MERGE_FLAG)).GetValue() & (SC_MF_AUTO|SC_MF_BUTTON|SC_MF_BUTTON_POPUP) ) && + ( static_cast(rPattern.GetItem(ATTR_MERGE_FLAG)).GetValue() & (ScMF::Auto|ScMF::Button|ScMF::ButtonPopup) ) && ( !bBreak || mpRefDevice == pFmtDevice ) ) { // filter drop-down width is now independent from row height diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 354621c6ecdb..85dbb4627f52 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1837,7 +1837,7 @@ void ScViewData::GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich, { OSL_FAIL("merge error found"); - pDoc->RemoveFlagsTab( 0,0, MAXCOL,MAXROW, nTabNo, SC_MF_HOR | SC_MF_VER ); + pDoc->RemoveFlagsTab( 0,0, MAXCOL,MAXROW, nTabNo, ScMF::Hor | ScMF::Ver ); SCCOL nEndCol = MAXCOL; SCROW nEndRow = MAXROW; pDoc->ExtendMerge( 0,0, nEndCol,nEndRow, nTabNo, true ); diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 67033a72a9e5..d0b3cad53cd5 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2040,7 +2040,7 @@ void ScViewFunc::ExtendScenario() ScDocument* pDoc = GetViewData().GetDocument(); ScPatternAttr aPattern( pDoc->GetPool() ); - aPattern.GetItemSet().Put( ScMergeFlagAttr( SC_MF_SCENARIO ) ); + aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) ); aPattern.GetItemSet().Put( ScProtectionAttr( true ) ); ApplySelectionPattern(aPattern); } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index b0ae4d0039bf..a6f3d675f8cd 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1688,7 +1688,7 @@ void ScViewFunc::DeleteMulti( bool bRows ) SCCOL nEndCol = MAXCOL; SCROW nEndRow = MAXROW; - rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, SC_MF_HOR | SC_MF_VER ); + rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true ); } -- cgit