[Libreoffice-commits] core.git: 2 commits - filter/source filter/uiconfig oox/source vcl/qa

Miklos Vajna vmiklos at collabora.co.uk
Wed Mar 29 08:47:10 UTC 2017


 filter/source/pdf/impdialog.cxx          |    5 +++++
 filter/source/pdf/impdialog.hxx          |    2 ++
 filter/source/pdf/pdfexport.cxx          |    7 ++++---
 filter/source/pdf/pdfexport.hxx          |    1 +
 filter/uiconfig/ui/pdfgeneralpage.ui     |   17 ++++++++++++++++-
 oox/source/shape/LockedCanvasContext.hxx |    4 ++--
 oox/source/shape/WpgContext.hxx          |    4 ++--
 oox/source/shape/WpsContext.hxx          |    4 ++--
 vcl/qa/cppunit/pdfexport/pdfexport.cxx   |    7 +++++++
 9 files changed, 41 insertions(+), 10 deletions(-)

New commits:
commit 9c944b0d1bff9a0ab1b7e8454c9ac5e7194aa533
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 29 09:47:09 2017 +0200

    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 at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

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.
commit ae74444cb726494a2497642d7b2da908cd007d35
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Mar 29 09:13:22 2017 +0200

    oox: remove redundant virtuals, implied by override
    
    Change-Id: Ia72aa17e82ccdf78b0581228b84ffafc1f6be4ba
    Reviewed-on: https://gerrit.libreoffice.org/35824
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/oox/source/shape/LockedCanvasContext.hxx b/oox/source/shape/LockedCanvasContext.hxx
index ca7ac4ade8d1..e22c46a1ed4c 100644
--- a/oox/source/shape/LockedCanvasContext.hxx
+++ b/oox/source/shape/LockedCanvasContext.hxx
@@ -23,9 +23,9 @@ class LockedCanvasContext : public oox::core::ContextHandler2
 {
 public:
     explicit LockedCanvasContext(oox::core::ContextHandler2Helper& rParent);
-    virtual ~LockedCanvasContext() override;
+    ~LockedCanvasContext() override;
 
-    virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const ::oox::AttributeList& rAttribs) override;
+    oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const ::oox::AttributeList& rAttribs) override;
 
     const oox::drawingml::ShapePtr& getShape()
     {
diff --git a/oox/source/shape/WpgContext.hxx b/oox/source/shape/WpgContext.hxx
index 6144ce427755..29dd97db151b 100644
--- a/oox/source/shape/WpgContext.hxx
+++ b/oox/source/shape/WpgContext.hxx
@@ -23,9 +23,9 @@ class WpgContext : public oox::core::ContextHandler2
 {
 public:
     explicit WpgContext(oox::core::ContextHandler2Helper& rParent);
-    virtual ~WpgContext() override;
+    ~WpgContext() override;
 
-    virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) override;
+    oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) override;
 
     const oox::drawingml::ShapePtr& getShape()
     {
diff --git a/oox/source/shape/WpsContext.hxx b/oox/source/shape/WpsContext.hxx
index bbb8db8fc649..1c2b662aa3ae 100644
--- a/oox/source/shape/WpsContext.hxx
+++ b/oox/source/shape/WpsContext.hxx
@@ -23,9 +23,9 @@ class WpsContext : public oox::core::ContextHandler2
 {
 public:
     WpsContext(oox::core::ContextHandler2Helper& rParent, css::uno::Reference<css::drawing::XShape> xShape);
-    virtual ~WpsContext() override;
+    ~WpsContext() override;
 
-    virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) override;
+    oox::core::ContextHandlerRef onCreateContext(sal_Int32 nElementToken, const oox::AttributeList& rAttribs) override;
 
     const oox::drawingml::ShapePtr& getShape()
     {


More information about the Libreoffice-commits mailing list