sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 34 ++++++++++ sw/source/core/text/itrpaint.cxx | 7 +- 3 files changed, 39 insertions(+), 2 deletions(-)
New commits: commit 3e04f54f7efdc0f7373c248b9ba02e6fd5a43da2 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jun 28 18:54:43 2023 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jul 4 22:59:59 2023 +0200 tdf#156078: Use TabOverSpacing compat option instead of TabOverflow As Justin Luth noted, "TabOverflow is basically always true", and using it basically equal to making the test always true. On the other hand, TabOverSpacing is accurate for the task. Change-Id: I608b200dac0169cbafc935a03452aac9ba0527a6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153722 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153876 diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 9c6dc347a47c..a189e5abf25b 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -167,8 +167,8 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, //compatibility settings: allow tabstop text to exceed right margin const auto& iDSA = GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess(); const bool bTabOverMargin = iDSA.get(DocumentSettingId::TAB_OVER_MARGIN); - const bool bTabOverflow = iDSA.get(DocumentSettingId::TAB_OVERFLOW); - if (bTabOverMargin || bTabOverflow) + const bool bTabOverSpacing = iDSA.get(DocumentSettingId::TAB_OVER_SPACING); + if (bTabOverMargin || bTabOverSpacing) { SwLinePortion* pPorIter = pPor; while( pPorIter ) commit 237a550af3b4ec1223decf451fb41dc74c229080 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Jun 27 17:42:49 2023 +0300 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Tue Jul 4 22:59:54 2023 +0200 tdf#156078: also consider TabOverflow for tabs outside of line bounds Before commit 29bd00f7628e7a54e69cabcc7e2a1792c24aa55c, TabOverMargin compat option was set for DOCX with any compat mode. After that commit, the unset option disallowed output of content after a tab stop outside of the paragraph indents, even within page margins. SwTabPortion::PreFormat consults TabOverflow when checking if position is outside the frame; so let's consult it also when painting. Change-Id: I05ada0da6cd765c70b7bad1287ccc8c11d9b60ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153672 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153875 diff --git a/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx b/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx new file mode 100644 index 000000000000..cc2715cf6acd Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf156078_rightTabOutsideParaRightIndent.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index c3e834823c02..20b190d59af6 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -23,6 +23,9 @@ #include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextTable.hpp> +#include <comphelper/propertysequence.hxx> +#include <vcl/BitmapReadAccess.hxx> +#include <vcl/graphicfilter.hxx> #include <xmloff/odffields.hxx> #include <wrtsh.hxx> @@ -1143,6 +1146,37 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf154695) } } +CPPUNIT_TEST_FIXTURE(Test, testTdf156078) +{ + // Given a DOCX with compat level 15, and a tab stop outside of paragraph right indent + createSwDoc("tdf156078_rightTabOutsideParaRightIndent.docx"); + + // Export it to a PNG (96 ppi) + uno::Sequence<beans::PropertyValue> aFilterData( + comphelper::InitPropertySequence({ { "PixelWidth", uno::Any(sal_Int32(816)) }, + { "PixelHeight", uno::Any(sal_Int32(1056)) } })); + uno::Sequence<beans::PropertyValue> aDescriptor(comphelper::InitPropertySequence( + { { "FilterName", uno::Any(OUString("writer_png_Export")) }, + { "FilterData", uno::Any(aFilterData) } })); + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + xStorable->storeToURL(maTempFile.GetURL(), aDescriptor); + CPPUNIT_ASSERT(maTempFile.IsValid()); + + Graphic exported; + GraphicFilter::LoadGraphic(maTempFile.GetURL(), {}, exported); + Bitmap bmp = exported.GetBitmapEx().GetBitmap(); + Bitmap::ScopedReadAccess pAccess(bmp); + + // "1" must export to the top right corner; check its pixels + bool numberPixelsFound = false; + for (tools::Long y = 90; y < 130; ++y) + for (tools::Long x = 680; x < 720; ++x) + if (Color(pAccess->GetPixel(y, x)).IsDark()) + numberPixelsFound = true; + + CPPUNIT_ASSERT(numberPixelsFound); +} + // tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx index 827f8d4fcfd2..9c6dc347a47c 100644 --- a/sw/source/core/text/itrpaint.cxx +++ b/sw/source/core/text/itrpaint.cxx @@ -164,8 +164,11 @@ void SwTextPainter::DrawTextLine( const SwRect &rPaint, SwSaveClip &rClip, // Optimization! SwTwips nMaxRight = std::min<SwTwips>( rPaint.Right(), Right() ); const SwTwips nTmpLeft = GetInfo().X(); - //compatibility setting: allow tabstop text to exceed right margin - if (GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess().get(DocumentSettingId::TAB_OVER_MARGIN)) + //compatibility settings: allow tabstop text to exceed right margin + const auto& iDSA = GetInfo().GetTextFrame()->GetDoc().getIDocumentSettingAccess(); + const bool bTabOverMargin = iDSA.get(DocumentSettingId::TAB_OVER_MARGIN); + const bool bTabOverflow = iDSA.get(DocumentSettingId::TAB_OVERFLOW); + if (bTabOverMargin || bTabOverflow) { SwLinePortion* pPorIter = pPor; while( pPorIter )