[Libreoffice-commits] core.git: fpicker/source offapi/com sfx2/source vcl/unx

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Thu Jun 30 11:41:10 UTC 2016


 fpicker/source/aqua/ControlHelper.mm                    |    3 +++
 fpicker/source/aqua/SalAquaFilePicker.mm                |    7 +++++--
 fpicker/source/office/OfficeFilePicker.cxx              |    4 ++++
 fpicker/source/win32/filepicker/FilePicker.cxx          |    1 +
 fpicker/source/win32/filepicker/VistaFilePicker.cxx     |    7 +++++++
 fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx |    1 +
 offapi/com/sun/star/ui/dialogs/TemplateDescription.idl  |    9 +++++++++
 sfx2/source/dialog/filedlghelper.cxx                    |   10 ++++++++++
 vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx                |    6 ++++++
 vcl/unx/kde/UnxFilePicker.cxx                           |    6 ++++++
 vcl/unx/kde4/KDE4FilePicker.cxx                         |    4 ++++
 11 files changed, 56 insertions(+), 2 deletions(-)

New commits:
commit e9891e5dd8e9c83a1bf0483aa314e743a1c02e50
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Jun 30 11:19:43 2016 +0200

    Add new open dialog type: Preview only (without link)
    
    This is needed e.g. for the "Insert Photo Album" dialog
    where we don't want the "Insert Link" option in the file open dialog (tdf#65356)
    
    Change-Id: I01aecaaf8194a8123931b0482b4a37155654dfc2
    Reviewed-on: https://gerrit.libreoffice.org/26796
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/fpicker/source/aqua/ControlHelper.mm b/fpicker/source/aqua/ControlHelper.mm
index 5727cdf..0cecb40 100644
--- a/fpicker/source/aqua/ControlHelper.mm
+++ b/fpicker/source/aqua/ControlHelper.mm
@@ -216,6 +216,9 @@ void ControlHelper::initialize( sal_Int16 nTemplateId )
         case FILESAVE_AUTOEXTENSION:
             m_bToggleVisibility[AUTOEXTENSION] = true;
             break;
+        case FILEOPEN_PREVIEW:
+            m_bToggleVisibility[PREVIEW] = true;
+            break;
     }
 
     createControls();
diff --git a/fpicker/source/aqua/SalAquaFilePicker.mm b/fpicker/source/aqua/SalAquaFilePicker.mm
index 78ec4f8..eef8f42 100644
--- a/fpicker/source/aqua/SalAquaFilePicker.mm
+++ b/fpicker/source/aqua/SalAquaFilePicker.mm
@@ -204,7 +204,7 @@ sal_Int16 SAL_CALL SalAquaFilePicker::execute() throw( uno::RuntimeException )
 
         default:
             throw uno::RuntimeException(
-                      "The dialog returned with an unknown result!", 
+                      "The dialog returned with an unknown result!",
                       static_cast<XFilePicker*>( static_cast<XFilePicker3*>( this ) ));
             break;
     }
@@ -288,7 +288,7 @@ uno::Sequence<rtl::OUString> SAL_CALL SalAquaFilePicker::getSelectedFiles() thro
     SAL_INFO("fpicker.aqua", "# of items: " << nFiles);
 
     uno::Sequence< rtl::OUString > aSelectedFiles(nFiles);
