Blame SOURCES/0001-tdf-39271-allow-to-export-only-notes-pages.patch

f325b2
From 770a1752cda8ba629ce11bd514869a2c800f0817 Mon Sep 17 00:00:00 2001
f325b2
From: David Tardon <dtardon@redhat.com>
f325b2
Date: Thu, 24 Mar 2016 14:52:35 +0100
f325b2
Subject: [PATCH] tdf#39271 allow to export only notes pages
f325b2
f325b2
Change-Id: Ia03062cf31b6bab8196dc317a7e8fbcfc86fadf0
f325b2
---
f325b2
 filter/source/pdf/impdialog.cxx                    | 23 +++++++++++++
f325b2
 filter/source/pdf/impdialog.hxx                    |  3 ++
f325b2
 filter/source/pdf/pdfexport.cxx                    | 18 ++++++----
f325b2
 filter/source/pdf/pdfexport.hxx                    |  1 +
f325b2
 filter/uiconfig/ui/pdfgeneralpage.ui               | 38 +++++++++++++++++-----
f325b2
 .../schema/org/openoffice/Office/Common.xcs        |  7 ++++
f325b2
 6 files changed, 75 insertions(+), 15 deletions(-)
f325b2
f325b2
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
f325b2
index 89a1351..8c9bd31 100644
f325b2
--- a/filter/source/pdf/impdialog.cxx
f325b2
+++ b/filter/source/pdf/impdialog.cxx
f325b2
@@ -86,6 +86,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
f325b2
     mbExportNotes( true ),
f325b2
     mbViewPDF( false ),
f325b2
     mbExportNotesPages( false ),
f325b2
+    mbExportOnlyNotesPages( false ),
f325b2
     mbUseTransitionEffects( false ),
f325b2
     mbIsSkipEmptyPages( true ),
f325b2
     mbAddStream( false ),
f325b2
@@ -193,7 +194,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue >
f325b2
     mbUseTaggedPDF = maConfigItem.ReadBool( "UseTaggedPDF", false );
f325b2
     mnPDFTypeSelection =  maConfigItem.ReadInt32( "SelectPdfVersion", 0 );
f325b2
     if ( mbIsPresentation )
f325b2
+    {
f325b2
         mbExportNotesPages = maConfigItem.ReadBool( "ExportNotesPages", false );
f325b2
+        mbExportOnlyNotesPages = maConfigItem.ReadBool( "ExportOnlyNotesPages", false );
f325b2
+    }
f325b2
     mbExportNotes = maConfigItem.ReadBool( "ExportNotes", false );
f325b2
     mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false );
f325b2
 
f325b2
@@ -395,7 +399,10 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
f325b2
     maConfigItem.WriteInt32("SelectPdfVersion", mnPDFTypeSelection );
f325b2
 
f325b2
     if ( mbIsPresentation )
f325b2
+    {
f325b2
         maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages );
f325b2
+        maConfigItem.WriteBool( "ExportOnlyNotesPages", mbExportOnlyNotesPages );
f325b2
+    }
f325b2
     maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
f325b2
     maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
f325b2
 
f325b2
@@ -543,6 +550,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe
f325b2
     get(mpCbExportHiddenSlides, "hiddenpages");
f325b2
     get(mpCbExportNotes, "comments");
f325b2
     get(mpCbExportNotesPages, "notes");
f325b2
+    get(mpCbExportOnlyNotesPages, "onlynotes");
f325b2
     get(mpCbExportEmptyPages, "emptypages");
f325b2
     get(mpCbViewPDF, "viewpdf");
f325b2
 
f325b2
@@ -580,6 +588,7 @@ void ImpPDFTabGeneralPage::dispose()
f325b2
     mpCbExportNotes.clear();
f325b2
     mpCbViewPDF.clear();
f325b2
     mpCbExportNotesPages.clear();
f325b2
+    mpCbExportOnlyNotesPages.clear();
f325b2
     mpCbExportEmptyPages.clear();
f325b2
     mpCbAddStream.clear();
f325b2
     mpCbWatermark.clear();
f325b2
@@ -661,6 +670,10 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
f325b2
         mpRbRange->SetText(get<FixedText>("slides")->GetText());
f325b2
         mpCbExportNotesPages->Show(true);
f325b2
         mpCbExportNotesPages->Check(paParent->mbExportNotesPages);
f325b2
+        mpCbExportNotesPages->SetToggleHdl( LINK(this, ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl ) );
f325b2
+        mpCbExportOnlyNotesPages->Show();
f325b2
+        mpCbExportOnlyNotesPages->Check(paParent->mbExportOnlyNotesPages);
f325b2
+        mpCbExportOnlyNotesPages->Enable(paParent->mbExportNotesPages);
f325b2
         mpCbExportHiddenSlides->Show(true);
