1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 29*cdf0e10cSrcweir // includes 30*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 34*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.h> 35*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/TemplateDescription.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> 38*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ControlActions.hpp> 39*cdf0e10cSrcweir #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <svtools/svtools.hrc> 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <vos/mutex.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include <vcl/svapp.hxx> 46*cdf0e10cSrcweir #include <vcl/sysdata.hxx> 47*cdf0e10cSrcweir #include <vcl/syswin.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir #include "osl/file.h" 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir #include "KDE4FilePicker.hxx" 52*cdf0e10cSrcweir #include "FPServiceInfo.hxx" 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir /* ********* Hack, but needed because of conflicting types... */ 55*cdf0e10cSrcweir #define Region QtXRegion 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir //kde has an enum that uses this...OO does too 58*cdf0e10cSrcweir #undef SETTINGS_MOUSE 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir #include <kfiledialog.h> 61*cdf0e10cSrcweir #include <kwindowsystem.h> 62*cdf0e10cSrcweir #include <kapplication.h> 63*cdf0e10cSrcweir #include <kfilefiltercombo.h> 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir #include <QWidget> 66*cdf0e10cSrcweir #include <QCheckBox> 67*cdf0e10cSrcweir #include <QGridLayout> 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir #undef Region 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir using namespace ::com::sun::star; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs; 74*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::TemplateDescription; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir using namespace ::com::sun::star; 77*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs; 78*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::TemplateDescription; 79*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; 80*cdf0e10cSrcweir using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; 81*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 82*cdf0e10cSrcweir using namespace ::com::sun::star::beans; 83*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 84*cdf0e10cSrcweir 85*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 86*cdf0e10cSrcweir // helper functions 87*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir #include <QDebug> 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir namespace 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir // controling event notifications 94*cdf0e10cSrcweir const bool STARTUP_SUSPENDED = true; 95*cdf0e10cSrcweir const bool STARTUP_ALIVE = false; 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir uno::Sequence<rtl::OUString> SAL_CALL FilePicker_getSupportedServiceNames() 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir uno::Sequence<rtl::OUString> aRet(3); 100*cdf0e10cSrcweir aRet[0] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.FilePicker"); 101*cdf0e10cSrcweir aRet[1] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.SystemFilePicker"); 102*cdf0e10cSrcweir aRet[2] = rtl::OUString::createFromAscii("com.sun.star.ui.dialogs.KDE4FilePicker"); 103*cdf0e10cSrcweir return aRet; 104*cdf0e10cSrcweir } 105*cdf0e10cSrcweir } 106*cdf0e10cSrcweir 107*cdf0e10cSrcweir rtl::OUString toOUString(const QString& s) 108*cdf0e10cSrcweir { 109*cdf0e10cSrcweir // QString stores UTF16, just like OUString 110*cdf0e10cSrcweir return rtl::OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length()); 111*cdf0e10cSrcweir } 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir QString toQString(const rtl::OUString& s) 114*cdf0e10cSrcweir { 115*cdf0e10cSrcweir return QString::fromUtf16(s.getStr(), s.getLength()); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 119*cdf0e10cSrcweir // KDE4FilePicker 120*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////// 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory>& xServiceMgr ) 123*cdf0e10cSrcweir : cppu::WeakComponentImplHelper8< 124*cdf0e10cSrcweir XFilterManager, 125*cdf0e10cSrcweir XFilterGroupManager, 126*cdf0e10cSrcweir XFilePickerControlAccess, 127*cdf0e10cSrcweir XFilePickerNotifier, 128*cdf0e10cSrcweir // TODO XFilePreview, 129*cdf0e10cSrcweir lang::XInitialization, 130*cdf0e10cSrcweir util::XCancellable, 131*cdf0e10cSrcweir lang::XEventListener, 132*cdf0e10cSrcweir lang::XServiceInfo>( _helperMutex ), 133*cdf0e10cSrcweir m_xServiceMgr( xServiceMgr ), 134*cdf0e10cSrcweir _resMgr( CREATEVERSIONRESMGR( fps_office ) ) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir _extraControls = new QWidget(); 137*cdf0e10cSrcweir _layout = new QGridLayout(_extraControls); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir _dialog = new KFileDialog(KUrl("~"), QString(""), 0, _extraControls); 140*cdf0e10cSrcweir _dialog->setMode(KFile::File | KFile::LocalOnly); 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir //default mode 143*cdf0e10cSrcweir _dialog->setOperationMode(KFileDialog::Opening); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir KDE4FilePicker::~KDE4FilePicker() 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir delete _resMgr; 149*cdf0e10cSrcweir delete _dialog; 150*cdf0e10cSrcweir } 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::addFilePickerListener( const uno::Reference<XFilePickerListener>& xListener ) 153*cdf0e10cSrcweir throw( uno::RuntimeException ) 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 156*cdf0e10cSrcweir m_xListener = xListener; 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::removeFilePickerListener( const uno::Reference<XFilePickerListener>& ) 160*cdf0e10cSrcweir throw( uno::RuntimeException ) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir ::vos::OGuard aGuard( Application::GetSolarMutex() ); 163*cdf0e10cSrcweir m_xListener.clear(); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setTitle( const rtl::OUString &title ) 167*cdf0e10cSrcweir throw( uno::RuntimeException ) 168*cdf0e10cSrcweir { 169*cdf0e10cSrcweir _dialog->setCaption(toQString(title)); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir sal_Int16 SAL_CALL KDE4FilePicker::execute() 173*cdf0e10cSrcweir throw( uno::RuntimeException ) 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir //get the window id of the main OO window to set it for the dialog as a parent 176*cdf0e10cSrcweir Window *pParentWin = Application::GetDefDialogParent(); 177*cdf0e10cSrcweir if ( pParentWin ) 178*cdf0e10cSrcweir { 179*cdf0e10cSrcweir const SystemEnvData* pSysData = ((SystemWindow *)pParentWin)->GetSystemData(); 180*cdf0e10cSrcweir if ( pSysData ) 181*cdf0e10cSrcweir { 182*cdf0e10cSrcweir KWindowSystem::setMainWindow( _dialog, pSysData->aWindow); // unx only 183*cdf0e10cSrcweir } 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir _dialog->clearFilter(); 187*cdf0e10cSrcweir _dialog->setFilter(_filter); 188*cdf0e10cSrcweir _dialog->filterWidget()->setEditable(false); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir //block and wait for user input 191*cdf0e10cSrcweir if (_dialog->exec() == KFileDialog::Accepted) 192*cdf0e10cSrcweir return ExecutableDialogResults::OK; 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir return ExecutableDialogResults::CANCEL; 195*cdf0e10cSrcweir } 196*cdf0e10cSrcweir 197*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setMultiSelectionMode( sal_Bool multiSelect ) 198*cdf0e10cSrcweir throw( uno::RuntimeException ) 199*cdf0e10cSrcweir { 200*cdf0e10cSrcweir if (multiSelect) 201*cdf0e10cSrcweir _dialog->setMode(KFile::Files | KFile::LocalOnly); 202*cdf0e10cSrcweir else 203*cdf0e10cSrcweir _dialog->setMode(KFile::File | KFile::LocalOnly); 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setDefaultName( const ::rtl::OUString &name ) 207*cdf0e10cSrcweir throw( uno::RuntimeException ) 208*cdf0e10cSrcweir { 209*cdf0e10cSrcweir const QString url = toQString(name); 210*cdf0e10cSrcweir _dialog->setSelection(url); 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setDisplayDirectory( const rtl::OUString &dir ) 214*cdf0e10cSrcweir throw( uno::RuntimeException ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir const QString url = toQString(dir); 217*cdf0e10cSrcweir _dialog->setUrl(KUrl(url)); 218*cdf0e10cSrcweir } 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir rtl::OUString SAL_CALL KDE4FilePicker::getDisplayDirectory() 221*cdf0e10cSrcweir throw( uno::RuntimeException ) 222*cdf0e10cSrcweir { 223*cdf0e10cSrcweir QString dir = _dialog->baseUrl().url(); 224*cdf0e10cSrcweir return toOUString(dir); 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles() 228*cdf0e10cSrcweir throw( uno::RuntimeException ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir QStringList rawFiles = _dialog->selectedFiles(); 231*cdf0e10cSrcweir QStringList files; 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir // check if we need to add an extension 234*cdf0e10cSrcweir QString extension = ""; 235*cdf0e10cSrcweir if ( _dialog->operationMode() == KFileDialog::Saving ) 236*cdf0e10cSrcweir { 237*cdf0e10cSrcweir QCheckBox *cb = dynamic_cast<QCheckBox*> ( 238*cdf0e10cSrcweir _customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]); 239*cdf0e10cSrcweir 240*cdf0e10cSrcweir if (cb && cb->isChecked()) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir extension = _dialog->currentFilter(); // assuming filter value is like this *.ext 243*cdf0e10cSrcweir extension.replace("*",""); 244*cdf0e10cSrcweir } 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir // Workaround for the double click selection KDE4 bug 248*cdf0e10cSrcweir // kde file picker returns the file and directories for selectedFiles() 249*cdf0e10cSrcweir // when a file is double clicked 250*cdf0e10cSrcweir // make a true list of files 251*cdf0e10cSrcweir const QString dir = KUrl(rawFiles[0]).directory(); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir bool singleFile = true; 254*cdf0e10cSrcweir if (rawFiles.size() > 1) 255*cdf0e10cSrcweir { 256*cdf0e10cSrcweir singleFile = false; 257*cdf0e10cSrcweir //for multi file sequences, oo expects the first param to be the directory 258*cdf0e10cSrcweir //can't treat all cases like multi file because in some instances (inserting image) 259*cdf0e10cSrcweir //oo WANTS only one entry in the final list 260*cdf0e10cSrcweir files.append(dir); 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir for (sal_uInt16 i = 0; i < rawFiles.size(); ++i) 264*cdf0e10cSrcweir { 265*cdf0e10cSrcweir // if the raw file is not the base directory (see above kde bug) 266*cdf0e10cSrcweir // we add the file to list of avail files 267*cdf0e10cSrcweir if ((dir + "/") != ( rawFiles[i])) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir QString filename = KUrl(rawFiles[i]).fileName(); 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir if (singleFile) 272*cdf0e10cSrcweir filename.prepend(dir + "/"); 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir //prevent extension append if we already have one 275*cdf0e10cSrcweir if (filename.endsWith(extension)) 276*cdf0e10cSrcweir files.append(filename); 277*cdf0e10cSrcweir else 278*cdf0e10cSrcweir files.append(filename + extension); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir // add all files and leading directory to outgoing OO sequence 283*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > seq(files.size()); 284*cdf0e10cSrcweir for (int i = 0; i < files.size(); ++i) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir rtl::OUString aFile(toOUString(files[i])), aURL; 287*cdf0e10cSrcweir osl_getFileURLFromSystemPath(aFile.pData, &aURL.pData ); 288*cdf0e10cSrcweir seq[i] = aURL; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir return seq; 292*cdf0e10cSrcweir } 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::appendFilter( const ::rtl::OUString &title, const ::rtl::OUString &filter ) 295*cdf0e10cSrcweir throw( lang::IllegalArgumentException, uno::RuntimeException ) 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir QString t = toQString(title); 298*cdf0e10cSrcweir QString f = toQString(filter); 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir if (!_filter.isNull()) 301*cdf0e10cSrcweir _filter.append("\n"); 302*cdf0e10cSrcweir 303*cdf0e10cSrcweir //add to hash map for reverse lookup in getCurrentFilter 304*cdf0e10cSrcweir _filters.insert(f, t); 305*cdf0e10cSrcweir 306*cdf0e10cSrcweir // '/' meed to be escaped to else they are assumed to be mime types by kfiledialog 307*cdf0e10cSrcweir //see the docs 308*cdf0e10cSrcweir t.replace("/", "\\/"); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir // openoffice gives us filters separated by ';' qt dialogs just want space separated 311*cdf0e10cSrcweir f.replace(";", " "); 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir _filter.append(QString("%1|%2").arg(f).arg(t)); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setCurrentFilter( const rtl::OUString &title ) 317*cdf0e10cSrcweir throw( lang::IllegalArgumentException, uno::RuntimeException ) 318*cdf0e10cSrcweir { 319*cdf0e10cSrcweir QString t = toQString(title); 320*cdf0e10cSrcweir t.replace("/", "\\/"); 321*cdf0e10cSrcweir _dialog->filterWidget()->setCurrentFilter(t); 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir rtl::OUString SAL_CALL KDE4FilePicker::getCurrentFilter() 325*cdf0e10cSrcweir throw( uno::RuntimeException ) 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir QString filter = _filters[_dialog->currentFilter()]; 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir //default if not found 330*cdf0e10cSrcweir if (filter.isNull()) 331*cdf0e10cSrcweir filter = "ODF Text Document (.odt)"; 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir return toOUString(filter); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::appendFilterGroup( const rtl::OUString& , const uno::Sequence<beans::StringPair>& filters) 337*cdf0e10cSrcweir throw( lang::IllegalArgumentException, uno::RuntimeException ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir if (!_filter.isNull()) 340*cdf0e10cSrcweir _filter.append(QString("\n")); 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir const sal_uInt16 length = filters.getLength(); 343*cdf0e10cSrcweir for (sal_uInt16 i = 0; i < length; ++i) 344*cdf0e10cSrcweir { 345*cdf0e10cSrcweir beans::StringPair aPair = filters[i]; 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir _filter.append(QString("%1|%2").arg( 348*cdf0e10cSrcweir toQString(aPair.Second).replace(";", " ")).arg( 349*cdf0e10cSrcweir toQString(aPair.First).replace("/","\\/"))); 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir if (i != length - 1) 352*cdf0e10cSrcweir _filter.append('\n'); 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setValue( sal_Int16 controlId, sal_Int16, const uno::Any &value ) 357*cdf0e10cSrcweir throw( uno::RuntimeException ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir QWidget* widget = _customWidgets[controlId]; 360*cdf0e10cSrcweir 361*cdf0e10cSrcweir if (widget) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir switch (controlId) 364*cdf0e10cSrcweir { 365*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 366*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 367*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 368*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 369*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 370*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 371*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 372*cdf0e10cSrcweir { 373*cdf0e10cSrcweir QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); 374*cdf0e10cSrcweir cb->setChecked(value.getValue()); 375*cdf0e10cSrcweir break; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 378*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 379*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 380*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 381*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 382*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 383*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 384*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 385*cdf0e10cSrcweir break; 386*cdf0e10cSrcweir } 387*cdf0e10cSrcweir } 388*cdf0e10cSrcweir } 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir uno::Any SAL_CALL KDE4FilePicker::getValue( sal_Int16 controlId, sal_Int16 ) 391*cdf0e10cSrcweir throw( uno::RuntimeException ) 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir uno::Any res(false); 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir QWidget* widget = _customWidgets[controlId]; 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir if (widget) 398*cdf0e10cSrcweir { 399*cdf0e10cSrcweir switch (controlId) 400*cdf0e10cSrcweir { 401*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 402*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 403*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 404*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 405*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 406*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 407*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); 410*cdf0e10cSrcweir res = uno::Any(cb->isChecked()); 411*cdf0e10cSrcweir break; 412*cdf0e10cSrcweir } 413*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 414*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 415*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 416*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 417*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 418*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 419*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 420*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 421*cdf0e10cSrcweir break; 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir } 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir return res; 426*cdf0e10cSrcweir } 427*cdf0e10cSrcweir 428*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::enableControl( sal_Int16 controlId, sal_Bool enable ) 429*cdf0e10cSrcweir throw( uno::RuntimeException ) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir QWidget* widget = _customWidgets[controlId]; 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir if (widget) 434*cdf0e10cSrcweir { 435*cdf0e10cSrcweir widget->setEnabled(enable); 436*cdf0e10cSrcweir } 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::setLabel( sal_Int16 controlId, const ::rtl::OUString &label ) 440*cdf0e10cSrcweir throw( uno::RuntimeException ) 441*cdf0e10cSrcweir { 442*cdf0e10cSrcweir QWidget* widget = _customWidgets[controlId]; 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if (widget) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir switch (controlId) 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 449*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 450*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 451*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 452*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 453*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 454*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); 457*cdf0e10cSrcweir cb->setText(toQString(label)); 458*cdf0e10cSrcweir break; 459*cdf0e10cSrcweir } 460*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 461*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 462*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 463*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 464*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 465*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 466*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 467*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 468*cdf0e10cSrcweir break; 469*cdf0e10cSrcweir } 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir } 472*cdf0e10cSrcweir 473*cdf0e10cSrcweir rtl::OUString SAL_CALL KDE4FilePicker::getLabel(sal_Int16 controlId) 474*cdf0e10cSrcweir throw ( uno::RuntimeException ) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir QWidget* widget = _customWidgets[controlId]; 477*cdf0e10cSrcweir QString label; 478*cdf0e10cSrcweir 479*cdf0e10cSrcweir if (widget) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir switch (controlId) 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 484*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 485*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 486*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 487*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 488*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 489*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 490*cdf0e10cSrcweir { 491*cdf0e10cSrcweir QCheckBox* cb = dynamic_cast<QCheckBox*>(widget); 492*cdf0e10cSrcweir label = cb->text(); 493*cdf0e10cSrcweir break; 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 496*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 497*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 498*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 499*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 500*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 501*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 502*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 503*cdf0e10cSrcweir break; 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir return toOUString(label); 507*cdf0e10cSrcweir } 508*cdf0e10cSrcweir 509*cdf0e10cSrcweir void KDE4FilePicker::addCustomControl(sal_Int16 controlId) 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir QWidget* widget = 0; 512*cdf0e10cSrcweir sal_Int32 resId = -1; 513*cdf0e10cSrcweir 514*cdf0e10cSrcweir switch (controlId) 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 517*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_AUTO_EXTENSION; 518*cdf0e10cSrcweir break; 519*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 520*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_PASSWORD; 521*cdf0e10cSrcweir break; 522*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 523*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_FILTER_OPTIONS; 524*cdf0e10cSrcweir break; 525*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 526*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_READONLY; 527*cdf0e10cSrcweir break; 528*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 529*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_INSERT_AS_LINK; 530*cdf0e10cSrcweir break; 531*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 532*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_SHOW_PREVIEW; 533*cdf0e10cSrcweir break; 534*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 535*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_SELECTION; 536*cdf0e10cSrcweir break; 537*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 538*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_PLAY; 539*cdf0e10cSrcweir break; 540*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 541*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_VERSION; 542*cdf0e10cSrcweir break; 543*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 544*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_TEMPLATES; 545*cdf0e10cSrcweir break; 546*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 547*cdf0e10cSrcweir resId = STR_SVT_FILEPICKER_IMAGE_TEMPLATE; 548*cdf0e10cSrcweir break; 549*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 550*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 551*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 552*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 553*cdf0e10cSrcweir break; 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir 556*cdf0e10cSrcweir switch (controlId) 557*cdf0e10cSrcweir { 558*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION: 559*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PASSWORD: 560*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS: 561*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_READONLY: 562*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_LINK: 563*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_PREVIEW: 564*cdf0e10cSrcweir case ExtendedFilePickerElementIds::CHECKBOX_SELECTION: 565*cdf0e10cSrcweir { 566*cdf0e10cSrcweir QString label; 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir if (_resMgr && resId != -1) 569*cdf0e10cSrcweir { 570*cdf0e10cSrcweir rtl::OUString s = String(ResId( resId, *_resMgr )); 571*cdf0e10cSrcweir label = toQString(s); 572*cdf0e10cSrcweir label.replace("~", "&"); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir widget = new QCheckBox(label, _extraControls); 576*cdf0e10cSrcweir 577*cdf0e10cSrcweir break; 578*cdf0e10cSrcweir } 579*cdf0e10cSrcweir case ExtendedFilePickerElementIds::PUSHBUTTON_PLAY: 580*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION: 581*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE: 582*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE: 583*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_VERSION_LABEL: 584*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_TEMPLATE_LABEL: 585*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE_LABEL: 586*cdf0e10cSrcweir case ExtendedFilePickerElementIds::LISTBOX_FILTER_SELECTOR: 587*cdf0e10cSrcweir break; 588*cdf0e10cSrcweir } 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir if (widget) 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir _layout->addWidget(widget); 593*cdf0e10cSrcweir _customWidgets.insert(controlId, widget); 594*cdf0e10cSrcweir } 595*cdf0e10cSrcweir } 596*cdf0e10cSrcweir 597*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args ) 598*cdf0e10cSrcweir throw( uno::Exception, uno::RuntimeException ) 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir _filter.clear(); 601*cdf0e10cSrcweir _filters.clear(); 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir // parameter checking 604*cdf0e10cSrcweir uno::Any arg; 605*cdf0e10cSrcweir if (args.getLength() == 0) 606*cdf0e10cSrcweir { 607*cdf0e10cSrcweir throw lang::IllegalArgumentException( 608*cdf0e10cSrcweir rtl::OUString::createFromAscii( "no arguments" ), 609*cdf0e10cSrcweir static_cast< XFilePicker* >( this ), 1 ); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir arg = args[0]; 613*cdf0e10cSrcweir 614*cdf0e10cSrcweir if (( arg.getValueType() != ::getCppuType((sal_Int16*)0)) && 615*cdf0e10cSrcweir ( arg.getValueType() != ::getCppuType((sal_Int8*)0))) 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir throw lang::IllegalArgumentException( 618*cdf0e10cSrcweir rtl::OUString::createFromAscii( "invalid argument type" ), 619*cdf0e10cSrcweir static_cast< XFilePicker* >( this ), 1 ); 620*cdf0e10cSrcweir } 621*cdf0e10cSrcweir 622*cdf0e10cSrcweir sal_Int16 templateId = -1; 623*cdf0e10cSrcweir arg >>= templateId; 624*cdf0e10cSrcweir 625*cdf0e10cSrcweir //default is opening 626*cdf0e10cSrcweir KFileDialog::OperationMode operationMode = KFileDialog::Opening; 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir switch ( templateId ) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir case FILEOPEN_SIMPLE: 631*cdf0e10cSrcweir break; 632*cdf0e10cSrcweir 633*cdf0e10cSrcweir case FILESAVE_SIMPLE: 634*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 635*cdf0e10cSrcweir break; 636*cdf0e10cSrcweir 637*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION: 638*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 639*cdf0e10cSrcweir //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); 640*cdf0e10cSrcweir break; 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_PASSWORD: 643*cdf0e10cSrcweir { 644*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 645*cdf0e10cSrcweir //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); 646*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); 647*cdf0e10cSrcweir break; 648*cdf0e10cSrcweir } 649*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS: 650*cdf0e10cSrcweir { 651*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 652*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); 653*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD ); 654*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS ); 655*cdf0e10cSrcweir break; 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_SELECTION: 658*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 659*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ); 660*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION ); 661*cdf0e10cSrcweir break; 662*cdf0e10cSrcweir 663*cdf0e10cSrcweir case FILESAVE_AUTOEXTENSION_TEMPLATE: 664*cdf0e10cSrcweir operationMode = KFileDialog::Saving; 665*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::LISTBOX_TEMPLATE ); 666*cdf0e10cSrcweir break; 667*cdf0e10cSrcweir 668*cdf0e10cSrcweir case FILEOPEN_LINK_PREVIEW_IMAGE_TEMPLATE: 669*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK ); 670*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); 671*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::LISTBOX_IMAGE_TEMPLATE ); 672*cdf0e10cSrcweir break; 673*cdf0e10cSrcweir 674*cdf0e10cSrcweir case FILEOPEN_PLAY: 675*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::PUSHBUTTON_PLAY ); 676*cdf0e10cSrcweir break; 677*cdf0e10cSrcweir 678*cdf0e10cSrcweir case FILEOPEN_READONLY_VERSION: 679*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_READONLY ); 680*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::LISTBOX_VERSION ); 681*cdf0e10cSrcweir break; 682*cdf0e10cSrcweir 683*cdf0e10cSrcweir case FILEOPEN_LINK_PREVIEW: 684*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_LINK ); 685*cdf0e10cSrcweir addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PREVIEW ); 686*cdf0e10cSrcweir break; 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir default: 689*cdf0e10cSrcweir throw lang::IllegalArgumentException( 690*cdf0e10cSrcweir rtl::OUString::createFromAscii( "Unknown template" ), 691*cdf0e10cSrcweir static_cast< XFilePicker* >( this ), 692*cdf0e10cSrcweir 1 ); 693*cdf0e10cSrcweir } 694*cdf0e10cSrcweir 695*cdf0e10cSrcweir _dialog->setOperationMode(operationMode); 696*cdf0e10cSrcweir _dialog->setConfirmOverwrite(true); 697*cdf0e10cSrcweir } 698*cdf0e10cSrcweir 699*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::cancel() 700*cdf0e10cSrcweir throw ( uno::RuntimeException ) 701*cdf0e10cSrcweir { 702*cdf0e10cSrcweir 703*cdf0e10cSrcweir } 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir void SAL_CALL KDE4FilePicker::disposing( const lang::EventObject &rEvent ) 706*cdf0e10cSrcweir throw( uno::RuntimeException ) 707*cdf0e10cSrcweir { 708*cdf0e10cSrcweir uno::Reference<XFilePickerListener> xFilePickerListener( rEvent.Source, uno::UNO_QUERY ); 709*cdf0e10cSrcweir 710*cdf0e10cSrcweir if ( xFilePickerListener.is() ) 711*cdf0e10cSrcweir { 712*cdf0e10cSrcweir removeFilePickerListener( xFilePickerListener ); 713*cdf0e10cSrcweir } 714*cdf0e10cSrcweir } 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir rtl::OUString SAL_CALL KDE4FilePicker::getImplementationName() 717*cdf0e10cSrcweir throw( uno::RuntimeException ) 718*cdf0e10cSrcweir { 719*cdf0e10cSrcweir return rtl::OUString::createFromAscii( FILE_PICKER_IMPL_NAME ); 720*cdf0e10cSrcweir } 721*cdf0e10cSrcweir 722*cdf0e10cSrcweir sal_Bool SAL_CALL KDE4FilePicker::supportsService( const rtl::OUString& ServiceName ) 723*cdf0e10cSrcweir throw( uno::RuntimeException ) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SupportedServicesNames = FilePicker_getSupportedServiceNames(); 726*cdf0e10cSrcweir 727*cdf0e10cSrcweir for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir if ( SupportedServicesNames[n].compareTo( ServiceName ) == 0 ) 730*cdf0e10cSrcweir return sal_True; 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir 733*cdf0e10cSrcweir return sal_False; 734*cdf0e10cSrcweir } 735*cdf0e10cSrcweir 736*cdf0e10cSrcweir uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getSupportedServiceNames() 737*cdf0e10cSrcweir throw( uno::RuntimeException ) 738*cdf0e10cSrcweir { 739*cdf0e10cSrcweir return FilePicker_getSupportedServiceNames(); 740*cdf0e10cSrcweir } 741