1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_fpicker.hxx" 30 31 //------------------------------------------------------------------------ 32 // includes 33 //------------------------------------------------------------------------ 34 #include "filepickerstate.hxx" 35 #include <osl/diagnose.h> 36 #include "controlaccess.hxx" 37 #include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> 38 #include <com/sun/star/ui/dialogs/CommonFilePickerElementIds.hpp> 39 #include <com/sun/star/ui/dialogs/ListBoxControlActions.hpp> 40 #include <com/sun/star/ui/dialogs/ControlActions.hpp> 41 #include "controlcommandrequest.hxx" 42 #include "controlcommandresult.hxx" 43 #include <com/sun/star/uno/Reference.hxx> 44 #include <com/sun/star/uno/XInterface.hpp> 45 #include <osl/file.hxx> 46 #include "FileOpenDlg.hxx" 47 48 #include <memory> 49 #include "..\misc\WinImplHelper.hxx" 50 //--------------------------------------------- 51 // 52 //--------------------------------------------- 53 54 using rtl::OUString; 55 using com::sun::star::uno::Any; 56 using com::sun::star::uno::Sequence; 57 using com::sun::star::uno::Reference; 58 using com::sun::star::uno::XInterface; 59 60 using namespace ::com::sun::star::ui::dialogs::ExtendedFilePickerElementIds; 61 using namespace ::com::sun::star::ui::dialogs::CommonFilePickerElementIds; 62 using namespace ::com::sun::star::ui::dialogs::ListboxControlActions; 63 64 //--------------------------------------------- 65 // 66 //--------------------------------------------- 67 68 const sal_Int32 MAX_LABEL = 256; 69 const sal_Int16 LISTBOX_LABEL_OFFSET = 100; 70 71 //--------------------------------------------- 72 // declaration 73 //--------------------------------------------- 74 75 CFilePickerState::~CFilePickerState( ) 76 { 77 } 78 79 //--------------------------------------------- 80 // 81 //--------------------------------------------- 82 83 CNonExecuteFilePickerState::CNonExecuteFilePickerState( ) : 84 m_FirstControlCommand( NULL ) 85 { 86 } 87 88 //--------------------------------------------- 89 // 90 //--------------------------------------------- 91 92 CNonExecuteFilePickerState::~CNonExecuteFilePickerState( ) 93 { 94 reset( ); 95 } 96 97 //--------------------------------------------- 98 // 99 //--------------------------------------------- 100 101 void SAL_CALL CNonExecuteFilePickerState::setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const Any& aValue ) 102 { 103 CValueControlCommand* value_command = new CValueControlCommand( 104 aControlId, aControlAction, aValue ); 105 106 addControlCommand( value_command ); 107 } 108 109 //--------------------------------------------- 110 // 111 //--------------------------------------------- 112 113 Any SAL_CALL CNonExecuteFilePickerState::getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) 114 { 115 CValueControlCommandRequest value_request( aControlId, aControlAction ); 116 Any aAny; 117 118 if (m_FirstControlCommand) 119 { 120 // pass the request along the command-chain 121 std::auto_ptr< CControlCommandResult > result( m_FirstControlCommand->handleRequest( &value_request ) ); 122 123 OSL_ENSURE( result.get(), "invalid getValue request" ); 124 125 if ( result.get() ) 126 { 127 // #101753 must remove assertion else running into deadlock 128 // because getValue may be called asynchronously from main thread 129 // with locked SOLAR_MUTEX but we also need SOLAR_MUTEX in 130 // WinFileOpenDialog::onInitDone ... but we cannot dismiss the 131 // assertion dialog because at this point the FileOpen Dialog 132 // has aleady the focus but is not yet visible :-( 133 // The real cure is to remove the VCL/SOLAR_MUTEX dependency 134 // cause by the use of our resource manager and not being able to 135 // generate native windows resources 136 //OSL_ENSURE( result->hasResult( ), "invalid getValue request" ); 137 138 if ( result->hasResult( ) ) 139 { 140 CValueCommandResult* value_result = dynamic_cast< CValueCommandResult* >( result.get( ) ); 141 OSL_ENSURE( value_result, "should have be a CValueCommandResult" ); 142 143 aAny = value_result->getValue( ); 144 OSL_ENSURE( aAny.hasValue( ), "empty any" ); 145 } 146 } 147 } 148 149 return aAny; 150 } 151 152 //--------------------------------------------- 153 // 154 //--------------------------------------------- 155 156 void SAL_CALL CNonExecuteFilePickerState::enableControl( sal_Int16 aControlId, sal_Bool bEnable ) 157 { 158 CEnableControlCommand* enable_command = new CEnableControlCommand( 159 aControlId, bEnable ); 160 161 addControlCommand( enable_command ); 162 } 163 164 //--------------------------------------------- 165 // 166 //--------------------------------------------- 167 168 void SAL_CALL CNonExecuteFilePickerState::setLabel( sal_Int16 aControlId, const ::rtl::OUString& aLabel ) 169 { 170 CLabelControlCommand* label_command = new CLabelControlCommand( 171 aControlId, aLabel ); 172 173 addControlCommand( label_command ); 174 } 175 176 //--------------------------------------------- 177 // 178 //--------------------------------------------- 179 180 OUString SAL_CALL CNonExecuteFilePickerState::getLabel( sal_Int16 aControlId ) 181 { 182 CControlCommandRequest label_request( aControlId ); 183 184 // pass the request along the command-chain 185 std::auto_ptr< CControlCommandResult > result( m_FirstControlCommand->handleRequest( &label_request ) ); 186 187 OSL_ENSURE( result->hasResult( ), "invalid getValue request" ); 188 189 OUString aLabel; 190 191 if ( result->hasResult( ) ) 192 { 193 CLabelCommandResult* label_result = dynamic_cast< CLabelCommandResult* >( result.get( ) ); 194 OSL_ENSURE( label_result, "should have be a CLabelCommandResult" ); 195 196 aLabel = label_result->getLabel( ); 197 } 198 199 return aLabel; 200 } 201 202 /* #i26224# 203 When typing file names with drive letter but without '\' 204 in the "File name" box of the FileOpen dialog the FileOpen 205 dialog makes strange paths out of them e.g. "d:.\test.sxw". 206 Such file names will not be accepted by sal so we fix these 207 somehow broken paths here. */ 208 OUString MatchFixBrokenPath(const OUString& path) 209 { 210 OSL_ASSERT(path.getLength() >= 4); 211 212 if (path[1] == ':' && path[2] == '.' && path[3] == '\\') 213 { 214 // skip the '.' 215 return OUString(path, 2) + path.copy(3, path.getLength() - 3); 216 } 217 return path; 218 } 219 220 //----------------------------------------------------------------------------------------- 221 // 222 //----------------------------------------------------------------------------------------- 223 static ::rtl::OUString trimTrailingSpaces(const ::rtl::OUString& rString) 224 { 225 rtl::OUString aResult(rString); 226 227 sal_Int32 nIndex = rString.lastIndexOf(' '); 228 if (nIndex == rString.getLength()-1) 229 { 230 while (nIndex >= 0 && rString[nIndex] == ' ') 231 nIndex--; 232 if (nIndex >= 0) 233 aResult = rString.copy(0,nIndex+1); 234 else 235 aResult = ::rtl::OUString(); 236 } 237 return aResult; 238 } 239 240 Sequence< OUString > SAL_CALL CNonExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog ) 241 { 242 OSL_PRECOND( aFileOpenDialog, "invalid parameter" ); 243 244 Sequence< OUString > aFilePathList; 245 OUString aFilePathURL; 246 OUString aFilePath; 247 ::osl::FileBase::RC rc; 248 249 aFilePath = aFileOpenDialog->getFullFileName( ); 250 251 if ( aFilePath.getLength( ) ) 252 { 253 // tokenize the returned string and copy the 254 // sub-strings separately into a sequence 255 const sal_Unicode* pTemp = aFilePath.getStr(); 256 const sal_Unicode* pStrEnd = pTemp + aFilePath.getLength(); 257 sal_uInt32 lSubStr; 258 259 while (pTemp < pStrEnd) 260 { 261 // detect the length of the next sub string 262 lSubStr = rtl_ustr_getLength(pTemp); 263 264 aFilePathList.realloc(aFilePathList.getLength() + 1); 265 266 aFilePathList[aFilePathList.getLength() - 1] = 267 MatchFixBrokenPath(OUString(pTemp, lSubStr)); 268 269 pTemp += (lSubStr + 1); 270 } 271 272 // change all entries to file URLs 273 sal_Int32 lenFileList = aFilePathList.getLength( ); 274 OSL_ASSERT( lenFileList >= 1 ); 275 276 for ( sal_Int32 i = 0; i < lenFileList; i++ ) 277 { 278 aFilePath = trimTrailingSpaces(aFilePathList[i]); 279 rc = ::osl::FileBase::getFileURLFromSystemPath( 280 aFilePath, aFilePathURL ); 281 282 // we do return all or nothing, that means 283 // in case of failures we destroy the sequence 284 // and return an empty sequence 285 if ( rc != ::osl::FileBase::E_None ) 286 { 287 aFilePathList.realloc( 0 ); 288 break; 289 } 290 291 aFilePathList[i] = aFilePathURL; 292 } 293 } 294 295 return aFilePathList; 296 } 297 298 //--------------------------------------------- 299 // 300 //--------------------------------------------- 301 302 OUString SAL_CALL CNonExecuteFilePickerState::getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) 303 { 304 OSL_PRECOND( aFileOpenDialog, "invalid parameter" ); 305 306 OUString pathURL; 307 OUString displayDir; 308 309 displayDir = aFileOpenDialog->getLastDisplayDirectory( ); 310 311 if ( displayDir.getLength( ) ) 312 ::osl::FileBase::getFileURLFromSystemPath( displayDir, pathURL ); 313 314 return pathURL; 315 } 316 317 //--------------------------------------------- 318 // 319 //--------------------------------------------- 320 321 void SAL_CALL CNonExecuteFilePickerState::reset( ) 322 { 323 CControlCommand* nextCommand; 324 CControlCommand* currentCommand = m_FirstControlCommand; 325 326 while( currentCommand ) 327 { 328 nextCommand = currentCommand->getNextCommand( ); 329 delete currentCommand; 330 currentCommand = nextCommand; 331 } 332 333 m_FirstControlCommand = NULL; 334 } 335 336 //--------------------------------------------- 337 // 338 //--------------------------------------------- 339 340 CControlCommand* SAL_CALL CNonExecuteFilePickerState::getControlCommand( ) const 341 { 342 return m_FirstControlCommand; 343 } 344 345 //--------------------------------------------- 346 // we append new control commands to the end 347 // of the list so that we are sure the commands 348 // will be executed as the client issued it 349 //--------------------------------------------- 350 351 void SAL_CALL CNonExecuteFilePickerState::addControlCommand( CControlCommand* aControlCommand ) 352 { 353 OSL_ASSERT( aControlCommand ); 354 355 if ( NULL == m_FirstControlCommand ) 356 { 357 m_FirstControlCommand = aControlCommand; 358 } 359 else 360 { 361 CControlCommand* pNextControlCommand = m_FirstControlCommand; 362 363 while ( pNextControlCommand->getNextCommand( ) != NULL ) 364 pNextControlCommand = pNextControlCommand->getNextCommand( ); 365 366 pNextControlCommand->setNextCommand( aControlCommand ); 367 } 368 } 369 370 //####################################################################### 371 372 //--------------------------------------------- 373 // 374 //--------------------------------------------- 375 376 CExecuteFilePickerState::CExecuteFilePickerState( HWND hwndDlg ) : 377 m_hwndDlg( hwndDlg ) 378 { 379 } 380 381 //--------------------------------------------- 382 // 383 //--------------------------------------------- 384 385 void SAL_CALL CExecuteFilePickerState::setValue( sal_Int16 aControlId, sal_Int16 aControlAction, const Any& aValue ) 386 { 387 // we do not support SET_HELP_URL/GET_HELP_URL 388 if ( com::sun::star::ui::dialogs::ControlActions::SET_HELP_URL == aControlAction ) 389 return; 390 391 HWND hwndCtrl = GetHwndDlgItem( aControlId ); 392 393 // the filter listbox can be manipulated via this 394 // method the caller should use XFilterManager 395 if ( !hwndCtrl || (aControlId == LISTBOX_FILTER) ) 396 { 397 OSL_ENSURE( sal_False, "invalid control id" ); 398 return; 399 } 400 401 CTRL_CLASS aCtrlClass = GetCtrlClass( hwndCtrl ); 402 if ( UNKNOWN == aCtrlClass ) 403 { 404 OSL_ENSURE( sal_False, "unsupported control class" ); 405 return; 406 } 407 408 CTRL_SETVALUE_FUNCTION_T lpfnSetValue = 409 GetCtrlSetValueFunction( aCtrlClass, aControlAction ); 410 411 if ( !lpfnSetValue ) 412 { 413 OSL_ENSURE( sal_False, "unsupported control action" ); 414 return; 415 } 416 417 // the function that we call should throw an IllegalArgumentException if 418 // the given value is invalid or empty, that's why we provide a Reference 419 // to an XInterface and a argument position 420 lpfnSetValue( hwndCtrl, aValue, Reference< XInterface >( ), 3 ); 421 } 422 423 //--------------------------------------------- 424 // 425 //--------------------------------------------- 426 427 Any SAL_CALL CExecuteFilePickerState::getValue( sal_Int16 aControlId, sal_Int16 aControlAction ) 428 { 429 // we do not support SET_HELP_URL/GET_HELP_URL 430 if ( com::sun::star::ui::dialogs::ControlActions::GET_HELP_URL == aControlAction ) 431 return Any( ); 432 433 HWND hwndCtrl = GetHwndDlgItem( aControlId ); 434 435 // the filter listbox can be manipulated via this 436 // method the caller should use XFilterManager 437 if ( !hwndCtrl || (aControlId == LISTBOX_FILTER) ) 438 { 439 OSL_ENSURE( sal_False, "invalid control id" ); 440 return Any( ); 441 } 442 443 CTRL_CLASS aCtrlClass = GetCtrlClass( hwndCtrl ); 444 if ( UNKNOWN == aCtrlClass ) 445 { 446 OSL_ENSURE( sal_False, "unsupported control class" ); 447 return Any( ); 448 } 449 450 CTRL_GETVALUE_FUNCTION_T lpfnGetValue = 451 GetCtrlGetValueFunction( aCtrlClass, aControlAction ); 452 453 if ( !lpfnGetValue ) 454 { 455 OSL_ENSURE( sal_False, "unsupported control action" ); 456 return Any( ); 457 } 458 459 return lpfnGetValue( hwndCtrl ); 460 } 461 462 //--------------------------------------------- 463 // 464 //--------------------------------------------- 465 466 void SAL_CALL CExecuteFilePickerState::enableControl( sal_Int16 aControlId, sal_Bool bEnable ) 467 { 468 HWND hwndCtrl = GetHwndDlgItem( aControlId ); 469 470 OSL_ENSURE( IsWindow( hwndCtrl ), "invalid element id"); 471 472 EnableWindow( hwndCtrl, bEnable ); 473 } 474 475 //--------------------------------------------- 476 // 477 //--------------------------------------------- 478 479 void SAL_CALL CExecuteFilePickerState::setLabel( sal_Int16 aControlId, const OUString& aLabel ) 480 { 481 HWND hwndCtrl = GetHwndDlgItem( aControlId ); 482 483 OSL_ENSURE( IsWindow( hwndCtrl ), "invalid element id"); 484 485 if ( IsListboxControl( hwndCtrl ) ) 486 hwndCtrl = GetListboxLabelItem( aControlId ); 487 488 OUString aWinLabel = SOfficeToWindowsLabel( aLabel ); 489 490 // somewhat risky because we don't know if OUString 491 // has a terminating '\0' 492 SetWindowText( hwndCtrl, reinterpret_cast<LPCTSTR>(aWinLabel.getStr( )) ); 493 } 494 495 //--------------------------------------------- 496 // 497 //--------------------------------------------- 498 499 OUString SAL_CALL CExecuteFilePickerState::getLabel( sal_Int16 aControlId ) 500 { 501 HWND hwndCtrl = GetHwndDlgItem( aControlId ); 502 503 OSL_ENSURE( IsWindow( hwndCtrl ), "invalid element id"); 504 505 if ( IsListboxControl( hwndCtrl ) ) 506 hwndCtrl = GetListboxLabelItem( aControlId ); 507 508 sal_Unicode aLabel[MAX_LABEL]; 509 int nRet = GetWindowText( hwndCtrl, reinterpret_cast<LPTSTR>(aLabel), MAX_LABEL ); 510 511 OUString ctrlLabel; 512 if ( nRet ) 513 { 514 ctrlLabel = OUString( aLabel, rtl_ustr_getLength( aLabel ) ); 515 ctrlLabel = WindowsToSOfficeLabel( aLabel ); 516 } 517 518 return ctrlLabel; 519 } 520 521 //--------------------------------------------- 522 // 523 //--------------------------------------------- 524 525 Sequence< OUString > SAL_CALL CExecuteFilePickerState::getFiles( CFileOpenDialog* aFileOpenDialog ) 526 { 527 OSL_POSTCOND( aFileOpenDialog, "invalid parameter" ); 528 529 Sequence< OUString > aFilePathList; 530 OUString aFilePathURL; 531 OUString aFilePath; 532 ::osl::FileBase::RC rc; 533 534 // in execution mode getFullFileName doesn't 535 // return anything, so we must use another way 536 537 // returns the currently selected file(s) 538 // including path information 539 aFilePath = aFileOpenDialog->getCurrentFilePath( ); 540 541 // if multiple files are selected or the user 542 // typed anything that doesn't seem to be a valid 543 // file name getFileURLFromSystemPath fails 544 // and we return an empty file list 545 rc = ::osl::FileBase::getFileURLFromSystemPath( 546 aFilePath, aFilePathURL ); 547 548 if ( ::osl::FileBase::E_None == rc ) 549 { 550 aFilePathList.realloc( 1 ); 551 aFilePathList[0] = aFilePathURL; 552 } 553 554 return aFilePathList; 555 } 556 557 //--------------------------------------------- 558 // 559 //--------------------------------------------- 560 561 OUString SAL_CALL CExecuteFilePickerState::getDisplayDirectory( CFileOpenDialog* aFileOpenDialog ) 562 { 563 OSL_POSTCOND( aFileOpenDialog, "invalid parameter" ); 564 565 OUString pathURL; 566 OUString displayDir; 567 568 displayDir = aFileOpenDialog->getCurrentFolderPath( ); 569 570 if ( displayDir.getLength( ) ) 571 ::osl::FileBase::getFileURLFromSystemPath( displayDir, pathURL ); 572 573 return pathURL; 574 } 575 576 //--------------------------------------------- 577 // 578 //--------------------------------------------- 579 580 void SAL_CALL CExecuteFilePickerState::initFilePickerControls( CControlCommand* firstControlCommand ) 581 { 582 CControlCommand* aControlCommand = firstControlCommand; 583 584 while ( aControlCommand ) 585 { 586 aControlCommand->exec( this ); 587 aControlCommand = aControlCommand->getNextCommand( ); 588 } 589 } 590 591 //--------------------------------------------- 592 // 593 //--------------------------------------------- 594 595 void SAL_CALL CExecuteFilePickerState::cacheControlState( HWND hwndControl, CFilePickerState* aNonExecFilePickerState ) 596 { 597 OSL_ENSURE( hwndControl && aNonExecFilePickerState, "invalid parameters" ); 598 599 CTRL_CLASS aCtrlClass = GetCtrlClass( hwndControl ); 600 601 sal_Int16 aControlAction; 602 CTRL_GETVALUE_FUNCTION_T lpfnGetValue; 603 604 if ( CHECKBOX == aCtrlClass ) 605 { 606 aControlAction = 0; 607 608 lpfnGetValue = GetCtrlGetValueFunction( aCtrlClass, aControlAction ); 609 610 OSL_ASSERT( lpfnGetValue ); 611 612 aNonExecFilePickerState->setValue( 613 sal::static_int_cast< sal_Int16 >( GetDlgCtrlID( hwndControl ) ), 614 aControlAction, 615 lpfnGetValue( hwndControl ) ); 616 617 aNonExecFilePickerState->setLabel( 618 sal::static_int_cast< sal_Int16 >( GetDlgCtrlID( hwndControl ) ), 619 getLabel( 620 sal::static_int_cast< sal_Int16 >( 621 GetDlgCtrlID( hwndControl ) ) ) ); 622 } 623 else if ( LISTBOX == aCtrlClass ) 624 { 625 // for listboxes we save only the 626 // last selected item and the last 627 // selected item index 628 629 aControlAction = GET_SELECTED_ITEM; 630 631 lpfnGetValue = GetCtrlGetValueFunction( aCtrlClass, aControlAction ); 632 633 aNonExecFilePickerState->setValue( 634 sal::static_int_cast< sal_Int16 >( GetDlgCtrlID( hwndControl ) ), 635 aControlAction, 636 lpfnGetValue( hwndControl ) ); 637 638 aControlAction = ::com::sun::star::ui::dialogs::ControlActions::GET_SELECTED_ITEM_INDEX; 639 640 lpfnGetValue = GetCtrlGetValueFunction( aCtrlClass, aControlAction ); 641 642 aNonExecFilePickerState->setValue( 643 sal::static_int_cast< sal_Int16 >( GetDlgCtrlID( hwndControl ) ), 644 aControlAction, 645 lpfnGetValue( hwndControl ) ); 646 } 647 } 648 649 //--------------------------------------------- 650 // 651 //--------------------------------------------- 652 653 void SAL_CALL CExecuteFilePickerState::setHwnd( HWND hwndDlg ) 654 { 655 m_hwndDlg = hwndDlg; 656 } 657 658 //--------------------------------------------- 659 // 660 //--------------------------------------------- 661 662 inline sal_Bool SAL_CALL CExecuteFilePickerState::IsListboxControl( HWND hwndControl ) const 663 { 664 OSL_PRECOND( IsWindow( hwndControl ), "invalid parameter" ); 665 666 CTRL_CLASS aCtrlClass = GetCtrlClass( hwndControl ); 667 return ( LISTBOX == aCtrlClass ); 668 } 669 670 //--------------------------------------------- 671 // because listboxes (comboboxes) and their labels 672 // are seperated we have to translate the listbox 673 // id to their corresponding label id 674 // the convention is that the label id of a listbox 675 // is the id of the listbox + 100 676 //--------------------------------------------- 677 678 inline sal_Int16 SAL_CALL CExecuteFilePickerState::ListboxIdToListboxLabelId( sal_Int16 aListboxId ) const 679 { 680 return ( aListboxId + LISTBOX_LABEL_OFFSET ); 681 } 682 683 //--------------------------------------------- 684 // 685 //--------------------------------------------- 686 687 inline HWND SAL_CALL CExecuteFilePickerState::GetListboxLabelItem( sal_Int16 aControlId ) const 688 { 689 sal_Int16 aLabelId = ListboxIdToListboxLabelId( aControlId ); 690 HWND hwndCtrl = GetHwndDlgItem( aLabelId ); 691 692 OSL_ASSERT( IsWindow( hwndCtrl ) ); 693 694 return hwndCtrl; 695 } 696 697 //--------------------------------------------- 698 // 699 //--------------------------------------------- 700 701 HWND SAL_CALL CExecuteFilePickerState::GetHwndDlgItem( sal_Int16 aControlId, sal_Bool bIncludeStdCtrls ) const 702 { 703 OSL_ENSURE( IsWindow( m_hwndDlg ), "no valid parent window set before" ); 704 705 HWND hwndCtrl = GetDlgItem( m_hwndDlg, aControlId ); 706 707 // maybe it's a control of the dialog itself for instance 708 // the ok and cancel button 709 if ( !hwndCtrl && bIncludeStdCtrls ) 710 { 711 hwndCtrl = GetDlgItem( 712 GetParent( m_hwndDlg ), 713 CommonFilePickerCtrlIdToWinFileOpenCtrlId( aControlId ) ); 714 } 715 716 return hwndCtrl; 717 } 718