From ba989a99ea19ffd0aafeea01f9b737ea79fa952a Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 27 Mar 2020 08:09:29 +0300 Subject: tdf#80635 ww8import:3 take float table orient to inlined table Since SW has problems with floating tables, any unnecessarily floated tables are converted to inline. However, the positioning of the tables is mostly lost. So the choice is either to refuse to inline a strangely positioned table or else to transfer the positioning onto the inlined table. For absolutely positioned flies, which are LEFT_AND_WIDTH, pass the X position to the left margin. Change-Id: I996a06c753e8b9b1151f7deea8ad4caf5724dd0d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91273 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- sw/source/filter/ww8/ww8par2.cxx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'sw/source') diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index 775dae384f6d..3f3ff253a44e 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2425,6 +2425,7 @@ void WW8TabDesc::CreateSwTable() // Because SW cannot handle multi-page floating frames, // _any unnecessary_ floating tables have been converted to inline. + long nLeft = 0; if ( m_pIo->m_xSFlyPara && !m_pIo->m_xSFlyPara->pFlyFormat ) { // Get the table orientation from the fly @@ -2436,6 +2437,17 @@ void WW8TabDesc::CreateSwTable() m_eOri = text::HoriOrientation::LEFT_AND_WIDTH; else if ( m_pIo->m_xSFlyPara->eHAlign != text::HoriOrientation::NONE ) m_eOri = m_pIo->m_xSFlyPara->eHAlign; + if ( m_eOri == text::HoriOrientation::LEFT_AND_WIDTH ) + { + nLeft = m_pIo->m_xSFlyPara->nXPos; + if ( m_pIo->m_xSFlyPara->eHRel == text::RelOrientation::PAGE_FRAME ) + { + if ( !m_bIsBiDi ) + nLeft -= m_pIo->m_aSectionManager.GetPageLeft(); + else + nLeft += m_pIo->m_aSectionManager.GetPageRight(); + } + } } // The table is small: The number of columns is the lowest count of @@ -2527,13 +2539,12 @@ void WW8TabDesc::CreateSwTable() //ability to set the margin. SvxLRSpaceItem aL( RES_LR_SPACE ); - long nLeft = 0; if (!m_bIsBiDi) - nLeft = GetMinLeft(); + nLeft += GetMinLeft(); else { const short nTableWidth = m_nPreferredWidth ? m_nPreferredWidth : m_nSwWidth; - nLeft = m_pIo->m_aSectionManager.GetTextAreaWidth(); + nLeft += m_pIo->m_aSectionManager.GetTextAreaWidth(); nLeft = nLeft - nTableWidth - GetMinLeft(); } aL.SetLeft(nLeft); -- cgit v1.2.3