summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-12 09:23:05 +0200
committerNoel Grandin <noel@peralex.com>2013-02-12 10:14:45 +0200
commit4b51374a7021d52f7f1be1861e2ee6a011b30ecd (patch)
tree77a0121f0eda201befd57a5848bd08aa906473f0 /vcl/win
parent53ec703c14470cb18845fc4483ec36c13b0d744e (diff)
fdo#46808, Adapt ui::dialogs::FilePicker UNO service to new style
Change-Id: I1cafbfc53994e5d74241042dbd1d292ddbda67d5
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/source/gdi/salprn.cxx46
1 files changed, 20 insertions, 26 deletions
diff --git a/vcl/win/source/gdi/salprn.cxx b/vcl/win/source/gdi/salprn.cxx
index 9bc4b148a609..57440cd1b064 100644
--- a/vcl/win/source/gdi/salprn.cxx
+++ b/vcl/win/source/gdi/salprn.cxx
@@ -41,7 +41,7 @@
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
+#include <com/sun/star/ui/dialogs/FilePicker.hpp>
#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -1600,33 +1600,27 @@ sal_Bool WinSalPrinter::StartJob( const rtl::OUString* pFileName,
if( mpInfoPrinter->maPortName.equalsIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "FILE:" ) ) && !(pFileName && !pFileName->isEmpty()) )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- if( xFactory.is() )
+ uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ uno::Reference< XFilePicker3 > xFilePicker = FilePicker::createDefault(xContext);
+
+ uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
+ uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
+ if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
{
- uno::Reference< XFilePicker > xFilePicker( xFactory->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ) ),
- UNO_QUERY );
- DBG_ASSERT( xFilePicker.is(), "could not get FilePicker service" );
-
- uno::Reference< XInitialization > xInit( xFilePicker, UNO_QUERY );
- uno::Reference< XFilterManager > xFilterMgr( xFilePicker, UNO_QUERY );
- if( xInit.is() && xFilePicker.is() && xFilterMgr.is() )
+ Sequence< Any > aServiceType( 1 );
+ aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE;
+ xInit->initialize( aServiceType );
+ if( xFilePicker->execute() == ExecutableDialogResults::OK )
{
- Sequence< Any > aServiceType( 1 );
- aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE;
- xInit->initialize( aServiceType );
- if( xFilePicker->execute() == ExecutableDialogResults::OK )
- {
- Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
- INetURLObject aObj( aPathSeq[0] );
- // we're using ansi calls (StartDocA) so convert the string
- aOutFileName = aObj.PathToFileName();
- }
- else
- {
- mnError = SAL_PRINTER_ERROR_ABORT;
- return FALSE;
- }
+ Sequence< OUString > aPathSeq( xFilePicker->getFiles() );
+ INetURLObject aObj( aPathSeq[0] );
+ // we're using ansi calls (StartDocA) so convert the string
+ aOutFileName = aObj.PathToFileName();
+ }
+ else
+ {
+ mnError = SAL_PRINTER_ERROR_ABORT;
+ return FALSE;
}
}
}