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

Anurag Kanungo (via Code Review) gerrit at gerrit.libreoffice.org
Tue May 7 05:57:08 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3810

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/10/3810/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 .

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.

It will require make dev-install to work properly .

Change-Id: Ic94c0a9c6e0f7bef9727a40a8b656218f233cd61
---
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/data/org/openoffice/Office/WebWizard.xcu
M officecfg/registry/schema/org/openoffice/Office/Common.xcs
M vcl/inc/vcl/pdfextoutdevdata.hxx
M vcl/source/gdi/pdfextoutdevdata.cxx
11 files changed, 60 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..6113254 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 , 189 ) ;
+        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..81beadc 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/data/org/openoffice/Office/WebWizard.xcu b/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
index c46ae46..bcdf2b2 100644
--- a/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/WebWizard.xcu
@@ -207,6 +207,11 @@
                             <value>false</value>
                         </prop>
                     </node>
+		    <node oor:name="IsViewPDF" oor:op="replace">
+                        <prop oor:name="Value">
+                            <value>false</value>
+                        </prop>
+                    </node>
                     <node oor:name="Format" oor:op="replace">
                         <prop oor:name="Value">
                             <value>%1</value>
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">
diff --git a/vcl/inc/vcl/pdfextoutdevdata.hxx b/vcl/inc/vcl/pdfextoutdevdata.hxx
index 59a1189..b5fec70 100644
--- a/vcl/inc/vcl/pdfextoutdevdata.hxx
+++ b/vcl/inc/vcl/pdfextoutdevdata.hxx
@@ -77,6 +77,7 @@
 
     sal_Bool                        mbTaggedPDF;
     sal_Bool                        mbExportNotes;
+    sal_Bool                        mbViewPDF;
     sal_Bool                        mbExportNotesPages;
     sal_Bool                        mbTransitionEffects;
     sal_Bool                        mbUseLosslessCompression;
@@ -108,7 +109,9 @@
 
 
     sal_Bool    GetIsExportNotes() const;
+    sal_Bool    GetIsViewPDF() const;
     void        SetIsExportNotes( const sal_Bool bExportNotes );
+    void        SetIsViewPDF( const sal_Bool bViewPDF );
 
     sal_Bool    GetIsExportNotesPages() const;
     void        SetIsExportNotesPages( const sal_Bool bExportNotesPages );
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 9895867..e619f8e 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -496,6 +496,7 @@
     mrOutDev                ( rOutDev ),
     mbTaggedPDF             ( sal_False ),
     mbExportNotes           ( sal_True ),
+    mbViewPDF               ( sal_True ),
     mbExportNotesPages      ( sal_False ),
     mbTransitionEffects     ( sal_True ),
     mbUseLosslessCompression( sal_True ),
@@ -552,10 +553,18 @@
 {
     return mbExportNotes;
 }
+sal_Bool PDFExtOutDevData::GetIsViewPDF() const
+{
+    return mbViewPDF;
+}
 void PDFExtOutDevData::SetIsExportNotes( const sal_Bool bExportNotes )
 {
     mbExportNotes = bExportNotes;
 }
+void PDFExtOutDevData::SetIsViewPDF( const sal_Bool bViewPDF )
+{
+    mbViewPDF = bViewPDF;
+}
 sal_Bool PDFExtOutDevData::GetIsExportNotesPages() const
 {
     return mbExportNotesPages;

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

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



More information about the LibreOffice mailing list