sw/source/filter/ww8/docxattributeoutput.cxx | 4 +--- sw/source/filter/ww8/rtfattributeoutput.cxx | 12 +----------- sw/source/filter/ww8/wrtww8.hxx | 2 ++ sw/source/filter/ww8/ww8atr.cxx | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 14 deletions(-)
New commits: commit 1e98b383f517ebc8c6b07aaa0cba5390a7b935d4 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Mar 4 20:19:07 2023 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sat Mar 4 21:06:34 2023 +0000 crashtesting: frequent assert on export to docx this is the same problem for docx as fixed for rtf with commit 811dfd7f2706f56119a1943e08d9bce73b0d2203 Date: Tue Feb 28 15:48:30 2023 +0100 sw: RTF export: fix assert on fdo37077-1.rtf so merge this duplicate code together and use the fixed version. Change-Id: I6a97d94a6cdaf488228a0a89088a3e14ca7e1749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148256 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 6d2ac92d1a43..15159e88e602 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -8696,9 +8696,7 @@ void DocxAttributeOutput::ParaTabStop( const SvxTabStopItem& rTabStop ) // Get offset for tabs // In DOCX, w:pos specifies the position of the current custom tab stop with respect to the current page margins. // But in ODT, zero position could be page margins or paragraph indent according to used settings. - tools::Long tabsOffset = 0; - if (m_rExport.m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) - tabsOffset = m_rExport.GetItem(RES_MARGIN_TEXTLEFT).GetTextLeft(); + tools::Long tabsOffset = m_rExport.GetParaTabStopOffset(); // clear unused inherited tabs - otherwise the style will add them back in sal_Int32 nCurrTab = 0; diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 9bfe2f787ff2..67eb0f94d87c 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -2989,17 +2989,7 @@ void RtfAttributeOutput::ParaWidows(const SvxWidowsItem& rWidows) void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) { - tools::Long nOffset = 0; - // Tabs are absolute by default. - if (m_rExport.m_rDoc.getIDocumentSettingAccess().get( - DocumentSettingId::TABS_RELATIVE_TO_INDENT)) - { - // don't do it for editengine text, it doesn't implement this anyway - if (!GetExport().m_pISet || GetExport().m_pISet->GetRanges()[0].first < RES_WHICHHINT_END) - { - nOffset = m_rExport.GetItem(RES_MARGIN_TEXTLEFT).GetTextLeft(); - } - } + tools::Long nOffset = m_rExport.GetParaTabStopOffset(); for (sal_uInt16 n = 0; n < rTabStop.Count(); n++) { diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 671dc7455b64..87aa2298f0a8 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -822,6 +822,8 @@ public: /// Returns the index of a picture bullet, used in numberings. int GetGrfIndex(const SvxBrushItem& rBrush); + tools::Long GetParaTabStopOffset() const; + enum ExportFormat { DOC = 0, RTF = 1, DOCX = 2}; virtual ExportFormat GetExportFormat() const = 0; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d36272ea4f72..54c4c4a52f8c 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -749,6 +749,21 @@ void MSWordExportBase::CorrectTabStopInSet( SfxItemSet& rSet, sal_Int32 nAbsLeft rSet.Put( aTStop ); } +tools::Long MSWordExportBase::GetParaTabStopOffset() const +{ + tools::Long nOffset = 0; + // Tabs are absolute by default. + if (m_rDoc.getIDocumentSettingAccess().get(DocumentSettingId::TABS_RELATIVE_TO_INDENT)) + { + // don't do it for editengine text, it doesn't implement this anyway + if (!m_pISet || m_pISet->GetRanges()[0].first < RES_WHICHHINT_END) + { + nOffset = GetItem(RES_MARGIN_TEXTLEFT).GetTextLeft(); + } + } + return nOffset; +} + sal_uInt8 WW8Export::GetNumId( sal_uInt16 eNumType ) { sal_uInt8 nRet = 0;