-    
+
     for(long nIndex = 0; nIndex < nFiles; nIndex += 1)
     {
         NSURL *url = [files objectAtIndex:nIndex];
@@ -483,6 +483,9 @@ throw( uno::Exception, uno::RuntimeException )
         case FILESAVE_AUTOEXTENSION:
             m_nDialogType = NAVIGATIONSERVICES_SAVE;
             break;
+        case FILEOPEN_PREVIEW:
+            m_nDialogType = NAVIGATIONSERVICES_OPEN;
+            break;
         default:
             throw lang::IllegalArgumentException("Unknown template",
                                                  static_cast<XFilePicker*>( static_cast<XFilePicker3*>(this) ),
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index 728dd4f..1a5496b 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -277,6 +277,10 @@ PickerFlags SvtFilePicker::getPickerFlags()
     {
         nBits = PickerFlags::Open | PickerFlags::InsertAsLink | PickerFlags::ShowPreview;
     }
+    else if ( m_nServiceType == TemplateDescription::FILEOPEN_PREVIEW )
+    {
+        nBits = PickerFlags::Open | PickerFlags::ShowPreview;
+    }
     if ( m_bMultiSelection && ( nBits & PickerFlags::Open ) )
         nBits |= PickerFlags::MultiSelection;
 
diff --git a/fpicker/source/win32/filepicker/FilePicker.cxx b/fpicker/source/win32/filepicker/FilePicker.cxx
index 88c8cdb..40c258d 100644
--- a/fpicker/source/win32/filepicker/FilePicker.cxx
+++ b/fpicker/source/win32/filepicker/FilePicker.cxx
@@ -562,6 +562,7 @@ void SAL_CALL CFilePicker::initialize(const uno::Sequence<uno::Any>& aArguments)
         break;
 
     case FILEOPEN_LINK_PREVIEW:
+    case FILEOPEN_PREVIEW: //FIXME: FILEOPEN_PREVIEW needs an own template, no idea how to create one
         winResTemplateId = TMPL2000_FILEOPEN_LINK_PREVIEW_BOX_SIMPLE_ID;
         break;
 
diff --git a/fpicker/source/win32/filepicker/VistaFilePicker.cxx b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
index 4b2a436..102117e 100644
--- a/fpicker/source/win32/filepicker/VistaFilePicker.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePicker.cxx
@@ -523,6 +523,13 @@ void SAL_CALL VistaFilePicker::initialize(const css::uno::Sequence< css::uno::An
             nFeatures        |= FEATURE_AUTOEXTENSION;
         }
         break;
+
+        case css::ui::dialogs::TemplateDescription::FILEOPEN_PREVIEW :
+        {
+            bFileOpenDialog  = sal_True;
+            nFeatures        |= FEATURE_PREVIEW;
+        }
+        break;
     }
     css::uno::Reference<css::awt::XWindow> xParentWindow;
     if(lArguments.getLength() > 1)
diff --git a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
index 1713870..d60aff8 100644
--- a/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
+++ b/fpicker/source/win32/filepicker/VistaFilePickerImpl.cxx
@@ -524,6 +524,7 @@ void VistaFilePickerImpl::impl_sta_enableFeatures(::sal_Int32 nFeatures, ::sal_I
     switch (nTemplate)
     {
         case css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE :
+        case css::ui::dialogs::TemplateDescription::FILEOPEN_PREVIEW :
         case css::ui::dialogs::TemplateDescription::FILESAVE_SIMPLE :
             aGUID = CLIENTID_FILEDIALOG_SIMPLE;
             break;
diff --git a/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl b/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl
index 76aaec1..503d4f8 100644
--- a/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl
+++ b/offapi/com/sun/star/ui/dialogs/TemplateDescription.idl
@@ -114,6 +114,15 @@ published constants TemplateDescription
     */
     const short FILESAVE_AUTOEXTENSION                         = 10;
 
+    /** A FileOpen dialog with additional controls.
+        <ul>
+            <li>A checkbox "Show Preview"</li>
+            <li>A window for displaying a file preview</li>
+        </ul>
+
+        @since LibreOffice 5.3
+    */
+    const short FILEOPEN_PREVIEW                               = 11;
 };
 
 
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index c41c0f8..e82b4ec 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -435,6 +435,7 @@ bool FileDialogHelper_Impl::isInOpenMode() const
         case FILEOPEN_PLAY:
         case FILEOPEN_READONLY_VERSION:
         case FILEOPEN_LINK_PREVIEW:
+        case FILEOPEN_PREVIEW:
             bRet = true;
     }
 
@@ -828,6 +829,7 @@ static open_or_save_t lcl_OpenOrSave(sal_Int16 const nDialogType)
         case FILEOPEN_PLAY:
         case FILEOPEN_READONLY_VERSION:
         case FILEOPEN_LINK_PREVIEW:
+        case FILEOPEN_PREVIEW:
             return OPEN;
         case FILESAVE_SIMPLE:
         case FILESAVE_AUTOEXTENSION_PASSWORD:
@@ -1015,6 +1017,14 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
                 mbIsSaveDlg = true;
                 break;
 
+            case FILEOPEN_PREVIEW:
+                nTemplateDescription = TemplateDescription::FILEOPEN_PREVIEW;
+                mbHasPreview = true;
+                // aPreviewTimer
+                maPreviewIdle.SetPriority( SchedulerPriority::LOWEST );
+                maPreviewIdle.SetIdleHdl( LINK( this, FileDialogHelper_Impl, TimeOutHdl_Impl ) );
+                break;
+
             default:
                 SAL_WARN( "sfx.dialog", "FileDialogHelper::ctor with unknown type" );
                 break;
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index 4a9453b..7207821 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -1681,6 +1681,12 @@ void SAL_CALL SalGtkFilePicker::initialize( const uno::Sequence<uno::Any>& aArgu
             OSL_TRACE( "7all true" );
             // TODO
                 break;
+        case FILEOPEN_PREVIEW:
+            eAction = GTK_FILE_CHOOSER_ACTION_OPEN;
+            first_button_text = GTK_STOCK_OPEN;
+            mbToggleVisibility[PREVIEW] = true;
+            // TODO
+                break;
         default:
                 throw lang::IllegalArgumentException(
                 OUString( "Unknown template" ),
diff --git a/vcl/unx/kde/UnxFilePicker.cxx b/vcl/unx/kde/UnxFilePicker.cxx
index 8dce0e0..bbee2f3 100644
--- a/vcl/unx/kde/UnxFilePicker.cxx
+++ b/vcl/unx/kde/UnxFilePicker.cxx
@@ -724,6 +724,12 @@ void SAL_CALL UnxFilePicker::initialize( const uno::Sequence<uno::Any> &rArgumen
             sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
             break;
 
+        case FILEOPEN_PREVIEW:
+            sendCommand( aTypeOpen );
+
+            sendAppendControlCommand( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW );
+            break;
+
         default:
             throw lang::IllegalArgumentException(
                     OUString( "Unknown template" ),
diff --git a/vcl/unx/kde4/KDE4FilePicker.cxx b/vcl/unx/kde4/KDE4FilePicker.cxx
index 229aa02..2a35998 100644
--- a/vcl/unx/kde4/KDE4FilePicker.cxx
+++ b/vcl/unx/kde4/KDE4FilePicker.cxx
@@ -725,6 +725,10 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
             addCustomControl( CHECKBOX_PREVIEW );
             break;
 
+        case FILEOPEN_PREVIEW:
+            addCustomControl( CHECKBOX_PREVIEW );
+            break;
+
         default:
             throw lang::IllegalArgumentException(
                     OUString( "Unknown template" ),


More information about the Libreoffice-commits mailing list