diff options
Diffstat (limited to 'sw/source/core/text')
-rw-r--r-- | sw/source/core/text/itratr.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/text/itratr.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/redlnitr.cxx | 16 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 15 |
4 files changed, 36 insertions, 7 deletions
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index d7d8f7a0aefc..28263abd9eaa 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -204,7 +204,8 @@ bool SwAttrIter::SeekStartAndChgAttrIter( OutputDevice* pOut, const bool bParaFo { assert(m_pMergedPara); m_pTextNode = m_pMergedPara->pFirstNode; - InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, + m_pMergedPara->mergedText, nullptr, nullptr); } // reset font to its original state @@ -338,7 +339,8 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) // items at all; it can only apply a previously effective item. // So do this by recreating the font from scratch. // Apply new para items: - InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *newPos.first, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *newPos.first, + m_pMergedPara->mergedText, nullptr, nullptr); // reset to next m_pTextNode = newPos.first; m_nStartIndex = 0; @@ -360,7 +362,8 @@ bool SwAttrIter::Seek(TextFrameIndex const nNewPos) m_pTextNode = newPos.first; // sw_redlinehide: hope it's okay to use the current text node // here; the AttrHandler shouldn't care about non-char items - InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, m_pMergedPara->mergedText, nullptr); + InitFontAndAttrHandler(*m_pMergedPara->pParaPropsNode, *m_pTextNode, + m_pMergedPara->mergedText, nullptr, nullptr); } } if (m_pMergedPara || m_pTextNode->GetpSwpHints()) diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx index 2dddd1265d8c..dd3a755c7bfd 100644 --- a/sw/source/core/text/itratr.hxx +++ b/sw/source/core/text/itratr.hxx @@ -67,7 +67,8 @@ private: void SetFnt( SwFont* pNew ) { m_pFont = pNew; } void InitFontAndAttrHandler( SwTextNode const& rPropsNode, SwTextNode const& rTextNode, - OUString const& rText, bool const* pbVertLayout); + OUString const& rText, bool const* pbVertLayout, + bool const* pbVertLayoutLRBT); protected: void Chg( SwTextAttr const *pHt ); diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 3b481b762914..95ce480d11b5 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -307,7 +307,8 @@ void SwAttrIter::InitFontAndAttrHandler( SwTextNode const& rPropsNode, SwTextNode const& rTextNode, OUString const& rText, - bool const*const pbVertLayout) + bool const*const pbVertLayout, + bool const*const pbVertLayoutLRBT) { // Build a font matching the default paragraph style: SwFontAccess aFontAccess( &rPropsNode.GetAnyFormatColl(), m_pViewShell ); @@ -328,7 +329,10 @@ void SwAttrIter::InitFontAndAttrHandler( // if it's a re-init, the vert flag never changes if (pbVertLayout ? *pbVertLayout : m_aAttrHandler.IsVertLayout()) { - m_pFont->SetVertical( m_pFont->GetOrientation(), true ); + bool bVertLayoutLRBT = false; + if (pbVertLayoutLRBT) + bVertLayoutLRBT = *pbVertLayoutLRBT; + m_pFont->SetVertical(m_pFont->GetOrientation(), true, bVertLayoutLRBT); } // Initialize the default attribute of the attribute handler @@ -385,6 +389,7 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, // set font to vertical if frame layout is vertical bool bVertLayout = false; + bool bVertLayoutLRBT = false; bool bRTL = false; if ( pFrame ) { @@ -392,6 +397,10 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, { bVertLayout = true; } + if (pFrame->IsVertLRBT()) + { + bVertLayoutLRBT = true; + } bRTL = pFrame->IsRightToLeft(); m_pMergedPara = pFrame->GetMergedPara(); } @@ -405,7 +414,8 @@ void SwAttrIter::CtorInitAttrIter(SwTextNode & rTextNode, m_pMergedPara ? *m_pMergedPara->pParaPropsNode : rTextNode, rTextNode, m_pMergedPara ? m_pMergedPara->mergedText : rTextNode.GetText(), - & bVertLayout); + & bVertLayout, + & bVertLayoutLRBT); m_nStartIndex = m_nEndIndex = m_nPosition = m_nChgCnt = 0; m_nPropFont = 0; diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 557a5f226afb..17d1d6f321fc 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -512,6 +512,21 @@ void SwTextFrame::SwitchHorizontalToVertical( SwRect& rRect ) const */ void SwTextFrame::SwitchHorizontalToVertical( Point& rPoint ) const { + if (IsVertLRBT()) + { + // The horizontal origo is the top left corner, the LRBT origo is the + // bottom left corner. Finally x and y has to be swapped. + SAL_WARN_IF(!mbIsSwapped, "sw.core", + "SwTextFrame::SwitchHorizontalToVertical, IsVertLRBT, not swapped"); + Point aPoint(rPoint); + rPoint.setX(getFrameArea().Left() + (aPoint.Y() - getFrameArea().Top())); + // This would be bottom - x delta, but bottom is top + height, finally + // width (and not height), as it's swapped. + rPoint.setY(getFrameArea().Top() + getFrameArea().Width() + - (aPoint.X() - getFrameArea().Left())); + return; + } + // calc offset inside frame const long nOfstX = rPoint.X() - getFrameArea().Left(); const long nOfstY = rPoint.Y() - getFrameArea().Top(); |