Kaydet (Commit) 9c944b0d authored tarafından Miklos Vajna's avatar Miklos Vajna

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/35826Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst ae74444c
......@@ -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();
......
......@@ -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;
......
......@@ -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 ));
......
......@@ -46,6 +46,7 @@ private:
bool mbExportNotes;
bool mbExportPlaceholders;
bool mbViewPDF;
bool mbUseReferenceXObject;
bool mbExportNotesPages;
bool mbExportOnlyNotesPages;
bool mbUseTransitionEffects;
......
......@@ -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>
......@@ -646,6 +646,21 @@
<property name="top_attach">12</property>
</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>
......
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment