[PATCH] fdo#37222 and fdo#37219 Open pdf after Export and added to ...

Anurag Kanungo (via Code Review) gerrit at gerrit.libreoffice.org
Wed May 1 04:36:31 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3709

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/09/3709/1

fdo#37222 and fdo#37219  Open pdf after Export and added to recent documents.

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 .

Change-Id: Ief7d2b4413c0964b472e339a0fb46555227d8c6d
---
M filter/source/pdf/impdialog.cxx
M filter/source/pdf/impdialog.hrc
M filter/source/pdf/impdialog.hxx
M filter/source/pdf/impdialog.src
M filter/source/pdf/pdffilter.cxx
5 files changed, 32 insertions(+), 0 deletions(-)



diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 9ddf052..e4a4a90 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -80,6 +80,7 @@
     mnMaxImageResolution( 300 ),
     mbUseTaggedPDF( sal_False ),
     mbExportNotes( sal_True ),
+    mbVIEWPDF( sal_False ),
     mbExportNotesPages( sal_False ),
     mbUseTransitionEffects( sal_False ),
     mbIsSkipEmptyPages( sal_True ),
@@ -511,6 +512,7 @@
     maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ),
     maCbExportHiddenSlides( this, PDFFilterResId( CB_EXPORTHIDDENSLIDES ) ),
     maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ),
+    maCbVIEWPDF( this, PDFFilterResId( CB_VIEWPDF ) ),
     maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
     maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
     maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
@@ -659,6 +661,7 @@
     ToggleAddStreamHdl( NULL );
 }
 
+int ImpPDFTabGeneralPage::pdfview=0; // To set Default Value of Checkbox (View Pdf after Export)
 // -----------------------------------------------------------------------------
 void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
 {
@@ -702,6 +705,12 @@
         paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
         paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
     }
+    
+    if( maCbVIEWPDF.IsChecked() )
+        pdfview=1;
+    else
+        pdfview=0;
+
     paParent->maWatermarkText = maEdWatermark.GetText();
 
     /*
diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc
index 03b6d55..938b622 100644
--- a/filter/source/pdf/impdialog.hrc
+++ b/filter/source/pdf/impdialog.hrc
@@ -87,6 +87,7 @@
 #define CB_WATERMARK                32
 #define FT_WATERMARK                33
 #define ED_WATERMARK                34
+#define CB_VIEWPDF                  35
 
 
 //controls for open options tab page
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index 11a3f38..ac5915b 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -94,6 +94,7 @@
     sal_Bool                    mbUseTaggedPDF;
     sal_Int32                   mnPDFTypeSelection;
     sal_Bool                    mbExportNotes;
+    sal_Bool                    mbVIEWPDF;
     sal_Bool                    mbExportNotesPages;
     sal_Bool                    mbUseTransitionEffects;
     sal_Bool                    mbIsSkipEmptyPages;
@@ -178,7 +179,9 @@
 class ImpPDFTabGeneralPage : public SfxTabPage
 {
     friend class                ImpPDFTabLinksPage;
+    friend class                PDFFilter;
 
+    static int                  pdfview;
     FixedLine                   maFlPages;
     RadioButton                 maRbAll;
     RadioButton                 maRbRange;
@@ -210,6 +213,7 @@
     CheckBox                    maCbExportBookmarks;
     CheckBox                    maCbExportHiddenSlides;
     CheckBox                    maCbExportNotes;
+    CheckBox                    maCbVIEWPDF;
     CheckBox                    maCbExportNotesPages;
 
     CheckBox                    maCbExportEmptyPages;
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
index 8d74616..1d6e202 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -278,6 +278,13 @@
         TabStop = TRUE ;
         Text[ en-US ] = "~Export comments";
     };
+    CheckBox CB_VIEWPDF
+    {
+        Pos = MAP_APPFONT ( 188 , 131 ) ;
+        Size = MAP_APPFONT ( 158 , 10 ) ;
+        TabStop = TRUE ;
+        Text[ en-US ] = "~View Pdf after Export";
+    };
     CheckBox CB_EXPORTNOTESPAGES
     {
         HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EXPORTNOTESPAGES";
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 9aadfed..c19618a 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -18,13 +18,17 @@
  */
 
 
+#include "impdialog.hxx"
 #include "pdffilter.hxx"
 #include "pdfexport.hxx"
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
 #include <svl/outstrm.hxx>
 #include <vcl/FilterConfigItem.hxx>
+#include <com/sun/star/system/SystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 
+using namespace css::system;
 // -------------
 // - PDFFilter -
 // -------------
@@ -51,6 +55,8 @@
     sal_Bool                    bRet = sal_False;
     Reference< task::XStatusIndicator > xStatusIndicator;
     Reference< task::XInteractionHandler > xIH;
+    OUString aUrl; 
+    int pdfview_ = ImpPDFTabGeneralPage::pdfview;
 
     for ( sal_Int32 i = 0 ; ( i < nLength ) && !xOStm.is(); ++i)
     {
@@ -62,6 +68,8 @@
             pValue[ i ].Value >>= xStatusIndicator;
         else if ( pValue[i].Name == "InteractionHandler" )
             pValue[i].Value >>= xIH;
+        else if ( pValue[ i ].Name == "URL" )
+            pValue[ i ].Value >>= aUrl;
     }
 
     /* we don't get FilterData if we are exporting directly
@@ -133,6 +141,9 @@
         }
     }
 
+if(pdfview_==1) {
+    Reference<XSystemShellExecute> xSystemShellExecute(SystemShellExecute::create( ::comphelper::getProcessComponentContext() ) ); //Open the newly exported pdf
+    xSystemShellExecute->execute(aUrl, "", SystemShellExecuteFlags::URIS_ONLY ); }
     return bRet;
 }
 

-- 
To view, visit https://gerrit.libreoffice.org/3709
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief7d2b4413c0964b472e339a0fb46555227d8c6d
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Anurag Kanungo <anuragkanungo at gmail.com>



More information about the LibreOffice mailing list