f325b2
         mpCbExportHiddenSlides->Check(paParent->mbExportHiddenSlides);
f325b2
     }
f325b2
@@ -668,6 +681,8 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent )
f325b2
     {
f325b2
         mpCbExportNotesPages->Show(false);
f325b2
         mpCbExportNotesPages->Check(false);
f325b2
+        mpCbExportOnlyNotesPages->Show(false);
f325b2
+        mpCbExportOnlyNotesPages->Check(false);
f325b2
         mpCbExportHiddenSlides->Show(false);
f325b2
         mpCbExportHiddenSlides->Check(false);
f325b2
     }
f325b2
@@ -693,7 +708,10 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
f325b2
     paParent->mbExportNotes = mpCbExportNotes->IsChecked();
f325b2
     paParent->mbViewPDF = mpCbViewPDF->IsChecked();
f325b2
     if ( mbIsPresentation )
f325b2
+    {
f325b2
         paParent->mbExportNotesPages = mpCbExportNotesPages->IsChecked();
f325b2
+        paParent->mbExportOnlyNotesPages = mpCbExportOnlyNotesPages->IsChecked();
f325b2
+    }
f325b2
     paParent->mbExportBookmarks = mpCbExportBookmarks->IsChecked();
f325b2
     if ( mbIsPresentation )
f325b2
         paParent->mbExportHiddenSlides = mpCbExportHiddenSlides->IsChecked();
f325b2
@@ -758,6 +776,11 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl)
f325b2
     return 0;
f325b2
 }
f325b2
 
f325b2
+IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl)
f325b2
+{
f325b2
+    mpCbExportOnlyNotesPages->Enable(mpCbExportNotesPages->IsChecked());
f325b2
+    return 0;
f325b2
+}
f325b2
 
f325b2
 IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleCompressionHdl)
f325b2
 {
f325b2
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
f325b2
index e828721..191bd48 100644
f325b2
--- a/filter/source/pdf/impdialog.hxx
f325b2
+++ b/filter/source/pdf/impdialog.hxx
f325b2
@@ -104,6 +104,7 @@ protected:
f325b2
     bool                    mbExportNotes;
f325b2
     bool                    mbViewPDF;
f325b2
     bool                    mbExportNotesPages;
f325b2
+    bool                        mbExportOnlyNotesPages;
f325b2
     bool                    mbUseTransitionEffects;
f325b2
     bool                    mbIsSkipEmptyPages;
f325b2
     bool                    mbAddStream;
f325b2
@@ -218,6 +219,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
f325b2
     VclPtr<CheckBox>     mpCbExportNotes;
f325b2
     VclPtr<CheckBox>     mpCbViewPDF;
f325b2
     VclPtr<CheckBox>     mpCbExportNotesPages;
f325b2
+    VclPtr<CheckBox>             mpCbExportOnlyNotesPages;
f325b2
 
f325b2
     VclPtr<CheckBox>     mpCbExportEmptyPages;
f325b2
     VclPtr<CheckBox>     mpCbAddStream;
f325b2
@@ -237,6 +239,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
f325b2
     DECL_LINK( ToggleWatermarkHdl, void* );
f325b2
     DECL_LINK( ToggleAddStreamHdl, void* );
f325b2
     DECL_LINK( ToggleExportFormFieldsHdl, void* );
f325b2
+    DECL_LINK( ToggleExportNotesPagesHdl, void* );
f325b2
 
f325b2
 public:
f325b2
     DECL_LINK( ToggleExportPDFAHdl, void* );
f325b2
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
f325b2
index daf4689..1856308 100644
f325b2
--- a/filter/source/pdf/pdfexport.cxx
f325b2
+++ b/filter/source/pdf/pdfexport.cxx
f325b2
@@ -100,6 +100,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
f325b2
     mbExportNotes               ( true ),
f325b2
     mbViewPDF                   ( true ),
f325b2
     mbExportNotesPages          ( false ),
f325b2
+    mbExportOnlyNotesPages      ( false ),
f325b2
     mbUseTransitionEffects      ( true ),
f325b2
     mbExportBookmarks           ( true ),
f325b2
     mbExportHiddenSlides        ( false ),
f325b2
@@ -464,6 +465,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
f325b2
                     rFilterData[ nData ].Value >>= mbViewPDF;
f325b2
                 else if ( rFilterData[ nData ].Name == "ExportNotesPages" )
f325b2
                     rFilterData[ nData ].Value >>= mbExportNotesPages;
f325b2
+                else if ( rFilterData[ nData ].Name == "ExportOnlyNotesPages" )
f325b2
+                    rFilterData[ nData ].Value >>= mbExportOnlyNotesPages;
f325b2
                 else if ( rFilterData[ nData ].Name == "UseTransitionEffects" )
f325b2
                     rFilterData[ nData ].Value >>= mbUseTransitionEffects;
f325b2
                 else if ( rFilterData[ nData ].Name == "ExportFormFields" )
f325b2
@@ -840,7 +843,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
f325b2
                     aSelection = Any();
f325b2
                     aSelection <<= mxSrcDoc;
f325b2
                 }
