Kaydet (Commit) eea4a30a authored tarafından anuragkanungo's avatar anuragkanungo Kaydeden (comit) Fridrich Strba

fdo#37222 and possibly fdo#37219

Added an checkbox option "View PDF after Export"  in Export as Pdf  Dialog Box .

If a user ticks the checkbox , pdf file will be opened after export
else only export will be done .

Goto File > Export as PDF >> Tick the checkbox "View PDF after Export "
to observe changes .

There is a lot of space in between last checkbox and this ViewPDF checkbox , because if we
open impress and check export as pdf , there are more options in the dialog.

If user export PDF and check view PDF after export, the PDF file is added to recent documents of the OS . ( tested on opensuse)

It will require make dev-install to work properly .

Change-Id: I76611c0e3382e27289d648942a98b092edc430ae
Reviewed-on: https://gerrit.libreoffice.org/3948Reviewed-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
Tested-by: 's avatarFridrich Strba <fridrich@documentfoundation.org>
üst d68243cd
...@@ -80,6 +80,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, ...@@ -80,6 +80,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
mnMaxImageResolution( 300 ), mnMaxImageResolution( 300 ),
mbUseTaggedPDF( sal_False ), mbUseTaggedPDF( sal_False ),
mbExportNotes( sal_True ), mbExportNotes( sal_True ),
mbViewPDF( sal_False ),
mbExportNotesPages( sal_False ), mbExportNotesPages( sal_False ),
mbUseTransitionEffects( sal_False ), mbUseTransitionEffects( sal_False ),
mbIsSkipEmptyPages( sal_True ), mbIsSkipEmptyPages( sal_True ),
...@@ -192,6 +193,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, ...@@ -192,6 +193,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
if ( mbIsPresentation ) if ( mbIsPresentation )
mbExportNotesPages = maConfigItem.ReadBool( "ExportNotesPages", sal_False ); mbExportNotesPages = maConfigItem.ReadBool( "ExportNotesPages", sal_False );
mbExportNotes = maConfigItem.ReadBool( "ExportNotes", sal_False ); mbExportNotes = maConfigItem.ReadBool( "ExportNotes", sal_False );
mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", sal_False );
mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", sal_True ); mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", sal_True );
if ( mbIsPresentation ) if ( mbIsPresentation )
...@@ -360,6 +362,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() ...@@ -360,6 +362,7 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
if ( mbIsPresentation ) if ( mbIsPresentation )
maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages ); maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages );
maConfigItem.WriteBool( "ExportNotes", mbExportNotes ); maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks ); maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
if ( mbIsPresentation ) if ( mbIsPresentation )
...@@ -511,6 +514,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, ...@@ -511,6 +514,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ), maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ),
maCbExportHiddenSlides( this, PDFFilterResId( CB_EXPORTHIDDENSLIDES ) ), maCbExportHiddenSlides( this, PDFFilterResId( CB_EXPORTHIDDENSLIDES ) ),
maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ), maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ),
maCbViewPDF( this, PDFFilterResId( CB_VIEWPDF ) ),
maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ), maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ), maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ), maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
...@@ -624,6 +628,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent ...@@ -624,6 +628,7 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
maCbExportBookmarks.Check( paParent->mbExportBookmarks ); maCbExportBookmarks.Check( paParent->mbExportBookmarks );
maCbExportNotes.Check( paParent->mbExportNotes ); maCbExportNotes.Check( paParent->mbExportNotes );
maCbViewPDF.Check( paParent->mbViewPDF);
if ( mbIsPresentation ) if ( mbIsPresentation )
{ {
...@@ -668,6 +673,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) ...@@ -668,6 +673,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked(); paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked();
paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().toInt32(); paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().toInt32();
paParent->mbExportNotes = maCbExportNotes.IsChecked(); paParent->mbExportNotes = maCbExportNotes.IsChecked();
paParent->mbViewPDF = maCbViewPDF.IsChecked();
if ( mbIsPresentation ) if ( mbIsPresentation )
paParent->mbExportNotesPages = maCbExportNotesPages.IsChecked(); paParent->mbExportNotesPages = maCbExportNotesPages.IsChecked();
paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked(); paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
...@@ -702,6 +708,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) ...@@ -702,6 +708,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
paParent->mbExportFormFields = maCbExportFormFields.IsChecked(); paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked(); paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
} }
paParent->maWatermarkText = maEdWatermark.GetText(); paParent->maWatermarkText = maEdWatermark.GetText();
/* /*
......
...@@ -87,6 +87,7 @@ ...@@ -87,6 +87,7 @@
#define CB_WATERMARK 32 #define CB_WATERMARK 32
#define FT_WATERMARK 33 #define FT_WATERMARK 33
#define ED_WATERMARK 34 #define ED_WATERMARK 34
#define CB_VIEWPDF 35
//controls for open options tab page //controls for open options tab page
......
...@@ -94,6 +94,7 @@ protected: ...@@ -94,6 +94,7 @@ protected:
sal_Bool mbUseTaggedPDF; sal_Bool mbUseTaggedPDF;
sal_Int32 mnPDFTypeSelection; sal_Int32 mnPDFTypeSelection;
sal_Bool mbExportNotes; sal_Bool mbExportNotes;
sal_Bool mbViewPDF;
sal_Bool mbExportNotesPages; sal_Bool mbExportNotesPages;
sal_Bool mbUseTransitionEffects; sal_Bool mbUseTransitionEffects;
sal_Bool mbIsSkipEmptyPages; sal_Bool mbIsSkipEmptyPages;
...@@ -210,6 +211,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage ...@@ -210,6 +211,7 @@ class ImpPDFTabGeneralPage : public SfxTabPage
CheckBox maCbExportBookmarks; CheckBox maCbExportBookmarks;
CheckBox maCbExportHiddenSlides; CheckBox maCbExportHiddenSlides;
CheckBox maCbExportNotes; CheckBox maCbExportNotes;
CheckBox maCbViewPDF;
CheckBox maCbExportNotesPages; CheckBox maCbExportNotesPages;
CheckBox maCbExportEmptyPages; CheckBox maCbExportEmptyPages;
......
...@@ -182,7 +182,7 @@ TabPage RID_PDF_TAB_GENER ...@@ -182,7 +182,7 @@ TabPage RID_PDF_TAB_GENER
FixedLine FL_GENERAL_VERTICAL FixedLine FL_GENERAL_VERTICAL
{ {
Pos = MAP_APPFONT ( 175 , 3 ) ; Pos = MAP_APPFONT ( 175 , 3 ) ;
Size = MAP_APPFONT ( 4 , 171 ) ; Size = MAP_APPFONT ( 4 , 190 ) ;
Vert = TRUE; Vert = TRUE;
}; };
...@@ -311,6 +311,13 @@ TabPage RID_PDF_TAB_GENER ...@@ -311,6 +311,13 @@ TabPage RID_PDF_TAB_GENER
TabStop = TRUE ; TabStop = TRUE ;
Text[ en-US ] = "E~mbed standard fonts"; Text[ en-US ] = "E~mbed standard fonts";
}; };
CheckBox CB_VIEWPDF
{
Pos = MAP_APPFONT ( 188 , 181 ) ;
Size = MAP_APPFONT ( 158 , 10 ) ;
TabStop = TRUE ;
Text[ en-US ] = "~View PDF after Export";
};
}; };
WarningBox RID_PDF_WARNPDFAPASSWORD WarningBox RID_PDF_WARNPDFAPASSWORD
......
...@@ -98,6 +98,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, ...@@ -98,6 +98,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
mbUseTaggedPDF ( sal_False ), mbUseTaggedPDF ( sal_False ),
mnPDFTypeSelection ( 0 ), mnPDFTypeSelection ( 0 ),
mbExportNotes ( sal_True ), mbExportNotes ( sal_True ),
mbViewPDF ( sal_True ),
mbExportNotesPages ( sal_False ), mbExportNotesPages ( sal_False ),
mbEmbedStandardFonts ( sal_False ),//in preparation for i54636 and i76458. mbEmbedStandardFonts ( sal_False ),//in preparation for i54636 and i76458.
//already used for i59651 (PDF/A-1) //already used for i59651 (PDF/A-1)
...@@ -457,6 +458,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue ...@@ -457,6 +458,8 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
rFilterData[ nData ].Value >>= mnPDFTypeSelection; rFilterData[ nData ].Value >>= mnPDFTypeSelection;
else if ( rFilterData[ nData ].Name == "ExportNotes" ) else if ( rFilterData[ nData ].Name == "ExportNotes" )
rFilterData[ nData ].Value >>= mbExportNotes; rFilterData[ nData ].Value >>= mbExportNotes;
else if ( rFilterData[ nData ].Name == "ViewPDFAfterExport" )
rFilterData[ nData ].Value >>= mbViewPDF;
else if ( rFilterData[ nData ].Name == "ExportNotesPages" ) else if ( rFilterData[ nData ].Name == "ExportNotesPages" )
rFilterData[ nData ].Value >>= mbExportNotesPages; rFilterData[ nData ].Value >>= mbExportNotesPages;
else if ( rFilterData[ nData ].Name == "EmbedStandardFonts" ) else if ( rFilterData[ nData ].Name == "EmbedStandardFonts" )
......
...@@ -47,6 +47,7 @@ private: ...@@ -47,6 +47,7 @@ private:
sal_Bool mbUseTaggedPDF; sal_Bool mbUseTaggedPDF;
sal_Int32 mnPDFTypeSelection; sal_Int32 mnPDFTypeSelection;
sal_Bool mbExportNotes; sal_Bool mbExportNotes;
sal_Bool mbViewPDF;
sal_Bool mbExportNotesPages; sal_Bool mbExportNotesPages;
sal_Bool mbEmbedStandardFonts; sal_Bool mbEmbedStandardFonts;
sal_Bool mbUseTransitionEffects; sal_Bool mbUseTransitionEffects;
......
...@@ -24,7 +24,10 @@ ...@@ -24,7 +24,10 @@
#include <vcl/window.hxx> #include <vcl/window.hxx>
#include <svl/outstrm.hxx> #include <svl/outstrm.hxx>
#include <vcl/FilterConfigItem.hxx> #include <vcl/FilterConfigItem.hxx>
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
using namespace css::system;
// ------------- // -------------
// - PDFFilter - // - PDFFilter -
// ------------- // -------------
...@@ -51,6 +54,10 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) ...@@ -51,6 +54,10 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
Reference< task::XStatusIndicator > xStatusIndicator; Reference< task::XStatusIndicator > xStatusIndicator;
Reference< task::XInteractionHandler > xIH; Reference< task::XInteractionHandler > xIH;
OUString aUrl;
FilterConfigItem aItem( "Office.Common/Filter/PDF/Export/" );
sal_Bool aViewPDF = aItem.ReadBool( "ViewPDFAfterExport", sal_False );
for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i) for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i)
{ {
...@@ -62,6 +69,8 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) ...@@ -62,6 +69,8 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
pValue[ i ].Value >>= xStatusIndicator; pValue[ i ].Value >>= xStatusIndicator;
else if ( pValue[i].Name == "InteractionHandler" ) else if ( pValue[i].Name == "InteractionHandler" )
pValue[i].Value >>= xIH; pValue[i].Value >>= xIH;
else if ( pValue[ i ].Name == "URL" )
pValue[ i ].Value >>= aUrl;
} }
/* we don't get FilterData if we are exporting directly /* we don't get FilterData if we are exporting directly
...@@ -133,6 +142,10 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) ...@@ -133,6 +142,10 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
} }
} }
if(aViewPDF==sal_True) {
Reference<XSystemShellExecute> xSystemShellExecute(SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) ); //Open the newly exported pdf
xSystemShellExecute->execute(aUrl, "", SystemShellExecuteFlags::URIS_ONLY ); }
return bRet; return bRet;
} }
......
...@@ -5278,6 +5278,12 @@ ...@@ -5278,6 +5278,12 @@
screen.</desc> screen.</desc>
</info> </info>
<value>false</value> <value>false</value>
<prop oor:name="ViewPDFAfterExport" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies if PDF automatically opens after export.</desc>
</info>
<value>false</value>
</prop>
</prop> </prop>
<!-- PDF Encryption --> <!-- PDF Encryption -->
<prop oor:name="Printing" oor:type="xs:int" oor:nillable="false"> <prop oor:name="Printing" oor:type="xs:int" oor:nillable="false">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment