Kaydet (Commit) 39c618ca authored tarafından Noel Grandin's avatar Noel Grandin

convert EEHorizontalTextDirection to scoped enum

Change-Id: Icb7298742ae80fa17d5e6f6a3a09a6bb30892b6d
Reviewed-on: https://gerrit.libreoffice.org/46590Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 12bb4bc9
......@@ -137,7 +137,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
nAsianCompressionMode = CharCompressType::NONE;
eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT;
eDefaultHorizontalTextDirection = EEHorizontalTextDirection::Default;
aStatus.GetControlWord() = EEControlBits::USECHARATTRIBS | EEControlBits::DOIDLEFORMAT |
......@@ -1971,12 +1971,12 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const
if ( !IsVertical() )
{
bR2L = GetDefaultHorizontalTextDirection() == EE_HTEXTDIR_R2L;
bR2L = GetDefaultHorizontalTextDirection() == EEHorizontalTextDirection::R2L;
pFrameDirItem = &GetParaAttrib( nPara, EE_PARA_WRITINGDIR );
if ( pFrameDirItem->GetValue() == SvxFrameDirection::Environment )
{
// #103045# if DefaultHorizontalTextDirection is set, use that value, otherwise pool default.
if ( GetDefaultHorizontalTextDirection() != EE_HTEXTDIR_DEFAULT )
if ( GetDefaultHorizontalTextDirection() != EEHorizontalTextDirection::Default )
{
pFrameDirItem = nullptr; // bR2L already set to default horizontal text direction
}
......
......@@ -34,7 +34,7 @@ class SvxRTFItemStackType;
enum class HtmlTokenId : sal_Int16;
enum class EETextFormat { Text = 0x20, Rtf, Html = 0x32, Xml };
enum EEHorizontalTextDirection { EE_HTEXTDIR_DEFAULT, EE_HTEXTDIR_L2R, EE_HTEXTDIR_R2L };
enum class EEHorizontalTextDirection { Default, L2R, R2L };
enum class EESelectionMode { Std, TxtOnly, Hidden };
// EE_SELMODE_HIDDEN can be used to completely hide the selection. This is useful e.g. when you want show the selection
// only as long as your window (which the edit view works on) has the focus
......
......@@ -55,6 +55,7 @@ enum class SvtScriptType;
enum class ScMF;
enum class FormulaError : sal_uInt16;
enum class CharCompressType;
enum class EEHorizontalTextDirection;
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace svl {
......@@ -2032,7 +2033,7 @@ public:
void SetAsianKerning(bool bNew);
void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine);
sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
EEHorizontalTextDirection GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values
SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;}
void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;}
......
......@@ -360,9 +360,9 @@ bool ScDocument::RenamePageStyleInUse( const OUString& rOld, const OUString& rNe
return bWasInUse;
}
sal_uInt8 ScDocument::GetEditTextDirection(SCTAB nTab) const
EEHorizontalTextDirection ScDocument::GetEditTextDirection(SCTAB nTab) const
{
EEHorizontalTextDirection eRet = EE_HTEXTDIR_DEFAULT;
EEHorizontalTextDirection eRet = EEHorizontalTextDirection::Default;
OUString aStyleName = GetPageStyle( nTab );
SfxStyleSheetBase* pStyle = mxPoolHelper->GetStylePool()->Find( aStyleName, SfxStyleFamily::Page );
......@@ -373,13 +373,13 @@ sal_uInt8 ScDocument::GetEditTextDirection(SCTAB nTab) const
rStyleSet.Get( ATTR_WRITINGDIR ).GetValue();
if ( eDirection == SvxFrameDirection::Horizontal_LR_TB )
eRet = EE_HTEXTDIR_L2R;
eRet = EEHorizontalTextDirection::L2R;
else if ( eDirection == SvxFrameDirection::Horizontal_RL_TB )
eRet = EE_HTEXTDIR_R2L;
eRet = EEHorizontalTextDirection::R2L;
// else (invalid for EditEngine): keep "default"
}
return sal::static_int_cast<sal_uInt8>(eRet);
return eRet;
}
ScMacroManager* ScDocument::GetMacroManager()
......
......@@ -783,7 +783,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab )
ScDocument* pDoc = rViewData.GetDocument();
pDoc->ApplyAsianEditSettings( *mpEditEngine );
mpEditEngine->SetDefaultHorizontalTextDirection(
(EEHorizontalTextDirection)pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
pDoc->GetEditTextDirection( rViewData.GetTabNo() ) );
mpEditEngine->SetFirstWordCapitalization( false );
}
......
......@@ -1170,7 +1170,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet )
if ( eAttrDir == SvxFrameDirection::Environment )
{
// get "environment" direction from page style
if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EE_HTEXTDIR_R2L )
if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L )
eAttrDir = SvxFrameDirection::Horizontal_RL_TB;
else
eAttrDir = SvxFrameDirection::Horizontal_LR_TB;
......
......@@ -93,7 +93,7 @@ ScEditWindow::ScEditWindow( vcl::Window* pParent, WinBits nBits, ScEditWindowLoc
pEdEngine->SetControlWord( pEdEngine->GetControlWord() | EEControlBits::MARKFIELDS );
mbRTL = ScGlobal::IsSystemRTL();
if (mbRTL)
pEdEngine->SetDefaultHorizontalTextDirection(EE_HTEXTDIR_R2L);
pEdEngine->SetDefaultHorizontalTextDirection(EEHorizontalTextDirection::R2L);
pEdView = new EditView( pEdEngine, this );
pEdView->SetOutputArea( tools::Rectangle( Point(0,0), GetOutputSize() ) );
......
......@@ -2737,17 +2737,17 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet )
rAttrSet.Get( ATTR_VERTICAL_ASIAN ).GetValue();
bool bBidiDontCare = (rAttrSet.GetItemState( ATTR_WRITINGDIR ) == SfxItemState::DONTCARE);
EEHorizontalTextDirection eBidiDir = EE_HTEXTDIR_DEFAULT;
EEHorizontalTextDirection eBidiDir = EEHorizontalTextDirection::Default;
if ( !bBidiDontCare )
{
SvxFrameDirection eCellDir = rAttrSet.Get( ATTR_WRITINGDIR ).GetValue();
if ( eCellDir == SvxFrameDirection::Environment )
eBidiDir = (EEHorizontalTextDirection)GetViewData()->GetDocument()->
eBidiDir = GetViewData()->GetDocument()->
GetEditTextDirection( GetViewData()->GetTabNo() );
else if ( eCellDir == SvxFrameDirection::Horizontal_RL_TB )
eBidiDir = EE_HTEXTDIR_R2L;
eBidiDir = EEHorizontalTextDirection::R2L;
else
eBidiDir = EE_HTEXTDIR_L2R;
eBidiDir = EEHorizontalTextDirection::L2R;
}
SvtLanguageOptions aLangOpt;
......@@ -2786,9 +2786,9 @@ void ScFormatShell::GetTextDirectionState( SfxItemSet& rSet )
else if ( bBidiDontCare )
rSet.InvalidateItem( nWhich );
else if ( nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT )
rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_L2R ) );
rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::L2R ) );
else
rSet.Put( SfxBoolItem( nWhich, eBidiDir == EE_HTEXTDIR_R2L ) );
rSet.Put( SfxBoolItem( nWhich, eBidiDir == EEHorizontalTextDirection::R2L ) );
}
}
nWhich = aIter.NextWhich();
......
......@@ -2123,7 +2123,7 @@ ScFieldEditEngine* ScOutputData::CreateOutputEditEngine()
pEngine->SetControlWord( nCtrl );
mpDoc->ApplyAsianEditSettings( *pEngine );
pEngine->EnableAutoColor( mbUseStyleColor );
pEngine->SetDefaultHorizontalTextDirection( (EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
pEngine->SetDefaultHorizontalTextDirection( mpDoc->GetEditTextDirection( nTab ) );
return pEngine;
}
......
......@@ -178,7 +178,7 @@ void ScOutputData::DrawSelectiveObjects(SdrLayerID nLayer)
SdrOutliner& rOutl = pModel->GetDrawOutliner();
rOutl.EnableAutoColor( mbUseStyleColor );
rOutl.SetDefaultHorizontalTextDirection(
(EEHorizontalTextDirection)mpDoc->GetEditTextDirection( nTab ) );
mpDoc->GetEditTextDirection( nTab ) );
// #i69767# The hyphenator must be set (used to be before drawing a text shape with hyphenation).
// LinguMgr::GetHyphenator (EditEngine) uses a wrapper now that creates the real hyphenator on demand,
......
......@@ -3472,7 +3472,7 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const
}
rOutl.SetDefaultHorizontalTextDirection(
(EEHorizontalTextDirection)pLocalDoc->GetEditTextDirection( nTabNo ) );
pLocalDoc->GetEditTextDirection( nTabNo ) );
}
ScAddress ScViewData::GetCurPos() const
......
......@@ -114,7 +114,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
Color aOldOutlinerBackgrdColor;
// set default horizontal text direction on painting <hell> or
// <heaven>.
EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R;
EEHorizontalTextDirection aOldEEHoriTextDir = EEHorizontalTextDirection::L2R;
const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess();
if ( (_nLayerID == rIDDMA.GetHellId()) ||
(_nLayerID == rIDDMA.GetHeavenId()) )
......@@ -131,7 +131,7 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
aOldEEHoriTextDir =
GetDrawView()->GetModel()->GetDrawOutliner().GetDefaultHorizontalTextDirection();
EEHorizontalTextDirection aEEHoriTextDirOfPage =
_bIsPageRightToLeft ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
_bIsPageRightToLeft ? EEHorizontalTextDirection::R2L : EEHorizontalTextDirection::L2R;
GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aEEHoriTextDirOfPage );
}
......
......@@ -538,7 +538,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
// set default horizontal text direction at outliner
EEHorizontalTextDirection aDefHoriTextDir =
pSh->IsShapeDefaultHoriTextDirR2L() ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
pSh->IsShapeDefaultHoriTextDirR2L() ? EEHorizontalTextDirection::R2L : EEHorizontalTextDirection::L2R;
pOutliner->SetDefaultHorizontalTextDirection( aDefHoriTextDir );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment