summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorDirk Völzke <dv@openoffice.org>2001-06-19 14:34:05 +0000
committerDirk Völzke <dv@openoffice.org>2001-06-19 14:34:05 +0000
commit7fc3f4d22618e1e3d407618c1c7b82e0611f5cdf (patch)
treeae5b636c8fe05e21a818372891755524cddd9808 /sfx2
parent9a90e2ecbb2735c546c3e03bee3672f85bffba53 (diff)
#84092# Added registerFactories()
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx54
1 files changed, 49 insertions, 5 deletions
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 62ea408d596a..23d1a930307f 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: filedlghelper.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dv $ $Date: 2001-06-18 10:56:17 $
+ * last change: $Author: dv $ $Date: 2001-06-19 15:34:05 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,13 @@
#include <com/sun/star/lang/XInitialization.hpp>
#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCONTENTENUMERATIONACCESS_HPP_
+#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XSET_HPP_
+#include <com/sun/star/container/XSet.hpp>
+#endif
+
#ifndef _COM_SUN_STAR_UI_DIALOGS_COMMONFILEPICKERELEMENTIDS_HPP_
#include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp>
#endif
@@ -112,6 +119,8 @@
#endif
#include "filedlghelper.hxx"
+#include "filepicker.hxx"
+#include "folderpicker.hxx"
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
@@ -172,6 +181,7 @@
//-----------------------------------------------------------------------------
+using namespace ::com::sun::star::container;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::ui::dialogs;
using namespace ::com::sun::star::uno;
@@ -499,6 +509,10 @@ IMPL_LINK( FileDialogHelper_Impl, TimeOutHdl_Impl, Timer*, EMPTYARG )
FileDialogHelper_Impl::FileDialogHelper_Impl( const short nDialogType,
sal_uInt32 nFlags )
{
+ OUString aService( RTL_CONSTASCII_USTRINGPARAM( FILE_OPEN_SERVICE_NAME ) );
+
+ Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+
// create the file open dialog
// the flags can be SFXWB_INSERT or SFXWB_MULTISELECTION
@@ -514,9 +528,6 @@ FileDialogHelper_Impl::FileDialogHelper_Impl( const short nDialogType,
mpMatcher = NULL;
- OUString aService( RTL_CONSTASCII_USTRINGPARAM( FILE_OPEN_SERVICE_NAME ) );
- Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
-
mxFileDlg = Reference < XFilePicker > ( xFactory->createInstance( aService ), UNO_QUERY );
Reference< XFilePickerNotifier > xNotifier( mxFileDlg, UNO_QUERY );
@@ -1189,6 +1200,39 @@ const short FileDialogHelper::getDialogType( sal_uInt32 nFlags ) const
}
// ------------------------------------------------------------------------
+void FileDialogHelper::registerFactories( Reference <XMultiServiceFactory> xFactory )
+{
+ OUString aFileService( RTL_CONSTASCII_USTRINGPARAM( FILE_OPEN_SERVICE_NAME ) );
+ OUString aFolderService( RTL_CONSTASCII_USTRINGPARAM( FOLDER_PICKER_SERVICE_NAME ) );
+
+ Reference< XContentEnumerationAccess > xEnumAccess( xFactory, UNO_QUERY );
+ Reference< XSet > xSet( xFactory, UNO_QUERY );
+
+ if ( ! xEnumAccess.is() || ! xSet.is() )
+ return;
+
+ try
+ {
+ Reference< XEnumeration > xEnum = xEnumAccess->createContentEnumeration( aFileService );
+ if ( ! xEnum.is() || ! xEnum->hasMoreElements() )
+ {
+ Reference< XInterface > xFac( SfxFilePicker::impl_createFactory(xFactory) );
+ xSet->insert( makeAny( xFac ) );
+ }
+
+ xEnum = xEnumAccess->createContentEnumeration( aFolderService );
+ if ( ! xEnum.is() || ! xEnum->hasMoreElements() )
+ {
+ Reference< XInterface > xFac( SfxFolderPicker::impl_createFactory(xFactory) );
+ xSet->insert( makeAny( xFac ) );
+ }
+ }
+
+ catch( IllegalArgumentException ) {}
+ catch( ElementExistException ) {}
+}
+
+// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------