sw/source/core/doc/notxtfrm.cxx | 23 ++---------------- vcl/qa/cppunit/pdfexport/data/tdf115967.odt |binary vcl/qa/cppunit/pdfexport/pdfexport.cxx | 34 ++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 20 deletions(-)
New commits: commit 1560adf9cfd1d4ef076561b1c48e80c9936c940d Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Oct 21 17:41:52 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Oct 25 09:38:08 2019 +0200 tdf#115967: Revert "sw: Use primitive renderer for graphics" This reverts commit 302af8c2da58719844d22483b65a9fe5b3674684 I would like to revert it until a better solution is proposed due to the number of duplicates already reported After the commit, Libo exports LTR formulas in RTL documents to PDF as RTL formulas it also introduced other problems like tdf#112513 and tdf#117560 Unittest added Reviewed-on: https://gerrit.libreoffice.org/81262 Tested-by: Jenkins Reviewed-by: Xisco FaulĂ <xiscofa...@libreoffice.org> (cherry picked from commit 83baaec3a087f83d0ad3371d55671d9496771586) Change-Id: I097fb5801eb728bd258ae96bd981c6725e7aa06a Reviewed-on: https://gerrit.libreoffice.org/81437 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 3fd9f05ffc83..2b79c73aa18f 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -1248,31 +1248,17 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr // SwOLENode does not have a known GraphicObject, need to // work with Graphic instead const Graphic* pGraphic = pOLENd->GetGraphic(); + const Point aPosition(aAlignedGrfArea.Pos()); + const Size aSize(aAlignedGrfArea.SSize()); if ( pGraphic && pGraphic->GetType() != GraphicType::NONE ) { - GraphicObject aTempGraphicObject(*pGraphic); - GraphicAttr aGrfAttr; - const basegfx::B2DHomMatrix aGraphicTransform( - basegfx::utils::createScaleTranslateB2DHomMatrix( - aAlignedGrfArea.Width(), aAlignedGrfArea.Height(), - aAlignedGrfArea.Left(), aAlignedGrfArea.Top())); - - paintGraphicUsingPrimitivesHelper( - *pOut, - aTempGraphicObject, - aGrfAttr, - aGraphicTransform, - nullptr == pOLENd->GetFlyFormat() ? OUString() : pOLENd->GetFlyFormat()->GetName(), - rNoTNd.GetTitle(), - rNoTNd.GetDescription()); + pGraphic->Draw( pOut, aPosition, aSize ); // shade the representation if the object is activated outplace uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef(); if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE ) { - const Point aPosition(aAlignedGrfArea.Pos()); - const Size aSize(aAlignedGrfArea.SSize()); ::svt::EmbeddedObjectRef::DrawShading( tools::Rectangle( @@ -1283,9 +1269,6 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr } else { - const Point aPosition(aAlignedGrfArea.Pos()); - const Size aSize(aAlignedGrfArea.SSize()); - ::svt::EmbeddedObjectRef::DrawPaintReplacement( tools::Rectangle(aPosition, aSize), pOLENd->GetOLEObj().GetCurrentPersistName(), diff --git a/vcl/qa/cppunit/pdfexport/data/tdf115967.odt b/vcl/qa/cppunit/pdfexport/data/tdf115967.odt new file mode 100644 index 000000000000..39f4ce1784e5 Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/tdf115967.odt differ diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 033a886f20ec..f46f94b10b4c 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -131,6 +131,7 @@ public: void testTdf113143(); void testTdf115262(); void testTdf121962(); + void testTdf115967(); void testTdf121615(); void testTocLink(); @@ -167,6 +168,7 @@ public: CPPUNIT_TEST(testTdf113143); CPPUNIT_TEST(testTdf115262); CPPUNIT_TEST(testTdf121962); + CPPUNIT_TEST(testTdf115967); CPPUNIT_TEST(testTdf121615); CPPUNIT_TEST(testTocLink); CPPUNIT_TEST_SUITE_END(); @@ -1694,6 +1696,38 @@ void PdfExportTest::testTdf121962() OUString sText(aText.data(), nTextSize / 2 - 1); CPPUNIT_ASSERT(sText != "** Expression is faulty **"); } + +} + +void PdfExportTest::testTdf115967() +{ + OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "tdf115967.odt"; + utl::MediaDescriptor aMediaDescriptor; + aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + auto pPdfDocument = exportAndParse(aURL, aMediaDescriptor); + CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); + + // Get the first page + PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); + CPPUNIT_ASSERT(pPdfPage.get()); + FPDF_TEXTPAGE pTextPage = FPDFText_LoadPage(pPdfPage.get()); + + // Make sure the elements inside a formula in a RTL document are exported + // LTR ( m=750abc ) and not RTL ( m=057cba ) + int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get()); + OUString sText; + for (int i = 0; i < nPageObjectCount; ++i) + { + FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), i); + if (FPDFPageObj_GetType(pPageObject) != FPDF_PAGEOBJ_TEXT) + continue; + unsigned long nTextSize = FPDFTextObj_GetText(pPageObject, pTextPage, nullptr, 2); + std::vector<sal_Unicode> aText(nTextSize); + FPDFTextObj_GetText(pPageObject, pTextPage, aText.data(), nTextSize); + OUString sChar(aText.data(), nTextSize / 2 - 1); + sText += sChar.trim(); + } + CPPUNIT_ASSERT_EQUAL(OUString("m=750abc"), sText); } void PdfExportTest::testTdf121615() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits