[Libreoffice-commits] core.git: filter/source officecfg/registry

anuragkanungo anuragkanungo at gmail.com
Fri May 17 08:46:37 PDT 2013


 filter/source/pdf/impdialog.cxx                            |    7 +++++++
 filter/source/pdf/impdialog.hrc                            |    1 +
 filter/source/pdf/impdialog.hxx                            |    2 ++
 filter/source/pdf/impdialog.src                            |    9 ++++++++-
 filter/source/pdf/pdfexport.cxx                            |    3 +++
 filter/source/pdf/pdfexport.hxx                            |    1 +
 filter/source/pdf/pdffilter.cxx                            |   13 +++++++++++++
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 ++++++
 8 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit eea4a30a4332b92b5534d3d3dc0e6152108ed670
Author: anuragkanungo <anuragkanungo at gmail.com>
Date:   Sat May 18 02:33:13 2013 +0530

    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/3948
    Reviewed-by: Fridrich Strba <fridrich at documentfoundation.org>
    Tested-by: Fridrich Strba <fridrich at documentfoundation.org>

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 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
     mnMaxImageResolution( 300 ),
     mbUseTaggedPDF( sal_False ),
     mbExportNotes( sal_True ),
+    mbViewPDF( sal_False ),
     mbExportNotesPages( sal_False ),
     mbUseTransitionEffects( sal_False ),
     mbIsSkipEmptyPages( sal_True ),
@@ -192,6 +193,7 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
     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 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
     if ( mbIsPresentation )
         maConfigItem.WriteBool( "ExportNotesPages", mbExportNotesPages );
     maConfigItem.WriteBool( "ExportNotes", mbExportNotes );
+    maConfigItem.WriteBool( "ViewPDFAfterExport", mbViewPDF );
 
     maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
     if ( mbIsPresentation )
@@ -511,6 +514,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
     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 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
     maCbExportBookmarks.Check( paParent->mbExportBookmarks );
 
     maCbExportNotes.Check( paParent->mbExportNotes );
+    maCbViewPDF.Check( paParent->mbViewPDF);
 
     if ( mbIsPresentation )
     {
@@ -668,6 +673,7 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
     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 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
         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 @@ protected:
     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 @@ class ImpPDFTabGeneralPage : public SfxTabPage
     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 @@ TabPage  RID_PDF_TAB_GENER
     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 @@ TabPage  RID_PDF_TAB_GENER
         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 23eea97..e771a0d 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -98,6 +98,7 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
     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 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
                     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" )
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 @@ private:
     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 PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
     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 @@ sal_Bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor )
             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 @@ 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;
 }
 
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index dfffccd..fea2329 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5278,6 +5278,12 @@
               screen.</desc>
             </info>
             <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>
           <!-- PDF Encryption -->
           <prop oor:name="Printing" oor:type="xs:int" oor:nillable="false">


More information about the Libreoffice-commits mailing list