f325b2
-                bool        bSecondPassForImpressNotes = false;
f325b2
+                bool bExportNotesPages = false;
f325b2
                 bool bReChangeToNormalView = false;
f325b2
                   OUString sShowOnlineLayout( "ShowOnlineLayout" );
f325b2
                   uno::Reference< beans::XPropertySet > xViewProperties;
f325b2
@@ -870,8 +873,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
f325b2
                 {
f325b2
                     uno::Reference< drawing::XShapes > xShapes;     // sj: do not allow to export notes when
f325b2
                     if ( ! ( aSelection >>= xShapes ) )             // exporting a selection -> todo: in the dialog
f325b2
-                        bSecondPassForImpressNotes = true;      // the export notes checkbox needs to be disabled
f325b2
+                        bExportNotesPages = true;
f325b2
                 }
f325b2
+                const bool bExportPages = bExportNotesPages ? !mbExportOnlyNotesPages : true;
f325b2
 
f325b2
                 if( aPageRange.isEmpty() )
f325b2
                 {
f325b2
@@ -885,18 +889,18 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >&
f325b2
                     if ( pResMgr )
f325b2
                     {
f325b2
                         sal_Int32 nTotalPageCount = aRangeEnum.size();
f325b2
-                        if ( bSecondPassForImpressNotes )
f325b2
+                        if ( bExportPages && bExportNotesPages )
f325b2
                             nTotalPageCount *= 2;
f325b2
                         mxStatusIndicator->start( OUString( ResId( PDF_PROGRESS_BAR, *pResMgr ) ), nTotalPageCount );
f325b2
                     }
f325b2
                 }
f325b2
 
f325b2
-                if( nPageCount > 0 )
f325b2
+                bRet = nPageCount > 0;
f325b2
+
f325b2
+                if ( bRet && bExportPages )
f325b2
                     bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aRangeEnum, aRenderOptions, nPageCount );
f325b2
-                else
f325b2
-                    bRet = false;
f325b2
 
f325b2
-                if ( bRet && bSecondPassForImpressNotes )
f325b2
+                if ( bRet && bExportNotesPages )
f325b2
                 {
f325b2
                     rExportNotesValue <<= sal_True;
f325b2
                     bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aRangeEnum, aRenderOptions, nPageCount );
f325b2
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
f325b2
index 499beb1..47e960a 100644
f325b2
--- a/filter/source/pdf/pdfexport.hxx
f325b2
+++ b/filter/source/pdf/pdfexport.hxx
f325b2
@@ -49,6 +49,7 @@ private:
f325b2
     bool                mbExportNotes;
f325b2
     bool                mbViewPDF;
f325b2
     bool                mbExportNotesPages;
f325b2
+    bool                mbExportOnlyNotesPages;
f325b2
     bool                mbUseTransitionEffects;
f325b2
     bool                mbExportBookmarks;
f325b2
     bool                mbExportHiddenSlides;
f325b2
diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui
f325b2
index 7ba4a25..52314ac 100644
f325b2
--- a/filter/uiconfig/ui/pdfgeneralpage.ui
f325b2
+++ b/filter/uiconfig/ui/pdfgeneralpage.ui
f325b2
@@ -1,5 +1,5 @@
f325b2
 
f325b2
-
f325b2
+
f325b2
 <interface>
f325b2
   <requires lib="gtk+" version="3.0"/>
f325b2
   <object class="GtkAdjustment" id="adjustment1">
f325b2
@@ -111,8 +111,8 @@
f325b2
                       <object class="GtkLabel" id="slides">
f325b2
                         <property name="can_focus">False</property>
f325b2
                         <property name="no_show_all">True</property>
f325b2
-                        <property name="xalign">0</property>
f325b2
                         <property name="label" translatable="yes">Slides:</property>
f325b2
+                        <property name="xalign">0</property>
f325b2
                       </object>
f325b2
                       <packing>
f325b2
                         <property name="left_attach">0</property>
f325b2
@@ -191,9 +191,9 @@
f325b2
                                   <object class="GtkLabel" id="label6">
f325b2
                                     <property name="visible">True</property>
f325b2
                                     <property name="can_focus">False</property>
f325b2
-                                    <property name="xalign">0</property>
f325b2
                                     <property name="label" translatable="yes">_Quality:</property>
f325b2
                                     <property name="use_underline">True</property>
