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

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