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