1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_svx.hxx" 26 27 #ifndef _SVX_FMRESIDS_HRC 28 #include "svx/fmresids.hrc" 29 #endif 30 #ifndef _SVX_FMEXPL_HRC 31 #include "fmexpl.hrc" 32 #endif 33 #include "fmexpl.hxx" 34 35 #ifndef _SVX_FMHELP_HRC 36 #include "fmhelp.hrc" 37 #endif 38 #include <svx/fmglob.hxx> 39 #include "fmservs.hxx" 40 #include <svx/fmmodel.hxx> 41 #include "fmexch.hxx" 42 #include "fmundo.hxx" 43 #include "fmpgeimp.hxx" 44 45 #ifndef _SVX_SVXIDS_HRC 46 #include <svx/svxids.hrc> 47 #endif 48 49 #ifndef _SVX_FMPROP_HRC 50 #include "fmprop.hrc" 51 #endif 52 #include <svx/dialmgr.hxx> 53 #include "svx/svditer.hxx" 54 #include <svx/svdouno.hxx> 55 #include <fmundo.hxx> 56 #include <svx/svdobj.hxx> 57 #include <vcl/msgbox.hxx> 58 #include <sfx2/dispatch.hxx> 59 #include <sfx2/objsh.hxx> 60 #include <sfx2/viewsh.hxx> 61 #include <sfx2/viewfrm.hxx> 62 #include <com/sun/star/lang/XServiceInfo.hpp> 63 #include <com/sun/star/form/FormComponentType.hpp> 64 #include <com/sun/star/awt/XTabControllerModel.hpp> 65 #include <vcl/menu.hxx> 66 #include <sfx2/objitem.hxx> 67 #include <sfx2/request.hxx> 68 #include <tools/shl.hxx> 69 70 #ifndef _WRKWIN_HXX //autogen 71 #include <vcl/wrkwin.hxx> 72 #endif 73 #include <vcl/sound.hxx> 74 #include <svx/fmshell.hxx> 75 #include "fmshimp.hxx" 76 #include <svx/fmpage.hxx> 77 #include <com/sun/star/io/XPersistObject.hpp> 78 #include <com/sun/star/script/XEventAttacherManager.hpp> 79 #include <com/sun/star/sdb/CommandType.hpp> 80 #include <com/sun/star/beans/PropertyAttribute.hpp> 81 #include <comphelper/property.hxx> 82 #include <comphelper/processfactory.hxx> 83 #include <osl/diagnose.h> 84 #include <rtl/logfile.hxx> 85 86 using namespace ::svxform; 87 using namespace ::com::sun::star::uno; 88 using namespace ::com::sun::star::sdbc; 89 using namespace ::com::sun::star::sdb; 90 using namespace ::com::sun::star::form; 91 using namespace ::com::sun::star::beans; 92 using namespace ::com::sun::star::lang; 93 using namespace ::com::sun::star::container; 94 95 //======================================================================== 96 97 SV_IMPL_PTRARR_SORT( FmEntryDataArray, FmEntryDataPtr ) 98 SV_IMPL_PTRARR_SORT( SvLBoxEntrySortedArray, SvLBoxEntryPtr ) 99 100 //======================================================================== 101 // class FmNavInsertedHint 102 //======================================================================== 103 TYPEINIT1( FmNavInsertedHint, SfxHint ); 104 DBG_NAME(FmNavInsertedHint); 105 //------------------------------------------------------------------------ 106 FmNavInsertedHint::FmNavInsertedHint( FmEntryData* pInsertedEntryData, sal_uInt32 nRelPos ) 107 :pEntryData( pInsertedEntryData ) 108 ,nPos( nRelPos ) 109 110 { 111 DBG_CTOR(FmNavInsertedHint,NULL); 112 } 113 114 //------------------------------------------------------------------------ 115 FmNavInsertedHint::~FmNavInsertedHint() 116 { 117 DBG_DTOR(FmNavInsertedHint,NULL); 118 } 119 120 121 //======================================================================== 122 // class FmNavInsertedHint 123 //======================================================================== 124 TYPEINIT1( FmNavModelReplacedHint, SfxHint ); 125 DBG_NAME(FmNavModelReplacedHint); 126 //------------------------------------------------------------------------ 127 FmNavModelReplacedHint::FmNavModelReplacedHint( FmEntryData* pAffectedEntryData ) 128 :pEntryData( pAffectedEntryData ) 129 { 130 DBG_CTOR(FmNavModelReplacedHint,NULL); 131 } 132 133 //------------------------------------------------------------------------ 134 FmNavModelReplacedHint::~FmNavModelReplacedHint() 135 { 136 DBG_DTOR(FmNavModelReplacedHint,NULL); 137 } 138 139 //======================================================================== 140 // class FmNavRemovedHint 141 //======================================================================== 142 TYPEINIT1( FmNavRemovedHint, SfxHint ); 143 DBG_NAME(FmNavRemovedHint); 144 //------------------------------------------------------------------------ 145 FmNavRemovedHint::FmNavRemovedHint( FmEntryData* pRemovedEntryData ) 146 :pEntryData( pRemovedEntryData ) 147 { 148 DBG_CTOR(FmNavRemovedHint,NULL); 149 } 150 151 //------------------------------------------------------------------------ 152 FmNavRemovedHint::~FmNavRemovedHint() 153 { 154 DBG_DTOR(FmNavRemovedHint,NULL); 155 } 156 157 158 //======================================================================== 159 // class FmNavNameChangedHint 160 //======================================================================== 161 TYPEINIT1( FmNavNameChangedHint, SfxHint ); 162 DBG_NAME(FmNavNameChangedHint); 163 //------------------------------------------------------------------------ 164 FmNavNameChangedHint::FmNavNameChangedHint( FmEntryData* pData, const ::rtl::OUString& rNewName ) 165 :pEntryData( pData ) 166 ,aNewName( rNewName ) 167 { 168 DBG_CTOR(FmNavNameChangedHint,NULL); 169 } 170 171 //------------------------------------------------------------------------ 172 FmNavNameChangedHint::~FmNavNameChangedHint() 173 { 174 DBG_DTOR(FmNavNameChangedHint,NULL); 175 } 176 177 //======================================================================== 178 // class FmNavClearedHint 179 //======================================================================== 180 TYPEINIT1( FmNavClearedHint, SfxHint ); 181 DBG_NAME(FmNavClearedHint); 182 //------------------------------------------------------------------------ 183 FmNavClearedHint::FmNavClearedHint() 184 { 185 DBG_CTOR(FmNavClearedHint,NULL); 186 } 187 188 //------------------------------------------------------------------------ 189 FmNavClearedHint::~FmNavClearedHint() 190 { 191 DBG_DTOR(FmNavClearedHint,NULL); 192 } 193 194 //======================================================================== 195 // class FmNavRequestSelectHint 196 //======================================================================== 197 TYPEINIT1(FmNavRequestSelectHint, SfxHint); 198 199 //======================================================================== 200 // class FmNavViewMarksChanged 201 //======================================================================== 202 TYPEINIT1(FmNavViewMarksChanged, SfxHint); 203 204 //======================================================================== 205 // class FmEntryDataList 206 //======================================================================== 207 DBG_NAME(FmEntryDataList); 208 //------------------------------------------------------------------------ 209 FmEntryDataList::FmEntryDataList() 210 { 211 DBG_CTOR(FmEntryDataList,NULL); 212 } 213 214 //------------------------------------------------------------------------ 215 FmEntryDataList::~FmEntryDataList() 216 { 217 DBG_DTOR(FmEntryDataList,NULL); 218 } 219 220 221 //======================================================================== 222 // class FmEntryData 223 //======================================================================== 224 TYPEINIT0( FmEntryData ); 225 DBG_NAME(FmEntryData); 226 //------------------------------------------------------------------------ 227 FmEntryData::FmEntryData( FmEntryData* pParentData, const Reference< XInterface >& _rxIFace ) 228 :pParent( pParentData ) 229 { 230 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" ); 231 DBG_CTOR(FmEntryData,NULL); 232 pChildList = new FmEntryDataList(); 233 234 newObject( _rxIFace ); 235 } 236 237 //------------------------------------------------------------------------ 238 FmEntryData::~FmEntryData() 239 { 240 Clear(); 241 delete pChildList; 242 DBG_DTOR(FmEntryData,NULL); 243 } 244 245 //------------------------------------------------------------------------ 246 void FmEntryData::newObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) 247 { 248 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::newObject" ); 249 // do not just copy, normalize it 250 m_xNormalizedIFace = Reference< XInterface >( _rxIFace, UNO_QUERY ); 251 m_xProperties = m_xProperties.query( m_xNormalizedIFace ); 252 m_xChild = m_xChild.query( m_xNormalizedIFace ); 253 } 254 255 //------------------------------------------------------------------------ 256 FmEntryData::FmEntryData( const FmEntryData& rEntryData ) 257 { 258 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::FmEntryData" ); 259 pChildList = new FmEntryDataList(); 260 aText = rEntryData.GetText(); 261 m_aNormalImage = rEntryData.GetNormalImage(); 262 m_aHCImage = rEntryData.GetHCImage(); 263 pParent = rEntryData.GetParent(); 264 265 FmEntryData* pChildData; 266 sal_uInt32 nEntryCount = rEntryData.GetChildList()->Count(); 267 for( sal_uInt32 i=0; i<nEntryCount; i++ ) 268 { 269 pChildData = rEntryData.GetChildList()->GetObject(i); 270 FmEntryData* pNewChildData = pChildData->Clone(); 271 pChildList->Insert( pNewChildData, LIST_APPEND ); 272 } 273 274 m_xNormalizedIFace = rEntryData.m_xNormalizedIFace; 275 m_xProperties = rEntryData.m_xProperties; 276 m_xChild = rEntryData.m_xChild; 277 } 278 279 //------------------------------------------------------------------------ 280 void FmEntryData::Clear() 281 { 282 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::Clear" ); 283 for (;;) 284 { 285 FmEntryData* pEntryData = GetChildList()->Remove(sal_uLong(0)); 286 if (pEntryData == NULL) 287 break; 288 delete pEntryData; 289 } 290 } 291 292 //------------------------------------------------------------------------ 293 sal_Bool FmEntryData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 294 { 295 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmEntryData::IsEqualWithoutChilds" ); 296 if(this == pEntryData) 297 return sal_True; 298 299 if( !pEntryData ) 300 return sal_False; 301 302 if( !aText.equals(pEntryData->GetText())) 303 return sal_False; 304 305 if( !pEntryData->GetParent() && pParent ) 306 return sal_False; 307 308 if( pEntryData->GetParent() && !pParent ) 309 return sal_False; 310 311 if( !pEntryData->GetParent() && !pParent ) 312 return sal_True; 313 314 if( !pParent->IsEqualWithoutChilds(pEntryData->GetParent()) ) 315 return sal_False; 316 317 return sal_True; 318 } 319 320 321 //======================================================================== 322 // class FmFormData 323 //======================================================================== 324 TYPEINIT1( FmFormData, FmEntryData ); 325 DBG_NAME(FmFormData); 326 //------------------------------------------------------------------------ 327 FmFormData::FmFormData( const Reference< XForm >& _rxForm, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent ) 328 :FmEntryData( _pParent, _rxForm ) 329 ,m_xForm( _rxForm ) 330 { 331 DBG_CTOR(FmEntryData,NULL); 332 ////////////////////////////////////////////////////////////////////// 333 // Images setzen 334 335 m_aNormalImage = _rNormalImages.GetImage( RID_SVXIMG_FORM ); 336 m_aHCImage = _rHCImages.GetImage( RID_SVXIMG_FORM ); 337 338 ////////////////////////////////////////////////////////////////////// 339 // Titel setzen 340 if (m_xForm.is()) 341 { 342 Reference< XPropertySet > xSet(m_xForm, UNO_QUERY); 343 if (xSet.is()) 344 { 345 ::rtl::OUString aEntryName(::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ))); 346 SetText(aEntryName); 347 } 348 } 349 else 350 SetText( ::rtl::OUString() ); 351 } 352 353 //------------------------------------------------------------------------ 354 FmFormData::~FmFormData() 355 { 356 DBG_DTOR(FmEntryData,NULL); 357 } 358 359 //------------------------------------------------------------------------ 360 FmFormData::FmFormData( const FmFormData& rFormData ) 361 :FmEntryData( rFormData ) 362 { 363 DBG_CTOR(FmEntryData,NULL); 364 m_xForm = rFormData.GetFormIface(); 365 } 366 367 //------------------------------------------------------------------------ 368 FmEntryData* FmFormData::Clone() 369 { 370 return new FmFormData( *this ); 371 } 372 373 //------------------------------------------------------------------------ 374 sal_Bool FmFormData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 375 { 376 if(this == pEntryData) 377 return sal_True; 378 if( !pEntryData->ISA(FmFormData) ) 379 return sal_False; 380 FmFormData* pFormData = (FmFormData*)pEntryData; 381 if( (XForm*)m_xForm.get() != (XForm*)pFormData->GetFormIface().get() ) 382 return sal_False; 383 384 return FmEntryData::IsEqualWithoutChilds( pFormData ); 385 } 386 387 388 //======================================================================== 389 // class FmControlData 390 //======================================================================== 391 TYPEINIT1( FmControlData, FmEntryData ); 392 DBG_NAME(FmControlData); 393 //------------------------------------------------------------------------ 394 FmControlData::FmControlData( const Reference< XFormComponent >& _rxComponent, const ImageList& _rNormalImages, const ImageList& _rHCImages, FmFormData* _pParent ) 395 :FmEntryData( _pParent, _rxComponent ) 396 ,m_xFormComponent( _rxComponent ) 397 { 398 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" ); 399 DBG_CTOR(FmControlData,NULL); 400 ////////////////////////////////////////////////////////////////////// 401 // Images setzen 402 m_aNormalImage = GetImage( _rNormalImages ); 403 m_aHCImage = GetImage( _rHCImages ); 404 405 ////////////////////////////////////////////////////////////////////// 406 // Titel setzen 407 Reference< XPropertySet > xSet(m_xFormComponent, UNO_QUERY); 408 if( xSet.is() ) 409 { 410 #ifdef DBG_UTIL 411 ::rtl::OUString aEntryName = ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME )); 412 #endif 413 SetText( ::comphelper::getString(xSet->getPropertyValue( FM_PROP_NAME ))); 414 } 415 } 416 417 //------------------------------------------------------------------------ 418 FmControlData::~FmControlData() 419 { 420 DBG_DTOR(FmControlData,NULL); 421 } 422 423 //------------------------------------------------------------------------ 424 FmControlData::FmControlData( const FmControlData& rControlData ) 425 :FmEntryData( rControlData ) 426 { 427 DBG_CTOR(FmControlData,NULL); 428 m_xFormComponent = rControlData.GetFormComponent(); 429 } 430 431 //------------------------------------------------------------------------ 432 FmEntryData* FmControlData::Clone() 433 { 434 return new FmControlData( *this ); 435 } 436 437 //------------------------------------------------------------------------ 438 Image FmControlData::GetImage(const ImageList& ilNavigatorImages) const 439 { 440 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::FmControlData" ); 441 ////////////////////////////////////////////////////////////////////// 442 // Default-Image 443 Image aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CONTROL ); 444 445 Reference< XServiceInfo > xInfo( m_xFormComponent, UNO_QUERY ); 446 if (!m_xFormComponent.is()) 447 return aImage; 448 449 ////////////////////////////////////////////////////////////////////// 450 // Spezielle Control-Images 451 sal_Int16 nObjectType = getControlTypeByObject(xInfo); 452 switch (nObjectType) 453 { 454 case OBJ_FM_BUTTON: 455 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_BUTTON ); 456 break; 457 458 case OBJ_FM_FIXEDTEXT: 459 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FIXEDTEXT ); 460 break; 461 462 case OBJ_FM_EDIT: 463 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_EDIT ); 464 break; 465 466 case OBJ_FM_RADIOBUTTON: 467 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_RADIOBUTTON ); 468 break; 469 470 case OBJ_FM_CHECKBOX: 471 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CHECKBOX ); 472 break; 473 474 case OBJ_FM_LISTBOX: 475 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_LISTBOX ); 476 break; 477 478 case OBJ_FM_COMBOBOX: 479 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_COMBOBOX ); 480 break; 481 482 case OBJ_FM_NAVIGATIONBAR: 483 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NAVIGATIONBAR ); 484 break; 485 486 case OBJ_FM_GROUPBOX: 487 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GROUPBOX ); 488 break; 489 490 case OBJ_FM_IMAGEBUTTON: 491 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGEBUTTON ); 492 break; 493 494 case OBJ_FM_FILECONTROL: 495 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FILECONTROL ); 496 break; 497 498 case OBJ_FM_HIDDEN: 499 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_HIDDEN ); 500 break; 501 502 case OBJ_FM_DATEFIELD: 503 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_DATEFIELD ); 504 break; 505 506 case OBJ_FM_TIMEFIELD: 507 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_TIMEFIELD ); 508 break; 509 510 case OBJ_FM_NUMERICFIELD: 511 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_NUMERICFIELD ); 512 break; 513 514 case OBJ_FM_CURRENCYFIELD: 515 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_CURRENCYFIELD ); 516 break; 517 518 case OBJ_FM_PATTERNFIELD: 519 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_PATTERNFIELD ); 520 break; 521 522 case OBJ_FM_IMAGECONTROL: 523 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_IMAGECONTROL ); 524 break; 525 526 case OBJ_FM_FORMATTEDFIELD: 527 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_FORMATTEDFIELD ); 528 break; 529 530 case OBJ_FM_GRID: 531 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_GRID ); 532 break; 533 534 case OBJ_FM_SCROLLBAR: 535 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SCROLLBAR ); 536 break; 537 538 case OBJ_FM_SPINBUTTON: 539 aImage = ilNavigatorImages.GetImage( RID_SVXIMG_SPINBUTTON); 540 break; 541 } 542 543 return aImage; 544 } 545 546 //------------------------------------------------------------------------ 547 sal_Bool FmControlData::IsEqualWithoutChilds( FmEntryData* pEntryData ) 548 { 549 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::IsEqualWithoutChilds" ); 550 if(this == pEntryData) 551 return sal_True; 552 553 if( !pEntryData->ISA(FmControlData) ) 554 return sal_False; 555 FmControlData* pControlData = (FmControlData*)pEntryData; 556 557 if( (XFormComponent*)m_xFormComponent.get() != (XFormComponent*)pControlData->GetFormComponent().get() ) 558 return sal_False; 559 560 return FmEntryData::IsEqualWithoutChilds( pControlData ); 561 } 562 563 //------------------------------------------------------------------------ 564 void FmControlData::ModelReplaced( const Reference< XFormComponent >& _rxNew, const ImageList& _rNormalImages, const ImageList& _rHCImages ) 565 { 566 RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "svx", "Ocke.Janssen@sun.com", "FmControlData::ModelReplaced" ); 567 m_xFormComponent = _rxNew; 568 newObject( m_xFormComponent ); 569 570 // Images neu setzen 571 m_aNormalImage = GetImage( _rNormalImages ); 572 m_aHCImage = GetImage( _rHCImages ); 573 } 574 575 //............................................................................ 576 namespace svxform 577 { 578 //............................................................................ 579 580 //======================================================================== 581 // class NavigatorFrame 582 //======================================================================== 583 DBG_NAME(NavigatorFrame) 584 //------------------------------------------------------------------------ 585 NavigatorFrame::NavigatorFrame( SfxBindings* _pBindings, SfxChildWindow* _pMgr, 586 Window* _pParent ) 587 :SfxDockingWindow( _pBindings, _pMgr, _pParent, WinBits(WB_STDMODELESS|WB_SIZEABLE|WB_ROLLABLE|WB_3DLOOK|WB_DOCKABLE) ) 588 ,SfxControllerItem( SID_FM_FMEXPLORER_CONTROL, *_pBindings ) 589 { 590 DBG_CTOR(NavigatorFrame,NULL); 591 SetHelpId( HID_FORM_NAVIGATOR_WIN ); 592 593 m_pNavigatorTree = new NavigatorTree(comphelper::getProcessServiceFactory(), this ); 594 m_pNavigatorTree->Show(); 595 SetText( SVX_RES(RID_STR_FMEXPLORER) ); 596 SfxDockingWindow::SetFloatingSize( Size(200,200) ); 597 } 598 599 //------------------------------------------------------------------------ 600 NavigatorFrame::~NavigatorFrame() 601 { 602 delete m_pNavigatorTree; 603 DBG_DTOR(NavigatorFrame,NULL); 604 } 605 606 //----------------------------------------------------------------------- 607 void NavigatorFrame::UpdateContent( FmFormShell* pFormShell ) 608 { 609 m_pNavigatorTree->UpdateContent( pFormShell ); 610 } 611 612 //----------------------------------------------------------------------- 613 void NavigatorFrame::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState ) 614 { 615 if( !pState || SID_FM_FMEXPLORER_CONTROL != nSID ) 616 return; 617 618 if( eState >= SFX_ITEM_AVAILABLE ) 619 { 620 FmFormShell* pShell = PTR_CAST( FmFormShell,((SfxObjectItem*)pState)->GetShell() ); 621 UpdateContent( pShell ); 622 } 623 else 624 UpdateContent( NULL ); 625 } 626 627 //----------------------------------------------------------------------- 628 void NavigatorFrame::GetFocus() 629 { 630 if ( m_pNavigatorTree ) 631 m_pNavigatorTree->GrabFocus(); 632 else 633 SfxDockingWindow::GetFocus(); 634 } 635 636 //----------------------------------------------------------------------- 637 sal_Bool NavigatorFrame::Close() 638 { 639 UpdateContent( NULL ); 640 return SfxDockingWindow::Close(); 641 } 642 643 //----------------------------------------------------------------------- 644 void NavigatorFrame::FillInfo( SfxChildWinInfo& rInfo ) const 645 { 646 SfxDockingWindow::FillInfo( rInfo ); 647 rInfo.bVisible = sal_False; 648 } 649 650 //----------------------------------------------------------------------- 651 Size NavigatorFrame::CalcDockingSize( SfxChildAlignment eAlign ) 652 { 653 if ( ( eAlign == SFX_ALIGN_TOP ) || ( eAlign == SFX_ALIGN_BOTTOM ) ) 654 return Size(); 655 656 return SfxDockingWindow::CalcDockingSize( eAlign ); 657 } 658 659 //----------------------------------------------------------------------- 660 SfxChildAlignment NavigatorFrame::CheckAlignment( SfxChildAlignment _eActAlign, SfxChildAlignment _eAlign ) 661 { 662 if ( ( _eAlign == SFX_ALIGN_LEFT ) || ( _eAlign == SFX_ALIGN_RIGHT ) || ( _eAlign == SFX_ALIGN_NOALIGNMENT ) ) 663 return _eAlign; 664 return _eActAlign; 665 } 666 667 //------------------------------------------------------------------------ 668 void NavigatorFrame::Resize() 669 { 670 SfxDockingWindow::Resize(); 671 672 Size aLogOutputSize = PixelToLogic( GetOutputSizePixel(), MAP_APPFONT ); 673 Size aLogExplSize = aLogOutputSize; 674 aLogExplSize.Width() -= 6; 675 aLogExplSize.Height() -= 6; 676 677 Point aExplPos = LogicToPixel( Point(3,3), MAP_APPFONT ); 678 Size aExplSize = LogicToPixel( aLogExplSize, MAP_APPFONT ); 679 680 m_pNavigatorTree->SetPosSizePixel( aExplPos, aExplSize ); 681 } 682 683 684 //======================================================================== 685 // class NavigatorFrameManager 686 //======================================================================== 687 688 //----------------------------------------------------------------------- 689 SFX_IMPL_DOCKINGWINDOW( NavigatorFrameManager, SID_FM_SHOW_FMEXPLORER ) 690 691 //----------------------------------------------------------------------- 692 NavigatorFrameManager::NavigatorFrameManager( Window* _pParent, sal_uInt16 _nId, 693 SfxBindings* _pBindings, SfxChildWinInfo* _pInfo ) 694 :SfxChildWindow( _pParent, _nId ) 695 { 696 pWindow = new NavigatorFrame( _pBindings, this, _pParent ); 697 eChildAlignment = SFX_ALIGN_NOALIGNMENT; 698 ((SfxDockingWindow*)pWindow)->Initialize( _pInfo ); 699 } 700 701 //............................................................................ 702 } // namespace svxform 703 //............................................................................ 704