[Libreoffice-commits] core.git: Branch 'libreoffice-5-1' - filter/source filter/uiconfig officecfg/registry sw/inc sw/source

Oliver Specht oliver.specht at cib.de
Fri May 20 07:27:59 UTC 2016


 filter/source/pdf/impdialog.cxx                            |   14 ++++++-
 filter/source/pdf/impdialog.hxx                            |    2 +
 filter/source/pdf/pdfexport.cxx                            |    6 ++-
 filter/source/pdf/pdfexport.hxx                            |    1 
 filter/source/pdf/pdffilter.cxx                            |    1 
 filter/uiconfig/ui/pdfgeneralpage.ui                       |   25 ++++++++++---
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 +++
 sw/inc/printdata.hxx                                       |    2 -
 sw/inc/unotxdoc.hxx                                        |    2 -
 sw/source/core/view/printdata.cxx                          |    4 +-
 sw/source/uibase/uno/unotxdoc.cxx                          |   20 ++++++++--
 11 files changed, 69 insertions(+), 14 deletions(-)

New commits:
commit 247e418485c276bb9e8dcb84a6e11b90191482a3
Author: Oliver Specht <oliver.specht at cib.de>
Date:   Fri May 13 16:26:42 2016 +0200

        tdf#64748: added placeholder option to pdf export dialog in Writer
    
        This patch introduces a setting 'Export placeholders' to File/Export as PDF.
        It works like the related printer setting.
    
    Change-Id: I3a11a4601b1244b57e55c9b73b58116d355e105c
    Reviewed-on: https://gerrit.libreoffice.org/24976
    Reviewed-by: Oliver Specht <oliver.specht at cib.de>
    Tested-by: Oliver Specht <oliver.specht at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/25053
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Adolfo Jayme Barrientos <fitojb at ubuntu.com>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 1fe1474..f1c86a8 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -86,6 +86,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
     mbExportNotesPages( false ),
     mbUseTransitionEffects( false ),
     mbIsSkipEmptyPages( true ),
+    mbIsExportPlaceholders( false ),
     mbAddStream( false ),
     mnFormsType( 0 ),
     mbExportFormFields( true ),
@@ -201,6 +202,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
     mnOpenBookmarkLevels = maConfigItem.ReadInt32( "OpenBookmarkLevels", -1 );
     mbUseTransitionEffects = maConfigItem.ReadBool( "UseTransitionEffects", true );
     mbIsSkipEmptyPages = maConfigItem.ReadBool( "IsSkipEmptyPages", false );
+    mbIsExportPlaceholders = maConfigItem.ReadBool( "ExportPlaceholders", false );
     mbAddStream = maConfigItem.ReadBool( "IsAddStream", false );
 
     mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
@@ -401,6 +403,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
         maConfigItem.WriteBool( "ExportHiddenSlides", mbExportHiddenSlides );
     maConfigItem.WriteBool( "UseTransitionEffects", mbUseTransitionEffects );
     maConfigItem.WriteBool( "IsSkipEmptyPages", mbIsSkipEmptyPages );
