From 32befbd3698fdd5e0bf3940b3aecb3791c85a70f Mon Sep 17 00:00:00 2001 From: David Tardon Date: Thu, 24 Mar 2016 18:24:43 +0100 Subject: [PATCH] tdf#39271 allow to export only notes pages --- ...271-allow-to-export-only-notes-pages.patch | 346 ++++++++++++++++++ libreoffice.spec | 1 + 2 files changed, 347 insertions(+) create mode 100644 0001-tdf-39271-allow-to-export-only-notes-pages.patch diff --git a/0001-tdf-39271-allow-to-export-only-notes-pages.patch b/0001-tdf-39271-allow-to-export-only-notes-pages.patch new file mode 100644 index 0000000..c106e72 --- /dev/null +++ b/0001-tdf-39271-allow-to-export-only-notes-pages.patch @@ -0,0 +1,346 @@ +From a8abbc28deebd6a9642033a47676ae9ba1900b05 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 24 Mar 2016 14:52:35 +0100 +Subject: [PATCH] tdf#39271 allow to export only notes pages + +Change-Id: Ia03062cf31b6bab8196dc317a7e8fbcfc86fadf0 +--- + filter/source/pdf/impdialog.cxx | 22 +++++++++++++ + filter/source/pdf/impdialog.hxx | 4 +++ + filter/source/pdf/pdfexport.cxx | 18 ++++++---- + filter/source/pdf/pdfexport.hxx | 1 + + filter/uiconfig/ui/pdfgeneralpage.ui | 38 +++++++++++++++++----- + .../schema/org/openoffice/Office/Common.xcs | 7 ++++ + 6 files changed, 75 insertions(+), 15 deletions(-) + +diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx +index 1fe1474..d51770c 100644 +--- a/filter/source/pdf/impdialog.cxx ++++ b/filter/source/pdf/impdialog.cxx +@@ -84,6 +84,7 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > + mbExportNotes( true ), + mbViewPDF( false ), + mbExportNotesPages( false ), ++ mbExportOnlyNotesPages( false ), + mbUseTransitionEffects( false ), + mbIsSkipEmptyPages( true ), + mbAddStream( false ), +@@ -191,7 +192,10 @@ ImpPDFTabDialog::ImpPDFTabDialog(vcl::Window* pParent, Sequence< PropertyValue > + mbUseTaggedPDF = maConfigItem.ReadBool( "UseTaggedPDF", false ); + mnPDFTypeSelection = maConfigItem.ReadInt32( "SelectPdfVersion", 0 ); + if ( mbIsPresentation ) ++ { + mbExportNotesPages = maConfigItem.ReadBool( "ExportNotesPages", false ); ++ mbExportOnlyNotesPages = maConfigItem.ReadBool( "ExportOnlyNotesPages", false ); ++ } + mbExportNotes = maConfigItem.ReadBool( "ExportNotes", false ); + mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", false ); + +@@ -392,7 +396,10 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() + maConfigItem.WriteInt32("SelectPdfVersion", mnPDFTypeSelection ); + + if ( mbIsPresentation ) ++ { + maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages ); ++ maConfigItem.WriteBool( "ExportOnlyNotesPages", mbExportOnlyNotesPages ); ++ } + maConfigItem.WriteBool( "ExportNotes", mbExportNotes ); + maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF ); + +@@ -540,6 +547,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage(vcl::Window* pParent, const SfxItemSe + get(mpCbExportHiddenSlides, "hiddenpages"); + get(mpCbExportNotes, "comments"); + get(mpCbExportNotesPages, "notes"); ++ get(mpCbExportOnlyNotesPages, "onlynotes"); + get(mpCbExportEmptyPages, "emptypages"); + get(mpCbViewPDF, "viewpdf"); + +@@ -577,6 +585,7 @@ void ImpPDFTabGeneralPage::dispose() + mpCbExportNotes.clear(); + mpCbViewPDF.clear(); + mpCbExportNotesPages.clear(); ++ mpCbExportOnlyNotesPages.clear(); + mpCbExportEmptyPages.clear(); + mpCbAddStream.clear(); + mpCbWatermark.clear(); +@@ -658,6 +667,10 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) + mpRbRange->SetText(get("slides")->GetText()); + mpCbExportNotesPages->Show(); + mpCbExportNotesPages->Check(paParent->mbExportNotesPages); ++ mpCbExportNotesPages->SetToggleHdl( LINK(this, ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl ) ); ++ mpCbExportOnlyNotesPages->Show(); ++ mpCbExportOnlyNotesPages->Check(paParent->mbExportOnlyNotesPages); ++ mpCbExportOnlyNotesPages->Enable(paParent->mbExportNotesPages); + mpCbExportHiddenSlides->Show(); + mpCbExportHiddenSlides->Check(paParent->mbExportHiddenSlides); + } +@@ -665,6 +678,8 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( ImpPDFTabDialog* paParent ) + { + mpCbExportNotesPages->Show(false); + mpCbExportNotesPages->Check(false); ++ mpCbExportOnlyNotesPages->Show(false); ++ mpCbExportOnlyNotesPages->Check(false); + mpCbExportHiddenSlides->Show(false); + mpCbExportHiddenSlides->Check(false); + } +@@ -690,7 +705,10 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) + paParent->mbExportNotes = mpCbExportNotes->IsChecked(); + paParent->mbViewPDF = mpCbViewPDF->IsChecked(); + if ( mbIsPresentation ) ++ { + paParent->mbExportNotesPages = mpCbExportNotesPages->IsChecked(); ++ paParent->mbExportOnlyNotesPages = mpCbExportOnlyNotesPages->IsChecked(); ++ } + paParent->mbExportBookmarks = mpCbExportBookmarks->IsChecked(); + if ( mbIsPresentation ) + paParent->mbExportHiddenSlides = mpCbExportHiddenSlides->IsChecked(); +@@ -758,6 +776,10 @@ IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl, CheckBox& + mpFormsFrame->Enable(mpCbExportFormFields->IsChecked()); + } + ++IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleExportNotesPagesHdl, CheckBox&, void) ++{ ++ mpCbExportOnlyNotesPages->Enable(mpCbExportNotesPages->IsChecked()); ++} + + IMPL_LINK_NOARG_TYPED(ImpPDFTabGeneralPage, ToggleCompressionHdl, RadioButton&, void) + { +diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx +index f4d916e..c1e80d5 100644 +--- a/filter/source/pdf/impdialog.hxx ++++ b/filter/source/pdf/impdialog.hxx +@@ -104,6 +104,7 @@ protected: + bool mbExportNotes; + bool mbViewPDF; + bool mbExportNotesPages; ++ bool mbExportOnlyNotesPages; + bool mbUseTransitionEffects; + bool mbIsSkipEmptyPages; + bool mbAddStream; +@@ -218,6 +219,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage + VclPtr mpCbExportNotes; + VclPtr mpCbViewPDF; + VclPtr mpCbExportNotesPages; ++ VclPtr mpCbExportOnlyNotesPages; + + VclPtr mpCbExportEmptyPages; + VclPtr mpCbAddStream; +@@ -237,6 +239,8 @@ class ImpPDFTabGeneralPage : public SfxTabPage + DECL_LINK_TYPED( ToggleWatermarkHdl, CheckBox&, void ); + DECL_LINK_TYPED( ToggleAddStreamHdl, CheckBox&, void ); + DECL_LINK_TYPED( ToggleExportFormFieldsHdl, CheckBox&, void ); ++ DECL_LINK_TYPED( ToggleExportNotesPagesHdl, CheckBox&, void ); ++ + void TogglePagesHdl(); + + public: +diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx +index 5a67041..c5f8f5a 100644 +--- a/filter/source/pdf/pdfexport.cxx ++++ b/filter/source/pdf/pdfexport.cxx +@@ -100,6 +100,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, + mbExportNotes ( true ), + mbViewPDF ( true ), + mbExportNotesPages ( false ), ++ mbExportOnlyNotesPages ( false ), + mbUseTransitionEffects ( true ), + mbExportBookmarks ( true ), + mbExportHiddenSlides ( false ), +@@ -464,6 +465,8 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& + rFilterData[ nData ].Value >>= mbViewPDF; + else if ( rFilterData[ nData ].Name == "ExportNotesPages" ) + rFilterData[ nData ].Value >>= mbExportNotesPages; ++ else if ( rFilterData[ nData ].Name == "ExportOnlyNotesPages" ) ++ rFilterData[ nData ].Value >>= mbExportOnlyNotesPages; + else if ( rFilterData[ nData ].Name == "UseTransitionEffects" ) + rFilterData[ nData ].Value >>= mbUseTransitionEffects; + else if ( rFilterData[ nData ].Name == "ExportFormFields" ) +@@ -840,7 +843,7 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& + aSelection = Any(); + aSelection <<= mxSrcDoc; + } +- bool bSecondPassForImpressNotes = false; ++ bool bExportNotesPages = false; + bool bReChangeToNormalView = false; + const OUString sShowOnlineLayout( "ShowOnlineLayout" ); + bool bReHideWhitespace = false; +@@ -879,8 +882,9 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& + { + uno::Reference< drawing::XShapes > xShapes; // sj: do not allow to export notes when + if ( ! ( aSelection >>= xShapes ) ) // exporting a selection -> todo: in the dialog +- bSecondPassForImpressNotes = true; // the export notes checkbox needs to be disabled ++ bExportNotesPages = true; + } ++ const bool bExportPages = bExportNotesPages ? !mbExportOnlyNotesPages : true; + + if( aPageRange.isEmpty() ) + { +@@ -894,18 +898,18 @@ bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue >& + if ( pResMgr ) + { + sal_Int32 nTotalPageCount = aRangeEnum.size(); +- if ( bSecondPassForImpressNotes ) ++ if ( bExportPages && bExportNotesPages ) + nTotalPageCount *= 2; + mxStatusIndicator->start( ResId( PDF_PROGRESS_BAR, *pResMgr ), nTotalPageCount ); + } + } + +- if( nPageCount > 0 ) ++ bRet = nPageCount > 0; ++ ++ if ( bRet && bExportPages ) + bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aRangeEnum, aRenderOptions, nPageCount ); +- else +- bRet = false; + +- if ( bRet && bSecondPassForImpressNotes ) ++ if ( bRet && bExportNotesPages ) + { + rExportNotesValue <<= sal_True; + bRet = ExportSelection( *pPDFWriter, xRenderable, aSelection, aRangeEnum, aRenderOptions, nPageCount ); +diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx +index 75ac0aa4..8754729 100644 +--- a/filter/source/pdf/pdfexport.hxx ++++ b/filter/source/pdf/pdfexport.hxx +@@ -49,6 +49,7 @@ private: + bool mbExportNotes; + bool mbViewPDF; + bool mbExportNotesPages; ++ bool mbExportOnlyNotesPages; + bool mbUseTransitionEffects; + bool mbExportBookmarks; + bool mbExportHiddenSlides; +diff --git a/filter/uiconfig/ui/pdfgeneralpage.ui b/filter/uiconfig/ui/pdfgeneralpage.ui +index 7ba4a25..52314ac 100644 +--- a/filter/uiconfig/ui/pdfgeneralpage.ui ++++ b/filter/uiconfig/ui/pdfgeneralpage.ui +@@ -1,5 +1,5 @@ + +- ++ + + + +@@ -111,8 +111,8 @@ + + False + True +- 0 + Slides: ++ 0 + + + 0 +@@ -191,9 +191,9 @@ + + True + False +- 0 + _Quality: + True ++ 0 + + + +@@ -378,10 +378,10 @@ + + True + False +- 0 + Text: + True + watermarkentry ++ 0 + + + +@@ -512,10 +512,10 @@ + + True + False +- 0 + Submit _format: + True + format ++ 0 + + + 0 +@@ -604,7 +604,7 @@ + + + 0 +- 9 ++ 10 + + + +@@ -619,7 +619,7 @@ + + + 0 +- 10 ++ 11 + + + +@@ -634,7 +634,7 @@ + + + 0 +- 8 ++ 9 + + + +@@ -652,6 +652,28 @@ + 7 + + ++ ++ ++ True ++ False ++ 12 ++ ++ ++ Export onl_y notes pages ++ True ++ True ++ False ++ True ++ 0 ++ True ++ ++ ++ ++ ++ 0 ++ 8 ++ ++ + + + +diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs +index 6adfa44a..9fce3d7 100644 +--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs ++++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs +@@ -5135,6 +5135,13 @@ + + false + ++ ++ ++ Specifies if only notes pages (i.e., not slides) are exported to PDF. (Notes pages ++ are available in Impress documents only). ++ ++ false ++ + + + Specifies slide transitions are exported to PDF. This option +-- +2.5.0 + diff --git a/libreoffice.spec b/libreoffice.spec index 8e8112f..83e56d0 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -261,6 +261,7 @@ Patch26: 0001-Resolves-tdf-98638-sometimes-menu-grab-doesn-t-take.patch Patch27: 0001-Resolves-tdf-98636.patch Patch28: 0001-Resolves-tdf-96989-videos-playback-at-maximum-possib.patch Patch29: 0001-delete-hidden-pages-before-deleting-unused-masters.patch +Patch30: 0001-tdf-39271-allow-to-export-only-notes-pages.patch %if ! 0%{?rhel} Patch400: 0001-Update-liborcus-to-0.11.0.patch