Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3945

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/45/3945/1

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: Id4f5cf5b7c6b0a917a46cdcdd308d8bb3e3cf127
---
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/pdfexport.cxx
M filter/source/pdf/pdfexport.hxx
M filter/source/pdf/pdffilter.cxx
M officecfg/registry/schema/org/openoffice/Office/Common.xcs
8 files changed, 43 insertions(+), 1 deletion(-)



diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 9ddf052..d265328 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 ),
@@ -192,6 +193,7 @@
     if ( mbIsPresentation )
         mbExportNotesPages = maConfigItem.ReadBool( "ExportNotesPages", sal_False );
     mbExportNotes = maConfigItem.ReadBool( "ExportNotes", sal_False );
+    mbViewPDF = maConfigItem.ReadBool( "ViewPDFAfterExport", sal_False );
 
     mbExportBookmarks = maConfigItem.ReadBool( "ExportBookmarks", sal_True );
     if ( mbIsPresentation )
@@ -360,6 +362,7 @@
     if ( mbIsPresentation )
         maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages );
     maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
+    maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
 
     maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
     if ( mbIsPresentation )
@@ -511,6 +514,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 ) ),
@@ -624,6 +628,7 @@
     maCbExportBookmarks.Check( paParent->mbExportBookmarks );
 
     maCbExportNotes.Check( paParent->mbExportNotes );
+    maCbViewPDF.Check( paParent->mbViewPDF);
 
     if ( mbIsPresentation )
     {
@@ -668,6 +673,7 @@
     paParent->mbReduceImageResolution = maCbReduceImageResolution.IsChecked();
     paParent->mnMaxImageResolution = maCoReduceImageResolution.GetText().toInt32();
     paParent->mbExportNotes = maCbExportNotes.IsChecked();
+    paParent->mbViewPDF = maCbViewPDF.IsChecked();
     if ( mbIsPresentation )
         paParent->mbExportNotesPages = maCbExportNotesPages.IsChecked();
     paParent->mbExportBookmarks = maCbExportBookmarks.IsChecked();
@@ -702,6 +708,7 @@
         paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
         paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
     }
+
     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..4049d53 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;
@@ -210,6 +211,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..ec33d1f 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -182,7 +182,7 @@
     FixedLine FL_GENERAL_VERTICAL
     {
         Pos = MAP_APPFONT ( 175 , 3 ) ;
-        Size = MAP_APPFONT ( 4 , 171 ) ;
+        Size = MAP_APPFONT ( 4 , 190 ) ;
         Vert = TRUE;
     };
 
@@ -311,6 +311,13 @@
         TabStop = TRUE ;
         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
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index c6e2648..188636e 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -98,6 +98,7 @@
     mbUseTaggedPDF              ( sal_False ),
     mnPDFTypeSelection          ( 0 ),
     mbExportNotes               ( sal_True ),
+    mbViewPDF                   ( sal_True ),
     mbExportNotesPages          ( sal_False ),
     mbEmbedStandardFonts        ( sal_False ),//in preparation for i54636 and i76458.
                                               //already used for i59651 (PDF/A-1)
@@ -457,6 +458,8 @@
                     rFilterData[ nData ].Value >>= mnPDFTypeSelection;
                 else if ( rFilterData[ nData ].Name == "ExportNotes" )
                     rFilterData[ nData ].Value >>= mbExportNotes;
+                else if ( rFilterData[ nData ].Name == "ViewPDFAfterExport" )
+                    rFilterData[ nData ].Value >>= mbViewPDF;
                 else if ( rFilterData[ nData ].Name == "ExportNotesPages" )
                     rFilterData[ nData ].Value >>= mbExportNotesPages;
                 else if ( rFilterData[ nData ].Name == "EmbedStandardFonts" )
@@ -811,6 +814,7 @@
                 pPDFExtOutDevData = new vcl::PDFExtOutDevData( *pOut );
                 pOut->SetExtOutDevData( pPDFExtOutDevData );
                 pPDFExtOutDevData->SetIsExportNotes( mbExportNotes );
+                //pPDFExtOutDevData->SetIsViewPDF( mbViewPDF );
                 pPDFExtOutDevData->SetIsExportTaggedPDF( mbUseTaggedPDF );
                 pPDFExtOutDevData->SetIsExportTransitionEffects( mbUseTransitionEffects );
                 pPDFExtOutDevData->SetFormsFormat( mnFormsFormat );
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index a69de13..0398e2f 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -47,6 +47,7 @@
     sal_Bool                mbUseTaggedPDF;
     sal_Int32               mnPDFTypeSelection;
     sal_Bool                mbExportNotes;
+    sal_Bool                mbViewPDF;
     sal_Bool                mbExportNotesPages;
     sal_Bool                mbEmbedStandardFonts;
     sal_Bool                mbUseTransitionEffects;
diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx
index 9aadfed..f09ae0a 100644
--- a/filter/source/pdf/pdffilter.cxx
+++ b/filter/source/pdf/pdffilter.cxx
@@ -24,7 +24,10 @@
 #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 +54,10 @@
     sal_Bool                    bRet = sal_False;
     Reference< task::XStatusIndicator > xStatusIndicator;
     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)
     {
@@ -62,6 +69,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 +142,10 @@
         }
     }
 
+    if(aViewPDF==sal_True) {
+    Reference<XSystemShellExecute> xSystemShellExecute(SystemShellExecute::create( 
::comphelper::getProcessComponentContext() ) ); //Open the newly exported pdf
+    xSystemShellExecute->execute(aUrl, "", SystemShellExecuteFlags::URIS_ONLY ); }
+
     return bRet;
 }
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs 
b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 4455509..0106dbb 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5278,6 +5278,13 @@
             </info>
             <value>false</value>
           </prop>
+         <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
               oor:name="ExportBookmarks" oor:type="xs:boolean"
               oor:nillable="false">

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

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


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.