+    maConfigItem.WriteBool( "ExportPlaceholders", mbIsExportPlaceholders );
     maConfigItem.WriteBool( "IsAddStream", mbAddStream );
 
     /*
@@ -541,6 +544,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
     get(mpCbExportNotes, "comments");
     get(mpCbExportNotesPages, "notes");
     get(mpCbExportEmptyPages, "emptypages");
+    get(mpCbExportPlaceholders, "exportplaceholders" );
     get(mpCbViewPDF, "viewpdf");
 
     get(mpCbWatermark, "watermark");
@@ -578,6 +582,7 @@ void ImpPDFTabGeneralPage::dispose()
     mpCbViewPDF.clear();
     mpCbExportNotesPages.clear();
     mpCbExportEmptyPages.clear();
+    mpCbExportPlaceholders.clear();
     mpCbAddStream.clear();
     mpCbWatermark.clear();
     mpFtWatermark.clear();
@@ -601,6 +606,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
     mbIsWriter = paParent->mbIsWriter;
 
     mpCbExportEmptyPages->Enable( mbIsWriter );
+    mpCbExportPlaceholders->Enable( mbIsWriter );
 
     mpRbLosslessCompression->SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleCompressionHdl ) );
     const bool bUseLosslessCompression = paParent->mbUseLosslessCompression;
@@ -668,8 +674,13 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
         mpCbExportHiddenSlides->Show(false);
         mpCbExportHiddenSlides->Check(false);
     }
-
+    mpCbExportPlaceholders->Show(mbIsWriter);
+    if( !mbIsWriter )
+    {
+        mpCbExportPlaceholders->Check(false);
+    }
     mpCbExportEmptyPages->Check(!paParent->mbIsSkipEmptyPages);
+    mpCbExportPlaceholders->Check(paParent->mbIsExportPlaceholders);
 
     mpCbAddStream->Show();
     mpCbAddStream->Check(paParent->mbAddStream);
@@ -696,6 +707,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
         paParent->mbExportHiddenSlides = mpCbExportHiddenSlides->IsChecked();
 
     paParent->mbIsSkipEmptyPages = !mpCbExportEmptyPages->IsChecked();
+    paParent->mbIsExportPlaceholders = mpCbExportPlaceholders->IsChecked();
     paParent->mbAddStream = mpCbAddStream->IsVisible() && mpCbAddStream->IsChecked();
 
     paParent->mbIsRangeChecked = false;
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index f4d916e..72938b0 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -106,6 +106,7 @@ protected:
     bool                    mbExportNotesPages;
     bool                    mbUseTransitionEffects;
     bool                    mbIsSkipEmptyPages;
+    bool                    mbIsExportPlaceholders;
     bool                    mbAddStream;
     sal_Int32               mnFormsType;
     bool                    mbExportFormFields;
@@ -220,6 +221,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
     VclPtr<CheckBox>     mpCbExportNotesPages;
 
     VclPtr<CheckBox>     mpCbExportEmptyPages;
+    VclPtr<CheckBox>     mpCbExportPlaceholders;
     VclPtr<CheckBox>     mpCbAddStream;
 
     VclPtr<CheckBox>     mpCbWatermark;
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 5a67041..a55bdc9 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -553,6 +553,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
                     rFilterData[ nData ].Value >>= maSignCertificate;
                 else if ( rFilterData[ nData ].Name == "SignatureTSA" )
                     rFilterData[ nData ].Value >>= msSignTSA;
+                else if ( rFilterData[ nData ].Name == "ExportPlaceholders" )
+                    rFilterData[ nData ].Value >>= mbExportPlaceholders;
             }
             aContext.URL        = aURL.GetMainURL(INetURLObject::DECODE_TO_IURI);
 
@@ -820,7 +822,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
                 pPDFExtOutDevData->SetIsReduceImageResolution( mbReduceImageResolution );
                 pPDFExtOutDevData->SetIsExportNamedDestinations( mbExportBmkToDest );
 
-                Sequence< PropertyValue > aRenderOptions( 6 );
+                Sequence< PropertyValue > aRenderOptions( 7 );
                 aRenderOptions[ 0 ].Name = "RenderDevice";
                 aRenderOptions[ 0 ].Value <<= Reference< awt::XDevice >( pXDevice );
                 aRenderOptions[ 1 ].Name = "ExportNotesPages";
@@ -834,6 +836,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
                 aRenderOptions[ 4 ].Value <<= mbSkipEmptyPages;
                 aRenderOptions[ 5 ].Name = "PageRange";
                 aRenderOptions[ 5 ].Value <<= aPageRange;
+                aRenderOptions[ 6 ].Name = "ExportPlaceholders";
+                aRenderOptions[ 6 ].Value <<= mbExportPlaceholders;
 
                 if( !aPageRange.isEmpty() || !aSelection.hasValue() )
                 {
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index 75ac0aa4..7e8528f 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -47,6 +47,7 @@ private:
     bool                mbUseTaggedPDF;
     sal_Int32               mnPDFTypeSelection;
     bool                mbExportNotes;
+    bool                mbExportPlaceholders;
     bool                mbViewPDF;
     bool                mbExportNotesPages;
     bool                mbUseTransitionEffects;
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 6d24356..7104ad9 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -70,6 +70,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
         aCfgItem.ReadBool(  "UseTaggedPDF", false );
         aCfgItem.ReadInt32( "SelectPdfVersion", 0 );
         aCfgItem.ReadBool(  "ExportNotes", false );
+        aCfgItem.ReadBool( "ExportPlaceholders", false );
         aCfgItem.ReadBool(  "ExportNotesPages", false );
         aCfgItem.ReadBool(  "UseTransitionEffects", true );
         aCfgItem.ReadBool(  "IsSkipEmptyPages", false );
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
index 7ba4a25..8a46e0f 100644
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
@@ -578,8 +578,8 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkCheckButton" id="comments">
-                    <property name="label" translatable="yes">_Export comments</property>
+                  <object class="GtkCheckButton" id="exportplaceholders">
+                    <property name="label" translatable="yes">Expo_rt placeholders</property>
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
@@ -593,6 +593,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="comments">
+                    <property name="label" translatable="yes">_Export comments</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">7</property>
+                  </packing>
+                </child>
+                 <child>
                   <object class="GtkCheckButton" id="emptypages">
                     <property name="label" translatable="yes">Exp_ort automatically inserted blank pages</property>
                     <property name="visible">True</property>
@@ -604,7 +619,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">9</property>
+                    <property name="top_attach">10</property>
                   </packing>
                 </child>
                 <child>
@@ -619,7 +634,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">10</property>
+                    <property name="top_attach">11</property>
                   </packing>
                 </child>
                 <child>
@@ -649,7 +664,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">0</property>
-                    <property name="top_attach">7</property>
+                    <property name="top_attach">8</property>
                   </packing>
                 </child>
               </object>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index ed958b8..8662cfc 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5121,6 +5121,12 @@
             </info>
             <value>true</value>
           </prop>
+          <prop oor:name="ExportPlaceholders" oor:type="xs:boolean" oor:nillable="false">
+            <info>
+              <desc>Specifies if placeholder fields are exported to PDF.</desc>
+            </info>
+            <value>true</value>
+          </prop>
           <prop oor:name="OpenBookmarkLevels" oor:type="xs:int" oor:nillable="false">
             <info>
               <desc>Specifies how many bookmark levels should be opened in the
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index 5271089..6651090 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -261,7 +261,7 @@ public:
     bool IsViewOptionAdjust() const  { return m_pViewOptionAdjust != nullptr; }
     bool NeedNewViewOptionAdjust( const SwViewShell& ) const;
     void ViewOptionAdjustStart( SwViewShell &rSh, const SwViewOption &rViewOptions);
-    void ViewOptionAdjust( SwPrintData const* const pPrtOptions );
+    void ViewOptionAdjust( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
     void ViewOptionAdjustStop();
     void ViewOptionAdjustCrashPreventionKludge();
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 87386bb..9435920 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -607,7 +607,7 @@ class SwViewOptionAdjust_Impl
 public:
     SwViewOptionAdjust_Impl( SwViewShell& rSh, const SwViewOption &rViewOptions );
     ~SwViewOptionAdjust_Impl();
-    void AdjustViewOptions( SwPrintData const* const pPrtOptions );
+    void AdjustViewOptions( SwPrintData const* const pPrtOptions, bool setShowPlaceHoldersInPDF );
     bool checkShell( const SwViewShell& rCompare ) const
     { return &rCompare == m_pShell; }
     void DontTouchThatViewShellItSmellsFunny() { m_pShell = nullptr; }
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index 009d8e4..7d33526 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -93,9 +93,9 @@ void SwRenderData::ViewOptionAdjustStart(
             new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
 }
 
-void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions)
+void SwRenderData::ViewOptionAdjust(SwPrintData const*const pPrtOptions, bool setShowPlaceHoldersInPDF)
 {
-    m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
+    m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions, setShowPlaceHoldersInPDF );
 }
 
 void SwRenderData::ViewOptionAdjustStop()
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index d9432d6..d08766a 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -2545,7 +2545,21 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
                 // PDF export should not make use of the SwPrtOptions
                 const SwPrintData *pPrtOptions = (bIsPDFExport)
                     ? nullptr : m_pRenderData->GetSwPrtOptions();
-                m_pRenderData->ViewOptionAdjust( pPrtOptions );
+                bool setShowPlaceHoldersInPDF = false;
+                if(bIsPDFExport)
+                {
+                    const sal_Int32 nLen = rxOptions.getLength();
+                    const beans::PropertyValue *pProps = rxOptions.getConstArray();
+                    for (sal_Int32 i = 0;  i < nLen;  ++i)
+                    {
+                        if (pProps[i].Name.equalsAscii( "ExportPlaceholders" ))
+                        {
+                            pProps[i].Value >>= setShowPlaceHoldersInPDF;
+                            break;
+                        }
+                    }
+                }
+                m_pRenderData->ViewOptionAdjust( pPrtOptions, setShowPlaceHoldersInPDF );
             }
 
             // since printing now also use the API for PDF export this option
@@ -4248,7 +4262,7 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
 }
 
 void
-SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions)
+SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions, bool setShowPlaceHoldersInPDF)
 {
     // to avoid unnecessary reformatting the view options related to the content
     // below should only change if necessary, that is if respective content is present
@@ -4285,7 +4299,7 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions)
     if (bContainsPlaceHolders)
     {
         // should always be printed in PDF export!
-        bVal = !pPrtOptions || pPrtOptions->m_bPrintTextPlaceholder;
+        bVal = !pPrtOptions ? setShowPlaceHoldersInPDF : pPrtOptions->m_bPrintTextPlaceholder;
         aRenderViewOptions.SetShowPlaceHolderFields( bVal );
     }
 


More information about the Libreoffice-commits mailing list