f325b2
+                                    <property name="xalign">0</property>
f325b2
                                   </object>
f325b2
                                 </child>
f325b2
                               </object>
f325b2
@@ -378,10 +378,10 @@
f325b2
                           <object class="GtkLabel" id="watermarklabel">
f325b2
                             <property name="visible">True</property>
f325b2
                             <property name="can_focus">False</property>
f325b2
-                            <property name="xalign">0</property>
f325b2
                             <property name="label" translatable="yes">Text:</property>
f325b2
                             <property name="use_underline">True</property>
f325b2
                             <property name="mnemonic_widget">watermarkentry</property>
f325b2
+                            <property name="xalign">0</property>
f325b2
                           </object>
f325b2
                         </child>
f325b2
                       </object>
f325b2
@@ -512,10 +512,10 @@
f325b2
                           <object class="GtkLabel" id="label7">
f325b2
                             <property name="visible">True</property>
f325b2
                             <property name="can_focus">False</property>
f325b2
-                            <property name="xalign">0</property>
f325b2
                             <property name="label" translatable="yes">Submit _format:</property>
f325b2
                             <property name="use_underline">True</property>
f325b2
                             <property name="mnemonic_widget">format</property>
f325b2
+                            <property name="xalign">0</property>
f325b2
                           </object>
f325b2
                           <packing>
f325b2
                             <property name="left_attach">0</property>
f325b2
@@ -604,7 +604,7 @@
f325b2
                   </object>
f325b2
                   <packing>
f325b2
                     <property name="left_attach">0</property>
f325b2
-                    <property name="top_attach">9</property>
f325b2
+                    <property name="top_attach">10</property>
f325b2
                   </packing>
f325b2
                 </child>
f325b2
                 <child>
f325b2
@@ -619,7 +619,7 @@
f325b2
                   </object>
f325b2
                   <packing>
f325b2
                     <property name="left_attach">0</property>
f325b2
-                    <property name="top_attach">10</property>
f325b2
+                    <property name="top_attach">11</property>
f325b2
                   </packing>
f325b2
                 </child>
f325b2
                 <child>
f325b2
@@ -634,7 +634,7 @@
f325b2
                   </object>
f325b2
                   <packing>
f325b2
                     <property name="left_attach">0</property>
f325b2
-                    <property name="top_attach">8</property>
f325b2
+                    <property name="top_attach">9</property>
f325b2
                   </packing>
f325b2
                 </child>
f325b2
                 <child>
f325b2
@@ -652,6 +652,28 @@
f325b2
                     <property name="top_attach">7</property>
f325b2
                   </packing>
f325b2
                 </child>
f325b2
+                <child>
f325b2
+                  <object class="GtkAlignment" id="onlynotesframe">
f325b2
+                    <property name="visible">True</property>
f325b2
+                    <property name="can_focus">False</property>
f325b2
+                    <property name="left_padding">12</property>
f325b2
+                    <child>
f325b2
+                      <object class="GtkCheckButton" id="onlynotes">
f325b2
+                        <property name="label" translatable="yes">Export onl_y notes pages</property>
f325b2
+                        <property name="visible">True</property>
f325b2
+                        <property name="can_focus">True</property>
f325b2
+                        <property name="receives_default">False</property>
f325b2
+                        <property name="use_underline">True</property>
f325b2
+                        <property name="xalign">0</property>
f325b2
+                        <property name="draw_indicator">True</property>
f325b2
+                      </object>
f325b2
+                    </child>
f325b2
+                  </object>
f325b2
+                  <packing>
f325b2
+                    <property name="left_attach">0</property>
f325b2
+                    <property name="top_attach">8</property>
f325b2
+                  </packing>
f325b2
+                </child>
f325b2
               </object>
f325b2
             </child>
f325b2
           </object>
f325b2
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
f325b2
index ad22cd2..782734a 100644
f325b2
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
f325b2
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
f325b2
@@ -5134,6 +5134,13 @@
f325b2
             </info>
f325b2
             <value>false</value>
f325b2
           </prop>
f325b2
+          <prop oor:name="ExportOnlyNotesPages" oor:type="xs:boolean" oor:nillable="false">
f325b2
+            <info>
f325b2
+              <desc>Specifies if only notes pages (i.e., not slides) are exported to PDF. (Notes pages
f325b2
+              are available in Impress documents only).</desc>
f325b2
+            </info>
f325b2
+            <value>false</value>
f325b2
+          </prop>
f325b2
           <prop oor:name="UseTransitionEffects" oor:type="xs:boolean" oor:nillable="false">
f325b2
             <info>
f325b2
               <desc>Specifies slide transitions are exported to PDF. This option
f325b2
-- 
f325b2
2.5.0
f325b2