vcl/inc/pdf/pdfwriter_impl.hxx | 3 -- vcl/source/gdi/pdfwriter_impl.cxx | 46 ++++---------------------------------- 2 files changed, 5 insertions(+), 44 deletions(-)
New commits: commit fa7ae4638431bf4f4d40d16ab0017ec59e233039 Author: Tobias Kokolakis <kokola...@mail.de> AuthorDate: Sat Sep 2 13:52:02 2023 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Nov 3 06:08:23 2023 +0100 tdf#156478 Remove unused default values for MediaBox and UserUnit Change-Id: Ica75be2fa238fdf2a40e274f1175710923b281e5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156468 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/inc/pdf/pdfwriter_impl.hxx b/vcl/inc/pdf/pdfwriter_impl.hxx index b20de8171473..23ba7c7baed5 100644 --- a/vcl/inc/pdf/pdfwriter_impl.hxx +++ b/vcl/inc/pdf/pdfwriter_impl.hxx @@ -113,9 +113,6 @@ class PDFObjectElement; namespace pdf { -constexpr sal_Int32 g_nInheritedPageWidth = 595; // default A4 in inch/72 -constexpr sal_Int32 g_nInheritedPageHeight = 842; // default A4 in inch/72 - struct PDFPage { VclPtr<PDFWriterImpl> m_pWriter; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index d11e75cf08dc..15eafe302953 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1211,7 +1211,7 @@ void PDFPage::appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer) double PDFPage::getHeight() const { - double fRet = m_nPageHeight ? m_nPageHeight : vcl::pdf::g_nInheritedPageHeight; + double fRet = m_nPageHeight ? m_nPageHeight : 842; // default A4 height in inch/72, OK to use hardcoded value here? if (m_nUserUnit > 1) { @@ -5241,41 +5241,9 @@ bool PDFWriterImpl::emitCatalog() aLine.append( getResourceDictObj() ); aLine.append( " 0 R\n" ); - double nMediaBoxWidth = 0; - double nMediaBoxHeight = 0; - sal_Int32 nUserUnit = 1; if( m_aPages.empty() ) // sanity check, this should not happen - { - nMediaBoxWidth = g_nInheritedPageWidth; - nMediaBoxHeight = g_nInheritedPageHeight; - } - else - { - for (auto const& page : m_aPages) - { - if( page.m_nPageWidth > nMediaBoxWidth ) - { - nMediaBoxWidth = page.m_nPageWidth; - nUserUnit = page.m_nUserUnit; - } - if( page.m_nPageHeight > nMediaBoxHeight ) - { - nMediaBoxHeight = page.m_nPageHeight; - nUserUnit = page.m_nUserUnit; - } - } - } - aLine.append( "/MediaBox[ 0 0 " ); - aLine.append(nMediaBoxWidth / nUserUnit); - aLine.append( ' ' ); - aLine.append(nMediaBoxHeight / nUserUnit); - aLine.append(" ]\n"); - if (nUserUnit > 1) - { - aLine.append("/UserUnit "); - aLine.append(nUserUnit); - aLine.append("\n"); - } + aLine.append( "/MediaBox[0 0 595 842]\n" ); // default A4 size in pt + aLine.append("/Kids[ "); unsigned int i = 0; for (const auto & page : m_aPages) @@ -5421,16 +5389,12 @@ bool PDFWriterImpl::emitCatalog() case PDFWriter::FitWidth : aLine.append( "/OpenAction[" ); aLine.append( aInitPageRef ); - aLine.append( " /FitH " ); - aLine.append( g_nInheritedPageHeight );//Open fit width - aLine.append( "]\n" ); + aLine.append( " /FitH 842]\n" ); //Open fit width, default A4 height in pt, OK to use hardcoded value here? break; case PDFWriter::FitVisible : aLine.append( "/OpenAction[" ); aLine.append( aInitPageRef ); - aLine.append( " /FitBH " ); - aLine.append( g_nInheritedPageHeight );//Open fit visible - aLine.append( "]\n" ); + aLine.append( " /FitBH 842]\n" ); //Open fit visible, , default A4 height in pt, OK to use hardcoded value here? break; case PDFWriter::ActionZoom : aLine.append( "/OpenAction[" );