diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-14 11:48:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-09-15 07:58:45 +0200 |
commit | 54e608c6605ca2bcfd8dfdbe674d5110a18d2c5c (patch) | |
tree | 0ac2df642d3499930f90b7b073cfcb52f44e6eaf /sc/source/ui | |
parent | loplugin:redundantcast (diff) | |
download | core-54e608c6605ca2bcfd8dfdbe674d5110a18d2c5c.tar.gz core-54e608c6605ca2bcfd8dfdbe674d5110a18d2c5c.zip |
convert SvxCellVerJustify to scoped enum
Change-Id: I9d1cdb4ddfee43b7a0990624d7d16e06679343c4
Reviewed-on: https://gerrit.libreoffice.org/42276
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/Accessibility/AccessibleText.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/view/output2.cxx | 92 |
5 files changed, 70 insertions, 70 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 7e80fd96571a..343a34d797da 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -814,16 +814,16 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() long nOffsetY = 0; const SvxVerJustifyItem* pVerJustifyItem = static_cast< const SvxVerJustifyItem* >( rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_VER_JUSTIFY ) ); - SvxCellVerJustify eVerJust = ( pVerJustifyItem ? pVerJustifyItem->GetValue() : SVX_VER_JUSTIFY_STANDARD ); + SvxCellVerJustify eVerJust = ( pVerJustifyItem ? pVerJustifyItem->GetValue() : SvxCellVerJustify::Standard ); switch ( eVerJust ) { - case SVX_VER_JUSTIFY_STANDARD: - case SVX_VER_JUSTIFY_BOTTOM: + case SvxCellVerJustify::Standard: + case SvxCellVerJustify::Bottom: { nOffsetY = nSizeY - nBottomM - nTextHeight; } break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: { nOffsetY = ( nSizeY - nTopM - nBottomM - nTextHeight ) / 2 + nTopM; } diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 210bd18e33a2..c9abf98d6147 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4826,7 +4826,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo if (rOption.mbCenter) { rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY ) ); - rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) ); + rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SvxCellVerJustify::Center, ATTR_VER_JUSTIFY ) ); } if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, MAXCOL,nEndRow,nTab ) ) ) diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index a20832c5c550..604a662009c2 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -691,7 +691,7 @@ void ScUndoMerge::DoChange( bool bUndo ) const SvxHorJustifyItem( SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY ) ); rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab(), - SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) ); + SvxVerJustifyItem( SvxCellVerJustify::Center, ATTR_VER_JUSTIFY ) ); } } diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 885f0ed1f50a..6908c960281e 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -108,13 +108,13 @@ SvxCellHorJustify lclConvertSlotToHAlign( sal_uInt16 nSlot ) SvxCellVerJustify lclConvertSlotToVAlign( sal_uInt16 nSlot ) { - SvxCellVerJustify eVJustify = SVX_VER_JUSTIFY_STANDARD; + SvxCellVerJustify eVJustify = SvxCellVerJustify::Standard; switch( nSlot ) { - case SID_ALIGN_ANY_VDEFAULT: eVJustify = SVX_VER_JUSTIFY_STANDARD; break; - case SID_ALIGN_ANY_TOP: eVJustify = SVX_VER_JUSTIFY_TOP; break; - case SID_ALIGN_ANY_VCENTER: eVJustify = SVX_VER_JUSTIFY_CENTER; break; - case SID_ALIGN_ANY_BOTTOM: eVJustify = SVX_VER_JUSTIFY_BOTTOM; break; + case SID_ALIGN_ANY_VDEFAULT: eVJustify = SvxCellVerJustify::Standard; break; + case SID_ALIGN_ANY_TOP: eVJustify = SvxCellVerJustify::Top; break; + case SID_ALIGN_ANY_VCENTER: eVJustify = SvxCellVerJustify::Center; break; + case SID_ALIGN_ANY_BOTTOM: eVJustify = SvxCellVerJustify::Bottom; break; default: OSL_FAIL( "lclConvertSlotToVAlign - invalid slot" ); } return eVJustify; @@ -1551,7 +1551,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) const SvxHorJustifyItem* pHorJustify = nullptr; const SvxVerJustifyItem* pVerJustify = nullptr; SvxCellHorJustify eHorJustify = SvxCellHorJustify::Standard; - SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD; + SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard; if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, true,&pItem ) == SfxItemState::SET) { @@ -1601,24 +1601,24 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) case SID_ALIGNTOP: rReq.SetSlot( SID_V_ALIGNCELL ); rReq.AppendItem( SvxVerJustifyItem( - !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_TOP) ? - SVX_VER_JUSTIFY_TOP : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); + !pVerJustify || (eVerJustify != SvxCellVerJustify::Top) ? + SvxCellVerJustify::Top : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; case SID_ALIGNBOTTOM: rReq.SetSlot( SID_V_ALIGNCELL ); rReq.AppendItem( SvxVerJustifyItem( - !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_BOTTOM) ? - SVX_VER_JUSTIFY_BOTTOM : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); + !pVerJustify || (eVerJustify != SvxCellVerJustify::Bottom) ? + SvxCellVerJustify::Bottom : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; case SID_ALIGNCENTERVER: rReq.SetSlot( SID_V_ALIGNCELL ); rReq.AppendItem( SvxVerJustifyItem( - !pVerJustify || (eVerJustify != SVX_VER_JUSTIFY_CENTER) ? - SVX_VER_JUSTIFY_CENTER : SVX_VER_JUSTIFY_STANDARD, SID_V_ALIGNCELL ) ); + !pVerJustify || (eVerJustify != SvxCellVerJustify::Center) ? + SvxCellVerJustify::Center : SvxCellVerJustify::Standard, SID_V_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; @@ -2291,7 +2291,7 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) const SvxHorJustifyItem* pHorJustify = nullptr; const SvxVerJustifyItem* pVerJustify = nullptr; - SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD; + SvxCellVerJustify eVerJustify = SvxCellVerJustify::Standard; sal_uInt16 nWhich = 0; bool bJustifyStd = false; SfxBoolItem aBoolItem ( 0, true ); @@ -2374,19 +2374,19 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) switch ( eVerJustify ) { - case SVX_VER_JUSTIFY_TOP: + case SvxCellVerJustify::Top: nWhich = SID_ALIGNTOP; break; - case SVX_VER_JUSTIFY_BOTTOM: + case SvxCellVerJustify::Bottom: nWhich = SID_ALIGNBOTTOM; break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: nWhich = SID_ALIGNCENTERVER; break; - case SVX_VER_JUSTIFY_STANDARD: + case SvxCellVerJustify::Standard: default: bJustifyStd = true; break; @@ -2445,7 +2445,7 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet ) if( bHasHAlign ) eHAlign = static_cast<const SvxHorJustifyItem&>(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); - SvxCellVerJustify eVAlign = SVX_VER_JUSTIFY_STANDARD; + SvxCellVerJustify eVAlign = SvxCellVerJustify::Standard; bool bHasVAlign = rAttrSet.GetItemState( ATTR_VER_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasVAlign ) eVAlign = static_cast<const SvxVerJustifyItem&>(rAttrSet.Get( ATTR_VER_JUSTIFY )).GetValue(); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index b324d40f872f..424862cc9693 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -185,7 +185,7 @@ ScDrawStringsVars::ScDrawStringsVars(ScOutputData* pData, bool bPTL) : nAscentPixel(0), eAttrOrient ( SvxCellOrientation::Standard ), eAttrHorJust( SvxCellHorJustify::Standard ), - eAttrVerJust( SVX_VER_JUSTIFY_BOTTOM ), + eAttrVerJust( SvxCellVerJustify::Bottom ), eAttrHorJustMethod( SvxCellJustifyMethod::Auto ), pMargin ( nullptr ), nIndent ( 0 ), @@ -326,8 +326,8 @@ void ScDrawStringsVars::SetPattern( eAttrHorJust = static_cast<const SvxHorJustifyItem&>(pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet )).GetValue(); eAttrVerJust = static_cast<const SvxVerJustifyItem&>(pPattern->GetItem( ATTR_VER_JUSTIFY, pCondSet )).GetValue(); - if ( eAttrVerJust == SVX_VER_JUSTIFY_STANDARD ) - eAttrVerJust = SVX_VER_JUSTIFY_BOTTOM; + if ( eAttrVerJust == SvxCellVerJustify::Standard ) + eAttrVerJust = SvxCellVerJustify::Bottom; // justification method @@ -1901,22 +1901,22 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co long nTestClipHeight = aVars.GetTextSize().Height(); switch (aVars.GetVerJust()) { - case SVX_VER_JUSTIFY_TOP: - case SVX_VER_JUSTIFY_BLOCK: + case SvxCellVerJustify::Top: + case SvxCellVerJustify::Block: { long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY ); nJustPosY += nTop; nTestClipHeight += nTop; } break; - case SVX_VER_JUSTIFY_BOTTOM: + case SvxCellVerJustify::Bottom: { long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); nJustPosY += nOutHeight - aVars.GetTextSize().Height() - nBot; nTestClipHeight += nBot; } break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: { long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY ); long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); @@ -2580,19 +2580,19 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() SvxAdjust eSvxAdjust = SvxAdjust::Left; switch (meVerJust) { - case SVX_VER_JUSTIFY_TOP: + case SvxCellVerJustify::Top: eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ? SvxAdjust::Left : SvxAdjust::Right; break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: eSvxAdjust = SvxAdjust::Center; break; - case SVX_VER_JUSTIFY_BOTTOM: - case SVX_VER_JUSTIFY_STANDARD: + case SvxCellVerJustify::Bottom: + case SvxCellVerJustify::Standard: eSvxAdjust = (meOrient == SvxCellOrientation::TopBottom || mbAsianVertical) ? SvxAdjust::Right : SvxAdjust::Left; break; - case SVX_VER_JUSTIFY_BLOCK: + case SvxCellVerJustify::Block: eSvxAdjust = SvxAdjust::Block; break; } @@ -2601,7 +2601,7 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() mpEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) ); if (meHorJustResult == SvxCellHorJustify::Block) - mpEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) ); + mpEngine->SetDefaultItem( SvxVerJustifyItem(SvxCellVerJustify::Block, EE_PARA_VER_JUST) ); } else { @@ -2637,17 +2637,17 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() else switch (meVerJust) { - case SVX_VER_JUSTIFY_TOP: + case SvxCellVerJustify::Top: eSvxAdjust = SvxAdjust::Right; break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: eSvxAdjust = SvxAdjust::Center; break; - case SVX_VER_JUSTIFY_BOTTOM: - case SVX_VER_JUSTIFY_STANDARD: + case SvxCellVerJustify::Bottom: + case SvxCellVerJustify::Standard: eSvxAdjust = SvxAdjust::Left; break; - case SVX_VER_JUSTIFY_BLOCK: + case SvxCellVerJustify::Block: eSvxAdjust = SvxAdjust::Block; break; } @@ -2659,13 +2659,13 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() { mpEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) ); if (meHorJustResult == SvxCellHorJustify::Block) - mpEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) ); + mpEngine->SetDefaultItem( SvxVerJustifyItem(SvxCellVerJustify::Block, EE_PARA_VER_JUST) ); } else { mpEngine->SetDefaultItem( SvxJustifyMethodItem(meHorJustMethod, EE_PARA_JUST_METHOD) ); - if (meVerJust == SVX_VER_JUSTIFY_BLOCK) - mpEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) ); + if (meVerJust == SvxCellVerJustify::Block) + mpEngine->SetDefaultItem( SvxVerJustifyItem(SvxCellVerJustify::Block, EE_PARA_VER_JUST) ); } } @@ -2834,8 +2834,8 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) // Fill the EditEngine (cell attributes and text) // default alignment for asian vertical mode is top-right - if ( rParam.mbAsianVertical && rParam.meVerJust == SVX_VER_JUSTIFY_STANDARD ) - rParam.meVerJust = SVX_VER_JUSTIFY_TOP; + if ( rParam.mbAsianVertical && rParam.meVerJust == SvxCellVerJustify::Standard ) + rParam.meVerJust = SvxCellVerJustify::Top; rParam.setPatternToEngine(mbUseStyleColor); rParam.setAlignmentToEngine(); @@ -3089,8 +3089,8 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) rParam.mpOldPattern = nullptr; } - if (rParam.meVerJust==SVX_VER_JUSTIFY_BOTTOM || - rParam.meVerJust==SVX_VER_JUSTIFY_STANDARD) + if (rParam.meVerJust==SvxCellVerJustify::Bottom || + rParam.meVerJust==SvxCellVerJustify::Standard) { //! if pRefDevice != pFmtDevice, keep heights in logic units, //! only converting margin? @@ -3103,7 +3103,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) else aLogicStart.Y() += nTopM + aCellSize.Height() - nEngineHeight; } - else if (rParam.meVerJust==SVX_VER_JUSTIFY_CENTER) + else if (rParam.meVerJust==SvxCellVerJustify::Center) { if (rParam.mbPixelToLogic) aLogicStart.Y() += mpRefDevice->PixelToLogic( Size(0, nTopM + ( @@ -3493,16 +3493,16 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) switch (rParam.meVerJust) { - case SVX_VER_JUSTIFY_STANDARD: - case SVX_VER_JUSTIFY_BOTTOM: + case SvxCellVerJustify::Standard: + case SvxCellVerJustify::Bottom: // align to bottom (do nothing). break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: // center it. aLogicStart.Y() -= nGap / 2; break; - case SVX_VER_JUSTIFY_BLOCK: - case SVX_VER_JUSTIFY_TOP: + case SvxCellVerJustify::Block: + case SvxCellVerJustify::Top: // align to top aLogicStart.Y() -= nGap; break; @@ -3744,17 +3744,17 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) switch (rParam.meVerJust) { - case SVX_VER_JUSTIFY_STANDARD: - case SVX_VER_JUSTIFY_BOTTOM: + case SvxCellVerJustify::Standard: + case SvxCellVerJustify::Bottom: // align to bottom aLogicStart.Y() -= nGap; break; - case SVX_VER_JUSTIFY_CENTER: + case SvxCellVerJustify::Center: // center it. aLogicStart.Y() -= nGap / 2; break; - case SVX_VER_JUSTIFY_BLOCK: - case SVX_VER_JUSTIFY_TOP: + case SvxCellVerJustify::Block: + case SvxCellVerJustify::Top: // align to top (do nothing) default: ; @@ -4056,8 +4056,8 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) else aLogicStart = Point(nStartX, nStartY); - if (rParam.meVerJust==SVX_VER_JUSTIFY_BOTTOM || - rParam.meVerJust==SVX_VER_JUSTIFY_STANDARD) + if (rParam.meVerJust==SvxCellVerJustify::Bottom || + rParam.meVerJust==SvxCellVerJustify::Standard) { //! if pRefDevice != pFmtDevice, keep heights in logic units, //! only converting margin? @@ -4070,7 +4070,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) else aLogicStart.Y() += nTopM + aCellSize.Height() - nEngineHeight; } - else if (rParam.meVerJust==SVX_VER_JUSTIFY_CENTER) + else if (rParam.meVerJust==SvxCellVerJustify::Center) { if (rParam.mbPixelToLogic) aLogicStart.Y() += mpRefDevice->PixelToLogic( Size(0, nTopM + ( @@ -4209,8 +4209,8 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // Fill the EditEngine (cell attributes and text) // default alignment for asian vertical mode is top-right - if ( rParam.meVerJust == SVX_VER_JUSTIFY_STANDARD ) - rParam.meVerJust = SVX_VER_JUSTIFY_TOP; + if ( rParam.meVerJust == SvxCellVerJustify::Standard ) + rParam.meVerJust = SvxCellVerJustify::Top; rParam.setPatternToEngine(mbUseStyleColor); rParam.setAlignmentToEngine(); @@ -5179,8 +5179,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if ( eOrient==SvxCellOrientation::Standard || eOrient==SvxCellOrientation::Stacked || !bBreak ) { - if (eVerJust==SVX_VER_JUSTIFY_BOTTOM || - eVerJust==SVX_VER_JUSTIFY_STANDARD) + if (eVerJust==SvxCellVerJustify::Bottom || + eVerJust==SvxCellVerJustify::Standard) { if (bPixelToLogic) aLogicStart.Y() += mpRefDevice->PixelToLogic( Size(0, @@ -5191,7 +5191,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) aLogicStart.Y() += aCellSize.Height() - nEngineHeight; } - else if (eVerJust==SVX_VER_JUSTIFY_CENTER) + else if (eVerJust==SvxCellVerJustify::Center) { if (bPixelToLogic) aLogicStart.Y() += mpRefDevice->PixelToLogic( Size(0,( @@ -5241,9 +5241,9 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nAddX -= nSkew; long nUp = 0; - if ( eVerJust == SVX_VER_JUSTIFY_CENTER ) + if ( eVerJust == SvxCellVerJustify::Center ) nUp = ( aCellSize.Height() - nEngineHeight ) / 2; - else if ( eVerJust == SVX_VER_JUSTIFY_TOP ) + else if ( eVerJust == SvxCellVerJustify::Top ) { if ( nSin > 0.0 ) nUp = aCellSize.Height() - nEngineHeight; |