summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-11-04 14:40:18 +0000
committerMichael Meeks <michael.meeks@suse.com>2011-11-07 14:19:33 +0000
commit17084c750df84e0da377d716a4088f72bd25f972 (patch)
tree148077dac89e352f9b6c35a83f2950b66e6cb40d /vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
parent7a47e0ead3471f8f6e737a79704ad8ad2978418a (diff)
gtk: move the file-picker into vcl/ and add Application:: factory hooks
drop un-necessary uno service related fluff, and component instantiation. nominal move to XMultiComponentFactory from XMultiServiceFactory Include fpicker in compilation for gtk3, but more work required here Simplify setting up transient parents for picker dialogs
Diffstat (limited to 'vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx')
-rw-r--r--vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx83
1 files changed, 23 insertions, 60 deletions
diff --git a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
index 52d9c78ba1e0..923a7fe4a329 100644
--- a/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
+++ b/vcl/unx/gtk/fpicker/SalGtkFolderPicker.cxx
@@ -26,9 +26,6 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_fpicker.hxx"
-
#ifdef AIX
#define _LINUX_SOURCE_COMPAT
#include <sys/timer.h>
@@ -38,21 +35,22 @@
//------------------------------------------------------------------------
// includes
//------------------------------------------------------------------------
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <osl/diagnose.h>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/uno/Any.hxx>
-#include <FPServiceInfo.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
-#include "SalGtkFolderPicker.hxx"
-#include "resourceprovider.hxx"
+#include "unx/gtk/gtkinst.hxx"
+#include "gtk/fpicker/resourceprovider.hxx"
+#include "gtk/fpicker/SalGtkFolderPicker.hxx"
#include <string.h>
+
//------------------------------------------------------------------------
// namespace directives
//------------------------------------------------------------------------
@@ -63,28 +61,13 @@ using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-//------------------------------------------------------------------------
-// helper functions
-//------------------------------------------------------------------------
-
-namespace
-{
- // controling event notifications
- uno::Sequence<rtl::OUString> SAL_CALL FolderPicker_getSupportedServiceNames()
- {
- uno::Sequence<rtl::OUString> aRet(2);
- aRet[0] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.SystemFolderPicker" ));
- aRet[1] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.GtkFolderPicker" ));
- return aRet;
- }
-}
+#if !GTK_CHECK_VERSION(3,0,0)
//-----------------------------------------------------------------------------------------
// constructor
//-----------------------------------------------------------------------------------------
-SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) :
- SalGtkPicker(xServiceMgr),
- m_xServiceMgr(xServiceMgr)
+SalGtkFolderPicker::SalGtkFolderPicker( const uno::Reference< uno::XComponentContext >& xContext ) :
+ SalGtkPicker( xContext )
{
CResourceProvider aResProvider;
@@ -177,10 +160,12 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
sal_Int16 retVal = 0;
uno::Reference< awt::XExtendedToolkit > xToolkit(
- m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")) ), uno::UNO_QUERY);
+ createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit"))),
+ uno::UNO_QUERY);
uno::Reference< frame::XDesktop > xDesktop(
- m_xServiceMgr->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ), uno::UNO_QUERY);
+ createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop")) ),
+ uno::UNO_QUERY);
RunDialog* pRunDialog = new RunDialog(m_pDialog, xToolkit, xDesktop);
uno::Reference < awt::XTopWindowListener > xLifeCycle(pRunDialog);
@@ -201,6 +186,7 @@ sal_Int16 SAL_CALL SalGtkFolderPicker::execute() throw( uno::RuntimeException )
return retVal;
}
+
//------------------------------------------------------------------------------------
// XCancellable
//------------------------------------------------------------------------------------
@@ -213,41 +199,18 @@ void SAL_CALL SalGtkFolderPicker::cancel() throw( uno::RuntimeException )
// TODO m_pImpl->cancel();
}
+#endif
-// -------------------------------------------------
-// XServiceInfo
-// -------------------------------------------------
-
-rtl::OUString SAL_CALL SalGtkFolderPicker::getImplementationName()
- throw( uno::RuntimeException )
-{
- return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_IMPL_NAME ));
-}
-
-// -------------------------------------------------
-// XServiceInfo
-// -------------------------------------------------
-
-sal_Bool SAL_CALL SalGtkFolderPicker::supportsService( const rtl::OUString& ServiceName )
- throw( uno::RuntimeException )
-{
- uno::Sequence <rtl::OUString> SupportedServicesNames = FolderPicker_getSupportedServiceNames();
-
- for( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
- if( SupportedServicesNames[n].compareTo( ServiceName ) == 0)
- return sal_True;
-
- return sal_False;
-}
-
-// -------------------------------------------------
-// XServiceInfo
-// -------------------------------------------------
-
-uno::Sequence<rtl::OUString> SAL_CALL SalGtkFolderPicker::getSupportedServiceNames()
- throw( uno::RuntimeException )
+uno::Reference< ui::dialogs::XFolderPicker >
+GtkInstance::createFolderPicker( const uno::Reference< uno::XComponentContext > &xMSF )
{
- return FolderPicker_getSupportedServiceNames();
+ fprintf( stderr, "Create gtk folder picker\n" );
+#if GTK_CHECK_VERSION(3,0,0)
+ return uno::Reference< ui::dialogs::XFolderPicker >();
+#else
+ return uno::Reference< ui::dialogs::XFolderPicker >(
+ new SalGtkFolderPicker( xMSF ) );
+#endif
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */