diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-12 09:23:05 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:45 +0200 |
commit | 4b51374a7021d52f7f1be1861e2ee6a011b30ecd (patch) | |
tree | 77a0121f0eda201befd57a5848bd08aa906473f0 /sdext/source | |
parent | fdo#46808, Adapt linguistic2::DictionaryList UNO service to new style (diff) | |
download | core-4b51374a7021d52f7f1be1861e2ee6a011b30ecd.tar.gz core-4b51374a7021d52f7f1be1861e2ee6a011b30ecd.zip |
fdo#46808, Adapt ui::dialogs::FilePicker UNO service to new style
Change-Id: I1cafbfc53994e5d74241042dbd1d292ddbda67d5
Diffstat (limited to 'sdext/source')
-rw-r--r-- | sdext/source/minimizer/fileopendialog.cxx | 25 | ||||
-rw-r--r-- | sdext/source/minimizer/fileopendialog.hxx | 7 |
2 files changed, 13 insertions, 19 deletions
diff --git a/sdext/source/minimizer/fileopendialog.cxx b/sdext/source/minimizer/fileopendialog.cxx index 4f03d40a33fe..e341b5a2b21a 100644 --- a/sdext/source/minimizer/fileopendialog.cxx +++ b/sdext/source/minimizer/fileopendialog.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> #include <com/sun/star/ui/dialogs/FilePreviewImageFormats.hpp> +#include <com/sun/star/ui/dialogs/FilePicker.hpp> #include <com/sun/star/ui/dialogs/ControlActions.hpp> #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> @@ -54,14 +55,9 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::view; using namespace ::com::sun::star::ui::dialogs; -FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) : - mxMSF( rxMSF ) +FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxContext ) { - Sequence< Any > aInitPropSeq( 1 ); - aInitPropSeq[ 0 ] <<= (sal_Int16)TemplateDescription::FILESAVE_AUTOEXTENSION; // TemplateDescription.FILEOPEN_SIMPLE - - mxFilePicker = Reference < XFilePicker >( mxMSF->getServiceManager()->createInstanceWithArgumentsAndContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aInitPropSeq, rxMSF ),UNO_QUERY_THROW ); + mxFilePicker = FilePicker::createWithMode( rxContext, TemplateDescription::FILESAVE_AUTOEXTENSION); mxFilePicker->setMultiSelectionMode( sal_False ); Reference< XFilePickerControlAccess > xAccess( mxFilePicker, UNO_QUERY ); @@ -77,8 +73,8 @@ FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) : } // collecting a list of impress filters - Reference< XNameAccess > xFilters( mxMSF->getServiceManager()->createInstanceWithContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ), rxMSF ), UNO_QUERY_THROW ); + Reference< XNameAccess > xFilters( rxContext->getServiceManager()->createInstanceWithContext( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) ), rxContext ), UNO_QUERY_THROW ); Sequence< OUString > aFilterList( xFilters->getElementNames() ); for ( int i = 0; i < aFilterList.getLength(); i++ ) { @@ -122,13 +118,12 @@ FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) : } } - Reference< XNameAccess > xTypes( mxMSF->getServiceManager()->createInstanceWithContext( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ) ), rxMSF ), UNO_QUERY_THROW ); + Reference< XNameAccess > xTypes( rxContext->getServiceManager()->createInstanceWithContext( + OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ) ), rxContext ), UNO_QUERY_THROW ); Sequence< OUString > aTypeList( xFilters->getElementNames() ); // mxFilePicker->setDefaultName( ); - Reference< XFilterManager > xFilterManager( mxFilePicker, UNO_QUERY_THROW ); std::vector< FilterEntry >::iterator aIter( aFilterEntryList.begin() ); while( aIter != aFilterEntryList.end() ) { @@ -148,13 +143,13 @@ FileOpenDialog::FileOpenDialog( const Reference< XComponentContext >& rxMSF ) : } if ( aExtensions.getLength() ) { - xFilterManager->appendFilter( aIter->maUIName, aExtensions[ 0 ] ); + mxFilePicker->appendFilter( aIter->maUIName, aExtensions[ 0 ] ); if ( aIter->maFlags & 0x100 ) - xFilterManager->setCurrentFilter( aIter->maUIName ); + mxFilePicker->setCurrentFilter( aIter->maUIName ); } } } - catch ( Exception& ) + catch ( const Exception& ) { } aIter++; diff --git a/sdext/source/minimizer/fileopendialog.hxx b/sdext/source/minimizer/fileopendialog.hxx index 244a3b49a989..5611d29857eb 100644 --- a/sdext/source/minimizer/fileopendialog.hxx +++ b/sdext/source/minimizer/fileopendialog.hxx @@ -24,7 +24,7 @@ #include <vector> #include <com/sun/star/beans/StringPair.hpp> #include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker3.hpp> #include <com/sun/star/uno/XComponentContext.hpp> class FileOpenDialog @@ -42,13 +42,12 @@ class FileOpenDialog FilterEntry() : maFlags( 0 ) {} }; - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF; - com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker > mxFilePicker; + com::sun::star::uno::Reference < ::com::sun::star::ui::dialogs::XFilePicker3 > mxFilePicker; std::vector< FilterEntry > aFilterEntryList; public : - FileOpenDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxMSF ); + FileOpenDialog( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); ~FileOpenDialog(); sal_Int16 execute(); |