summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/options/optgdlg.cxx25
-rw-r--r--sfx2/inc/sfx2/filedlghelper.hxx1
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx10
-rw-r--r--vcl/inc/salinst.hxx2
-rw-r--r--vcl/inc/unx/gtk/gtkinst.hxx2
-rw-r--r--vcl/inc/vcl/svapp.hxx4
-rw-r--r--vcl/source/app/svapp.cxx6
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx2
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx1
9 files changed, 31 insertions, 22 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index e08dcc797afb..72355b768ea0 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -124,20 +124,11 @@ int OfaMiscTabPage::DeactivatePage( SfxItemSet* pSet_ )
namespace
{
- ::rtl::OUString impl_SystemFileOpenServiceName()
+ static ::rtl::OUString impl_SystemFileOpenServiceName()
{
- const ::rtl::OUString &rDesktopEnvironment =
- Application::GetDesktopEnvironment();
+ const ::rtl::OUString &rDesktopEnvironment = Application::GetDesktopEnvironment();
- if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "gnome" ) )
- {
- #ifdef ENABLE_GTK
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.GtkFilePicker") );
- #else
- return rtl::OUString();
- #endif
- }
- else if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
+ if ( rDesktopEnvironment.equalsIgnoreAsciiCaseAscii( "kde4" ) )
{
#ifdef ENABLE_KDE4
return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.KDE4FilePicker") );
@@ -162,10 +153,14 @@ namespace
#endif
}
- sal_Bool lcl_HasSystemFilePicker()
+ static bool lcl_HasSystemFilePicker()
{
+ if( Application::hasNativeFileSelection() )
+ return true;
+
+ // Otherwise fall-back on querying services
+ bool bRet = false;
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
- sal_Bool bRet = sal_False;
Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
Reference< XSet > xSet( xFactory, UNO_QUERY );
@@ -178,7 +173,7 @@ namespace
::rtl::OUString aFileService = impl_SystemFileOpenServiceName();
Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
if ( xEnum.is() && xEnum->hasMoreElements() )
- bRet = sal_True;
+ bRet = true;
}
catch (const IllegalArgumentException&)
{
diff --git a/sfx2/inc/sfx2/filedlghelper.hxx b/sfx2/inc/sfx2/filedlghelper.hxx
index 291897d2eb8d..215759021ab4 100644
--- a/sfx2/inc/sfx2/filedlghelper.hxx
+++ b/sfx2/inc/sfx2/filedlghelper.hxx
@@ -99,7 +99,6 @@ class Window;
#define FILE_OPEN_SERVICE_NAME "com.sun.star.ui.dialogs.FilePicker"
#define FOLDER_PICKER_SERVICE_NAME "com.sun.star.ui.dialogs.FolderPicker"
-#define FILE_OPEN_SERVICE_NAME_SYSTEM "com.sun.star.ui.dialogs.SystemFilePicker"
#define FILE_OPEN_SERVICE_NAME_OOO "com.sun.star.ui.dialogs.OfficeFilePicker"
//-----------------------------------------------------------------------------
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 0a647687dfb4..56b0868a2be4 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -842,21 +842,21 @@ ErrCode FileDialogHelper_Impl::getGraphic( Graphic& rGraphic ) const
}
// ------------------------------------------------------------------------
-sal_Bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP )
+static bool lcl_isSystemFilePicker( const uno::Reference< XFilePicker >& _rxFP )
{
try
{
uno::Reference< XServiceInfo > xSI( _rxFP, UNO_QUERY );
- if ( xSI.is() && xSI->supportsService( DEFINE_CONST_OUSTRING( "com.sun.star.ui.dialogs.SystemFilePicker" ) ) )
- return sal_True;
+ if ( !xSI.is() )
+ return true;
+ return xSI->supportsService( DEFINE_CONST_OUSTRING( "com.sun.star.ui.dialogs.SystemFilePicker" ) );
}
catch( const Exception& )
{
}
- return sal_False;
+ return false;
}
-
// ------------------------------------------------------------------------
// ----------- FileDialogHelper_Impl ---------------------------
// ------------------------------------------------------------------------
diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx
index e503fb4ea871..67affdbec700 100644
--- a/vcl/inc/salinst.hxx
+++ b/vcl/inc/salinst.hxx
@@ -170,6 +170,8 @@ public:
virtual com::sun::star::uno::Reference< com::sun::star::uno::XInterface > CreateDropTarget();
virtual void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType) = 0;
+ virtual bool hasNativeFileSelection() const { return false; }
+
virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
createFilePicker( const com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >& )
diff --git a/vcl/inc/unx/gtk/gtkinst.hxx b/vcl/inc/unx/gtk/gtkinst.hxx
index 55a187908566..8b937a33e577 100644
--- a/vcl/inc/unx/gtk/gtkinst.hxx
+++ b/vcl/inc/unx/gtk/gtkinst.hxx
@@ -109,6 +109,8 @@ public:
virtual GenPspGraphics *CreatePrintGraphics();
+ virtual bool hasNativeFileSelection() const { return true; }
+
virtual com::sun::star::uno::Reference< com::sun::star::ui::dialogs::XFilePicker2 >
createFilePicker( const com::sun::star::uno::Reference<
com::sun::star::uno::XComponentContext >& );
diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx
index 951f817b7aa3..07782dfb07aa 100644
--- a/vcl/inc/vcl/svapp.hxx
+++ b/vcl/inc/vcl/svapp.hxx
@@ -373,6 +373,10 @@ public:
*/
static void AddToRecentDocumentList(const rtl::OUString& rFileUrl, const rtl::OUString& rMimeType);
+ /** Do we have a native / system file selector available ?
+ */
+ static bool hasNativeFileSelection();
+
/** Create a platform specific file picker, if one is available,
otherwise return an empty reference
*/
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index e1448510278a..e23192c33cc8 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1895,6 +1895,12 @@ void Application::AppEvent( const ApplicationEvent& /*rAppEvent*/ )
{
}
+bool Application::hasNativeFileSelection()
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ return pSVData->mpDefInst->hasNativeFileSelection();
+}
+
Reference< ui::dialogs::XFilePicker2 >
Application::createFilePicker( const Reference< uno::XComponentContext >& xSM )
{
diff --git a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
index b7caa0ac51c9..7ffcb69b22c3 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFilePicker.cxx
@@ -972,7 +972,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute() throw( uno::RuntimeException )
UNO_QUERY_THROW );
uno::Reference< frame::XDesktop > xDesktop(
- createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ),
+ createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
UNO_QUERY_THROW );
RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 923a7fe4a329..07b6bb2abd29 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -206,6 +206,7 @@ GtkInstance::createFolderPicker( const uno::Reference< uno::XComponentContext >
{
fprintf( stderr, "Create gtk folder picker\n" );
#if GTK_CHECK_VERSION(3,0,0)
+ (void)xMSF;
return uno::Reference< ui::dialogs::XFolderPicker >();
#else
return uno::Reference< ui::dialogs::XFolderPicker >(