diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-07-21 13:36:13 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-07-21 14:03:49 +0200 |
commit | 1cfa72a83101d7ea1f89b2c20a6c29d12e8da933 (patch) | |
tree | 318032bd20ff9943c9039b539c8a68c6a71b4e10 /editeng | |
parent | 99cd1d8834bb708afc81c825ff2b7992b7acb37d (diff) |
IsVertical->IsEffectivelyVertical, GetDirectVertical->GetVertical
Before commit 653b53287ca09a9ffe3f5ce0242919e719c1086c, editengine
objects had a pair IsVertical/SetVertical, which queried and set
a boolean flag (and SetVertical also had a second argument to set
another flag).
The mentioned commit had introduced an inconsistency, changing
SetVertical to only set a single flag, but at the same time making
IsVertical to return a synthesized result from two values: vertical
and rotation. Additionally, GetDirectVertical was introduced to
complement SetVertical.
In many places, the use of synthetic IsVertical looks suspicious,
especially where it is used in combinations with SetVertical. But
here I don't change existing logic, and only rename the methods,
so that in case someone sees an actual problem, it would be easier
to spot the method mismatch.
The end result is that now we have a proper getter/setter pair
GetVertical/SetVertical, and also IsEffectivelyVertical, named to
reflect that it calculates its return value.
Change-Id: I38e2b7c5bd7af0787dd7a1c48e1385138dac80b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119315
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editdoc.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 8 | ||||
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 32 | ||||
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/editobj2.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.cxx | 10 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 74 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 | ||||
-rw-r--r-- | editeng/source/outliner/outlin2.cxx | 2 | ||||
-rw-r--r-- | editeng/source/outliner/outlobj.cxx | 10 | ||||
-rw-r--r-- | editeng/source/uno/unofored.cxx | 6 |
13 files changed, 84 insertions, 84 deletions
diff --git a/editeng/inc/editdoc.hxx b/editeng/inc/editdoc.hxx index 133ea1ca9daa..b18b22195973 100644 --- a/editeng/inc/editdoc.hxx +++ b/editeng/inc/editdoc.hxx @@ -756,9 +756,9 @@ public: sal_uInt16 GetDefTab() const { return nDefTab; } void SetVertical( bool bVertical ) { bIsVertical = bVertical; } - bool IsVertical() const; + bool IsEffectivelyVertical() const; bool IsTopToBottom() const; - bool GetDirectVertical() const; + bool GetVertical() const; void SetRotation( TextRotation nRotation ) { mnRotation = nRotation; } TextRotation GetRotation() const { return mnRotation; } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index a30111e33e66..774d3ad52cf9 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -2015,8 +2015,8 @@ void EditDoc::CreateDefFont( bool bUseStyles ) { SfxItemSet aTmpSet( GetItemPool(), svl::Items<EE_PARA_START, EE_CHAR_END> ); CreateFont( aDefFont, aTmpSet ); - aDefFont.SetVertical( IsVertical() ); - aDefFont.SetOrientation( Degree10(IsVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); + aDefFont.SetVertical( IsEffectivelyVertical() ); + aDefFont.SetOrientation( Degree10(IsEffectivelyVertical() ? (IsTopToBottom() ? 2700 : 900) : 0) ); for ( sal_Int32 nNode = 0; nNode < Count(); nNode++ ) { @@ -2027,7 +2027,7 @@ void EditDoc::CreateDefFont( bool bUseStyles ) } } -bool EditDoc::IsVertical() const +bool EditDoc::IsEffectivelyVertical() const { return (bIsVertical && mnRotation == TextRotation::NONE) || (!bIsVertical && mnRotation != TextRotation::NONE); @@ -2039,7 +2039,7 @@ bool EditDoc::IsTopToBottom() const (!bIsVertical && mnRotation == TextRotation::TOPTOBOTTOM); } -bool EditDoc::GetDirectVertical() const +bool EditDoc::GetVertical() const { return bIsVertical; } diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index b90ad3127fee..9159f9b7169c 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -213,7 +213,7 @@ void EditEngine::Draw( OutputDevice& rOutDev, const Point& rStartPos, Degree10 n if( rOutDev.GetConnectMetaFile() ) rOutDev.Push(); Point aStartPos( rStartPos ); - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) { aStartPos.AdjustX(GetPaperSize().Width() ); aStartPos = Rotate( aStartPos, nOrientation, rStartPos ); @@ -241,7 +241,7 @@ void EditEngine::Draw( OutputDevice& rOutDev, const tools::Rectangle& rOutRect, aOutRect = rOutDev.PixelToLogic( aOutRect ); Point aStartPos; - if ( !IsVertical() ) + if ( !IsEffectivelyVertical() ) { aStartPos.setX( aOutRect.Left() - rStartDocPos.X() ); aStartPos.setY( aOutRect.Top() - rStartDocPos.Y() ); @@ -437,9 +437,9 @@ TextRotation EditEngine::GetRotation() const return pImpEditEngine->GetRotation(); } -bool EditEngine::IsVertical() const +bool EditEngine::IsEffectivelyVertical() const { - return pImpEditEngine->IsVertical(); + return pImpEditEngine->IsEffectivelyVertical(); } bool EditEngine::IsTopToBottom() const @@ -447,9 +447,9 @@ bool EditEngine::IsTopToBottom() const return pImpEditEngine->IsTopToBottom(); } -bool EditEngine::GetDirectVertical() const +bool EditEngine::GetVertical() const { - return pImpEditEngine->GetDirectVertical(); + return pImpEditEngine->GetVertical(); } void EditEngine::SetTextColumns(sal_Int16 nColumns, sal_Int32 nSpacing) @@ -633,7 +633,7 @@ tools::Rectangle EditEngine::GetParaBounds( sal_Int32 nPara ) Point aPnt = GetDocPosTopLeft( nPara ); - if( IsVertical() ) + if( IsEffectivelyVertical() ) { sal_Int32 nTextHeight = pImpEditEngine->GetTextHeight(); sal_Int32 nParaWidth = pImpEditEngine->CalcParaWidth( nPara, true ); @@ -1399,15 +1399,15 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v } pImpEditEngine->UpdateSelections(); - if ( ( !IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ) || - ( IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) )) + if ( ( !IsEffectivelyVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) ) || + ( IsEffectivelyVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) )) { pEditView->pImpEditView->nTravelXPos = TRAVEL_X_DONTKNOW; } if ( /* ( nCode != KEY_HOME ) && ( nCode != KEY_END ) && */ - ( !IsVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) || - ( IsVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) )) + ( !IsEffectivelyVertical() && ( nCode != KEY_LEFT ) && ( nCode != KEY_RIGHT ) ) || + ( IsEffectivelyVertical() && ( nCode != KEY_UP ) && ( nCode != KEY_DOWN ) )) { pEditView->pImpEditView->SetCursorBidiLevel( CURSOR_BIDILEVEL_DONTKNOW ); } @@ -1441,7 +1441,7 @@ sal_uInt32 EditEngine::GetTextHeight() const if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - sal_uInt32 nHeight = !IsVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( true ); + sal_uInt32 nHeight = !IsEffectivelyVertical() ? pImpEditEngine->GetTextHeight() : pImpEditEngine->CalcTextWidth( true ); return nHeight; } @@ -1451,7 +1451,7 @@ sal_uInt32 EditEngine::GetTextHeightNTP() const if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) return pImpEditEngine->CalcTextWidth( true ); return pImpEditEngine->GetTextHeightNTP(); @@ -1463,7 +1463,7 @@ sal_uInt32 EditEngine::CalcTextWidth() if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( true ) : pImpEditEngine->GetTextHeight(); + sal_uInt32 nWidth = !IsEffectivelyVertical() ? pImpEditEngine->CalcTextWidth( true ) : pImpEditEngine->GetTextHeight(); return nWidth; } @@ -1817,7 +1817,7 @@ void EditEngine::StripPortions() { ScopedVclPtrInstance< VirtualDevice > aTmpDev; tools::Rectangle aBigRect( Point( 0, 0 ), Size( 0x7FFFFFFF, 0x7FFFFFFF ) ); - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) { if( IsTopToBottom() ) { @@ -1958,7 +1958,7 @@ tools::Long EditEngine::GetFirstLineStartX( sal_Int32 nParagraph ) Point EditEngine::GetDocPos( const Point& rPaperPos ) const { Point aDocPos( rPaperPos ); - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) { if ( IsTopToBottom() ) { diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index e9654f4d3a38..579f8d73c30a 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -365,7 +365,7 @@ std::vector<svl::SharedString> EditTextObjectImpl::GetSharedStrings() const return aSSs; } -bool EditTextObjectImpl::IsVertical() const +bool EditTextObjectImpl::IsEffectivelyVertical() const { return (mbVertical && meRotation == TextRotation::NONE) || (!mbVertical && meRotation != TextRotation::NONE); @@ -386,7 +386,7 @@ void EditTextObjectImpl::SetVertical( bool bVert) } } -bool EditTextObjectImpl::GetDirectVertical() const +bool EditTextObjectImpl::GetVertical() const { return mbVertical; } diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx index 66a3517883be..a6f2b1be0d6d 100644 --- a/editeng/source/editeng/editobj2.hxx +++ b/editeng/source/editeng/editobj2.hxx @@ -199,8 +199,8 @@ public: virtual void NormalizeString( svl::SharedStringPool& rPool ) override; virtual std::vector<svl::SharedString> GetSharedStrings() const override; - virtual bool IsVertical() const override; - virtual bool GetDirectVertical() const override; + virtual bool IsEffectivelyVertical() const override; + virtual bool GetVertical() const override; virtual bool IsTopToBottom() const override; virtual void SetVertical( bool bVert) override; virtual void SetRotation(TextRotation nRotation) override; diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 63dd7b78cd44..25942b9e09c9 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -736,7 +736,7 @@ void ImpEditView::ImplDrawHighlightRect( OutputDevice& rTarget, const Point& rDo bool ImpEditView::IsVertical() const { - return pEditEngine->pImpEditEngine->IsVertical(); + return pEditEngine->pImpEditEngine->IsEffectivelyVertical(); } bool ImpEditView::IsTopToBottom() const @@ -754,7 +754,7 @@ Point ImpEditView::GetDocPos( const Point& rWindowPos ) const // Window Position => Position Document Point aPoint; - if ( !pEditEngine->pImpEditEngine->IsVertical() ) + if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() ) { aPoint.setX( rWindowPos.X() - aOutArea.Left() + GetVisDocLeft() ); aPoint.setY( rWindowPos.Y() - aOutArea.Top() + GetVisDocTop() ); @@ -781,7 +781,7 @@ Point ImpEditView::GetWindowPos( const Point& rDocPos ) const // Document position => window position Point aPoint; - if ( !pEditEngine->pImpEditEngine->IsVertical() ) + if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() ) { aPoint.setX( rDocPos.X() + aOutArea.Left() - GetVisDocLeft() ); aPoint.setY( rDocPos.Y() + aOutArea.Top() - GetVisDocTop() ); @@ -809,7 +809,7 @@ tools::Rectangle ImpEditView::GetWindowPos( const tools::Rectangle& rDocRect ) c Point aPos( GetWindowPos( rDocRect.TopLeft() ) ); Size aSz = rDocRect.GetSize(); tools::Rectangle aRect; - if ( !pEditEngine->pImpEditEngine->IsVertical() ) + if ( !pEditEngine->pImpEditEngine->IsEffectivelyVertical() ) { aRect = tools::Rectangle( aPos, aSz ); } @@ -2571,7 +2571,7 @@ void ImpEditView::dragOver(const css::datatransfer::dnd::DropTargetDragEvent& rD Point aEndPos( GetOutputArea().GetWidth(), nDDYPos ); aEndPos = GetWindowPos( aEndPos ); aEditCursor = rOutDev.LogicToPixel( tools::Rectangle( aStartPos, aEndPos ) ); - if ( !pEditEngine->IsVertical() ) + if ( !pEditEngine->IsEffectivelyVertical() ) { aEditCursor.AdjustTop( -1 ); aEditCursor.AdjustBottom( 1 ); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index b074117dfd58..5be7f1bbd1c2 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -808,9 +808,9 @@ public: void SetPaperSize( const Size& rSz ) { aPaperSize = rSz; } void SetVertical( bool bVertical); - bool IsVertical() const { return GetEditDoc().IsVertical(); } + bool IsEffectivelyVertical() const { return GetEditDoc().IsEffectivelyVertical(); } bool IsTopToBottom() const { return GetEditDoc().IsTopToBottom(); } - bool GetDirectVertical() const { return GetEditDoc().GetDirectVertical(); } + bool GetVertical() const { return GetEditDoc().GetVertical(); } void SetRotation( TextRotation nRotation); TextRotation GetRotation() const { return GetEditDoc().GetRotation(); } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 091bad24e080..e89c1258bc33 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -795,9 +795,9 @@ EditSelection const & ImpEditEngine::MoveCursor( const KeyEvent& rKeyEvent, Edit EditPaM aOldPaM( aPaM ); TextDirectionality eTextDirection = TextDirectionality::LeftToRight_TopToBottom; - if (IsVertical() && IsTopToBottom()) + if (IsEffectivelyVertical() && IsTopToBottom()) eTextDirection = TextDirectionality::TopToBottom_RightToLeft; - else if (IsVertical() && !IsTopToBottom()) + else if (IsEffectivelyVertical() && !IsTopToBottom()) eTextDirection = TextDirectionality::BottomToTop_LeftToRight; else if ( IsRightToLeft( GetEditDoc().GetPos( aPaM.GetNode() ) ) ) eTextDirection = TextDirectionality::RightToLeft_TopToBottom; @@ -1980,7 +1980,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const bool bR2L = false; const SvxFrameDirectionItem* pFrameDirItem = nullptr; - if ( !IsVertical() ) + if ( !IsEffectivelyVertical() ) { bR2L = GetDefaultHorizontalTextDirection() == EEHorizontalTextDirection::R2L; pFrameDirItem = &GetParaAttrib( nPara, EE_PARA_WRITINGDIR ); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 273f44a65a59..b98470ec2c28 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -425,7 +425,7 @@ void ImpEditEngine::FormatDoc() tools::Long nNewHeight = CalcTextHeight(&nNewHeightNTP); tools::Long nDiff = nNewHeight - nCurTextHeight; if ( nDiff ) - aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TextHeightChanged : EditStatusFlags::TEXTWIDTHCHANGED; + aStatus.GetStatusWord() |= !IsEffectivelyVertical() ? EditStatusFlags::TextHeightChanged : EditStatusFlags::TEXTWIDTHCHANGED; nCurTextHeight = nNewHeight; nCurTextHeightNTP = nNewHeightNTP; @@ -503,20 +503,20 @@ void ImpEditEngine::CheckAutoPageSize() { Size aPrevPaperSize( GetPaperSize() ); if ( GetStatus().AutoPageWidth() ) - aPaperSize.setWidth( !IsVertical() ? CalcTextWidth( true ) : GetTextHeight() ); + aPaperSize.setWidth( !IsEffectivelyVertical() ? CalcTextWidth( true ) : GetTextHeight() ); if ( GetStatus().AutoPageHeight() ) - aPaperSize.setHeight( !IsVertical() ? GetTextHeight() : CalcTextWidth( true ) ); + aPaperSize.setHeight( !IsEffectivelyVertical() ? GetTextHeight() : CalcTextWidth( true ) ); SetValidPaperSize( aPaperSize ); // consider Min, Max if ( aPaperSize == aPrevPaperSize ) return; - if ( ( !IsVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) ) - || ( IsVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) ) + if ( ( !IsEffectivelyVertical() && ( aPaperSize.Width() != aPrevPaperSize.Width() ) ) + || ( IsEffectivelyVertical() && ( aPaperSize.Height() != aPrevPaperSize.Height() ) ) ) { // If ahead is centered / right or tabs... - aStatus.GetStatusWord() |= !IsVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::TextHeightChanged; + aStatus.GetStatusWord() |= !IsEffectivelyVertical() ? EditStatusFlags::TEXTWIDTHCHANGED : EditStatusFlags::TextHeightChanged; for ( sal_Int32 nPara = 0; nPara < GetParaPortions().Count(); nPara++ ) { // Only paragraphs which are not aligned to the left need to be @@ -538,7 +538,7 @@ void ImpEditEngine::CheckAutoPageSize() aInvSize.setHeight( aPrevPaperSize.Height() ); Size aSz( aInvSize ); - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) { aSz.setWidth( aInvSize.Height() ); aSz.setHeight( aInvSize.Width() ); @@ -591,7 +591,7 @@ static sal_Int32 ImplCalculateFontIndependentLineSpacing( const sal_Int32 nFontH tools::Long ImpEditEngine::GetColumnWidth(const Size& rPaperSize) const { assert(mnColumns >= 1); - tools::Long nWidth = IsVertical() ? rPaperSize.Height() : rPaperSize.Width(); + tools::Long nWidth = IsEffectivelyVertical() ? rPaperSize.Height() : rPaperSize.Width(); return (nWidth - mnColumnSpacing * (mnColumns - 1)) / mnColumns; } @@ -782,7 +782,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } } - const bool bAutoSize = IsVertical() ? aStatus.AutoPageHeight() : aStatus.AutoPageWidth(); + const bool bAutoSize = IsEffectivelyVertical() ? aStatus.AutoPageHeight() : aStatus.AutoPageWidth(); tools::Long nMaxLineWidth = GetColumnWidth(bAutoSize ? aMaxAutoPaperSize : aPaperSize); nMaxLineWidth -= GetXValue( rLRItem.GetRight() ); @@ -816,7 +816,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) tools::Long nTextLineHeight = 0; if ( GetTextRanger() ) { - GetTextRanger()->SetVertical( IsVertical() ); + GetTextRanger()->SetVertical( IsEffectivelyVertical() ); tools::Long nTextY = nStartPosY + GetEditCursor( &rParaPortion, pLine, pLine->GetStart(), GetCursorFlags::NONE ).Top(); if ( !bSameLineAgain ) @@ -844,7 +844,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { tools::Long nYOff = nTextY + nTextExtraYOffset; tools::Long nYDiff = nTextLineHeight; - if ( IsVertical() ) + if ( IsEffectivelyVertical() ) { tools::Long nMaxPolygonX = GetTextRanger()->GetBoundRect().Right(); nYOff = nMaxPolygonX-nYOff; @@ -1455,8 +1455,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } } - if ( ( !IsVertical() && aStatus.AutoPageWidth() ) || - ( IsVertical() && aStatus.AutoPageHeight() ) ) + if ( ( !IsEffectivelyVertical() && aStatus.AutoPageWidth() ) || + ( IsEffectivelyVertical() && aStatus.AutoPageHeight() ) ) { // If the row fits within the current paper width, then this width // has to be used for the Alignment. If it does not fit or if it @@ -2604,7 +2604,7 @@ void ImpEditEngine::SetTextRanger( std::unique_ptr<TextRanger> pRanger ) void ImpEditEngine::SetVertical( bool bVertical) { - if ( IsVertical() != bVertical) + if ( IsEffectivelyVertical() != bVertical) { GetEditDoc().SetVertical(bVertical); bool bUseCharAttribs = bool(aStatus.GetControlWord() & EEControlBits::USECHARATTRIBS); @@ -2958,17 +2958,17 @@ void ImpEditEngine::RecalcFormatterFontMetrics( FormatterFontMetric& rCurMetrics tools::Long ImpEditEngine::getWidthDirectionAware(const Size& sz) const { - return !IsVertical() ? sz.Width() : sz.Height(); + return !IsEffectivelyVertical() ? sz.Width() : sz.Height(); } tools::Long ImpEditEngine::getHeightDirectionAware(const Size& sz) const { - return !IsVertical() ? sz.Height() : sz.Width(); + return !IsEffectivelyVertical() ? sz.Height() : sz.Width(); } void ImpEditEngine::adjustXDirectionAware(Point& pt, tools::Long x) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) pt.AdjustX(x); else pt.AdjustY(IsTopToBottom() ? x : -x); @@ -2976,7 +2976,7 @@ void ImpEditEngine::adjustXDirectionAware(Point& pt, tools::Long x) const void ImpEditEngine::adjustYDirectionAware(Point& pt, tools::Long y) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) pt.AdjustY(y); else pt.AdjustX(IsTopToBottom() ? -y : y); @@ -2984,7 +2984,7 @@ void ImpEditEngine::adjustYDirectionAware(Point& pt, tools::Long y) const void ImpEditEngine::setXDirectionAwareFrom(Point& ptDest, const Point& ptSrc) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) ptDest.setX(ptSrc.X()); else ptDest.setY(ptSrc.Y()); @@ -2992,7 +2992,7 @@ void ImpEditEngine::setXDirectionAwareFrom(Point& ptDest, const Point& ptSrc) co void ImpEditEngine::setYDirectionAwareFrom(Point& ptDest, const Point& ptSrc) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) ptDest.setY(ptSrc.Y()); else ptDest.setX(ptSrc.Y()); @@ -3002,7 +3002,7 @@ tools::Long ImpEditEngine::getYOverflowDirectionAware(const Point& pt, const tools::Rectangle& rectMax) const { tools::Long nRes; - if (!IsVertical()) + if (!IsEffectivelyVertical()) nRes = pt.Y() - rectMax.Bottom(); else if (IsTopToBottom()) nRes = rectMax.Left() - pt.X(); @@ -3013,7 +3013,7 @@ tools::Long ImpEditEngine::getYOverflowDirectionAware(const Point& pt, bool ImpEditEngine::isXOverflowDirectionAware(const Point& pt, const tools::Rectangle& rectMax) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) return pt.X() > rectMax.Right(); if (IsTopToBottom()) @@ -3024,7 +3024,7 @@ bool ImpEditEngine::isXOverflowDirectionAware(const Point& pt, const tools::Rect tools::Long ImpEditEngine::getBottomDocOffset(const tools::Rectangle& rect) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) return rect.Bottom(); if (IsTopToBottom()) @@ -3035,7 +3035,7 @@ tools::Long ImpEditEngine::getBottomDocOffset(const tools::Rectangle& rect) cons Size ImpEditEngine::getTopLeftDocOffset(const tools::Rectangle& rect) const { - if (!IsVertical()) + if (!IsEffectivelyVertical()) return { rect.Left(), rect.Top() }; if (IsTopToBottom()) @@ -3140,9 +3140,9 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po const tools::Long nParaHeight = rPortion.GetHeight(); if ( rPortion.IsVisible() && ( - ( !IsVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRect.Top() ) ) || - ( IsVertical() && IsTopToBottom() && ( ( aStartPos.X() - nParaHeight ) < aClipRect.Right() ) ) || - ( IsVertical() && !IsTopToBottom() && ( ( aStartPos.X() + nParaHeight ) > aClipRect.Left() ) ) ) ) + ( !IsEffectivelyVertical() && ( ( aStartPos.Y() + nParaHeight ) > aClipRect.Top() ) ) || + ( IsEffectivelyVertical() && IsTopToBottom() && ( ( aStartPos.X() - nParaHeight ) < aClipRect.Right() ) ) || + ( IsEffectivelyVertical() && !IsTopToBottom() && ( ( aStartPos.X() + nParaHeight ) > aClipRect.Left() ) ) ) ) { Point aTmpPos; @@ -3174,9 +3174,9 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po adjustXDirectionAware(aTmpPos, pLine->GetStartPosX()); adjustYDirectionAware(aTmpPos, pLine->GetMaxAscent() - nLineHeight); - if ( ( !IsVertical() && ( aStartPos.Y() > aClipRect.Top() ) ) - || ( IsVertical() && IsTopToBottom() && aStartPos.X() < aClipRect.Right() ) - || ( IsVertical() && !IsTopToBottom() && aStartPos.X() > aClipRect.Left() ) ) + if ( ( !IsEffectivelyVertical() && ( aStartPos.Y() > aClipRect.Top() ) ) + || ( IsEffectivelyVertical() && IsTopToBottom() && aStartPos.X() < aClipRect.Right() ) + || ( IsEffectivelyVertical() && !IsTopToBottom() && aStartPos.X() > aClipRect.Left() ) ) { bPaintBullet = false; @@ -3556,8 +3556,8 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po // Take only what begins in the visible range: // Important, because of a bug in some graphic cards // when transparent font, output when negative - if ( nOrientation || ( !IsVertical() && ( ( aTmpPos.X() + nTxtWidth ) >= nFirstVisXPos ) ) - || ( IsVertical() && ( ( aTmpPos.Y() + nTxtWidth ) >= nFirstVisYPos ) ) ) + if ( nOrientation || ( !IsEffectivelyVertical() && ( ( aTmpPos.X() + nTxtWidth ) >= nFirstVisXPos ) ) + || ( IsEffectivelyVertical() && ( ( aTmpPos.Y() + nTxtWidth ) >= nFirstVisYPos ) ) ) { if ( nEsc && ( aTmpFont.GetUnderline() != LINESTYLE_NONE ) ) { @@ -3674,7 +3674,7 @@ void ImpEditEngine::Paint( OutputDevice& rOutDev, tools::Rectangle aClipRect, Po } Color aOldColor( rOutDev.GetLineColor() ); rOutDev.SetLineColor( GetColorConfig().GetColorValue( svtools::SPELL ).nColor ); - lcl_DrawRedLines( rOutDev, aTmpFont.GetFontSize().Height(), aRedLineTmpPos, static_cast<size_t>(nIndex), static_cast<size_t>(nIndex) + rTextPortion.GetLen(), pDXArray, rPortion.GetNode()->GetWrongList(), nOrientation, aOrigin, IsVertical(), rTextPortion.IsRightToLeft() ); + lcl_DrawRedLines( rOutDev, aTmpFont.GetFontSize().Height(), aRedLineTmpPos, static_cast<size_t>(nIndex), static_cast<size_t>(nIndex) + rTextPortion.GetLen(), pDXArray, rPortion.GetNode()->GetWrongList(), nOrientation, aOrigin, IsEffectivelyVertical(), rTextPortion.IsRightToLeft() ); rOutDev.SetLineColor( aOldColor ); } } @@ -3847,7 +3847,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const tools::Rectangle& rRect, Ou OutputDevice& rTarget = pTargetDevice ? *pTargetDevice : *pView->GetWindow()->GetOutDev(); Point aStartPos; - if ( !IsVertical() ) + if ( !IsEffectivelyVertical() ) aStartPos = pView->GetOutputArea().TopLeft(); else { @@ -3863,7 +3863,7 @@ void ImpEditEngine::Paint( ImpEditView* pView, const tools::Rectangle& rRect, Ou // the fields usually protrude if > line. // (Not at the top, since there the Doc-width from formatting is already // there) - if ( !IsVertical() && ( pView->GetOutputArea().GetWidth() > GetPaperSize().Width() ) ) + if ( !IsEffectivelyVertical() && ( pView->GetOutputArea().GetWidth() > GetPaperSize().Width() ) ) { tools::Long nMaxX = pView->GetOutputArea().Left() + GetPaperSize().Width(); if ( aClipRect.Left() > nMaxX ) @@ -4139,7 +4139,7 @@ tools::Long ImpEditEngine::CalcVertLineSpacing(Point& rStartPos) const return 0; // Shift the text to the right for the asian layout mode. - if (IsVertical()) + if (IsEffectivelyVertical()) adjustYDirectionAware(rStartPos, -nTotalSpace); return nTotalSpace / (nTotalLineCount-1); @@ -4218,7 +4218,7 @@ void ImpEditEngine::SetFlatMode( bool bFlat ) void ImpEditEngine::SetCharStretching( sal_uInt16 nX, sal_uInt16 nY ) { bool bChanged; - if ( !IsVertical() ) + if ( !IsEffectivelyVertical() ) { bChanged = nStretchX!=nX || nStretchY!=nY; nStretchX = nX; diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 90b89fc3bcc7..bda54e123304 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -990,7 +990,7 @@ std::unique_ptr<EditTextObject> ImpEditEngine::CreateTextObject(const EditSelect std::unique_ptr<EditTextObject> ImpEditEngine::CreateTextObject( EditSelection aSel, SfxItemPool* pPool, bool bAllowBigObjects, sal_Int32 nBigObjectStart ) { std::unique_ptr<EditTextObjectImpl> pTxtObj(std::make_unique<EditTextObjectImpl>(pPool)); - pTxtObj->SetVertical( GetDirectVertical() ); + pTxtObj->SetVertical( GetVertical() ); pTxtObj->SetRotation( GetRotation() ); MapUnit eMapUnit = aEditDoc.GetItemPool().GetMetric( DEF_METRIC ); pTxtObj->SetMetric( eMapUnit ); @@ -1150,7 +1150,7 @@ void ImpEditEngine::SetText( const EditTextObject& rTextObject ) EnableUndo( false ); InsertText( rTextObject, EditSelection( aPaM, aPaM ) ); - SetVertical(rTextObject.GetDirectVertical()); + SetVertical(rTextObject.GetVertical()); SetRotation(rTextObject.GetRotation()); DBG_ASSERT( !HasUndoManager() || !GetUndoManager().GetUndoActionCount(), "From where comes the Undo in SetText ?!" ); diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 789d5d54e061..d486b2e8b7e3 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -529,7 +529,7 @@ void Outliner::SetRotation(TextRotation nRotation) bool Outliner::IsVertical() const { - return pEditEngine->IsVertical(); + return pEditEngine->IsEffectivelyVertical(); } bool Outliner::IsTopToBottom() const diff --git a/editeng/source/outliner/outlobj.cxx b/editeng/source/outliner/outlobj.cxx index 373fca12c5f1..e8cbd6dbd565 100644 --- a/editeng/source/outliner/outlobj.cxx +++ b/editeng/source/outliner/outlobj.cxx @@ -119,14 +119,14 @@ void OutlinerParaObject::SetOutlinerMode(OutlinerMode nNew) } } -bool OutlinerParaObject::IsVertical() const +bool OutlinerParaObject::IsEffectivelyVertical() const { - return mpImpl->mpEditTextObject->IsVertical(); + return mpImpl->mpEditTextObject->IsEffectivelyVertical(); } -bool OutlinerParaObject::GetDirectVertical() const +bool OutlinerParaObject::GetVertical() const { - return mpImpl->mpEditTextObject->GetDirectVertical(); + return mpImpl->mpEditTextObject->GetVertical(); } bool OutlinerParaObject::IsTopToBottom() const @@ -137,7 +137,7 @@ bool OutlinerParaObject::IsTopToBottom() const void OutlinerParaObject::SetVertical(bool bNew) { const ::o3tl::cow_wrapper< OutlinerParaObjData >* pImpl = &mpImpl; - if ( ( *pImpl )->mpEditTextObject->IsVertical() != bNew) + if ( ( *pImpl )->mpEditTextObject->IsEffectivelyVertical() != bNew) { mpImpl->mpEditTextObject->SetVertical(bNew); } diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx index de8cab5ef060..114792e98073 100644 --- a/editeng/source/uno/unofored.cxx +++ b/editeng/source/uno/unofored.cxx @@ -294,7 +294,7 @@ tools::Rectangle SvxEditEngineForwarder::GetCharBounds( sal_Int32 nPara, sal_Int tools::Long tmp = aSize.Width(); aSize.setWidth(aSize.Height()); aSize.setHeight(tmp); - bool bIsVertical( rEditEngine.IsVertical() ); + bool bIsVertical( rEditEngine.IsEffectivelyVertical() ); // #108900# Handle virtual position one-past-the end of the string if( nIndex >= rEditEngine.GetTextLen(nPara) ) @@ -341,7 +341,7 @@ tools::Rectangle SvxEditEngineForwarder::GetParaBounds( sal_Int32 nPara ) const sal_uLong nWidth; sal_uLong nHeight; - if( rEditEngine.IsVertical() ) + if( rEditEngine.IsEffectivelyVertical() ) { // Hargl. EditEngine's 'external' methods return the rotated // dimensions, 'internal' methods like GetTextHeight( n ) @@ -380,7 +380,7 @@ bool SvxEditEngineForwarder::GetIndexAtPoint( const Point& rPos, sal_Int32& nPar aSize.setHeight(tmp); Point aEEPos( SvxEditSourceHelper::UserSpaceToEE( rPos, aSize, - rEditEngine.IsVertical() )); + rEditEngine.IsEffectivelyVertical() )); EPosition aDocPos = rEditEngine.FindDocPosition( aEEPos ); |