From 6ef4d92869114179fc7802e2a2b5be665f248029 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 24 Mar 2015 14:15:45 +0200 Subject: convert VALID_ constants to enum class Change-Id: Id63d0e0dcf550b4d4f9cf3a2800aeb40f9f9bbce --- svx/source/svdraw/svdattr.cxx | 2 +- svx/source/table/cell.cxx | 28 ++++++++--------- svx/source/table/tablecontroller.cxx | 58 ++++++++++++++++++------------------ svx/source/tbxctrls/tbcontrl.cxx | 16 +++++----- 4 files changed, 52 insertions(+), 52 deletions(-) (limited to 'svx/source') diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index 281ccf7857c8..3380f21e4984 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -315,7 +315,7 @@ SdrItemPool::SdrItemPool( pBoxInfoItem->SetTable( true ); pBoxInfoItem->SetDist( true); // always show margin field - pBoxInfoItem->SetValid( VALID_DISABLE, true ); // some lines may have DontCare state only in tables + pBoxInfoItem->SetValid( SvxBoxInfoItemValidFlags::DISABLE, true ); // some lines may have DontCare state only in tables mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_INNER - SDRATTR_START ] = pBoxInfoItem; mppLocalPoolDefaults[ SDRATTR_TABLE_BORDER_TLBR - SDRATTR_START ] = new SvxLineItem( SDRATTR_TABLE_BORDER_TLBR ); diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index cbe80906ce85..fe096cb280a9 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1061,30 +1061,30 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& bool bSet = SvxBoxItem::LineToSvxLine(pBorder->TopLine, aLine, false); aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_TOP); - aBoxInfo.SetValid(VALID_TOP, pBorder->IsTopLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::TOP, pBorder->IsTopLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->BottomLine, aLine, false); aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_BOTTOM); - aBoxInfo.SetValid(VALID_BOTTOM, pBorder->IsBottomLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::BOTTOM, pBorder->IsBottomLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->LeftLine, aLine, false); aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_LEFT); - aBoxInfo.SetValid(VALID_LEFT, pBorder->IsLeftLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::LEFT, pBorder->IsLeftLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->RightLine, aLine, false); aBox.SetLine(bSet ? &aLine : 0, BOX_LINE_RIGHT); - aBoxInfo.SetValid(VALID_RIGHT, pBorder->IsRightLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::RIGHT, pBorder->IsRightLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->HorizontalLine, aLine, false); aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_HORI); - aBoxInfo.SetValid(VALID_HORI, pBorder->IsHorizontalLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::HORI, pBorder->IsHorizontalLineValid); bSet = SvxBoxItem::LineToSvxLine(pBorder->VerticalLine, aLine, false); aBoxInfo.SetLine(bSet ? &aLine : 0, BOXINFO_LINE_VERT); - aBoxInfo.SetValid(VALID_VERT, pBorder->IsVerticalLineValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::VERT, pBorder->IsVerticalLineValid); aBox.SetDistance(pBorder->Distance); //TODO - aBoxInfo.SetValid(VALID_DISTANCE, pBorder->IsDistanceValid); + aBoxInfo.SetValid(SvxBoxInfoItemValidFlags::DISTANCE, pBorder->IsDistanceValid); mpProperties->SetObjectItem(aBox); mpProperties->SetObjectItem(aBoxInfo); @@ -1189,19 +1189,19 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) throw(Unknow TableBorder aTableBorder; aTableBorder.TopLine = SvxBoxItem::SvxLineToLine(rBox.GetTop(), false); - aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(VALID_TOP); + aTableBorder.IsTopLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::TOP); aTableBorder.BottomLine = SvxBoxItem::SvxLineToLine(rBox.GetBottom(), false); - aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(VALID_BOTTOM); + aTableBorder.IsBottomLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::BOTTOM); aTableBorder.LeftLine = SvxBoxItem::SvxLineToLine(rBox.GetLeft(), false); - aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(VALID_LEFT); + aTableBorder.IsLeftLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::LEFT); aTableBorder.RightLine = SvxBoxItem::SvxLineToLine(rBox.GetRight(), false); - aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(VALID_RIGHT ); + aTableBorder.IsRightLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::RIGHT ); aTableBorder.HorizontalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetHori(), false); - aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(VALID_HORI); + aTableBorder.IsHorizontalLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::HORI); aTableBorder.VerticalLine = SvxBoxItem::SvxLineToLine(rBoxInfoItem.GetVert(), false); - aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(VALID_VERT); + aTableBorder.IsVerticalLineValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::VERT); aTableBorder.Distance = rBox.GetDistance(); - aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(VALID_DISTANCE); + aTableBorder.IsDistanceValid = rBoxInfoItem.IsValid(SvxBoxInfoItemValidFlags::DISTANCE); return Any( aTableBorder ); } diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 0abbf7ee4367..6b442ca83082 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2221,12 +2221,12 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, { if( nCellFlags & CELL_UPPER ) { - if( pBoxInfoItem->IsValid(VALID_TOP) ) + if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) ) rNewFrame.SetLine(0, BOX_LINE_BOTTOM ); } else if( nCellFlags & CELL_LOWER ) { - if( pBoxInfoItem->IsValid(VALID_BOTTOM) ) + if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) ) rNewFrame.SetLine( 0, BOX_LINE_TOP ); } } @@ -2234,12 +2234,12 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, { if( nCellFlags & CELL_BEFORE ) { - if( pBoxInfoItem->IsValid(VALID_LEFT) ) + if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) ) rNewFrame.SetLine( 0, BOX_LINE_RIGHT ); } else if( nCellFlags & CELL_AFTER ) { - if( pBoxInfoItem->IsValid(VALID_RIGHT) ) + if( pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) ) rNewFrame.SetLine( 0, BOX_LINE_LEFT ); } } @@ -2248,20 +2248,20 @@ static void ImplApplyBoxItem( sal_uInt16 nCellFlags, const SvxBoxItem* pBoxItem, { // current cell is inside the selection - if( (nCellFlags & CELL_LEFT) ? pBoxInfoItem->IsValid(VALID_LEFT) : pBoxInfoItem->IsValid(VALID_VERT) ) + if( (nCellFlags & CELL_LEFT) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::LEFT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) rNewFrame.SetLine( (nCellFlags & CELL_LEFT) ? pBoxItem->GetLeft() : pBoxInfoItem->GetVert(), BOX_LINE_LEFT ); - if( (nCellFlags & CELL_RIGHT) ? pBoxInfoItem->IsValid(VALID_RIGHT) : pBoxInfoItem->IsValid(VALID_VERT) ) + if( (nCellFlags & CELL_RIGHT) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::RIGHT) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::VERT) ) rNewFrame.SetLine( (nCellFlags & CELL_RIGHT) ? pBoxItem->GetRight() : pBoxInfoItem->GetVert(), BOX_LINE_RIGHT ); - if( (nCellFlags & CELL_TOP) ? pBoxInfoItem->IsValid(VALID_TOP) : pBoxInfoItem->IsValid(VALID_HORI) ) + if( (nCellFlags & CELL_TOP) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::TOP) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) rNewFrame.SetLine( (nCellFlags & CELL_TOP) ? pBoxItem->GetTop() : pBoxInfoItem->GetHori(), BOX_LINE_TOP ); - if( (nCellFlags & CELL_BOTTOM) ? pBoxInfoItem->IsValid(VALID_BOTTOM) : pBoxInfoItem->IsValid(VALID_HORI) ) + if( (nCellFlags & CELL_BOTTOM) ? pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::BOTTOM) : pBoxInfoItem->IsValid(SvxBoxInfoItemValidFlags::HORI) ) rNewFrame.SetLine( (nCellFlags & CELL_BOTTOM) ? pBoxItem->GetBottom() : pBoxInfoItem->GetHori(), BOX_LINE_BOTTOM ); // apply distance to borders - if( pBoxInfoItem->IsValid( VALID_DISTANCE ) ) + if( pBoxInfoItem->IsValid( SvxBoxInfoItemValidFlags::DISTANCE ) ) for( sal_uInt16 nLine = 0; nLine < 4; ++nLine ) rNewFrame.SetDistance( pBoxItem->GetDistance( nLine ), nLine ); } @@ -2824,9 +2824,9 @@ void BoxItemWrapper::setLine(const SvxBorderLine* pLine) void lcl_MergeBorderLine( LinesState& rLinesState, const SvxBorderLine* const pLine, const sal_uInt16 nLine, - const sal_uInt8 nValidFlag, const bool bBorder = true) + SvxBoxInfoItemValidFlags nValidFlag, const bool bBorder = true) { - const sal_uInt16 nInnerLine(bBorder ? 0 : ((nValidFlag & VALID_HORI) ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT)); + const sal_uInt16 nInnerLine(bBorder ? 0 : ((nValidFlag & SvxBoxInfoItemValidFlags::HORI) ? BOXINFO_LINE_HORI : BOXINFO_LINE_VERT)); BoxItemWrapper aBoxItem(rLinesState.rBoxItem, rLinesState.rBoxInfoItem, nLine, nInnerLine, bBorder); bool& rbSet(bBorder ? rLinesState.aBorderSet[nLine] : rLinesState.aInnerLineSet[nInnerLine]); @@ -2852,14 +2852,14 @@ void lcl_MergeBorderLine( void lcl_MergeBorderOrInnerLine( LinesState& rLinesState, const SvxBorderLine* const pLine, const sal_uInt16 nLine, - const sal_uInt8 nValidFlag, const bool bBorder) + SvxBoxInfoItemValidFlags nValidFlag, const bool bBorder) { if (bBorder) lcl_MergeBorderLine(rLinesState, pLine, nLine, nValidFlag); else { const bool bVertical = (nLine == BOX_LINE_LEFT) || (nLine == BOX_LINE_RIGHT); - lcl_MergeBorderLine(rLinesState, pLine, nLine, bVertical ? VALID_VERT : VALID_HORI, false); + lcl_MergeBorderLine(rLinesState, pLine, nLine, bVertical ? SvxBoxInfoItemValidFlags::VERT : SvxBoxInfoItemValidFlags::HORI, false); } } @@ -2887,16 +2887,16 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB if( (nCellFlags & ( CELL_BEFORE|CELL_AFTER)) == 0 ) // check if its not nw or ne corner { if( nCellFlags & CELL_UPPER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_TOP, VALID_TOP); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_TOP, SvxBoxInfoItemValidFlags::TOP); else if( nCellFlags & CELL_LOWER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_BOTTOM, VALID_BOTTOM); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM); } else if( (nCellFlags & ( CELL_UPPER|CELL_LOWER)) == 0 ) // check if its not sw or se corner { if( nCellFlags & CELL_BEFORE ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_LEFT, VALID_LEFT); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_LEFT, SvxBoxInfoItemValidFlags::LEFT); else if( nCellFlags & CELL_AFTER ) - lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_RIGHT, VALID_RIGHT); + lcl_MergeBorderLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_RIGHT, SvxBoxInfoItemValidFlags::RIGHT); } // NOTE: inner distances for cells outside the selected range @@ -2906,10 +2906,10 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB { // current cell is inside the selection - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_TOP, VALID_TOP, (nCellFlags & CELL_TOP) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_BOTTOM, VALID_BOTTOM, (nCellFlags & CELL_BOTTOM) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_LEFT, VALID_LEFT, (nCellFlags & CELL_LEFT) != 0); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_RIGHT, VALID_RIGHT, (nCellFlags & CELL_RIGHT) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), BOX_LINE_TOP, SvxBoxInfoItemValidFlags::TOP, (nCellFlags & CELL_TOP) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), BOX_LINE_BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM, (nCellFlags & CELL_BOTTOM) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), BOX_LINE_LEFT, SvxBoxInfoItemValidFlags::LEFT, (nCellFlags & CELL_LEFT) != 0); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), BOX_LINE_RIGHT, SvxBoxInfoItemValidFlags::RIGHT, (nCellFlags & CELL_RIGHT) != 0); lcl_MergeDistance(rLinesState, BOX_LINE_TOP, rCellBoxItem.GetDistance(BOX_LINE_TOP)); lcl_MergeDistance(rLinesState, BOX_LINE_BOTTOM, rCellBoxItem.GetDistance(BOX_LINE_BOTTOM)); @@ -2936,7 +2936,7 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox const sal_Int32 nLastRow = std::min( aEnd.mnRow + 2, nRowCount ); const sal_Int32 nLastCol = std::min( aEnd.mnCol + 2, nColCount ); - rBoxInfoItem.SetValid( sal_uInt8( ~0 ), false ); + rBoxInfoItem.SetValid( SvxBoxInfoItemValidFlags::ALL, false ); LinesState aLinesState( rBoxItem, rBoxInfoItem ); /* Here we go through all the selected cells (enhanced by @@ -2975,17 +2975,17 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox } if (!aLinesState.aBorderIndeterminate[BOX_LINE_TOP]) - aLinesState.rBoxInfoItem.SetValid(VALID_TOP); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::TOP); if (!aLinesState.aBorderIndeterminate[BOX_LINE_BOTTOM]) - aLinesState.rBoxInfoItem.SetValid(VALID_BOTTOM); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::BOTTOM); if (!aLinesState.aBorderIndeterminate[BOX_LINE_LEFT]) - aLinesState.rBoxInfoItem.SetValid(VALID_LEFT); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::LEFT); if (!aLinesState.aBorderIndeterminate[BOX_LINE_RIGHT]) - aLinesState.rBoxInfoItem.SetValid(VALID_RIGHT); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::RIGHT); if (!aLinesState.aInnerLineIndeterminate[BOXINFO_LINE_HORI]) - aLinesState.rBoxInfoItem.SetValid(VALID_HORI); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::HORI); if (!aLinesState.aInnerLineIndeterminate[BOXINFO_LINE_VERT]) - aLinesState.rBoxInfoItem.SetValid(VALID_VERT); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::VERT); if (!aLinesState.bDistanceIndeterminate) { @@ -2997,7 +2997,7 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_LEFT], BOX_LINE_LEFT); if (aLinesState.aDistanceSet[BOX_LINE_RIGHT]) aLinesState.rBoxItem.SetDistance(aLinesState.aDistance[BOX_LINE_RIGHT], BOX_LINE_RIGHT); - aLinesState.rBoxInfoItem.SetValid(VALID_DISTANCE); + aLinesState.rBoxInfoItem.SetValid(SvxBoxInfoItemValidFlags::DISTANCE); } } } diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index e66a10c36a02..16cbf3816782 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -1623,14 +1623,14 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl) if(nModifier == KEY_SHIFT) nValidFlags |= FRM_VALID_ALL; - aBorderInner.SetValid( VALID_TOP, 0 != (nValidFlags&FRM_VALID_TOP )); - aBorderInner.SetValid( VALID_BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); - aBorderInner.SetValid( VALID_LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); - aBorderInner.SetValid( VALID_RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); - aBorderInner.SetValid( VALID_HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); - aBorderInner.SetValid( VALID_VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); - aBorderInner.SetValid( VALID_DISTANCE, true ); - aBorderInner.SetValid( VALID_DISABLE, false ); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::TOP, 0 != (nValidFlags&FRM_VALID_TOP )); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, 0 != (nValidFlags&FRM_VALID_BOTTOM )); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, 0 != (nValidFlags&FRM_VALID_LEFT)); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, 0 != (nValidFlags&FRM_VALID_RIGHT )); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::HORI, 0 != (nValidFlags&FRM_VALID_HINNER )); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::VERT, 0 != (nValidFlags&FRM_VALID_VINNER)); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISTANCE, true ); + aBorderInner.SetValid( SvxBoxInfoItemValidFlags::DISABLE, false ); if ( IsInPopupMode() ) EndPopupMode(); -- cgit