filter/source/pdf/pdfexport.cxx | 3 ++- sw/source/uibase/app/docsh2.cxx | 4 +++- vcl/qa/cppunit/pdfexport/pdfexport.cxx | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-)
New commits: commit b5035a5ec51e29851eaf6c195e7e12320baed36f Author: Aron Budea <aron.bu...@collabora.com> Date: Mon Jul 9 00:54:53 2018 +0200 tdf#112690: make page size of exported PDF closer to what is set regression from 3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8 Change-Id: Ia0fddeb112fa0867ec367c085e3682eac078d5f8 Reviewed-on: https://gerrit.libreoffice.org/57166 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> (cherry picked from commit 9a7a419baf9a6aa9fc70d9e2a00dec3fbdeee565) Reviewed-on: https://gerrit.libreoffice.org/57184 diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 04479fa2d9f3..c7e307f21453 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -1004,7 +1004,8 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors bool PDFExport::ImplExportPage( vcl::PDFWriter& rWriter, vcl::PDFExtOutDevData& rPDFExtOutDevData, const GDIMetaFile& rMtf ) { - basegfx::B2DPolygon aSize(tools::Polygon(tools::Rectangle(Point(0, 0), rMtf.GetPrefSize())).getB2DPolygon()); + //Rectangle(Point, Size) creates a rectangle off by 1, use Rectangle(long, long, long, long) instead + basegfx::B2DPolygon aSize(tools::Polygon(tools::Rectangle(0, 0, rMtf.GetPrefSize().Width(), rMtf.GetPrefSize().Height())).getB2DPolygon()); basegfx::B2DPolygon aSizePDF(OutputDevice::LogicToLogic(aSize, rMtf.GetPrefMapMode(), MapMode(MapUnit::MapPoint))); basegfx::B2DRange aRangePDF(aSizePDF.getB2DRange()); tools::Rectangle aPageRect( Point(), rMtf.GetPrefSize() ); diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 849e87b90f4a..5d8214b898c3 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -772,6 +772,14 @@ void PdfExportTest::testTdf108963() mpPdfPage = FPDF_LoadPage(mpPdfDocument, /*page_index=*/0); CPPUNIT_ASSERT(mpPdfPage); + // Test page size (28x15.75 cm, was 1/100th mm off, tdf#112690) + // bad: MediaBox[0 0 793.672440944882 446.428346456693] + // good: MediaBox[0 0 793.700787401575 446.456692913386] + const double aWidth = FPDF_GetPageWidth(mpPdfPage); + CPPUNIT_ASSERT_DOUBLES_EQUAL(793.7, aWidth, 0.01); + const double aHeight = FPDF_GetPageHeight(mpPdfPage); + CPPUNIT_ASSERT_DOUBLES_EQUAL(446.46, aHeight, 0.01); + // Make sure there is a filled rectangle inside. int nPageObjectCount = FPDFPage_CountObjects(mpPdfPage); int nYellowPathCount = 0; @@ -795,35 +803,35 @@ void PdfExportTest::testTdf108963() float fY = 0; FPDFPathSegment_GetPoint(pSegment, &fX, &fY); CPPUNIT_ASSERT_EQUAL(245395, static_cast<int>(round(fX * 1000))); - CPPUNIT_ASSERT_EQUAL(244233, static_cast<int>(round(fY * 1000))); + CPPUNIT_ASSERT_EQUAL(244261, static_cast<int>(round(fY * 1000))); CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment)); pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 1); CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment)); FPDFPathSegment_GetPoint(pSegment, &fX, &fY); CPPUNIT_ASSERT_EQUAL(275102, static_cast<int>(round(fX * 1000))); - CPPUNIT_ASSERT_EQUAL(267590, static_cast<int>(round(fY * 1000))); + CPPUNIT_ASSERT_EQUAL(267618, static_cast<int>(round(fY * 1000))); CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment)); pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 2); CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment)); FPDFPathSegment_GetPoint(pSegment, &fX, &fY); CPPUNIT_ASSERT_EQUAL(287518, static_cast<int>(round(fX * 1000))); - CPPUNIT_ASSERT_EQUAL(251801, static_cast<int>(round(fY * 1000))); + CPPUNIT_ASSERT_EQUAL(251829, static_cast<int>(round(fY * 1000))); CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment)); pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 3); CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment)); FPDFPathSegment_GetPoint(pSegment, &fX, &fY); CPPUNIT_ASSERT_EQUAL(257839, static_cast<int>(round(fX * 1000))); - CPPUNIT_ASSERT_EQUAL(228444, static_cast<int>(round(fY * 1000))); + CPPUNIT_ASSERT_EQUAL(228472, static_cast<int>(round(fY * 1000))); CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment)); pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 4); CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment)); FPDFPathSegment_GetPoint(pSegment, &fX, &fY); CPPUNIT_ASSERT_EQUAL(245395, static_cast<int>(round(fX * 1000))); - CPPUNIT_ASSERT_EQUAL(244233, static_cast<int>(round(fY * 1000))); + CPPUNIT_ASSERT_EQUAL(244261, static_cast<int>(round(fY * 1000))); CPPUNIT_ASSERT(FPDFPathSegment_GetClose(pSegment)); } } commit 6f89e62cb7d4d32ad321840bd1887e7226c62cce Author: Henry Castro <hcas...@collabora.com> Date: Thu Jul 5 15:28:06 2018 -0400 tdf#118540: LO6.1b2: DOCX crashes when properties... are opened in print preview mode Change-Id: Idc64d2b98dff157d28813dd3f90a276f8cacd11f Reviewed-on: https://gerrit.libreoffice.org/57024 Tested-by: Jenkins Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/57057 Tested-by: Xisco FaulĂ <xiscofa...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 07afee0fcd64..c9678c6b9836 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -145,7 +145,9 @@ using namespace ::sfx2; // create DocInfo (virtual) VclPtr<SfxDocumentInfoDialog> SwDocShell::CreateDocumentInfoDialog(const SfxItemSet &rSet) { - VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(&GetView()->GetViewFrame()->GetWindow(), rSet); + SfxViewShell* pViewShell = GetView() ? GetView() : SfxViewShell::Current(); + vcl::Window* pWindow = pViewShell ? &pViewShell->GetViewFrame()->GetWindow() : nullptr; + VclPtr<SfxDocumentInfoDialog> pDlg = VclPtr<SfxDocumentInfoDialog>::Create(pWindow, rSet); //only with statistics, when this document is being shown, not //from within the Doc-Manager SwDocShell* pDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits