diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-03-29 09:47:09 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-03-29 08:46:52 +0000 |
commit | 9c944b0d1bff9a0ab1b7e8454c9ac5e7194aa533 (patch) | |
tree | 6d87b130ce4138dd371c80406a73d613e566549a | |
parent | ae74444cb726494a2497642d7b2da908cd007d35 (diff) |
vcl PDF export, norefxobj: add UI for this
Disable the "use reference XObjects" (old behavior) by default, but keep
it as an option in case someone wants it.
Summary till the help is updated: the old way is simpler code, so it's
always correct, but really only Acrobat supports that markup. The new
way is supported by all readers, but more complex, so it's more likely
it goes wrong.
Change-Id: I4769474f29d98412be496a0aa4e8254ae4f0919e
Reviewed-on: https://gerrit.libreoffice.org/35826
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 5 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 2 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 7 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.hxx | 1 | ||||
-rw-r--r-- | filter/uiconfig/ui/pdfgeneralpage.ui | 17 | ||||
-rw-r--r-- | vcl/qa/cppunit/pdfexport/pdfexport.cxx | 7 |
6 files changed, 35 insertions, 4 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx index 42af810c9113..8d27a63df4d1 100644 --- a/filter/source/pdf/impdialog.cxx +++ b/filter/source/pdf/impdialog.cxx @@ -83,6 +83,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > mbUseTaggedPDF( false ), mbExportNotes( true ), mbViewPDF( false ), + mbUseReferenceXObject( false ), mbExportNotesPages( false ), mbExportOnlyNotesPages( false ), mbUseTransitionEffects( false ), @@ -472,6 +473,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() aRet.push_back(comphelper::makePropertyValue("SignaturePassword", msSignPassword)); aRet.push_back(comphelper::makePropertyValue("SignatureCertificate", maSignCertificate)); aRet.push_back(comphelper::makePropertyValue("SignatureTSA", msSignTSA)); + aRet.push_back(comphelper::makePropertyValue("UseReferenceXObject", mbUseReferenceXObject)); return comphelper::concatSequences(maConfigItem.GetFilterData(), comphelper::containerToSequence(aRet)); } @@ -516,6 +518,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe get(mpCbExportEmptyPages, "emptypages"); get(mpCbExportPlaceholders, "exportplaceholders" ); get(mpCbViewPDF, "viewpdf"); + get(mpCbUseReferenceXObject, "usereferencexobject"); get(mpCbWatermark, "watermark"); get(mpFtWatermark, "watermarklabel"); @@ -552,6 +555,7 @@ void ImpPDFTabGeneralPage::dispose() mpCbExportHiddenSlides.clear(); mpCbExportNotes.clear(); mpCbViewPDF.clear(); + mpCbUseReferenceXObject.clear(); mpCbExportNotesPages.clear(); mpCbExportOnlyNotesPages.clear(); mpCbExportEmptyPages.clear(); @@ -689,6 +693,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) paParent->mnMaxImageResolution = mpCoReduceImageResolution->GetText().toInt32(); paParent->mbExportNotes = mpCbExportNotes->IsChecked(); paParent->mbViewPDF = mpCbViewPDF->IsChecked(); + paParent->mbUseReferenceXObject = mpCbUseReferenceXObject->IsChecked(); if ( mbIsPresentation ) { paParent->mbExportNotesPages = mpCbExportNotesPages->IsChecked(); diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx index e96062633988..2def0c7ffd83 100644 --- a/filter/source/pdf/impdialog.hxx +++ b/filter/source/pdf/impdialog.hxx @@ -105,6 +105,7 @@ protected: sal_Int32 mnPDFTypeSelection; bool mbExportNotes; bool mbViewPDF; + bool mbUseReferenceXObject; bool mbExportNotesPages; bool mbExportOnlyNotesPages; bool mbUseTransitionEffects; @@ -222,6 +223,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage VclPtr<CheckBox> mpCbExportHiddenSlides; VclPtr<CheckBox> mpCbExportNotes; VclPtr<CheckBox> mpCbViewPDF; + VclPtr<CheckBox> mpCbUseReferenceXObject; VclPtr<CheckBox> mpCbExportNotesPages; VclPtr<CheckBox> mpCbExportOnlyNotesPages; diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index e341b07f50bf..5be242f870e7 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -47,7 +47,6 @@ #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/compbase.hxx> #include <cppuhelper/basemutex.hxx> -#include <officecfg/Office/Common.hxx> #include "pdfexport.hxx" #include "impdialog.hxx" @@ -97,6 +96,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, mbExportNotes ( true ), mbExportPlaceholders ( false ), mbViewPDF ( true ), + mbUseReferenceXObject ( false ), mbExportNotesPages ( false ), mbExportOnlyNotesPages ( false ), mbUseTransitionEffects ( true ), @@ -554,6 +554,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& rFilterData[ nData ].Value >>= msSignTSA; else if ( rFilterData[ nData ].Name == "ExportPlaceholders" ) rFilterData[ nData ].Value >>= mbExportPlaceholders; + else if ( rFilterData[ nData ].Name == "UseReferenceXObject" ) + rFilterData[ nData ].Value >>= mbUseReferenceXObject; } aContext.URL = aURL.GetMainURL(INetURLObject::DecodeMechanism::ToIUri); @@ -777,8 +779,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& aContext.SignPassword = msSignPassword; aContext.SignCertificate = maSignCertificate; aContext.SignTSA = msSignTSA; - // Not using reference XObjects is experimental for now. - aContext.UseReferenceXObject = !officecfg::Office::Common::Misc::ExperimentalMode::get(); + aContext.UseReferenceXObject = mbUseReferenceXObject; // all context data set, time to create the printing device std::unique_ptr<vcl::PDFWriter> pPDFWriter(new vcl::PDFWriter( aContext, xEnc )); diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx index 5b9391ad60e9..4051cd88ff21 100644 --- a/filter/source/pdf/pdfexport.hxx +++ b/filter/source/pdf/pdfexport.hxx @@ -46,6 +46,7 @@ private: bool mbExportNotes; bool mbExportPlaceholders; bool mbViewPDF; + bool mbUseReferenceXObject; bool mbExportNotesPages; bool mbExportOnlyNotesPages; bool mbUseTransitionEffects; diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui index 1013f9529b86..11364c0bf308 100644 --- a/filter/uiconfig/ui/pdfgeneralpage.ui +++ b/filter/uiconfig/ui/pdfgeneralpage.ui @@ -436,7 +436,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="top_padding">6</property> - <property name="left_padding">12</property> + <property name="left_padding">13</property> <child> <object class="GtkGrid" id="grid10"> <property name="visible">True</property> @@ -647,6 +647,21 @@ </packing> </child> <child> + <object class="GtkCheckButton" id="usereferencexobject"> + <property name="label" translatable="yes">Use reference XObjects</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">13</property> + </packing> + </child> + <child> <object class="GtkCheckButton" id="hiddenpages"> <property name="label" translatable="yes">Export _hidden pages</property> <property name="visible">True</property> diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 4e80f08d9e45..fb0bd8b3c597 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -13,6 +13,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/propertyvalue.hxx> #include <cppuhelper/implbase.hxx> #include <test/bootstrapfixture.hxx> #include <unotest/macros_test.hxx> @@ -87,6 +88,12 @@ void PdfExportTest::testTdf106059() aTempFile.EnableKillingFile(); utl::MediaDescriptor aMediaDescriptor; aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); + // Explicitly enable the usage of the reference XObject markup. + uno::Sequence<beans::PropertyValue> aFilterData = + { + comphelper::makePropertyValue("UseReferenceXObject", true) + }; + aMediaDescriptor["FilterData"] <<= aFilterData; xStorable->storeToURL(aTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); // Parse the export result. |