From 9b95093950436caebd45a06008929427869844fa Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 Mar 2017 12:39:34 +0200 Subject: convert SvxCellHorJustify to scoped enum Change-Id: I0dd88b5bf9e1aededfa2d94b6b2d3d26694fff33 Reviewed-on: https://gerrit.libreoffice.org/34968 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/ui/Accessibility/AccessibleText.cxx | 10 +- sc/source/ui/app/inputhdl.cxx | 16 +-- sc/source/ui/app/transobj.cxx | 4 +- sc/source/ui/docshell/docfunc.cxx | 2 +- sc/source/ui/docshell/docsh.cxx | 10 +- sc/source/ui/miscdlgs/autofmt.cxx | 20 +-- sc/source/ui/sidebar/AlignmentPropertyPanel.cxx | 8 +- sc/source/ui/undo/undoblk3.cxx | 2 +- sc/source/ui/view/formatsh.cxx | 44 +++---- sc/source/ui/view/gridwin.cxx | 23 ++-- sc/source/ui/view/output2.cxx | 162 ++++++++++++------------ sc/source/ui/view/viewdata.cxx | 10 +- sc/source/ui/view/viewfunc.cxx | 4 +- 13 files changed, 157 insertions(+), 158 deletions(-) (limited to 'sc/source/ui') diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 6f4fb2d85d97..2878d60e91d2 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -713,8 +713,8 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() long nIndent = 0; const SvxHorJustifyItem* pHorJustifyItem = static_cast< const SvxHorJustifyItem* >( rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_HOR_JUSTIFY ) ); - SvxCellHorJustify eHorJust = ( pHorJustifyItem ? static_cast< SvxCellHorJustify >( pHorJustifyItem->GetValue() ) : SVX_HOR_JUSTIFY_STANDARD ); - if ( eHorJust == SVX_HOR_JUSTIFY_LEFT ) + SvxCellHorJustify eHorJust = pHorJustifyItem ? pHorJustifyItem->GetValue() : SvxCellHorJustify::Standard; + if ( eHorJust == SvxCellHorJustify::Left ) { const SfxUInt16Item* pIndentItem = static_cast< const SfxUInt16Item* >( rDoc.GetAttr( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab(), ATTR_INDENT ) ); @@ -777,7 +777,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() pEditEngine->SetPaperSize( aSize ); // #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells - if ( eHorJust == SVX_HOR_JUSTIFY_STANDARD && rDoc.HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) + if ( eHorJust == SvxCellHorJustify::Standard && rDoc.HasValueData( aCellPos.Col(), aCellPos.Row(), aCellPos.Tab() ) ) { pEditEngine->SetDefaultItem( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); } @@ -796,12 +796,12 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder() { switch ( eHorJust ) { - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: { nOffsetX -= nDiffX; } break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: { nOffsetX -= nDiffX / 2; } diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 751fe84f11f3..52987d1a3fcf 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -629,7 +629,7 @@ ScInputHandler::ScInputHandler() bLastIsSymbol( false ), mbDocumentDisposing(false), nValidation( 0 ), - eAttrAdjust( SVX_HOR_JUSTIFY_STANDARD ), + eAttrAdjust( SvxCellHorJustify::Standard ), aScaleX( 1,1 ), aScaleY( 1,1 ), pRefViewSh( nullptr ), @@ -1943,7 +1943,7 @@ void ScInputHandler::UpdateAdjust( sal_Unicode cTyped ) SvxAdjust eSvxAdjust; switch (eAttrAdjust) { - case SVX_HOR_JUSTIFY_STANDARD: + case SvxCellHorJustify::Standard: { bool bNumber = false; if (cTyped) // Restarted @@ -1956,16 +1956,16 @@ void ScInputHandler::UpdateAdjust( sal_Unicode cTyped ) eSvxAdjust = bNumber ? SvxAdjust::Right : SvxAdjust::Left; } break; - case SVX_HOR_JUSTIFY_BLOCK: + case SvxCellHorJustify::Block: eSvxAdjust = SvxAdjust::Block; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: eSvxAdjust = SvxAdjust::Center; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: eSvxAdjust = SvxAdjust::Right; break; - default: // SVX_HOR_JUSTIFY_LEFT + default: // SvxCellHorJustify::Left eSvxAdjust = SvxAdjust::Left; break; } @@ -2133,11 +2133,11 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn // Adjustment eAttrAdjust = (SvxCellHorJustify)static_cast(pPattern-> GetItem(ATTR_HOR_JUSTIFY)).GetValue(); - if ( eAttrAdjust == SVX_HOR_JUSTIFY_REPEAT && + if ( eAttrAdjust == SvxCellHorJustify::Repeat && static_cast(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() ) { // #i31843# "repeat" with "line breaks" is treated as default alignment - eAttrAdjust = SVX_HOR_JUSTIFY_STANDARD; + eAttrAdjust = SvxCellHorJustify::Standard; } } diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 3edc86d2e6bc..990be1b5bde8 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -827,9 +827,9 @@ void ScTransferObj::StripRefs( ScDocument* pDoc, { if ( static_cast(pDestDoc->GetAttr( nCol,nRow,nDestTab, ATTR_HOR_JUSTIFY))->GetValue() == - SVX_HOR_JUSTIFY_STANDARD ) + SvxCellHorJustify::Standard ) pDestDoc->ApplyAttr( nCol,nRow,nDestTab, - SvxHorJustifyItem(SVX_HOR_JUSTIFY_RIGHT, ATTR_HOR_JUSTIFY) ); + SvxHorJustifyItem(SvxCellHorJustify::Right, ATTR_HOR_JUSTIFY) ); ScSetStringParam aParam; aParam.setTextInput(); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index f2d85bcfaa5b..3b8ed04a2790 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4802,7 +4802,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo if (rOption.mbCenter) { - rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) ); + rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxHorJustifyItem( SvxCellHorJustify::Center, ATTR_HOR_JUSTIFY ) ); rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SVX_VER_JUSTIFY_CENTER, ATTR_VER_JUSTIFY ) ); } diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index f8baa2e50126..70faa90ca738 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1771,19 +1771,19 @@ void lcl_ScDocShell_GetFixedWidthString( OUString& rStr, const ScDocument& rDoc, } if ( nLen > aString.getLength() ) { - if ( bValue && eHorJust == SVX_HOR_JUSTIFY_STANDARD ) - eHorJust = SVX_HOR_JUSTIFY_RIGHT; + if ( bValue && eHorJust == SvxCellHorJustify::Standard ) + eHorJust = SvxCellHorJustify::Right; sal_Int32 nBlanks = nLen - aString.getLength(); switch ( eHorJust ) { - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: { OUStringBuffer aTmp; aTmp = comphelper::string::padToLength( aTmp, nBlanks, ' ' ); aString = aTmp.append(aString).makeStringAndClear(); } break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: { sal_Int32 nLeftPad = nBlanks / 2; OUStringBuffer aTmp; @@ -1809,7 +1809,7 @@ void lcl_ScDocShell_WriteEmptyFixedWidthString( SvStream& rStream, { OUString aString; lcl_ScDocShell_GetFixedWidthString( aString, rDoc, nTab, nCol, false, - SVX_HOR_JUSTIFY_STANDARD ); + SvxCellHorJustify::Standard ); rStream.WriteUnicodeOrByteText( aString ); } diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index 4eaa250f4a7f..9d45331e24e4 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -260,9 +260,9 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo // Justification: - eJustification = mbRTL ? SVX_HOR_JUSTIFY_RIGHT : bJustify ? + eJustification = mbRTL ? SvxCellHorJustify::Right : bJustify ? (SvxCellHorJustify) (static_cast(pCurData->GetItem(nFmtIndex, ATTR_HOR_JUSTIFY))->GetValue()) : - SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify::Standard; if (pCurData->GetIncludeFont()) { @@ -288,7 +288,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo } while((theMaxStrSize.Width() <= aStrSize.Width()) && (cellString.getLength() > 1)) { - if( eJustification == SVX_HOR_JUSTIFY_RIGHT ) + if( eJustification == SvxCellHorJustify::Right ) cellString = cellString.copy(1); else cellString = cellString.copy(0, cellString.getLength() - 1 ); @@ -312,25 +312,25 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo // horizontal - if (eJustification != SVX_HOR_JUSTIFY_STANDARD) + if (eJustification != SvxCellHorJustify::Standard) { sal_uInt16 nHorPos = sal_uInt16((cellRect.GetWidth()-aStrSize.Width()) / 2); switch (eJustification) { - case SVX_HOR_JUSTIFY_LEFT: + case SvxCellHorJustify::Left: aPos.X() += FRAME_OFFSET; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: aPos.X() += nRightX; break; - case SVX_HOR_JUSTIFY_BLOCK: - case SVX_HOR_JUSTIFY_REPEAT: - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Block: + case SvxCellHorJustify::Repeat: + case SvxCellHorJustify::Center: aPos.X() += nHorPos; break; // coverity[dead_error_line] - following conditions exist to avoid compiler warning - case SVX_HOR_JUSTIFY_STANDARD: + case SvxCellHorJustify::Standard: default: // Standard is not handled here break; diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index 24f3f9538766..240434acd37c 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -270,14 +270,14 @@ void AlignmentPropertyPanel::NotifyItemUpdate( { case SID_H_ALIGNCELL: { - SvxCellHorJustify meHorAlignState = SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify meHorAlignState = SvxCellHorJustify::Standard; if(eState >= SfxItemState::DEFAULT && pState && dynamic_cast( pState) != nullptr ) { const SvxHorJustifyItem* pItem = static_cast(pState); meHorAlignState = (SvxCellHorJustify)pItem->GetValue(); } - if( meHorAlignState == SVX_HOR_JUSTIFY_REPEAT ) + if( meHorAlignState == SvxCellHorJustify::Repeat ) { mpFtRotate->Disable(); mpMtrAngle->Disable(); @@ -288,8 +288,8 @@ void AlignmentPropertyPanel::NotifyItemUpdate( mpMtrAngle->Enable(!mbMultiDisable); } - mpFTLeftIndent->Enable( meHorAlignState == SVX_HOR_JUSTIFY_LEFT ); - mpMFLeftIndent->Enable( meHorAlignState == SVX_HOR_JUSTIFY_LEFT ); + mpFTLeftIndent->Enable( meHorAlignState == SvxCellHorJustify::Left ); + mpMFLeftIndent->Enable( meHorAlignState == SvxCellHorJustify::Left ); } break; case SID_ATTR_ALIGN_INDENT: diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index d5690e250baa..c3057d7b4bcd 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -688,7 +688,7 @@ void ScUndoMerge::DoChange( bool bUndo ) const { rDoc.ApplyAttr( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aStart.Tab(), - SvxHorJustifyItem( SVX_HOR_JUSTIFY_CENTER, ATTR_HOR_JUSTIFY ) ); + 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 ) ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index b88721002cba..9102ee662008 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -91,14 +91,14 @@ namespace { SvxCellHorJustify lclConvertSlotToHAlign( sal_uInt16 nSlot ) { - SvxCellHorJustify eHJustify = SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify eHJustify = SvxCellHorJustify::Standard; switch( nSlot ) { - case SID_ALIGN_ANY_HDEFAULT: eHJustify = SVX_HOR_JUSTIFY_STANDARD; break; - case SID_ALIGN_ANY_LEFT: eHJustify = SVX_HOR_JUSTIFY_LEFT; break; - case SID_ALIGN_ANY_HCENTER: eHJustify = SVX_HOR_JUSTIFY_CENTER; break; - case SID_ALIGN_ANY_RIGHT: eHJustify = SVX_HOR_JUSTIFY_RIGHT; break; - case SID_ALIGN_ANY_JUSTIFIED: eHJustify = SVX_HOR_JUSTIFY_BLOCK; break; + case SID_ALIGN_ANY_HDEFAULT: eHJustify = SvxCellHorJustify::Standard; break; + case SID_ALIGN_ANY_LEFT: eHJustify = SvxCellHorJustify::Left; break; + case SID_ALIGN_ANY_HCENTER: eHJustify = SvxCellHorJustify::Center; break; + case SID_ALIGN_ANY_RIGHT: eHJustify = SvxCellHorJustify::Right; break; + case SID_ALIGN_ANY_JUSTIFIED: eHJustify = SvxCellHorJustify::Block; break; default: OSL_FAIL( "lclConvertSlotToHAlign - invalid slot" ); } return eHJustify; @@ -1541,7 +1541,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) const SfxPoolItem* pItem = nullptr; const SvxHorJustifyItem* pHorJustify = nullptr; const SvxVerJustifyItem* pVerJustify = nullptr; - SvxCellHorJustify eHorJustify = SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify eHorJustify = SvxCellHorJustify::Standard; SvxCellVerJustify eVerJustify = SVX_VER_JUSTIFY_STANDARD; if (rAttrSet.GetItemState(ATTR_HOR_JUSTIFY, true,&pItem ) == SfxItemState::SET) @@ -1560,32 +1560,32 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq ) case SID_ALIGNLEFT: rReq.SetSlot( SID_H_ALIGNCELL ); rReq.AppendItem( SvxHorJustifyItem( - !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_LEFT) ? - SVX_HOR_JUSTIFY_LEFT : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); + !pHorJustify || (eHorJustify != SvxCellHorJustify::Left) ? + SvxCellHorJustify::Left : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; case SID_ALIGNRIGHT: rReq.SetSlot( SID_H_ALIGNCELL ); rReq.AppendItem( SvxHorJustifyItem( - !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_RIGHT) ? - SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); + !pHorJustify || (eHorJustify != SvxCellHorJustify::Right) ? + SvxCellHorJustify::Right : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; case SID_ALIGNCENTERHOR: rReq.SetSlot( SID_H_ALIGNCELL ); rReq.AppendItem( SvxHorJustifyItem( - !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_CENTER) ? - SVX_HOR_JUSTIFY_CENTER : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); + !pHorJustify || (eHorJustify != SvxCellHorJustify::Center) ? + SvxCellHorJustify::Center : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; case SID_ALIGNBLOCK: rReq.SetSlot( SID_H_ALIGNCELL ); rReq.AppendItem( SvxHorJustifyItem( - !pHorJustify || (eHorJustify != SVX_HOR_JUSTIFY_BLOCK) ? - SVX_HOR_JUSTIFY_BLOCK : SVX_HOR_JUSTIFY_STANDARD, SID_H_ALIGNCELL ) ); + !pHorJustify || (eHorJustify != SvxCellHorJustify::Block) ? + SvxCellHorJustify::Block : SvxCellHorJustify::Standard, SID_H_ALIGNCELL ) ); ExecuteSlot( rReq, GetInterface() ); return; @@ -2265,26 +2265,26 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet ) { switch ( SvxCellHorJustify( pHorJustify->GetValue() ) ) { - case SVX_HOR_JUSTIFY_STANDARD: + case SvxCellHorJustify::Standard: break; - case SVX_HOR_JUSTIFY_LEFT: + case SvxCellHorJustify::Left: nWhich = SID_ALIGNLEFT; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: nWhich = SID_ALIGNRIGHT; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: nWhich = SID_ALIGNCENTERHOR; break; - case SVX_HOR_JUSTIFY_BLOCK: + case SvxCellHorJustify::Block: nWhich = SID_ALIGNBLOCK; break; - case SVX_HOR_JUSTIFY_REPEAT: + case SvxCellHorJustify::Repeat: default: bJustifyStd = true; break; @@ -2401,7 +2401,7 @@ void ScFormatShell::GetAlignState( SfxItemSet& rSet ) SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - SvxCellHorJustify eHAlign = SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify eHAlign = SvxCellHorJustify::Standard; bool bHasHAlign = rAttrSet.GetItemState( ATTR_HOR_JUSTIFY ) != SfxItemState::DONTCARE; if( bHasHAlign ) eHAlign = (SvxCellHorJustify)static_cast(rAttrSet.Get( ATTR_HOR_JUSTIFY )).GetValue(); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 8debb68bc758..3640f0b3ed40 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4975,24 +4975,23 @@ namespace { SvxAdjust toSvxAdjust( const ScPatternAttr& rPat ) { SvxCellHorJustify eHorJust = - static_cast( - static_cast(rPat.GetItem(ATTR_HOR_JUSTIFY)).GetValue()); + static_cast(rPat.GetItem(ATTR_HOR_JUSTIFY)).GetValue(); SvxAdjust eSvxAdjust = SvxAdjust::Left; switch (eHorJust) { - case SVX_HOR_JUSTIFY_LEFT: - case SVX_HOR_JUSTIFY_REPEAT: // not implemented - case SVX_HOR_JUSTIFY_STANDARD: // always Text if an EditCell type + case SvxCellHorJustify::Left: + case SvxCellHorJustify::Repeat: // not implemented + case SvxCellHorJustify::Standard: // always Text if an EditCell type eSvxAdjust = SvxAdjust::Left; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: eSvxAdjust = SvxAdjust::Right; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: eSvxAdjust = SvxAdjust::Center; break; - case SVX_HOR_JUSTIFY_BLOCK: + case SvxCellHorJustify::Block: eSvxAdjust = SvxAdjust::Block; break; } @@ -5077,7 +5076,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, bool bBreak = static_cast(pPattern->GetItem(ATTR_LINEBREAK)).GetValue() || ((SvxCellHorJustify)static_cast(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK); + GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block); SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast(pPattern-> GetItem(ATTR_HOR_JUSTIFY)).GetValue(); @@ -5127,9 +5126,9 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, long nTextHeight = pEngine->GetTextHeight(); if ( nTextWidth < nThisColLogic ) { - if (eHorJust == SVX_HOR_JUSTIFY_RIGHT) + if (eHorJust == SvxCellHorJustify::Right) nStartX += nThisColLogic - nTextWidth; - else if (eHorJust == SVX_HOR_JUSTIFY_CENTER) + else if (eHorJust == SvxCellHorJustify::Center) nStartX += (nThisColLogic - nTextWidth) / 2; } @@ -5141,7 +5140,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, // the cell content is NUMERIC. This defaults to right aligned and // we need to adjust accordingly. if (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->IsValue() && - eHorJust == SVX_HOR_JUSTIFY_STANDARD) + eHorJust == SvxCellHorJustify::Standard) { aLogicEdit.Right() = aLogicEdit.Left() + nThisColLogic - 1; aLogicEdit.Left() = aLogicEdit.Right() - nTextWidth; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index b689f3ccc6d5..40206ad6fa0e 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) : pCondSet ( nullptr ), nAscentPixel(0), eAttrOrient ( SVX_ORIENTATION_STANDARD ), - eAttrHorJust( SVX_HOR_JUSTIFY_STANDARD ), + eAttrHorJust( SvxCellHorJustify::Standard ), eAttrVerJust( SVX_VER_JUSTIFY_BOTTOM ), eAttrHorJustMethod( SvxCellJustifyMethod::Auto ), eAttrVerJustMethod( SvxCellJustifyMethod::Auto ), @@ -342,7 +342,7 @@ void ScDrawStringsVars::SetPattern( // handle "repeat" alignment - bRepeat = ( eAttrHorJust == SVX_HOR_JUSTIFY_REPEAT ); + bRepeat = ( eAttrHorJust == SvxCellHorJustify::Repeat ); if ( bRepeat ) { // "repeat" disables rotation (before constructing the font) @@ -350,7 +350,7 @@ void ScDrawStringsVars::SetPattern( // #i31843# "repeat" with "line breaks" is treated as default alignment (but rotation is still disabled) if ( bLineBreak ) - eAttrHorJust = SVX_HOR_JUSTIFY_STANDARD; + eAttrHorJust = SvxCellHorJustify::Standard; } short nRot; @@ -419,7 +419,7 @@ void ScDrawStringsVars::SetPattern( // margins pMargin = static_cast(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); - if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT || eAttrHorJust == SVX_HOR_JUSTIFY_RIGHT ) + if ( eAttrHorJust == SvxCellHorJustify::Left || eAttrHorJust == SvxCellHorJustify::Right ) nIndent = static_cast(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); else nIndent = 0; @@ -465,7 +465,7 @@ void ScDrawStringsVars::SetPatternSimple( const ScPatternAttr* pNew, const SfxIt pMargin = static_cast(&pPattern->GetItem( ATTR_MARGIN, pCondSet )); - if ( eAttrHorJust == SVX_HOR_JUSTIFY_LEFT ) + if ( eAttrHorJust == SvxCellHorJustify::Left ) nIndent = static_cast(pPattern->GetItem( ATTR_INDENT, pCondSet )).GetValue(); else nIndent = 0; @@ -1257,13 +1257,13 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY long nRightMissing = 0; switch ( eHorJust ) { - case SVX_HOR_JUSTIFY_LEFT: + case SvxCellHorJustify::Left: nRightMissing = nMissing; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: nLeftMissing = nMissing; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: nLeftMissing = nMissing / 2; nRightMissing = nMissing - nLeftMissing; break; @@ -1400,39 +1400,39 @@ static SvxCellHorJustify getAlignmentFromContext( SvxCellHorJustify eInHorJust, { SvxCellHorJustify eHorJustContext = eInHorJust; bool bUseWritingDirection = false; - if (eInHorJust == SVX_HOR_JUSTIFY_STANDARD) + if (eInHorJust == SvxCellHorJustify::Standard) { // fdo#32530: Default alignment depends on value vs // string, and the direction of the 1st letter. if (beginsWithRTLCharacter( rText)) //If language is RTL { if (bCellIsValue) - eHorJustContext = bNumberFormatIsText ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT; + eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Right : SvxCellHorJustify::Left; else - eHorJustContext = SVX_HOR_JUSTIFY_RIGHT; + eHorJustContext = SvxCellHorJustify::Right; } else if (bCellIsValue) //If language is not RTL - eHorJustContext = bNumberFormatIsText ? SVX_HOR_JUSTIFY_LEFT : SVX_HOR_JUSTIFY_RIGHT; + eHorJustContext = bNumberFormatIsText ? SvxCellHorJustify::Left : SvxCellHorJustify::Right; else bUseWritingDirection = true; } if (bUseWritingDirection || - eInHorJust == SVX_HOR_JUSTIFY_BLOCK || eInHorJust == SVX_HOR_JUSTIFY_REPEAT) + eInHorJust == SvxCellHorJustify::Block || eInHorJust == SvxCellHorJustify::Repeat) { sal_uInt16 nDirection = lcl_GetValue( rPattern, ATTR_WRITINGDIR, pCondSet); if (nDirection == FRMDIR_HORI_LEFT_TOP || nDirection == FRMDIR_VERT_TOP_LEFT) - eHorJustContext = SVX_HOR_JUSTIFY_LEFT; + eHorJustContext = SvxCellHorJustify::Left; else if (nDirection == FRMDIR_ENVIRONMENT) { SAL_WARN_IF( !pDoc, "sc.ui", "getAlignmentFromContext - pDoc==NULL"); // fdo#73588: The content of the cell must also // begin with a RTL character to be right // aligned; otherwise, it should be left aligned. - eHorJustContext = (pDoc && pDoc->IsLayoutRTL(nTab) && (beginsWithRTLCharacter( rText))) ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT; + eHorJustContext = (pDoc && pDoc->IsLayoutRTL(nTab) && (beginsWithRTLCharacter( rText))) ? SvxCellHorJustify::Right : SvxCellHorJustify::Left; } else - eHorJustContext = SVX_HOR_JUSTIFY_RIGHT; + eHorJustContext = SvxCellHorJustify::Right; } return eHorJustContext; } @@ -1692,7 +1692,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA bNeedEdit = aVars.HasEditCharacters() || (bFormulaCell && aCell.mpFormula->IsMultilineResult()); } long nTotalMargin = 0; - SvxCellHorJustify eOutHorJust = SVX_HOR_JUSTIFY_STANDARD; + SvxCellHorJustify eOutHorJust = SvxCellHorJustify::Standard; if (bDoCell && !bNeedEdit) { CellType eCellType = aCell.meType; @@ -1707,7 +1707,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA eOutHorJust = getAlignmentFromContext( aVars.GetHorJust(), bCellIsValue, aVars.GetString(), *pPattern, pCondSet, mpDoc, nTab, bNumberFormatIsText ); - bool bBreak = ( aVars.GetLineBreak() || aVars.GetHorJust() == SVX_HOR_JUSTIFY_BLOCK ); + bool bBreak = ( aVars.GetLineBreak() || aVars.GetHorJust() == SvxCellHorJustify::Block ); // #i111387# #o11817313# disable automatic line breaks only for "General" number format if (bBreak && bCellIsValue && (aVars.GetResultValueFormat() % SV_COUNTRY_LANGUAGE_OFFSET) == 0) bBreak = false; @@ -1811,7 +1811,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA if (!bNeedEdit) { bNeedEdit = - aVars.GetHorJust() == SVX_HOR_JUSTIFY_BLOCK && + aVars.GetHorJust() == SvxCellHorJustify::Block && aVars.GetHorJustMethod() == SvxCellJustifyMethod::Distribute; } } @@ -1889,15 +1889,15 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA bool bRightAdjusted = false; // to correct text width calculation later switch (eOutHorJust) { - case SVX_HOR_JUSTIFY_LEFT: + case SvxCellHorJustify::Left: nJustPosX += (long) ( aVars.GetLeftTotal() * mnPPTX ); break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: nJustPosX += nAvailWidth - aVars.GetTextSize().Width() - (long) ( aVars.GetRightTotal() * mnPPTX ); bRightAdjusted = true; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: nJustPosX += ( nAvailWidth - aVars.GetTextSize().Width() + (long) ( aVars.GetLeftTotal() * mnPPTX ) - (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2; @@ -2039,7 +2039,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA double fVisibleRatio = 1.0; double fTextWidth = aVars.GetTextSize().Width(); sal_Int32 nTextLen = aString.getLength(); - if (eOutHorJust == SVX_HOR_JUSTIFY_LEFT && aAreaParam.mnRightClipLength > 0) + if (eOutHorJust == SvxCellHorJustify::Left && aAreaParam.mnRightClipLength > 0) { fVisibleRatio = (fTextWidth - aAreaParam.mnRightClipLength) / fTextWidth; if (0.0 < fVisibleRatio && fVisibleRatio < 1.0) @@ -2049,7 +2049,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA aShort = aShort.copy(0, nShortLen); } } - else if (eOutHorJust == SVX_HOR_JUSTIFY_RIGHT && aAreaParam.mnLeftClipLength > 0) + else if (eOutHorJust == SvxCellHorJustify::Right && aAreaParam.mnLeftClipLength > 0) { fVisibleRatio = (fTextWidth - aAreaParam.mnLeftClipLength) / fTextWidth; if (0.0 < fVisibleRatio && fVisibleRatio < 1.0) @@ -2340,7 +2340,7 @@ ScOutputData::DrawEditParam::DrawEditParam(const ScPatternAttr* pPattern, const mnArrY(0), mnX(0), mnY(0), mnCellX(0), mnCellY(0), mnTab(0), mnPosX(0), mnPosY(0), mnInitPosX(0), - mbBreak( (meHorJustAttr == SVX_HOR_JUSTIFY_BLOCK) || lcl_GetBoolValue(*pPattern, ATTR_LINEBREAK, pCondSet) ), + mbBreak( (meHorJustAttr == SvxCellHorJustify::Block) || lcl_GetBoolValue(*pPattern, ATTR_LINEBREAK, pCondSet) ), mbCellIsValue(bCellIsValue), mbAsianVertical(false), mbPixelToLogic(false), @@ -2472,14 +2472,14 @@ void ScOutputData::DrawEditParam::calcMargins(long& rTopM, long& rLeftM, long& r static_cast(mpPattern->GetItem(ATTR_MARGIN, mpCondSet)); sal_uInt16 nIndent = 0; - if (meHorJustAttr == SVX_HOR_JUSTIFY_LEFT || meHorJustAttr == SVX_HOR_JUSTIFY_RIGHT) + if (meHorJustAttr == SvxCellHorJustify::Left || meHorJustAttr == SvxCellHorJustify::Right) nIndent = lcl_GetValue(*mpPattern, ATTR_INDENT, mpCondSet); rLeftM = static_cast(((rMargin.GetLeftMargin() + nIndent) * nPPTX)); rTopM = static_cast((rMargin.GetTopMargin() * nPPTY)); rRightM = static_cast((rMargin.GetRightMargin() * nPPTX)); rBottomM = static_cast((rMargin.GetBottomMargin() * nPPTY)); - if(meHorJustAttr == SVX_HOR_JUSTIFY_RIGHT) + if(meHorJustAttr == SvxCellHorJustify::Right) { rLeftM = static_cast((rMargin.GetLeftMargin() * nPPTX)); rRightM = static_cast(((rMargin.GetRightMargin() + nIndent) * nPPTX)); @@ -2571,10 +2571,10 @@ void ScOutputData::DrawEditParam::calcStartPosForVertical( switch (meHorJustResult) { - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: rLogicStart.X() += (nCellWidth - nEngineWidth) / 2; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: rLogicStart.X() += nCellWidth - nEngineWidth; break; default: @@ -2610,7 +2610,7 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() mpEngine->SetDefaultItem( SvxAdjustItem(eSvxAdjust, EE_PARA_JUST) ); mpEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) ); - if (meHorJustResult == SVX_HOR_JUSTIFY_BLOCK) + if (meHorJustResult == SvxCellHorJustify::Block) mpEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) ); } else @@ -2627,20 +2627,20 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() if (meOrient == SVX_ORIENTATION_STANDARD) switch (meHorJustResult) { - case SVX_HOR_JUSTIFY_REPEAT: // repeat is not yet implemented - case SVX_HOR_JUSTIFY_STANDARD: + case SvxCellHorJustify::Repeat: // repeat is not yet implemented + case SvxCellHorJustify::Standard: SAL_WARN("sc.ui","meHorJustResult does not match getAlignmentFromContext()"); SAL_FALLTHROUGH; - case SVX_HOR_JUSTIFY_LEFT: + case SvxCellHorJustify::Left: eSvxAdjust = SvxAdjust::Left; break; - case SVX_HOR_JUSTIFY_CENTER: + case SvxCellHorJustify::Center: eSvxAdjust = SvxAdjust::Center; break; - case SVX_HOR_JUSTIFY_RIGHT: + case SvxCellHorJustify::Right: eSvxAdjust = SvxAdjust::Right; break; - case SVX_HOR_JUSTIFY_BLOCK: + case SvxCellHorJustify::Block: eSvxAdjust = SvxAdjust::Block; break; } @@ -2668,7 +2668,7 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() if (mbAsianVertical) { mpEngine->SetDefaultItem( SvxJustifyMethodItem(meVerJustMethod, EE_PARA_JUST_METHOD) ); - if (meHorJustResult == SVX_HOR_JUSTIFY_BLOCK) + if (meHorJustResult == SvxCellHorJustify::Block) mpEngine->SetDefaultItem( SvxVerJustifyItem(SVX_VER_JUSTIFY_BLOCK, EE_PARA_VER_JUST) ); } else @@ -2693,9 +2693,9 @@ void ScOutputData::DrawEditParam::setAlignmentToEngine() bool ScOutputData::DrawEditParam::adjustHorAlignment(ScFieldEditEngine* pEngine) { - if (meHorJustResult == SVX_HOR_JUSTIFY_RIGHT || meHorJustResult == SVX_HOR_JUSTIFY_CENTER) + if (meHorJustResult == SvxCellHorJustify::Right || meHorJustResult == SvxCellHorJustify::Center) { - SvxAdjust eEditAdjust = (meHorJustResult == SVX_HOR_JUSTIFY_CENTER) ? + SvxAdjust eEditAdjust = (meHorJustResult == SvxCellHorJustify::Center) ? SvxAdjust::Center : SvxAdjust::Right; pEngine->SetUpdateMode(false); @@ -2758,11 +2758,11 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) Size aRefOne = mpRefDevice->PixelToLogic(Size(1,1)); bool bHidden = false; - bool bRepeat = (rParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT && !rParam.mbBreak); + bool bRepeat = (rParam.meHorJustAttr == SvxCellHorJustify::Repeat && !rParam.mbBreak); bool bShrink = !rParam.mbBreak && !bRepeat && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); long nAttrRotate = lcl_GetValue(*rParam.mpPattern, ATTR_ROTATE_VALUE, rParam.mpCondSet); - if ( rParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT ) + if ( rParam.meHorJustAttr == SvxCellHorJustify::Repeat ) { // ignore orientation/rotation if "repeat" is active rParam.meOrient = SVX_ORIENTATION_STANDARD; @@ -2771,7 +2771,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) // #i31843# "repeat" with "line breaks" is treated as default alignment // (but rotation is still disabled). // Default again leads to context dependent alignment instead of - // SVX_HOR_JUSTIFY_STANDARD. + // SvxCellHorJustify::Standard. if ( rParam.mbBreak ) rParam.meHorJustResult = rParam.meHorJustContext; } @@ -2942,7 +2942,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) // No clip marks if "###" doesn't fit (same as in DrawStrings) } - if (eOutHorJust != SVX_HOR_JUSTIFY_LEFT) + if (eOutHorJust != SvxCellHorJustify::Left) { aPaperSize.Width() = nNeededPixel + 1; if (rParam.mbPixelToLogic) @@ -2968,9 +2968,9 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) } else { - if ( eOutHorJust == SVX_HOR_JUSTIFY_RIGHT ) + if ( eOutHorJust == SvxCellHorJustify::Right ) nStartX -= nNeededPixel - nCellWidth + nRightM + 1; - else if ( eOutHorJust == SVX_HOR_JUSTIFY_CENTER ) + else if ( eOutHorJust == SvxCellHorJustify::Center ) nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2; else nStartX += nLeftM; @@ -3276,9 +3276,9 @@ bool ScOutputData::Clip( DrawEditParam& rParam, const Size& aCellSize, void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) { - OSL_ASSERT(rParam.meHorJustAttr != SVX_HOR_JUSTIFY_REPEAT); + OSL_ASSERT(rParam.meHorJustAttr != SvxCellHorJustify::Repeat); - const bool bRepeat = (rParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT && !rParam.mbBreak); + const bool bRepeat = (rParam.meHorJustAttr == SvxCellHorJustify::Repeat && !rParam.mbBreak); const bool bShrink = !rParam.mbBreak && !bRepeat && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); SvxCellHorJustify eOutHorJust = rParam.meHorJustContext; @@ -3440,9 +3440,9 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) } else { - if ( eOutHorJust == SVX_HOR_JUSTIFY_RIGHT ) + if ( eOutHorJust == SvxCellHorJustify::Right ) nStartX -= nNeededPixel - nCellWidth + nRightM + 1; - else if ( eOutHorJust == SVX_HOR_JUSTIFY_CENTER ) + else if ( eOutHorJust == SvxCellHorJustify::Center ) nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2; else nStartX += nLeftM; @@ -3464,7 +3464,7 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) Point aURLStart = aLogicStart; // copy before modifying for orientation - if (rParam.meHorJustResult == SVX_HOR_JUSTIFY_BLOCK || rParam.mbBreak) + if (rParam.meHorJustResult == SvxCellHorJustify::Block || rParam.mbBreak) { Size aPSize = rParam.mpEngine->GetPaperSize(); aPSize.Width() = aCellSize.Height(); @@ -3537,9 +3537,9 @@ void ScOutputData::DrawEditBottomTop(DrawEditParam& rParam) void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) { - OSL_ASSERT(rParam.meHorJustAttr != SVX_HOR_JUSTIFY_REPEAT); + OSL_ASSERT(rParam.meHorJustAttr != SvxCellHorJustify::Repeat); - const bool bRepeat = (rParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT && !rParam.mbBreak); + const bool bRepeat = (rParam.meHorJustAttr == SvxCellHorJustify::Repeat && !rParam.mbBreak); const bool bShrink = !rParam.mbBreak && !bRepeat && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); SvxCellHorJustify eOutHorJust = rParam.meHorJustContext; @@ -3698,14 +3698,14 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) // is always left-aligned nStartX += nLeftM; - if (rParam.meHorJustResult == SVX_HOR_JUSTIFY_BLOCK) + if (rParam.meHorJustResult == SvxCellHorJustify::Block) nStartX += aPaperSize.Height(); } else { - if ( eOutHorJust == SVX_HOR_JUSTIFY_RIGHT ) + if ( eOutHorJust == SvxCellHorJustify::Right ) nStartX -= nNeededPixel - nCellWidth + nRightM + 1; - else if ( eOutHorJust == SVX_HOR_JUSTIFY_CENTER ) + else if ( eOutHorJust == SvxCellHorJustify::Center ) nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2; else nStartX += nLeftM; @@ -3727,7 +3727,7 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) Point aURLStart = aLogicStart; // copy before modifying for orientation - if (rParam.meHorJustResult != SVX_HOR_JUSTIFY_BLOCK) + if (rParam.meHorJustResult != SvxCellHorJustify::Block) { aLogicStart.X() += nEngineWidth; if (!rParam.mbBreak) @@ -3792,10 +3792,10 @@ void ScOutputData::DrawEditTopBottom(DrawEditParam& rParam) void ScOutputData::DrawEditStacked(DrawEditParam& rParam) { - OSL_ASSERT(rParam.meHorJustAttr != SVX_HOR_JUSTIFY_REPEAT); + OSL_ASSERT(rParam.meHorJustAttr != SvxCellHorJustify::Repeat); Size aRefOne = mpRefDevice->PixelToLogic(Size(1,1)); - bool bRepeat = (rParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT && !rParam.mbBreak); + bool bRepeat = (rParam.meHorJustAttr == SvxCellHorJustify::Repeat && !rParam.mbBreak); bool bShrink = !rParam.mbBreak && !bRepeat && lcl_GetBoolValue(*rParam.mpPattern, ATTR_SHRINKTOFIT, rParam.mpCondSet); rParam.mbAsianVertical = @@ -3917,7 +3917,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) // No clip marks if "###" doesn't fit (same as in DrawStrings) } - if ( eOutHorJust != SVX_HOR_JUSTIFY_LEFT ) + if ( eOutHorJust != SvxCellHorJustify::Left ) { aPaperSize.Width() = nNeededPixel + 1; if (rParam.mbPixelToLogic) @@ -3943,9 +3943,9 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) } else { - if ( eOutHorJust == SVX_HOR_JUSTIFY_RIGHT ) + if ( eOutHorJust == SvxCellHorJustify::Right ) nStartX -= nNeededPixel - nCellWidth + nRightM + 1; - else if ( eOutHorJust == SVX_HOR_JUSTIFY_CENTER ) + else if ( eOutHorJust == SvxCellHorJustify::Center ) nStartX -= ( nNeededPixel - nCellWidth + nRightM + 1 - nLeftM ) / 2; else nStartX += nLeftM; @@ -4138,7 +4138,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // and the asian vertical boolean is true. OSL_ASSERT(rParam.meOrient == SVX_ORIENTATION_STANDARD); OSL_ASSERT(rParam.mbAsianVertical); - OSL_ASSERT(rParam.meHorJustAttr != SVX_HOR_JUSTIFY_REPEAT); + OSL_ASSERT(rParam.meHorJustAttr != SvxCellHorJustify::Repeat); Size aRefOne = mpRefDevice->PixelToLogic(Size(1,1)); @@ -4155,10 +4155,10 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // default alignment for asian vertical mode is top-right /* TODO: is setting meHorJustContext and meHorJustResult unconditionally to - * SVX_HOR_JUSTIFY_RIGHT really wanted? Seems this was done all the time, + * SvxCellHorJustify::Right really wanted? Seems this was done all the time, * also before context was introduced and everything was attr only. */ - if ( rParam.meHorJustAttr == SVX_HOR_JUSTIFY_STANDARD ) - rParam.meHorJustResult = rParam.meHorJustContext = SVX_HOR_JUSTIFY_RIGHT; + if ( rParam.meHorJustAttr == SvxCellHorJustify::Standard ) + rParam.meHorJustResult = rParam.meHorJustContext = SvxCellHorJustify::Right; if (bHidden) return; @@ -4276,7 +4276,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // No clip marks if "###" doesn't fit (same as in DrawStrings) } - if (eOutHorJust != SVX_HOR_JUSTIFY_LEFT) + if (eOutHorJust != SvxCellHorJustify::Left) { aPaperSize.Width() = nNeededPixel + 1; if (rParam.mbPixelToLogic) @@ -4418,9 +4418,9 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) // horizontal alignment - if (rParam.meHorJustResult==SVX_HOR_JUSTIFY_RIGHT) + if (rParam.meHorJustResult==SvxCellHorJustify::Right) aLogicStart.X() += nAvailWidth - nEngineWidth; - else if (rParam.meHorJustResult==SVX_HOR_JUSTIFY_CENTER) + else if (rParam.meHorJustResult==SvxCellHorJustify::Center) aLogicStart.X() += (nAvailWidth - nEngineWidth) / 2; // paper size is subtracted below @@ -4585,8 +4585,8 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) const bool bNumberFormatIsText = lcl_isNumberFormatText( mpDoc, nCellX, nCellY, nTab ); aParam.meHorJustContext = getAlignmentFromContext( aParam.meHorJustAttr, aParam.mbCellIsValue, aStr, *pPattern, pCondSet, mpDoc, nTab, bNumberFormatIsText); - aParam.meHorJustResult = (aParam.meHorJustAttr == SVX_HOR_JUSTIFY_BLOCK) ? - SVX_HOR_JUSTIFY_BLOCK : aParam.meHorJustContext; + aParam.meHorJustResult = (aParam.meHorJustAttr == SvxCellHorJustify::Block) ? + SvxCellHorJustify::Block : aParam.meHorJustContext; aParam.mbPixelToLogic = bPixelToLogic; aParam.mbHyphenatorSet = bHyphenatorSet; aParam.mpEngine = pEngine.get(); @@ -4608,7 +4608,7 @@ void ScOutputData::DrawEdit(bool bPixelToLogic) if (mpSpellCheckCxt) aParam.mpMisspellRanges = mpSpellCheckCxt->getMisspellRanges(nCellX, nCellY); - if (aParam.meHorJustAttr == SVX_HOR_JUSTIFY_REPEAT) + if (aParam.meHorJustAttr == SvxCellHorJustify::Repeat) { // ignore orientation/rotation if "repeat" is active aParam.meOrient = SVX_ORIENTATION_STANDARD; @@ -4733,9 +4733,9 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) SvxCellHorJustify eHorJust = (SvxCellHorJustify)static_cast( pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet)).GetValue(); - bool bBreak = ( eHorJust == SVX_HOR_JUSTIFY_BLOCK ) || + bool bBreak = ( eHorJust == SvxCellHorJustify::Block ) || static_cast(pPattern->GetItem(ATTR_LINEBREAK, pCondSet)).GetValue(); - bool bRepeat = ( eHorJust == SVX_HOR_JUSTIFY_REPEAT && !bBreak ); + bool bRepeat = ( eHorJust == SvxCellHorJustify::Repeat && !bBreak ); bool bShrink = !bBreak && !bRepeat && static_cast (pPattern->GetItem( ATTR_SHRINKTOFIT, pCondSet )).GetValue(); SvxCellOrientation eOrient = pPattern->GetCellOrientation( pCondSet ); @@ -4830,7 +4830,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) const SvxMarginItem* pMargin = static_cast( &pPattern->GetItem(ATTR_MARGIN, pCondSet)); sal_uInt16 nIndent = 0; - if ( eHorJust == SVX_HOR_JUSTIFY_LEFT ) + if ( eHorJust == SvxCellHorJustify::Left ) nIndent = static_cast(pPattern-> GetItem(ATTR_INDENT, pCondSet)).GetValue(); @@ -5037,7 +5037,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) SCROW nCellY = nY; SvxCellHorJustify eOutHorJust = eHorJust; if ( eRotMode != SVX_ROTATE_MODE_STANDARD ) - eOutHorJust = bNegative ? SVX_HOR_JUSTIFY_RIGHT : SVX_HOR_JUSTIFY_LEFT; + eOutHorJust = bNegative ? SvxCellHorJustify::Right : SvxCellHorJustify::Left; long nNeededWidth = nGridWidth; // in pixel for GetOutputArea if ( bPixelToLogic ) nNeededWidth = mpRefDevice->LogicToPixel(Size(nNeededWidth,0)).Width(); @@ -5153,13 +5153,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if (eOrient==SVX_ORIENTATION_STANDARD && !nAttrRotate) { - if (eHorJust==SVX_HOR_JUSTIFY_RIGHT || - eHorJust==SVX_HOR_JUSTIFY_CENTER) + if (eHorJust==SvxCellHorJustify::Right || + eHorJust==SvxCellHorJustify::Center) { pEngine->SetUpdateMode( false ); SvxAdjust eSvxAdjust = - (eHorJust==SVX_HOR_JUSTIFY_RIGHT) ? + (eHorJust==SvxCellHorJustify::Right) ? SvxAdjust::Right : SvxAdjust::Center; pEngine->SetDefaultItem( SvxAdjustItem( eSvxAdjust, EE_PARA_JUST ) ); @@ -5176,10 +5176,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) else { // rotated text is centered by default - if (eHorJust==SVX_HOR_JUSTIFY_RIGHT) + if (eHorJust==SvxCellHorJustify::Right) aLogicStart.X() += nAvailWidth - nEngineWidth; - else if (eHorJust==SVX_HOR_JUSTIFY_CENTER || - eHorJust==SVX_HOR_JUSTIFY_STANDARD) + else if (eHorJust==SvxCellHorJustify::Center || + eHorJust==SvxCellHorJustify::Standard) aLogicStart.X() += (nAvailWidth - nEngineWidth) / 2; } } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index f2253f4d1709..188d0631f289 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1041,7 +1041,7 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); - bool bBreak = ( eJust == SVX_HOR_JUSTIFY_BLOCK ) || + bool bBreak = ( eJust == SvxCellHorJustify::Block ) || static_cast(pPattern->GetItem(ATTR_LINEBREAK)).GetValue(); bool bAsianVertical = pNewEngine->IsVertical(); // set by InputHandler @@ -1078,8 +1078,8 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, // For growing use only the alignment value from the attribute, numbers // (existing or started) with default alignment extend to the right. - bool bGrowCentered = ( eJust == SVX_HOR_JUSTIFY_CENTER ); - bool bGrowToLeft = ( eJust == SVX_HOR_JUSTIFY_RIGHT ); // visual left + bool bGrowCentered = ( eJust == SvxCellHorJustify::Center ); + bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left if ( bAsianVertical ) bGrowCentered = bGrowToLeft = false; // keep old behavior for asian mode @@ -1246,8 +1246,8 @@ void ScViewData::EditGrowX() const ScPatternAttr* pPattern = pLocalDoc->GetPattern( nEditCol, nEditRow, nTabNo ); SvxCellHorJustify eJust = (SvxCellHorJustify)static_cast( pPattern->GetItem( ATTR_HOR_JUSTIFY )).GetValue(); - bool bGrowCentered = ( eJust == SVX_HOR_JUSTIFY_CENTER ); - bool bGrowToLeft = ( eJust == SVX_HOR_JUSTIFY_RIGHT ); // visual left + bool bGrowCentered = ( eJust == SvxCellHorJustify::Center ); + bool bGrowToLeft = ( eJust == SvxCellHorJustify::Right ); // visual left bool bGrowBackwards = bGrowToLeft; // logical left if ( bLayoutRTL ) bGrowBackwards = !bGrowBackwards; // invert on RTL sheet diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 4dafd60d58e9..a577cece2781 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -2203,7 +2203,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) static_cast(pPattern->GetItem(ATTR_MARGIN)); sal_uInt16 nMargin = rMItem.GetLeftMargin() + rMItem.GetRightMargin(); if ( static_cast( pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_LEFT ) + GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Left ) nMargin = sal::static_int_cast( nMargin + static_cast(pPattern->GetItem(ATTR_INDENT)).GetValue() ); @@ -2256,7 +2256,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) bool bNeedHeight = static_cast(pPattern->GetItem( ATTR_LINEBREAK )).GetValue() || static_cast(pPattern-> - GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SVX_HOR_JUSTIFY_BLOCK; + GetItem( ATTR_HOR_JUSTIFY )).GetValue() == SvxCellHorJustify::Block; if (bNeedHeight) AdjustRowHeight( nRow, nRow ); } -- cgit