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_framework.hxx" 26 27 //_________________________________________________________________________________________________________________ 28 // my own includes 29 //_________________________________________________________________________________________________________________ 30 #include <services/frame.hxx> 31 #include <dispatch/dispatchprovider.hxx> 32 33 #ifndef __FRAMEWORK_DISPATCH_INTERCEPTIONHELPER_HXX_ 34 #include <dispatch/interceptionhelper.hxx> 35 #endif 36 #include <dispatch/closedispatcher.hxx> 37 #include <dispatch/windowcommanddispatch.hxx> 38 #include <loadenv/loadenv.hxx> 39 #include <helper/oframes.hxx> 40 #include <helper/statusindicatorfactory.hxx> 41 #include <framework/titlehelper.hxx> 42 #include <classes/droptargetlistener.hxx> 43 #include <classes/taskcreator.hxx> 44 #include <loadenv/targethelper.hxx> 45 #include <framework/framelistanalyzer.hxx> 46 #include <helper/dockingareadefaultacceptor.hxx> 47 #include <dispatch/dispatchinformationprovider.hxx> 48 #include <threadhelp/transactionguard.hxx> 49 #include <pattern/window.hxx> 50 #include <services.h> 51 #include <properties.h> 52 53 //_________________________________________________________________________________________________________________ 54 // interface includes 55 //_________________________________________________________________________________________________________________ 56 #include <com/sun/star/lang/XInitialization.hpp> 57 #include <com/sun/star/lang/DisposedException.hpp> 58 #include <com/sun/star/task/XJobExecutor.hpp> 59 #include <com/sun/star/util/XURLTransformer.hpp> 60 #include <com/sun/star/util/XCloseable.hpp> 61 #include <com/sun/star/awt/XDevice.hpp> 62 #include <com/sun/star/awt/XTopWindow.hpp> 63 #include <com/sun/star/frame/XDesktop.hpp> 64 #include <com/sun/star/awt/PosSize.hpp> 65 #include <com/sun/star/frame/FrameSearchFlag.hpp> 66 #include <com/sun/star/awt/XWindowPeer.hpp> 67 #include <com/sun/star/awt/XVclWindowPeer.hpp> 68 #include <com/sun/star/task/XStatusIndicatorSupplier.hpp> 69 #include <com/sun/star/beans/PropertyAttribute.hpp> 70 #include <com/sun/star/beans/PropertyValue.hpp> 71 #include <com/sun/star/beans/XPropertySet.hpp> 72 #include <com/sun/star/frame/XModel.hpp> 73 #include <com/sun/star/awt/XDataTransferProviderAccess.hpp> 74 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> 75 #include <com/sun/star/awt/WindowAttribute.hpp> 76 #include <com/sun/star/container/XIndexAccess.hpp> 77 #include <com/sun/star/beans/XMaterialHolder.hpp> 78 79 #ifndef _COM_SUN_STAR_FRAME_XTITLECHANGEBROADCASTER_HPP_ 80 #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> 81 #endif 82 83 //_________________________________________________________________________________________________________________ 84 // includes of other projects 85 //_________________________________________________________________________________________________________________ 86 #include <comphelper/sequenceashashmap.hxx> 87 #include <cppuhelper/queryinterface.hxx> 88 #include <cppuhelper/typeprovider.hxx> 89 #include <cppuhelper/factory.hxx> 90 #include <cppuhelper/proptypehlp.hxx> 91 #include <rtl/ustrbuf.hxx> 92 #include <vcl/window.hxx> 93 #include <vcl/wrkwin.hxx> 94 #include <vcl/svapp.hxx> 95 96 #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_ 97 #include <toolkit/unohlp.hxx> 98 #endif 99 #include <toolkit/awt/vclxwindow.hxx> 100 #include <comphelper/processfactory.hxx> 101 #include <unotools/moduleoptions.hxx> 102 #include <tools/diagnose_ex.h> 103 104 #ifdef ENABLE_ASSERTIONS 105 #ifndef _RTL_STRBUF_HXX_ 106 #include <rtl/strbuf.hxx> 107 #endif 108 #endif 109 110 #include <vcl/menu.hxx> 111 112 //_________________________________________________________________________________________________________________ 113 // namespace 114 //_________________________________________________________________________________________________________________ 115 116 namespace framework{ 117 118 //_________________________________________________________________________________________________________________ 119 // non exported const 120 //_________________________________________________________________________________________________________________ 121 122 //_________________________________________________________________________________________________________________ 123 // non exported definitions 124 //_________________________________________________________________________________________________________________ 125 126 css::uno::WeakReference< css::frame::XFrame > Frame::m_xCloserFrame = css::uno::WeakReference< css::frame::XFrame >(); 127 128 //_________________________________________________________________________________________________________________ 129 // declarations 130 //_________________________________________________________________________________________________________________ 131 132 //***************************************************************************************************************** 133 // XInterface, XTypeProvider, XServiceInfo 134 //***************************************************************************************************************** 135 DEFINE_XINTERFACE_21 ( Frame , 136 OWeakObject , 137 DIRECT_INTERFACE(css::lang::XTypeProvider ), 138 DIRECT_INTERFACE(css::lang::XServiceInfo ), 139 DIRECT_INTERFACE(css::frame::XFramesSupplier ), 140 DIRECT_INTERFACE(css::frame::XFrame ), 141 DIRECT_INTERFACE(css::lang::XComponent ), 142 DIRECT_INTERFACE(css::task::XStatusIndicatorFactory ), 143 DIRECT_INTERFACE(css::frame::XDispatchProvider ), 144 DIRECT_INTERFACE(css::frame::XDispatchInformationProvider ), 145 DIRECT_INTERFACE(css::frame::XDispatchProviderInterception ), 146 DIRECT_INTERFACE(css::beans::XPropertySet ), 147 DIRECT_INTERFACE(css::beans::XPropertySetInfo ), 148 DIRECT_INTERFACE(css::awt::XWindowListener ), 149 DIRECT_INTERFACE(css::awt::XTopWindowListener ), 150 DIRECT_INTERFACE(css::awt::XFocusListener ), 151 DERIVED_INTERFACE(css::lang::XEventListener, css::awt::XWindowListener ), 152 DIRECT_INTERFACE(css::document::XActionLockable ), 153 DIRECT_INTERFACE(css::util::XCloseable ), 154 DIRECT_INTERFACE(css::util::XCloseBroadcaster ), 155 DIRECT_INTERFACE(css::frame::XComponentLoader ), 156 DIRECT_INTERFACE(css::frame::XTitle ), 157 DIRECT_INTERFACE(css::frame::XTitleChangeBroadcaster ) 158 ) 159 160 DEFINE_XTYPEPROVIDER_20 ( Frame , 161 css::lang::XTypeProvider , 162 css::lang::XServiceInfo , 163 css::frame::XFramesSupplier , 164 css::frame::XFrame , 165 css::lang::XComponent , 166 css::task::XStatusIndicatorFactory , 167 css::beans::XPropertySet , 168 css::beans::XPropertySetInfo , 169 css::frame::XDispatchProvider , 170 css::frame::XDispatchInformationProvider , 171 css::frame::XDispatchProviderInterception , 172 css::awt::XWindowListener , 173 css::awt::XTopWindowListener , 174 css::awt::XFocusListener , 175 css::lang::XEventListener , 176 css::util::XCloseable , 177 css::util::XCloseBroadcaster , 178 css::frame::XComponentLoader , 179 css::frame::XTitle , 180 css::frame::XTitleChangeBroadcaster 181 ) 182 183 DEFINE_XSERVICEINFO_MULTISERVICE ( Frame , 184 ::cppu::OWeakObject , 185 SERVICENAME_FRAME , 186 IMPLEMENTATIONNAME_FRAME 187 ) 188 189 DEFINE_INIT_SERVICE ( Frame, 190 { 191 /*Attention 192 I think we don't need any mutex or lock here ... because we are called by our own static method impl_createInstance() 193 to create a new instance of this class by our own supported service factory. 194 see macro DEFINE_XSERVICEINFO_MULTISERVICE and "impl_initService()" for further informations! 195 */ 196 css::uno::Reference< css::uno::XInterface > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY_THROW); 197 198 //------------------------------------------------------------------------------------------------------------- 199 // Initialize a new dispatchhelper-object to handle dispatches. 200 // We use these helper as slave for our interceptor helper ... not directly! 201 // But he is event listener on THIS instance! 202 DispatchProvider* pDispatchHelper = new DispatchProvider( m_xFactory, this ); 203 css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( static_cast< ::cppu::OWeakObject* >(pDispatchHelper), css::uno::UNO_QUERY ); 204 205 //------------------------------------------------------------------------------------------------------------- 206 DispatchInformationProvider* pInfoHelper = new DispatchInformationProvider(m_xFactory, this); 207 m_xDispatchInfoHelper = css::uno::Reference< css::frame::XDispatchInformationProvider >( static_cast< ::cppu::OWeakObject* >(pInfoHelper), css::uno::UNO_QUERY ); 208 209 //------------------------------------------------------------------------------------------------------------- 210 // Initialize a new interception helper object to handle dispatches and implement an interceptor mechanism. 211 // Set created dispatch provider as slowest slave of it. 212 // Hold interception helper by reference only - not by pointer! 213 // So it's easiear to destroy it. 214 InterceptionHelper* pInterceptionHelper = new InterceptionHelper( this, xDispatchProvider ); 215 m_xDispatchHelper = css::uno::Reference< css::frame::XDispatchProvider >( static_cast< ::cppu::OWeakObject* >(pInterceptionHelper), css::uno::UNO_QUERY ); 216 217 //------------------------------------------------------------------------------------------------------------- 218 // Initialize a new XFrames-helper-object to handle XIndexAccess and XElementAccess. 219 // We hold member as reference ... not as pointer too! 220 // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that. 221 // But look on dispose() for right order of deinitialization. 222 OFrames* pFramesHelper = new OFrames( m_xFactory, this, &m_aChildFrameContainer ); 223 m_xFramesHelper = css::uno::Reference< css::frame::XFrames >( static_cast< ::cppu::OWeakObject* >(pFramesHelper), css::uno::UNO_QUERY ); 224 225 //------------------------------------------------------------------------------------------------------------- 226 // Initialize a the drop target listener. 227 // We hold member as reference ... not as pointer too! 228 DropTargetListener* pDropListener = new DropTargetListener( m_xFactory, this ); 229 m_xDropTargetListener = css::uno::Reference< css::datatransfer::dnd::XDropTargetListener >( static_cast< ::cppu::OWeakObject* >(pDropListener), css::uno::UNO_QUERY ); 230 231 // Safe impossible cases 232 // We can't work without these helpers! 233 LOG_ASSERT2( xDispatchProvider.is ()==sal_False, "Frame::impl_initService()", "Slowest slave for dispatch- and interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ) 234 LOG_ASSERT2( m_xDispatchHelper.is ()==sal_False, "Frame::impl_initService()", "Interception helper isn't valid. XDispatchProvider, XDispatch, XDispatchProviderInterception are not full supported!" ) 235 LOG_ASSERT2( m_xFramesHelper.is ()==sal_False, "Frame::impl_initService()", "Frames helper isn't valid. XFrames, XIndexAccess and XElementAcces are not supported!" ) 236 LOG_ASSERT2( m_xDropTargetListener.is()==sal_False, "Frame::impl_initService()", "DropTarget helper isn't valid. Drag and drop without functionality!" ) 237 238 //------------------------------------------------------------------------------------------------------------- 239 // establish notifies for changing of "disabled commands" configuration during runtime 240 m_aCommandOptions.EstablisFrameCallback(this); 241 242 //------------------------------------------------------------------------------------------------------------- 243 // Create an initial layout manager 244 // Create layout manager and connect it to the newly created frame 245 m_xLayoutManager = css::uno::Reference< css::frame::XLayoutManager >(m_xFactory->createInstance(SERVICENAME_LAYOUTMANAGER), css::uno::UNO_QUERY); 246 247 //------------------------------------------------------------------------------------------------------------- 248 // set information about all supported properties at the base class helper PropertySetHelper 249 impl_initializePropInfo(); 250 } 251 ) 252 253 /*-****************************************************************************************************//** 254 @short standard constructor to create instance by factory 255 @descr This constructor initialize a new instance of this class by valid factory, 256 and will be set valid values on his member and baseclasses. 257 258 @attention a) Don't use your own reference during an UNO-Service-ctor! There is no guarantee, that you 259 will get over this. (e.g. using of your reference as parameter to initialize some member) 260 Do such things in DEFINE_INIT_SERVICE() method, which is called automaticly after your ctor!!! 261 b) Baseclass OBroadcastHelper is a typedef in namespace cppu! 262 The microsoft compiler has some problems to handle it right BY using namespace explicitly ::cppu::OBroadcastHelper. 263 If we write it without a namespace or expand the typedef to OBrodcastHelperVar<...> -> it will be OK!? 264 I don't know why! (other compiler not tested .. but it works!) 265 266 @seealso method DEFINE_INIT_SERVICE() 267 268 @param "xFactory" is the multi service manager, which create this instance. 269 The value must be different from NULL! 270 @return - 271 272 @onerror ASSERT in debug version or nothing in relaese version. 273 *//*-*****************************************************************************************************/ 274 Frame::Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) 275 : ThreadHelpBase ( &Application::GetSolarMutex() ) 276 , TransactionBase ( ) 277 , PropertySetHelper ( xFactory, 278 &m_aLock, 279 &m_aTransactionManager, 280 sal_False) // sal_False => dont release shared mutex on calling us! 281 , ::cppu::OWeakObject ( ) 282 // init member 283 , m_xFactory ( xFactory ) 284 , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) 285 , m_xParent ( ) 286 , m_xContainerWindow ( ) 287 , m_xComponentWindow ( ) 288 , m_xController ( ) 289 , m_eActiveState ( E_INACTIVE ) 290 , m_sName ( ) 291 , m_bIsFrameTop ( sal_True ) // I think we are top without a parent ... and there is no parent yet! 292 , m_bConnected ( sal_False ) // There exist no component inside of use => sal_False, we are not connected! 293 , m_nExternalLockCount ( 0 ) 294 , m_bSelfClose ( sal_False ) // Important! 295 , m_bIsHidden ( sal_True ) 296 , m_xTitleHelper ( ) 297 , m_aChildFrameContainer ( ) 298 { 299 // Check incoming parameter to avoid against wrong initialization. 300 LOG_ASSERT2( implcp_ctor( xFactory ), "Frame::Frame()", "Invalid parameter detected!" ) 301 302 /* Please have a look on "@attentions" of description before! */ 303 } 304 305 /*-****************************************************************************************************//** 306 @short standard destructor 307 @descr This one do NOTHING! Use dispose() instaed of this. 308 309 @seealso method dispose() 310 311 @param - 312 @return - 313 314 @onerror - 315 *//*-*****************************************************************************************************/ 316 Frame::~Frame() 317 { 318 LOG_ASSERT2( m_aTransactionManager.getWorkingMode()!=E_CLOSE, "Frame::~Frame()", "Who forgot to dispose this service?" ) 319 } 320 321 /*-************************************************************************************************************//** 322 @interface XComponentLoader 323 @short try to load given URL into a task 324 @descr You can give us some informations about the content, which you will load into a frame. 325 We search or create this target for you, make a type detection of given URL and try to load it. 326 As result of this operation we return the new created component or nothing, if loading failed. 327 328 @seealso - 329 330 @param "sURL" , URL, which represant the content 331 @param "sTargetFrameName" , name of target frame or special value like "_self", "_blank" ... 332 @param "nSearchFlags" , optional arguments for frame search, if target isn't a special one 333 @param "lArguments" , optional arguments for loading 334 @return A valid component reference, if loading was successfully. 335 A null reference otherwise. 336 337 @onerror We return a null reference. 338 @threadsafe yes 339 *//*-*************************************************************************************************************/ 340 css::uno::Reference< css::lang::XComponent > SAL_CALL Frame::loadComponentFromURL( const ::rtl::OUString& sURL , 341 const ::rtl::OUString& sTargetFrameName, 342 sal_Int32 nSearchFlags , 343 const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::io::IOException , 344 css::lang::IllegalArgumentException , 345 css::uno::RuntimeException ) 346 { 347 { 348 // If the frame is closed the call might lead to crash even with target "_blank", 349 // so the DisposedException should be thrown in this case 350 // It still looks to be too dangerous to set the transaction for the whole loading process 351 // so the guard is used in scopes to let the standard check be used 352 353 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 354 } 355 356 ReadGuard aReadLock(m_aLock); 357 css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); 358 css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; 359 aReadLock.unlock(); 360 361 return LoadEnv::loadComponentFromURL(xThis, xSMGR, sURL, sTargetFrameName, nSearchFlags, lArguments); 362 } 363 364 /*-****************************************************************************************************//** 365 @short return access to append or remove childs on desktop 366 @descr We don't implement these interface directly. We use a helper class to do this. 367 If you wish to add or delete childs to/from the container, call these method to get 368 a reference to the helper. 369 370 @seealso class OFrames 371 372 @param - 373 @return A reference to the helper which answer your queries. 374 375 @onerror A null reference is returned. 376 *//*-*****************************************************************************************************/ 377 css::uno::Reference< css::frame::XFrames > SAL_CALL Frame::getFrames() throw( css::uno::RuntimeException ) 378 { 379 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 380 // Register transaction and reject wrong calls. 381 382 /*TODO 383 This is a temp. HACK! 384 Our parent (a Task!) stand in close/dispose and set working mode to E_BEFOERECLOSE 385 and call dispose on us! We tra to get this xFramesHelper and are reject by an "already closed" pranet instance .... 386 => We use SOFTEXCEPTIONS here ... but we should make it right in further times .... 387 */ 388 389 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 390 391 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 392 ReadGuard aReadLock( m_aLock ); 393 394 // Return access to all child frames to caller. 395 // Ouer childframe container is implemented in helper class OFrames and used as a reference m_xFramesHelper! 396 return m_xFramesHelper; 397 } 398 399 /*-****************************************************************************************************//** 400 @short get the current active child frame 401 @descr It must be a frameto. Direct childs of a frame are frames only! No task or desktop is accepted. 402 We don't save this information directly in this class. We use ouer container-helper 403 to do that. 404 405 @seealso class OFrameContainer 406 @seealso method setActiveFrame() 407 408 @param - 409 @return A reference to ouer current active childframe, if anyone exist. 410 @return A null reference, if nobody is active. 411 412 @onerror A null reference is returned. 413 *//*-*****************************************************************************************************/ 414 css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::getActiveFrame() throw( css::uno::RuntimeException ) 415 { 416 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 417 // Register transaction and reject wrong calls. 418 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 419 420 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 421 ReadGuard aReadLock( m_aLock ); 422 423 // Return current active frame. 424 // This information is avaliable on the container. 425 return m_aChildFrameContainer.getActive(); 426 } 427 428 /*-****************************************************************************************************//** 429 @short set the new active direct child frame 430 @descr It must be a frame to. Direct childs of frame are frames only! No task or desktop is accepted. 431 We don't save this information directly in this class. We use ouer container-helper 432 to do that. 433 434 @seealso class OFrameContainer 435 @seealso method getActiveFrame() 436 437 @param "xFrame", reference to new active child. It must be an already existing child! 438 @return - 439 440 @onerror An assertion is thrown and element is ignored, if given frame is'nt already a child of us. 441 *//*-*****************************************************************************************************/ 442 void SAL_CALL Frame::setActiveFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ) 443 { 444 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 445 // Check incoming parameters. 446 LOG_ASSERT2( implcp_setActiveFrame( xFrame ), "Frame::setActiveFrame()", "Invalid parameter detected!" ) 447 // Look for rejected calls! 448 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 449 450 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 451 WriteGuard aWriteLock( m_aLock ); 452 453 // Copy neccessary member for threadsafe access! 454 // m_aChildFrameContainer is threadsafe himself and he live if we live!!! 455 // ...and our transaction is non breakable too ... 456 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive(); 457 EActiveState eActiveState = m_eActiveState ; 458 459 aWriteLock.unlock(); 460 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 461 462 // Don't work, if "new" active frame is'nt different from current one! 463 // (xFrame==NULL is allowed to UNSET it!) 464 if( xActiveChild != xFrame ) 465 { 466 // ... otherwise set new and deactivate old one. 467 m_aChildFrameContainer.setActive( xFrame ); 468 if ( 469 ( eActiveState != E_INACTIVE ) && 470 ( xActiveChild.is() == sal_True ) 471 ) 472 { 473 xActiveChild->deactivate(); 474 } 475 } 476 477 if( xFrame.is() == sal_True ) 478 { 479 // If last active frame had focus ... 480 // ... reset state to ACTIVE and send right FrameActionEvent for focus lost. 481 if( eActiveState == E_FOCUS ) 482 { 483 aWriteLock.lock(); 484 eActiveState = E_ACTIVE ; 485 m_eActiveState = eActiveState; 486 aWriteLock.unlock(); 487 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING ); 488 } 489 490 // If last active frame was active ... 491 // but new one isn't it ... 492 // ... set it as active one. 493 if ( 494 ( eActiveState == E_ACTIVE ) && 495 ( xFrame->isActive() == sal_False ) 496 ) 497 { 498 xFrame->activate(); 499 } 500 } 501 else 502 // If this frame is active and has no active subframe anymore it is UI active too 503 if( eActiveState == E_ACTIVE ) 504 { 505 aWriteLock.lock(); 506 eActiveState = E_FOCUS ; 507 m_eActiveState = eActiveState; 508 aWriteLock.unlock(); 509 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED ); 510 } 511 } 512 513 /*-****************************************************************************************************//** 514 initialize new created layout manager 515 **/ 516 void lcl_enableLayoutManager(const css::uno::Reference< css::frame::XLayoutManager >& xLayoutManager, 517 const css::uno::Reference< css::frame::XFrame >& xFrame ) 518 { 519 // Provide container window to our layout manager implementation 520 xLayoutManager->attachFrame(xFrame); 521 522 css::uno::Reference< css::frame::XFrameActionListener > xListen(xLayoutManager, css::uno::UNO_QUERY_THROW); 523 xFrame->addFrameActionListener(xListen); 524 525 DockingAreaDefaultAcceptor* pAcceptor = new DockingAreaDefaultAcceptor(xFrame); 526 css::uno::Reference< css::ui::XDockingAreaAcceptor > xDockingAreaAcceptor( static_cast< ::cppu::OWeakObject* >(pAcceptor), css::uno::UNO_QUERY_THROW); 527 xLayoutManager->setDockingAreaAcceptor(xDockingAreaAcceptor); 528 } 529 530 /*-****************************************************************************************************//** 531 deinitialize layout manager 532 **/ 533 void lcl_disableLayoutManager(const css::uno::Reference< css::frame::XLayoutManager >& xLayoutManager, 534 const css::uno::Reference< css::frame::XFrame >& xFrame ) 535 { 536 css::uno::Reference< css::frame::XFrameActionListener > xListen(xLayoutManager, css::uno::UNO_QUERY_THROW); 537 xFrame->removeFrameActionListener(xListen); 538 xLayoutManager->setDockingAreaAcceptor(css::uno::Reference< css::ui::XDockingAreaAcceptor >()); 539 xLayoutManager->attachFrame(css::uno::Reference< css::frame::XFrame >()); 540 } 541 542 /*-****************************************************************************************************//** 543 @short initialize frame instance 544 @descr A frame needs a window. This method set a new one ... but should called one times only! 545 We use this window to listen for window events and forward it to our set component. 546 Its used as parent of component window too. 547 548 @seealso method getContainerWindow() 549 @seealso method setComponent() 550 @seealso member m_xContainerWindow 551 552 @param "xWindow", reference to new container window - must be valid! 553 @return - 554 555 @onerror We do nothing. 556 *//*-*****************************************************************************************************/ 557 void SAL_CALL Frame::initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ) 558 { 559 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 560 if (!xWindow.is()) 561 throw css::uno::RuntimeException( 562 ::rtl::OUString::createFromAscii("Frame::initialize() called without a valid container window reference."), 563 static_cast< css::frame::XFrame* >(this)); 564 565 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 566 WriteGuard aWriteLock( m_aLock ); 567 568 if ( m_xContainerWindow.is() ) 569 throw css::uno::RuntimeException( 570 ::rtl::OUString::createFromAscii("Frame::initialized() is called more then once, which isnt usefull nor allowed."), 571 static_cast< css::frame::XFrame* >(this)); 572 573 // Look for rejected calls first! 574 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 575 576 // Enable object for real working ... so follow impl methods don't must handle it special! (e.g. E_SOFTEXCEPTIONS for rejected calls) 577 m_aTransactionManager.setWorkingMode( E_WORK ); 578 579 // This must be the first call of this method! 580 // We should initialize our object and open it for working. 581 // Set the new window. 582 LOG_ASSERT2( m_xContainerWindow.is()==sal_True, "Frame::initialize()", "Leak detected! This state should never occure ..." ) 583 m_xContainerWindow = xWindow; 584 585 // if window is initially visible, we will never get a windowShowing event 586 Window* pWindow = VCLUnoHelper::GetWindow(xWindow); 587 if (pWindow && pWindow->IsVisible()) 588 m_bIsHidden = sal_False; 589 590 css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xFactory; 591 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager = m_xLayoutManager; 592 593 // Release lock ... because we call some impl methods, which are threadsafe by himself. 594 // If we hold this lock - we will produce our own deadlock! 595 aWriteLock.unlock(); 596 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 597 598 if (xLayoutManager.is()) 599 lcl_enableLayoutManager(xLayoutManager, this); 600 601 // create progress helper 602 css::uno::Reference< css::frame::XFrame > xThis (static_cast< css::frame::XFrame* >(this) , css::uno::UNO_QUERY_THROW); 603 css::uno::Reference< css::task::XStatusIndicatorFactory > xIndicatorFactory(xSMGR->createInstance(IMPLEMENTATIONNAME_STATUSINDICATORFACTORY), css::uno::UNO_QUERY_THROW); 604 css::uno::Reference< css::lang::XInitialization > xIndicatorInit (xIndicatorFactory , css::uno::UNO_QUERY_THROW); 605 css::uno::Sequence< css::uno::Any > lArgs(2); 606 css::beans::NamedValue aArg; 607 aArg.Name = STATUSINDICATORFACTORY_PROPNAME_FRAME; 608 aArg.Value <<= xThis; 609 lArgs[0] <<= aArg; 610 aArg.Name = STATUSINDICATORFACTORY_PROPNAME_ALLOWPARENTSHOW; 611 aArg.Value <<= sal_True; 612 lArgs[1] <<= aArg; 613 xIndicatorInit->initialize(lArgs); 614 615 // SAFE -> ---------------------------------- 616 aWriteLock.lock(); 617 m_xIndicatorFactoryHelper = xIndicatorFactory; 618 aWriteLock.unlock(); 619 // <- SAFE ---------------------------------- 620 621 // Start listening for events after setting it on helper class ... 622 // So superflous messages are filtered to NULL :-) 623 implts_startWindowListening(); 624 625 impl_enablePropertySet(); 626 627 // create WindowCommandDispatch; it is supposed to release itself at frame destruction 628 (void)new WindowCommandDispatch(xSMGR, this); 629 630 // Initialize title functionality 631 TitleHelper* pTitleHelper = new TitleHelper(xSMGR); 632 m_xTitleHelper = css::uno::Reference< css::frame::XTitle >(static_cast< ::cppu::OWeakObject* >(pTitleHelper), css::uno::UNO_QUERY_THROW); 633 pTitleHelper->setOwner(xThis); 634 } 635 636 /*-****************************************************************************************************//** 637 @short returns current set container window 638 @descr The ContainerWindow property is used as a container for the component 639 in this frame. So this object implements a container interface too. 640 The instantiation of the container window is done by the user of this class. 641 The frame is the owner of its container window. 642 643 @seealso method initialize() 644 645 @param - 646 @return A reference to current set containerwindow. 647 648 @onerror A null reference is returned. 649 *//*-*****************************************************************************************************/ 650 css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getContainerWindow() throw( css::uno::RuntimeException ) 651 { 652 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 653 // Register transaction and reject wrong calls. 654 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 655 656 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 657 ReadGuard aReadLock( m_aLock ); 658 659 return m_xContainerWindow; 660 } 661 662 /*-****************************************************************************************************//** 663 @short set parent frame 664 @descr We need a parent to support some functionality! e.g. findFrame() 665 By the way we use the chance to set an internal information about our top state. 666 So we must not check this information during every isTop() call. 667 We are top, if our parent is the desktop instance or we havent any parent. 668 669 @seealso getCreator() 670 @seealso findFrame() 671 @seealso isTop() 672 @seealos m_bIsFrameTop 673 674 @param xCreator 675 valid reference to our new owner frame, which should implement a supplier interface 676 677 @threadsafe yes 678 @modified 08.05.2002 09:35, as96863 679 *//*-*****************************************************************************************************/ 680 void SAL_CALL Frame::setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ) 681 { 682 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 683 684 /* SAFE { */ 685 WriteGuard aWriteLock( m_aLock ); 686 m_xParent = xCreator; 687 aWriteLock.unlock(); 688 /* } SAFE */ 689 690 css::uno::Reference< css::frame::XDesktop > xIsDesktop( xCreator, css::uno::UNO_QUERY ); 691 m_bIsFrameTop = ( xIsDesktop.is() || ! xCreator.is() ); 692 } 693 694 /*-****************************************************************************************************//** 695 @short returns current parent frame 696 @descr The Creator is the parent frame container. If it is NULL, the frame is the uppermost one. 697 698 @seealso method setCreator() 699 700 @param - 701 @return A reference to current set parent frame container. 702 703 @onerror A null reference is returned. 704 *//*-*****************************************************************************************************/ 705 css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Frame::getCreator() throw( css::uno::RuntimeException ) 706 { 707 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 708 // Register transaction and reject wrong calls. 709 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 710 711 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 712 ReadGuard aReadLock( m_aLock ); 713 714 return m_xParent; 715 } 716 717 /*-****************************************************************************************************//** 718 @short returns current set name of frame 719 @descr This name is used to find target of findFrame() or queryDispatch() calls. 720 721 @seealso method setName() 722 723 @param - 724 @return Current set name of frame. 725 726 @onerror An empty string is returned. 727 *//*-*****************************************************************************************************/ 728 ::rtl::OUString SAL_CALL Frame::getName() throw( css::uno::RuntimeException ) 729 { 730 /* SAFE { */ 731 ReadGuard aReadLock( m_aLock ); 732 return m_sName; 733 /* } SAFE */ 734 } 735 736 /*-****************************************************************************************************//** 737 @short set new name for frame 738 @descr This name is used to find target of findFrame() or queryDispatch() calls. 739 740 @attention Special names like "_blank", "_self" aren't allowed ... 741 "_beamer" or "_menubar" excepts this rule! 742 743 @seealso method getName() 744 745 @param "sName", new frame name. 746 @return - 747 748 @onerror We do nothing. 749 *//*-*****************************************************************************************************/ 750 void SAL_CALL Frame::setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ) 751 { 752 /* SAFE { */ 753 WriteGuard aWriteLock( m_aLock ); 754 // Set new name ... but look for invalid special target names! 755 // They are not allowed to set. 756 if (TargetHelper::isValidNameForFrame(sName)) 757 m_sName = sName; 758 aWriteLock.unlock(); 759 /* } SAFE */ 760 } 761 762 /*-****************************************************************************************************//** 763 @short search for frames 764 @descr This method searches for a frame with the specified name. 765 Frames may contain other frames (e.g. a frameset) and may 766 be contained in other frames. This hierarchie ist searched by 767 this method. 768 First some special names are taken into account, i.e. "", 769 "_self", "_top", "_blank" etc. The nSearchFlags are ignored 770 when comparing these names with sTargetFrameName, further steps are 771 controlled by the search flags. If allowed, the name of the frame 772 itself is compared with the desired one, then ( again if allowed ) 773 the method findFrame() is called for all children, for siblings 774 and as last for the parent frame. 775 If no frame with the given name is found until the top frames container, 776 a new top one is created, if this is allowed by a special 777 flag. The new frame also gets the desired name. 778 779 @param sTargetFrameName 780 special names (_blank, _self) or real name of target frame 781 @param nSearchFlags 782 optional flags which regulate search for non special target frames 783 784 @return A reference to found or may be new created frame. 785 @threadsafe yes 786 @modified 16.05.2002 11:08, as96863 787 *//*-*****************************************************************************************************/ 788 css::uno::Reference< css::frame::XFrame > SAL_CALL Frame::findFrame( const ::rtl::OUString& sTargetFrameName, 789 sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ) 790 { 791 css::uno::Reference< css::frame::XFrame > xTarget; 792 793 //----------------------------------------------------------------------------------------------------- 794 // 0) Ignore wrong parameter! 795 // We doesn't support search for following special targets. 796 // If we reject this requests - we mustnt check for such names 797 // in following code again and again. If we do not so -wrong 798 // search results can occure! 799 //----------------------------------------------------------------------------------------------------- 800 if ( 801 (sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()! 802 (sTargetFrameName==SPECIALTARGET_MENUBAR ) || // valid for dispatches - not for findFrame()! 803 (sTargetFrameName==SPECIALTARGET_HELPAGENT) // valid for dispatches - not for findFrame()! 804 ) 805 { 806 return NULL; 807 } 808 809 //----------------------------------------------------------------------------------------------------- 810 // I) check for special defined targets first which must be handled exclusive. 811 // force using of "if() else if() ..." 812 //----------------------------------------------------------------------------------------------------- 813 814 // get threadsafe some neccessary member which are neccessary for following functionality 815 /* SAFE { */ 816 ReadGuard aReadLock( m_aLock ); 817 css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY ); 818 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; 819 sal_Bool bIsTopFrame = m_bIsFrameTop; 820 sal_Bool bIsTopWindow = WindowHelper::isTopWindow(m_xContainerWindow); 821 aReadLock.unlock(); 822 /* } SAFE */ 823 824 //----------------------------------------------------------------------------------------------------- 825 // I.I) "_blank" 826 // Not allowed for a normal frame - but for the desktop. 827 // Use helper class to do so. It use the desktop automaticly. 828 //----------------------------------------------------------------------------------------------------- 829 if ( sTargetFrameName==SPECIALTARGET_BLANK ) 830 { 831 TaskCreator aCreator(xFactory); 832 xTarget = aCreator.createTask(sTargetFrameName,sal_False); 833 } 834 835 //----------------------------------------------------------------------------------------------------- 836 // I.II) "_parent" 837 // It doesn't matter if we have a valid parent or not. User ask for him and get it. 838 // An empty result is a valid result too. 839 //----------------------------------------------------------------------------------------------------- 840 else 841 if ( sTargetFrameName==SPECIALTARGET_PARENT ) 842 { 843 xTarget = xParent; 844 } 845 846 //----------------------------------------------------------------------------------------------------- 847 // I.III) "_top" 848 // If we are not the top frame in this hierarchy, we must forward request to our parent. 849 // Otherwhise we must return ourself. 850 //----------------------------------------------------------------------------------------------------- 851 else 852 if ( sTargetFrameName==SPECIALTARGET_TOP ) 853 { 854 if (bIsTopFrame) 855 xTarget = this; 856 else 857 if (xParent.is()) // If we are not top - the parent MUST exist. But may it's better to check it again .-) 858 xTarget = xParent->findFrame(SPECIALTARGET_TOP,0); 859 } 860 861 //----------------------------------------------------------------------------------------------------- 862 // I.IV) "_self", "" 863 // This mean this frame in every case. 864 //----------------------------------------------------------------------------------------------------- 865 else 866 if ( 867 ( sTargetFrameName==SPECIALTARGET_SELF ) || 868 ( sTargetFrameName.getLength()<1 ) 869 ) 870 { 871 xTarget = this; 872 } 873 874 //----------------------------------------------------------------------------------------------------- 875 // I.V) "_beamer" 876 // This is a special sub frame of any task. We must return it if we found it on our direct childrens 877 // or create it there if it not already exists. 878 // Note: Such beamer exists for task(top) frames only! 879 //----------------------------------------------------------------------------------------------------- 880 else 881 if ( sTargetFrameName==SPECIALTARGET_BEAMER ) 882 { 883 // We are a task => search or create the beamer 884 if (bIsTopWindow) 885 { 886 xTarget = m_aChildFrameContainer.searchOnDirectChildrens(SPECIALTARGET_BEAMER); 887 if ( ! xTarget.is() ) 888 { 889 /* TODO 890 Creation not supported yet! 891 Wait for new layout manager service because we can't plug it 892 inside already opened document of this frame ... 893 */ 894 } 895 } 896 // We arent a task => forward request to our parent or ignore it. 897 else 898 if (xParent.is()) 899 xTarget = xParent->findFrame(SPECIALTARGET_BEAMER,0); 900 } 901 902 else 903 { 904 //------------------------------------------------------------------------------------------------- 905 // II) otherwhise use optional given search flags 906 // force using of combinations of such flags. means no "else" part of use if() statements. 907 // But we ust break further searches if target was already found. 908 // Order of using flags is fix: SELF - CHILDREN - SIBLINGS - PARENT 909 // TASK and CREATE are handled special. 910 //------------------------------------------------------------------------------------------------- 911 912 // get threadsafe some neccessary member which are neccessary for following functionality 913 /* SAFE { */ 914 aReadLock.lock(); 915 ::rtl::OUString sOwnName = m_sName; 916 aReadLock.unlock(); 917 /* } SAFE */ 918 919 //------------------------------------------------------------------------------------------------- 920 // II.I) SELF 921 // Check for right name. If it's the searched one return ourself - otherwhise 922 // ignore this flag. 923 //------------------------------------------------------------------------------------------------- 924 if ( 925 (nSearchFlags & css::frame::FrameSearchFlag::SELF) && 926 (sOwnName == sTargetFrameName ) 927 ) 928 { 929 xTarget = this; 930 } 931 932 //------------------------------------------------------------------------------------------------- 933 // II.II) CHILDREN 934 // Search on all children for the given target name. 935 // An empty name value can't occure here - because it must be already handled as "_self" 936 // before. Used helper function of container doesn't create any frame. 937 // It makes a deep search only. 938 //------------------------------------------------------------------------------------------------- 939 if ( 940 ( ! xTarget.is() ) && 941 (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN) 942 ) 943 { 944 xTarget = m_aChildFrameContainer.searchOnAllChildrens(sTargetFrameName); 945 } 946 947 //------------------------------------------------------------------------------------------------- 948 // II.III) TASKS 949 // This is a special flag. It regulate search on this task tree only or allow search on 950 // all other ones (which are sibling trees of us) too. 951 // Upper search must stop at this frame if we are the topest one and the TASK flag isn't set 952 // or we can ignore it if we have no valid parent. 953 //------------------------------------------------------------------------------------------------- 954 if ( 955 ( bIsTopFrame && (nSearchFlags & css::frame::FrameSearchFlag::TASKS) ) || 956 ( ! bIsTopFrame ) 957 ) 958 { 959 //------------------------------------------------------------------------------------------------- 960 // II.III.I) SIBLINGS 961 // Search on all our direct siblings - means all childrens of our parent. 962 // Use this flag in combination with TASK. We must supress such upper search if 963 // user has not set it and if we are a top frame. 964 // 965 // Attention: Don't forward this request to our parent as a findFrame() call. 966 // In such case we must protect us against recursive calls. 967 // Use snapshot of our parent. But don't use queryFrames() of XFrames interface. 968 // Because it's return all siblings and all her childrens including our children too 969 // if we call it with the CHILDREN flag. We doesn't need that - we need the direct container 970 // items of our parent only to start searches there. So we must use the container interface 971 // XIndexAccess instead of XFrames. 972 //------------------------------------------------------------------------------------------------- 973 if ( 974 ( ! xTarget.is() ) && 975 (nSearchFlags & css::frame::FrameSearchFlag::SIBLINGS) && 976 ( xParent.is() ) // search on siblings is impossible without a parent 977 ) 978 { 979 css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY ); 980 if (xSupplier.is()) 981 { 982 css::uno::Reference< css::container::XIndexAccess > xContainer( xSupplier->getFrames(), css::uno::UNO_QUERY ); 983 if (xContainer.is()) 984 { 985 sal_Int32 nCount = xContainer->getCount(); 986 for( sal_Int32 i=0; i<nCount; ++i ) 987 { 988 css::uno::Reference< css::frame::XFrame > xSibling; 989 if ( 990 ( !(xContainer->getByIndex(i)>>=xSibling) ) || // control unpacking 991 ( ! xSibling.is() ) || // check for valid items 992 ( xSibling==static_cast< ::cppu::OWeakObject* >(this) ) // ignore ourself! (We are a part of this container too - but search on our children was already done.) 993 ) 994 { 995 continue; 996 } 997 998 // Don't allow upper search here! Use rigth flags to regulate it. 999 // And allow deep search on children only - if it was allowed for us too. 1000 sal_Int32 nRightFlags = css::frame::FrameSearchFlag::SELF; 1001 if (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN) 1002 nRightFlags |= css::frame::FrameSearchFlag::CHILDREN; 1003 xTarget = xSibling->findFrame(sTargetFrameName, nRightFlags ); 1004 // perform search be breaking further search if a result exist. 1005 if (xTarget.is()) 1006 break; 1007 } 1008 } 1009 } 1010 } 1011 1012 //------------------------------------------------------------------------------------------------- 1013 // II.III.II) PARENT 1014 // Forward search to our parent (if he exists.) 1015 // To prevent us against recursive and superflous calls (which can occure if we allow him 1016 // to search on his childrens too) we must change used search flags. 1017 //------------------------------------------------------------------------------------------------- 1018 if ( 1019 ( ! xTarget.is() ) && 1020 (nSearchFlags & css::frame::FrameSearchFlag::PARENT) && 1021 ( xParent.is() ) 1022 ) 1023 { 1024 if (xParent->getName() == sTargetFrameName) 1025 xTarget = xParent; 1026 else 1027 { 1028 sal_Int32 nRightFlags = nSearchFlags; 1029 nRightFlags &= ~css::frame::FrameSearchFlag::CHILDREN; 1030 xTarget = xParent->findFrame(sTargetFrameName, nRightFlags); 1031 } 1032 } 1033 } 1034 1035 //------------------------------------------------------------------------------------------------- 1036 // II.IV) CREATE 1037 // If we haven't found any valid target frame by using normal flags - but user allowed us to create 1038 // a new one ... we should do that. Used TaskCreator use Desktop instance automaticly as parent! 1039 //------------------------------------------------------------------------------------------------- 1040 if ( 1041 ( ! xTarget.is() ) && 1042 (nSearchFlags & css::frame::FrameSearchFlag::CREATE) 1043 ) 1044 { 1045 TaskCreator aCreator(xFactory); 1046 xTarget = aCreator.createTask(sTargetFrameName,sal_False); 1047 } 1048 } 1049 1050 return xTarget; 1051 } 1052 1053 /*-****************************************************************************************************//** 1054 @short - 1055 @descr Returns sal_True, if this frame is a "top frame", otherwise sal_False. 1056 The "m_bIsFrameTop" member must be set in the ctor or setCreator() method. 1057 A top frame is a member of the top frame container or a member of the 1058 task frame container. Both containers can create new frames if the findFrame() 1059 method of their css::frame::XFrame interface is called with a frame name not yet known. 1060 1061 @seealso ctor 1062 @seealso method setCreator() 1063 @seealso method findFrame() 1064 1065 @param - 1066 @return true, if is it a top frame ... false otherwise. 1067 1068 @onerror No error should occure! 1069 *//*-*****************************************************************************************************/ 1070 sal_Bool SAL_CALL Frame::isTop() throw( css::uno::RuntimeException ) 1071 { 1072 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1073 // Register transaction and reject wrong calls. 1074 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1075 1076 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1077 ReadGuard aReadLock( m_aLock ); 1078 1079 // This information is set in setCreator(). 1080 // We are top, if ouer parent is a task or the desktop or if no parent exist! 1081 return m_bIsFrameTop; 1082 } 1083 1084 /*-****************************************************************************************************//** 1085 @short activate frame in hierarchy 1086 @descr This feature is used to mark active pathes in our frame hierarchy. 1087 You can be a listener for this event to react for it ... change some internal states or something else. 1088 1089 @seealso method deactivate() 1090 @seealso method isActivate() 1091 @seealso enum EActiveState 1092 @seealso listener mechanism 1093 1094 @param - 1095 @return - 1096 1097 @onerror - 1098 *//*-*****************************************************************************************************/ 1099 void SAL_CALL Frame::activate() throw( css::uno::RuntimeException ) 1100 { 1101 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1102 // Register transaction and reject wrong calls. 1103 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1104 1105 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1106 WriteGuard aWriteLock( m_aLock ); 1107 1108 // Copy neccessary member and free the lock. 1109 // It's not neccessary for m_aChildFrameContainer ... because 1110 // he is threadsafe himself and live if we live. 1111 // We use a registered transaction to prevent us against 1112 // breaks during this operation! 1113 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive() ; 1114 css::uno::Reference< css::frame::XFramesSupplier > xParent ( m_xParent, css::uno::UNO_QUERY ) ; 1115 css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 1116 css::uno::Reference< css::awt::XWindow > xComponentWindow( m_xComponentWindow, css::uno::UNO_QUERY ) ; 1117 EActiveState eState = m_eActiveState ; 1118 1119 aWriteLock.unlock(); 1120 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1121 1122 //_________________________________________________________________________________________________________ 1123 // 1) If I'am not active before ... 1124 if( eState == E_INACTIVE ) 1125 { 1126 // ... do it then. 1127 aWriteLock.lock(); 1128 eState = E_ACTIVE; 1129 m_eActiveState = eState; 1130 aWriteLock.unlock(); 1131 // Deactivate sibling path and forward activation to parent ... if any parent exist! 1132 if( xParent.is() == sal_True ) 1133 { 1134 // Everytime set THIS frame as active child of parent and activate it. 1135 // We MUST have a valid path from bottom to top as active path! 1136 // But we must deactivate the old active sibling path first. 1137 1138 // Attention: Deactivation of an active path, deactivate the whole path ... from bottom to top! 1139 // But we wish to deactivate founded sibling-tree only. 1140 // [ see deactivate() / step 4) for further informations! ] 1141 1142 xParent->setActiveFrame( xThis ); 1143 1144 // Then we can activate from here to top. 1145 // Attention: We are ACTIVE now. And the parent will call activate() at us! 1146 // But we do nothing then! We are already activated. 1147 xParent->activate(); 1148 } 1149 // Its neccessary to send event NOW - not before. 1150 // Activation goes from bottom to top! 1151 // Thats the reason to activate parent first and send event now. 1152 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_ACTIVATED ); 1153 } 1154 1155 //_________________________________________________________________________________________________________ 1156 // 2) I was active before or current activated and there is a path from here to bottom, who CAN be active. 1157 // But ouer direct child of path is not active yet. 1158 // (It can be, if activation occur in the middle of a current path!) 1159 // In these case we activate path to bottom to set focus on right frame! 1160 if ( 1161 ( eState == E_ACTIVE ) && 1162 ( xActiveChild.is() == sal_True ) && 1163 ( xActiveChild->isActive() == sal_False ) 1164 ) 1165 { 1166 xActiveChild->activate(); 1167 } 1168 1169 //_________________________________________________________________________________________________________ 1170 // 3) I was active before or current activated. But if I have no active child => I will get the focus! 1171 if ( 1172 ( eState == E_ACTIVE ) && 1173 ( xActiveChild.is() == sal_False ) 1174 ) 1175 { 1176 aWriteLock.lock(); 1177 eState = E_FOCUS; 1178 m_eActiveState = eState; 1179 aWriteLock.unlock(); 1180 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_ACTIVATED ); 1181 } 1182 } 1183 1184 /*-****************************************************************************************************//** 1185 @short deactivate frame in hierarchy 1186 @descr This feature is used to deactive pathes in our frame hierarchy. 1187 You can be a listener for this event to react for it ... change some internal states or something else. 1188 1189 @seealso method activate() 1190 @seealso method isActivate() 1191 @seealso enum EActiveState 1192 @seealso listener mechanism 1193 1194 @param - 1195 @return - 1196 1197 @onerror - 1198 *//*-*****************************************************************************************************/ 1199 void SAL_CALL Frame::deactivate() throw( css::uno::RuntimeException ) 1200 { 1201 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1202 // Register transaction and reject wrong calls. 1203 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1204 1205 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1206 WriteGuard aWriteLock( m_aLock ); 1207 1208 // Copy neccessary member and free the lock. 1209 css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive() ; 1210 css::uno::Reference< css::frame::XFramesSupplier > xParent ( m_xParent, css::uno::UNO_QUERY ) ; 1211 css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 1212 EActiveState eState = m_eActiveState ; 1213 1214 aWriteLock.unlock(); 1215 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1216 1217 // Work only, if there something to do! 1218 if( eState != E_INACTIVE ) 1219 { 1220 //_____________________________________________________________________________________________________ 1221 // 1) Deactivate all active childs. 1222 if ( 1223 ( xActiveChild.is() == sal_True ) && 1224 ( xActiveChild->isActive() == sal_True ) 1225 ) 1226 { 1227 xActiveChild->deactivate(); 1228 } 1229 1230 //_____________________________________________________________________________________________________ 1231 // 2) If I have the focus - I will lost it now. 1232 if( eState == E_FOCUS ) 1233 { 1234 // Set new state INACTIVE(!) and send message to all listener. 1235 // Don't set ACTIVE as new state. This frame is deactivated for next time - due to activate(). 1236 aWriteLock.lock(); 1237 eState = E_ACTIVE; 1238 m_eActiveState = eState ; 1239 aWriteLock.unlock(); 1240 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_UI_DEACTIVATING ); 1241 } 1242 1243 //_____________________________________________________________________________________________________ 1244 // 3) If I'am active - I will be deactivated now. 1245 if( eState == E_ACTIVE ) 1246 { 1247 // Set new state and send message to all listener. 1248 aWriteLock.lock(); 1249 eState = E_INACTIVE; 1250 m_eActiveState = eState ; 1251 aWriteLock.unlock(); 1252 implts_sendFrameActionEvent( css::frame::FrameAction_FRAME_DEACTIVATING ); 1253 } 1254 1255 //_____________________________________________________________________________________________________ 1256 // 4) If there is a path from here to my parent ... 1257 // ... I'am on the top or in the middle of deactivated subtree and action was started here. 1258 // I must deactivate all frames from here to top, which are members of current path. 1259 // Stop, if THESE frame not the active frame of ouer parent! 1260 if ( 1261 ( xParent.is() == sal_True ) && 1262 ( xParent->getActiveFrame() == xThis ) 1263 ) 1264 { 1265 // We MUST break the path - otherwise we will get the focus - not ouer parent! ... 1266 // Attention: Ouer parent don't call us again - WE ARE NOT ACTIVE YET! 1267 // [ see step 3 and condition "if ( m_eActiveState!=INACTIVE ) ..." in this method! ] 1268 xParent->deactivate(); 1269 } 1270 } 1271 } 1272 1273 /*-****************************************************************************************************//** 1274 @short returns active state 1275 @descr Call it to get informations about current active state of this frame. 1276 1277 @seealso method activate() 1278 @seealso method deactivate() 1279 @seealso enum EActiveState 1280 1281 @param - 1282 @return true if active, false otherwise. 1283 1284 @onerror No error should occure. 1285 *//*-*****************************************************************************************************/ 1286 sal_Bool SAL_CALL Frame::isActive() throw( css::uno::RuntimeException ) 1287 { 1288 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1289 // Register transaction and reject wrong calls. 1290 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1291 1292 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1293 ReadGuard aReadLock( m_aLock ); 1294 1295 return ( 1296 ( m_eActiveState == E_ACTIVE ) || 1297 ( m_eActiveState == E_FOCUS ) 1298 ); 1299 } 1300 1301 /*-****************************************************************************************************//** 1302 @short ??? 1303 @descr - 1304 1305 @seealso - 1306 1307 @param - 1308 @return - 1309 1310 @onerror - 1311 *//*-*****************************************************************************************************/ 1312 void SAL_CALL Frame::contextChanged() throw( css::uno::RuntimeException ) 1313 { 1314 // Look for rejected calls! 1315 // Sometimes called during closing object... => soft exceptions 1316 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 1317 // Impl-method is threadsafe himself! 1318 // Send event to all listener for frame actions. 1319 implts_sendFrameActionEvent( css::frame::FrameAction_CONTEXT_CHANGED ); 1320 } 1321 1322 /*-****************************************************************************************************//** 1323 @short set new component inside the frame 1324 @descr A frame is a container for a component. Use this method to set, change or realease it! 1325 We accept null references! The xComponentWindow will be a child of our container window 1326 and get all window events from us. 1327 1328 @attention (a) A current set component can disagree with the suspend() request! 1329 We don't set the new one and return with false then. 1330 (b) It's possible to set: 1331 (b1) a simple component here which supports the window only - no controller; 1332 (b2) a full featured component which supports window and controller; 1333 (b3) or both to NULL if outside code which to forget this component. 1334 1335 @seealso method getComponentWindow() 1336 @seealso method getController() 1337 1338 @param xComponentWindow 1339 valid reference to new component window which will be a child of internal container window 1340 May <NULL/> for releasing. 1341 @param xController 1342 reference to new component controller 1343 (may <NULL/> for relasing or setting of a simple component) 1344 1345 @return <TRUE/> if operation was successful, <FALSE/> otherwise. 1346 1347 @onerror We return <FALSE/>. 1348 @threadsafe yes 1349 @modified 06.05.2002 11:39, as96863 1350 *//*-*****************************************************************************************************/ 1351 sal_Bool SAL_CALL Frame::setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , 1352 const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ) 1353 { 1354 //_____________________________________________________________________________________________________ 1355 // Ignore this HACK of sfx2! 1356 // He call us with an valid controller without a valid window ... Thats not allowed! 1357 if ( xController.is() && ! xComponentWindow.is() ) 1358 return sal_True; 1359 1360 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1361 1362 //_____________________________________________________________________________________________________ 1363 // Get threadsafe some copies of used members. 1364 /* SAFE { */ 1365 ReadGuard aReadLock( m_aLock ); 1366 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; 1367 css::uno::Reference< css::awt::XWindow > xOldComponentWindow = m_xComponentWindow; 1368 css::uno::Reference< css::frame::XController > xOldController = m_xController; 1369 Window* pOwnWindow = VCLUnoHelper::GetWindow( xContainerWindow ); 1370 sal_Bool bHadFocus = pOwnWindow->HasChildPathFocus(); 1371 sal_Bool bWasConnected = m_bConnected; 1372 aReadLock.unlock(); 1373 /* } SAFE */ 1374 1375 //_____________________________________________________________________________________________________ 1376 // stop listening on old window 1377 // May it produce some trouble. 1378 // But don't forget to listen on new window again ... or reactivate listening 1379 // if we reject this setComponent() request and leave this method without changing the old window. 1380 implts_stopWindowListening(); 1381 1382 // Notify all listener, that this component (if current one exist) will be unloaded. 1383 if (bWasConnected) 1384 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_DETACHING ); 1385 1386 //_____________________________________________________________________________________________________ 1387 // otherwhise release old component first 1388 // Always release controller before releasing window, 1389 // because controller may want to access its window! 1390 // But check for real changes - may the new controller is the old one. 1391 if ( 1392 (xOldController.is() ) && 1393 (xOldController != xController) 1394 ) 1395 { 1396 /* ATTENTION 1397 Don't suspend the old controller here. Because the outside caller must do that 1398 by definition. We have to dispose it here only. 1399 */ 1400 1401 // Before we dispose this controller we should hide it inside this frame instance. 1402 // We hold it alive for next calls by using xOldController! 1403 /* SAFE {*/ 1404 WriteGuard aWriteLock( m_aLock ); 1405 m_xController = NULL; 1406 aWriteLock.unlock(); 1407 /* } SAFE */ 1408 1409 css::uno::Reference< css::lang::XComponent > xDisposable( xOldController, css::uno::UNO_QUERY ); 1410 if (xDisposable.is()) 1411 { 1412 try 1413 { 1414 xDisposable->dispose(); 1415 } 1416 catch(const css::lang::DisposedException&) 1417 {} 1418 } 1419 xOldController = NULL; 1420 } 1421 1422 //_____________________________________________________________________________________________________ 1423 // Now it's time to release the component window. 1424 // If controller wasn't released successfully - this code line shouldn't be reached. 1425 // Because in case of "suspend()==false" we return immediately with false ... 1426 // see before 1427 // Check for real changes too. 1428 if ( 1429 (xOldComponentWindow.is() ) && 1430 (xOldComponentWindow != xComponentWindow) 1431 ) 1432 { 1433 /* SAFE { */ 1434 WriteGuard aWriteLock( m_aLock ); 1435 m_xComponentWindow = NULL; 1436 aWriteLock.unlock(); 1437 /* } SAFE */ 1438 1439 css::uno::Reference< css::lang::XComponent > xDisposable( xOldComponentWindow, css::uno::UNO_QUERY ); 1440 if (xDisposable.is()) 1441 { 1442 try 1443 { 1444 xDisposable->dispose(); 1445 } 1446 catch(const css::lang::DisposedException&) 1447 {} 1448 } 1449 xOldComponentWindow = NULL; 1450 } 1451 1452 //_____________________________________________________________________________________________________ 1453 // Now it's time to set the new component ... 1454 // By the way - find out our new "load state" - means if we have a valid component inside. 1455 /* SAFE { */ 1456 WriteGuard aWriteLock( m_aLock ); 1457 m_xComponentWindow = xComponentWindow; 1458 m_xController = xController ; 1459 m_bConnected = (m_xComponentWindow.is() || m_xController.is()); 1460 sal_Bool bIsConnected = m_bConnected; 1461 aWriteLock.unlock(); 1462 /* } SAFE */ 1463 1464 //_____________________________________________________________________________________________________ 1465 // notifies all interest listener, that current component was changed or a new one was loaded 1466 if (bIsConnected && bWasConnected) 1467 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_REATTACHED ); 1468 else 1469 if (bIsConnected && !bWasConnected) 1470 implts_sendFrameActionEvent( css::frame::FrameAction_COMPONENT_ATTACHED ); 1471 1472 //_____________________________________________________________________________________________________ 1473 // A new component window doesn't know anything about current active/focus states. 1474 // Set this information on it! 1475 if ( 1476 (bHadFocus ) && 1477 (xComponentWindow.is()) 1478 ) 1479 { 1480 xComponentWindow->setFocus(); 1481 } 1482 1483 // If it was a new component window - we must resize it to fill out 1484 // our container window. 1485 implts_resizeComponentWindow(); 1486 // New component should change our current icon ... 1487 implts_setIconOnWindow(); 1488 // OK - start listening on new window again - or do nothing if it is an empty one. 1489 implts_startWindowListening(); 1490 1491 /* SAFE { */ 1492 aWriteLock.lock(); 1493 impl_checkMenuCloser(); 1494 aWriteLock.unlock(); 1495 /* } SAFE */ 1496 1497 return sal_True; 1498 } 1499 1500 /*-****************************************************************************************************//** 1501 @short returns current set component window 1502 @descr Frames are used to display components. The actual displayed component is 1503 held by the m_xComponentWindow property. If the component implements only a 1504 XComponent interface, the communication between the frame and the 1505 component is very restricted. Better integration is achievable through a 1506 XController interface. 1507 If the component wants other objects to be able to get information about its 1508 ResourceDescriptor it has to implement a XModel interface. 1509 This frame is the owner of the component window. 1510 1511 @seealso method setComponent() 1512 1513 @param - 1514 @return css::uno::Reference to current set component window. 1515 1516 @onerror A null reference is returned. 1517 *//*-*****************************************************************************************************/ 1518 css::uno::Reference< css::awt::XWindow > SAL_CALL Frame::getComponentWindow() throw( css::uno::RuntimeException ) 1519 { 1520 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1521 // Register transaction and reject wrong calls. 1522 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1523 1524 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1525 ReadGuard aReadLock( m_aLock ); 1526 1527 return m_xComponentWindow; 1528 } 1529 1530 /*-****************************************************************************************************//** 1531 @short returns current set controller 1532 @descr Frames are used to display components. The actual displayed component is 1533 held by the m_xComponentWindow property. If the component implements only a 1534 XComponent interface, the communication between the frame and the 1535 component is very restricted. Better integration is achievable through a 1536 XController interface. 1537 If the component wants other objects to be able to get information about its 1538 ResourceDescriptor it has to implement a XModel interface. 1539 This frame is the owner of the component window. 1540 1541 @seealso method setComponent() 1542 1543 @param - 1544 @return css::uno::Reference to current set controller. 1545 1546 @onerror A null reference is returned. 1547 *//*-*****************************************************************************************************/ 1548 css::uno::Reference< css::frame::XController > SAL_CALL Frame::getController() throw( css::uno::RuntimeException ) 1549 { 1550 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1551 // It seems to be unavoidable that disposed frames allow to ask for a Controller (#111452) 1552 // Register transaction and reject wrong calls. 1553 // TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1554 1555 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1556 ReadGuard aReadLock( m_aLock ); 1557 1558 return m_xController; 1559 } 1560 1561 /*-****************************************************************************************************//** 1562 @short add/remove listener for activate/deactivate/contextChanged events 1563 @descr - 1564 1565 @seealso method activate() 1566 @seealso method deactivate() 1567 @seealso method contextChanged() 1568 1569 @param "xListener" reference to your listener object 1570 @return - 1571 1572 @onerror Listener is ignored. 1573 *//*-*****************************************************************************************************/ 1574 void SAL_CALL Frame::addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) 1575 { 1576 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1577 // Check incoming parameter. 1578 LOG_ASSERT2( implcp_addFrameActionListener( xListener ), "Frame::addFrameActionListener()", "Invalid parameter detected." ) 1579 // Listener container is threadsafe by himself ... but we must look for rejected calls! 1580 // Our OMenuDispatch-helper (is a member of ODispatchProvider!) is create at startup of this frame BEFORE initialize! 1581 // => soft exceptions! 1582 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 1583 1584 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1585 m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::frame::XFrameActionListener >*)NULL ), xListener ); 1586 } 1587 1588 //***************************************************************************************************************** 1589 void SAL_CALL Frame::removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) 1590 { 1591 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1592 // Check incoming parameter. 1593 LOG_ASSERT2( implcp_removeFrameActionListener( xListener ), "Frame::removeFrameActionListener()", "Invalid parameter detected." ) 1594 // Listener container is threadsafe by himself ... but we must look for rejected calls after disposing! 1595 // But we must work with E_SOFTEXCEPTIONS ... because sometimes we are called from our listeners 1596 // during dispose! Our work mode is E_BEFORECLOSE then ... and E_HARDEXCEPTIONS whould throw a DisposedException. 1597 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 1598 1599 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 1600 m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::frame::XFrameActionListener >*)NULL ), xListener ); 1601 } 1602 1603 /*-****************************************************************************************************//** 1604 @short support two way mechanism to release a frame 1605 @descr This method ask internal component (controller) if he accept this close request. 1606 In case of <TRUE/> nothing will be happen (from point of caller of this close method). 1607 In case of <FALSE/> a CloseVetoException is thrown. After such exception given parameter 1608 <var>bDeliverOwnerShip</var> regulate which will be the new owner of this instance. 1609 1610 @attention It's the replacement for XTask::close() which is marked as obsolete method. 1611 1612 @param bDeliverOwnerShip 1613 If parameter is set to <FALSE/> the original caller will be the owner after thrown 1614 veto exception and must try to close this frame at later time again. Otherwhise the 1615 source of throwed exception is the right one. May it will be the frame himself. 1616 1617 @thrown CloseVetoException 1618 if any internal things willn't be closed 1619 1620 @threadsafe yes 1621 @modified 06.05.2002 08:33, as96863 1622 *//*-*****************************************************************************************************/ 1623 void SAL_CALL Frame::close( sal_Bool bDeliverOwnerShip ) throw( css::util::CloseVetoException, 1624 css::uno::RuntimeException ) 1625 { 1626 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1627 1628 // At the end of this method may we must dispose ourself ... 1629 // and may nobody from outside hold a reference to us ... 1630 // then it's a good idea to do that by ourself. 1631 css::uno::Reference< css::uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >(this) ); 1632 1633 // Check any close listener before we look for currently running internal processes. 1634 // Because if a listener disagree with this close() request - we hace time to finish this 1635 // internal operations too ... 1636 // Note: container is threadsafe himself. 1637 css::lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this)); 1638 ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >*) NULL ) ); 1639 if (pContainer!=NULL) 1640 { 1641 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); 1642 while (pIterator.hasMoreElements()) 1643 { 1644 try 1645 { 1646 ((css::util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnerShip ); 1647 } 1648 catch( css::uno::RuntimeException& ) 1649 { 1650 pIterator.remove(); 1651 } 1652 } 1653 } 1654 1655 // Ok - no listener disagreed with this close() request 1656 // check if this frame is used for any load process currently 1657 if (isActionLocked()) 1658 { 1659 if (bDeliverOwnerShip) 1660 { 1661 /* SAFE */ 1662 WriteGuard aWriteLock( m_aLock ); 1663 m_bSelfClose = sal_True; 1664 aWriteLock.unlock(); 1665 /* SAFE */ 1666 } 1667 1668 throw css::util::CloseVetoException(DECLARE_ASCII("Frame in use for loading document ..."),static_cast< ::cppu::OWeakObject*>(this)); 1669 } 1670 1671 if ( ! setComponent(NULL,NULL) ) 1672 throw css::util::CloseVetoException(DECLARE_ASCII("Component couldn't be deattached ..."),static_cast< ::cppu::OWeakObject*>(this)); 1673 1674 // If closing is allowed ... inform all istener and dispose this frame! 1675 pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >*) NULL ) ); 1676 if (pContainer!=NULL) 1677 { 1678 ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); 1679 while (pIterator.hasMoreElements()) 1680 { 1681 try 1682 { 1683 ((css::util::XCloseListener*)pIterator.next())->notifyClosing( aSource ); 1684 } 1685 catch( css::uno::RuntimeException& ) 1686 { 1687 pIterator.remove(); 1688 } 1689 } 1690 } 1691 1692 /* SAFE { */ 1693 WriteGuard aWriteLock( m_aLock ); 1694 m_bIsHidden = sal_True; 1695 aWriteLock.unlock(); 1696 /* } SAFE */ 1697 impl_checkMenuCloser(); 1698 1699 // Attention: We must release our own registered transaction here. Otherwhise following dispose() call 1700 // wait for us too .... 1701 aTransaction.stop(); 1702 dispose(); 1703 } 1704 1705 /*-****************************************************************************************************//** 1706 @short be a listener for close events! 1707 @descr Adds/remove a CloseListener at this frame instance. If the close() method is called on 1708 this object, the such listener are informed and can disagree with that by throwing 1709 a CloseVetoException. 1710 1711 @seealso Frame::close() 1712 1713 @param xListener 1714 reference to your listener object 1715 1716 @onerror Listener is ignored. 1717 1718 @threadsafe yes 1719 @modified 06.05.2002 10:03, as96863 1720 *//*-*****************************************************************************************************/ 1721 void SAL_CALL Frame::addCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException) 1722 { 1723 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1724 // We doesn't need any lock here ... 1725 // Container lives if we live and is threadsafe by himself. 1726 m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >* ) NULL ), xListener ); 1727 } 1728 1729 //***************************************************************************************************************** 1730 void SAL_CALL Frame::removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException) 1731 { 1732 // Use soft exception mode - moslty this method is called during disposing of this frame ... 1733 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 1734 // We doesn't need any lock here ... 1735 // Container lives if we live and is threadsafe by himself. 1736 m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::util::XCloseListener >* ) NULL ), xListener ); 1737 } 1738 1739 //***************************************************************************************************************** 1740 ::rtl::OUString SAL_CALL Frame::getTitle() 1741 throw (css::uno::RuntimeException) 1742 { 1743 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1744 1745 // SAFE -> 1746 ReadGuard aReadLock(m_aLock); 1747 css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW); 1748 aReadLock.unlock(); 1749 // <- SAFE 1750 1751 return xTitle->getTitle(); 1752 } 1753 1754 //***************************************************************************************************************** 1755 void SAL_CALL Frame::setTitle( const ::rtl::OUString& sTitle ) 1756 throw (css::uno::RuntimeException) 1757 { 1758 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1759 1760 // SAFE -> 1761 ReadGuard aReadLock(m_aLock); 1762 css::uno::Reference< css::frame::XTitle > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW); 1763 aReadLock.unlock(); 1764 // <- SAFE 1765 1766 xTitle->setTitle(sTitle); 1767 } 1768 1769 //***************************************************************************************************************** 1770 void SAL_CALL Frame::addTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) 1771 throw (css::uno::RuntimeException) 1772 { 1773 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1774 1775 // SAFE -> 1776 ReadGuard aReadLock(m_aLock); 1777 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW); 1778 aReadLock.unlock(); 1779 // <- SAFE 1780 1781 xTitle->addTitleChangeListener(xListener); 1782 } 1783 1784 //***************************************************************************************************************** 1785 void SAL_CALL Frame::removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener ) 1786 throw (css::uno::RuntimeException) 1787 { 1788 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1789 1790 // SAFE -> 1791 ReadGuard aReadLock(m_aLock); 1792 css::uno::Reference< css::frame::XTitleChangeBroadcaster > xTitle(m_xTitleHelper, css::uno::UNO_QUERY_THROW); 1793 aReadLock.unlock(); 1794 // <- SAFE 1795 1796 xTitle->removeTitleChangeListener(xListener); 1797 } 1798 1799 /*-****************************************************************************************************/ 1800 void Frame::implts_forgetSubFrames() 1801 { 1802 // SAFE -> 1803 ReadGuard aReadLock(m_aLock); 1804 css::uno::Reference< css::container::XIndexAccess > xContainer(m_xFramesHelper, css::uno::UNO_QUERY_THROW); 1805 aReadLock.unlock(); 1806 // <- SAFE 1807 1808 sal_Int32 c = xContainer->getCount(); 1809 sal_Int32 i = 0; 1810 1811 for (i=0; i<c; ++i) 1812 { 1813 try 1814 { 1815 css::uno::Reference< css::frame::XFrame > xFrame; 1816 xContainer->getByIndex(i) >>= xFrame; 1817 if (xFrame.is()) 1818 xFrame->setCreator(css::uno::Reference< css::frame::XFramesSupplier >()); 1819 } 1820 catch(const css::uno::Exception&) 1821 { 1822 // Ignore errors here. 1823 // Nobody can guarantee a stable index in multi threaded environments .-) 1824 } 1825 } 1826 1827 // SAFE -> 1828 WriteGuard aWriteLock(m_aLock); 1829 m_xFramesHelper.clear(); // clear uno reference 1830 m_aChildFrameContainer.clear(); // clear container content 1831 aWriteLock.unlock(); 1832 // <- SAFE 1833 } 1834 1835 /*-****************************************************************************************************//** 1836 @short destroy instance 1837 @descr The owner of this object calles the dispose method if the object 1838 should be destroyed. All other objects and components, that are registered 1839 as an EventListener are forced to release their references to this object. 1840 Furthermore this frame is removed from its parent frame container to release 1841 this reference. The reference attributes are disposed and released also. 1842 1843 @attention Look for globale description at beginning of file too! 1844 (DisposedException, FairRWLock ..., initialize, dispose) 1845 1846 @seealso method initialize() 1847 @seealso baseclass FairRWLockBase! 1848 1849 @param - 1850 @return - 1851 1852 @onerror - 1853 *//*-*****************************************************************************************************/ 1854 void SAL_CALL Frame::dispose() throw( css::uno::RuntimeException ) 1855 { 1856 // We should hold a reference to ourself ... 1857 // because our owner dispose us and release our reference ... 1858 // May be we will die before we could finish this method ... 1859 css::uno::Reference< css::frame::XFrame > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 1860 1861 LOG_DISPOSEEVENT( "Frame", sName ) 1862 1863 // First operation should be ... "stopp all listening for window events on our container window". 1864 // These events are superflous but can make trouble! 1865 // We will die, die and die ... 1866 implts_stopWindowListening(); 1867 1868 // Send message to all listener and forget her references. 1869 css::lang::EventObject aEvent( xThis ); 1870 m_aListenerContainer.disposeAndClear( aEvent ); 1871 1872 // set "end of live" for our property set helper 1873 impl_disablePropertySet(); 1874 1875 // interception/dispatch chain must be destructed explicitly 1876 // Otherwhise some dispatches and/or interception objects wont die. 1877 css::uno::Reference< css::lang::XEventListener > xDispatchHelper(m_xDispatchHelper, css::uno::UNO_QUERY_THROW); 1878 xDispatchHelper->disposing(aEvent); 1879 xDispatchHelper.clear(); 1880 1881 // Disable this instance for further work. 1882 // This will wait for all current running ones ... 1883 // and reject all further requests! 1884 m_aTransactionManager.setWorkingMode( E_BEFORECLOSE ); 1885 1886 // Don't show any dialogs, errors or something else any more! 1887 // If somewhere called dispose() whitout close() before - normaly no dialogs 1888 // should exist. Otherwhise it's the problem of the outside caller. 1889 // Note: 1890 // (a) Do it after stopWindowListening(). May that force some active/deactive 1891 // notifications which we doesn't need here realy. 1892 // (b) Don't forget to save the old value of IsDialogCancelEnabled() to 1893 // restore it afterwards. We cannot call EnableDialogCancel( sal_False ) 1894 // as we would kill the headless mode! 1895 sal_Bool bCancelDialogs( Application::IsDialogCancelEnabled() ); 1896 Application::EnableDialogCancel( sal_True ); 1897 1898 // We should be alone for ever and further dispose calls are rejected by lines before ... 1899 // I hope it :-) 1900 1901 // Free references of our frame tree. 1902 // Force parent container to forget this frame too ... 1903 // ( It's contained in m_xParent and so no css::lang::XEventListener for m_xParent! ) 1904 // It's important to do that before we free some other internal structures. 1905 // Because if our parent gets an activate and found us as last possible active frame 1906 // he try to deactivate us ... and we run into some trouble (DisposedExceptions!). 1907 if( m_xParent.is() == sal_True ) 1908 { 1909 m_xParent->getFrames()->remove( xThis ); 1910 m_xParent = css::uno::Reference< css::frame::XFramesSupplier >(); 1911 } 1912 1913 /* } SAFE */ 1914 // Forget our internal component and her window first. 1915 // So we can release our container window later without problems. 1916 // Because this container window is the parent of the component window ... 1917 // Note: Dispose it hard - because suspending must be done inside close() call! 1918 // But try to dispose the controller first befor you destroy the window. 1919 // Because the window is used by the controller too ... 1920 if (m_xController.is()) 1921 { 1922 css::uno::Reference< css::lang::XComponent > xDisposable( m_xController, css::uno::UNO_QUERY ); 1923 if (xDisposable.is()) 1924 xDisposable->dispose(); 1925 } 1926 1927 if (m_xComponentWindow.is()) 1928 { 1929 css::uno::Reference< css::lang::XComponent > xDisposable( m_xComponentWindow, css::uno::UNO_QUERY ); 1930 if (xDisposable.is()) 1931 xDisposable->dispose(); 1932 } 1933 1934 impl_checkMenuCloser(); 1935 1936 impl_disposeContainerWindow( m_xContainerWindow ); 1937 1938 /*ATTENTION 1939 Clear container after successful removing from parent container ... 1940 because our parent could be the desktop which stand in dispose too! 1941 If we have already cleared our own container we lost our child before this could be 1942 remove himself at this instance ... 1943 Release m_xFramesHelper after that ... it's the same problem between parent and child! 1944 "m_xParent->getFrames()->remove( xThis );" needs this helper ... 1945 Otherwise we get a null reference and could finish removing successfuly. 1946 => You see: Order of calling operations is important!!! 1947 */ 1948 implts_forgetSubFrames(); 1949 1950 // Release some other references. 1951 // This calls should be easy ... I hope it :-) 1952 m_xDispatchHelper.clear(); 1953 m_xFactory.clear(); 1954 m_xDropTargetListener.clear(); 1955 m_xDispatchRecorderSupplier.clear(); 1956 m_xLayoutManager.clear(); 1957 m_xIndicatorFactoryHelper.clear(); 1958 1959 // It's important to set default values here! 1960 // If may be later somewhere change the disposed-behaviour of this implementation 1961 // and doesn't throw any DisposedExceptions we must guarantee best matching default values ... 1962 m_eActiveState = E_INACTIVE; 1963 m_sName = ::rtl::OUString(); 1964 m_bIsFrameTop = sal_False; 1965 m_bConnected = sal_False; 1966 m_nExternalLockCount = 0; 1967 m_bSelfClose = sal_False; 1968 m_bIsHidden = sal_True; 1969 1970 // Disable this instance for further working realy! 1971 m_aTransactionManager.setWorkingMode( E_CLOSE ); 1972 1973 // Don't forget it restore old value - 1974 // otherwhise no dialogs can be shown anymore in other frames. 1975 Application::EnableDialogCancel( bCancelDialogs ); 1976 } 1977 1978 /*-****************************************************************************************************//** 1979 @short Be a listener for dispose events! 1980 @descr Adds/remove an EventListener to this object. If the dispose method is called on 1981 this object, the disposing method of the listener is called. 1982 1983 @seealso - 1984 1985 @param "xListener" reference to your listener object. 1986 @return - 1987 1988 @onerror Listener is ignored. 1989 *//*-*****************************************************************************************************/ 1990 void SAL_CALL Frame::addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) 1991 { 1992 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 1993 // Check incoming parameter. 1994 LOG_ASSERT2( implcp_addEventListener( xListener ), "Frame::addEventListener()", "Invalid parameter detected." ) 1995 // Look for rejected calls only! 1996 // Container is threadsafe. 1997 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 1998 1999 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2000 m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener ); 2001 } 2002 2003 //***************************************************************************************************************** 2004 void SAL_CALL Frame::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) 2005 { 2006 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2007 // Check incoming parameter. 2008 LOG_ASSERT2( implcp_removeEventListener( xListener ), "Frame::removeEventListener()", "Invalid parameter detected." ) 2009 // Look for rejected calls only! 2010 // Container is threadsafe. 2011 // Use E_SOFTEXCEPTIONS to allow removing listeners during dispose call! 2012 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2013 2014 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2015 m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener ); 2016 } 2017 2018 /*-****************************************************************************************************//** 2019 @short create new status indicator 2020 @descr Use returned status indicator to show progresses and some text informations. 2021 All created objects share the same dialog! Only the last one can show his information. 2022 2023 @seealso class StatusIndicatorFactory 2024 @seealso class StatusIndicator 2025 2026 @param - 2027 @return A reference to created object. 2028 2029 @onerror We return a null reference. 2030 *//*-*****************************************************************************************************/ 2031 css::uno::Reference< css::task::XStatusIndicator > SAL_CALL Frame::createStatusIndicator() throw( css::uno::RuntimeException ) 2032 { 2033 /* UNSAFE AREA ----------------------------------------------------------------------------------------- */ 2034 // Look for rejected calls! 2035 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2036 2037 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2038 ReadGuard aReadLock( m_aLock ); 2039 2040 // Make snapshot of neccessary member and define default return value. 2041 css::uno::Reference< css::task::XStatusIndicator > xExternal(m_xIndicatorInterception.get(), css::uno::UNO_QUERY); 2042 css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory = m_xIndicatorFactoryHelper; 2043 2044 aReadLock.unlock(); 2045 /* UNSAFE AREA ----------------------------------------------------------------------------------------- */ 2046 2047 // Was set from outside to intercept any progress activities! 2048 if (xExternal.is()) 2049 return xExternal; 2050 2051 // Or use our own factory as fallback, to create such progress. 2052 if (xFactory.is()) 2053 return xFactory->createStatusIndicator(); 2054 2055 return css::uno::Reference< css::task::XStatusIndicator >(); 2056 } 2057 2058 /*-****************************************************************************************************//** 2059 @short search for target to load URL 2060 @descr This method searches for a dispatch for the specified DispatchDescriptor. 2061 The FrameSearchFlags and the FrameName of the DispatchDescriptor are 2062 treated as described for findFrame. 2063 2064 @seealso method findFrame() 2065 @seealso method queryDispatches() 2066 @seealso method set/getName() 2067 @seealso class TargetFinder 2068 2069 @param "aURL" , URL for loading 2070 @param "sTargetFrameName" , name of target frame 2071 @param "nSearchFlags" , additional flags to regulate search if sTargetFrameName isn't clear 2072 @return css::uno::Reference to dispatch handler. 2073 2074 @onerror A null reference is returned. 2075 *//*-*****************************************************************************************************/ 2076 css::uno::Reference< css::frame::XDispatch > SAL_CALL Frame::queryDispatch( const css::util::URL& aURL , 2077 const ::rtl::OUString& sTargetFrameName, 2078 sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ) 2079 { 2080 const char UNO_PROTOCOL[] = ".uno:"; 2081 2082 // Don't check incoming parameter here! Our helper do it for us and it isn't a good idea to do it more then ones! 2083 // But look for rejected calls! 2084 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2085 2086 // Remove uno and cmd protocol part as we want to support both of them. We store only the command part 2087 // in our hash map. All other protocols are stored with the protocol part. 2088 String aCommand( aURL.Main ); 2089 if ( aURL.Protocol.equalsIgnoreAsciiCaseAsciiL( UNO_PROTOCOL, sizeof( UNO_PROTOCOL )-1 )) 2090 aCommand = aURL.Path; 2091 2092 // Make hash_map lookup if the current URL is in the disabled list 2093 if ( m_aCommandOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, aCommand ) ) 2094 return css::uno::Reference< css::frame::XDispatch >(); 2095 else 2096 { 2097 // We use a helper to support these interface and an interceptor mechanism. 2098 // Our helper is threadsafe by himself! 2099 return m_xDispatchHelper->queryDispatch( aURL, sTargetFrameName, nSearchFlags ); 2100 } 2101 } 2102 2103 /*-****************************************************************************************************//** 2104 @short handle more then ones dispatches at same call 2105 @descr Returns a sequence of dispatches. For details see the queryDispatch method. 2106 For failed dispatches we return empty items in list! 2107 2108 @seealso method queryDispatch() 2109 2110 @param "lDescriptor" list of dispatch arguments for queryDispatch()! 2111 @return List of dispatch references. Some elements can be NULL! 2112 2113 @onerror An empty list is returned. 2114 *//*-*****************************************************************************************************/ 2115 css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Frame::queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ) 2116 { 2117 // Don't check incoming parameter here! Our helper do it for us and it isn't a good idea to do it more then ones! 2118 // But look for rejected calls! 2119 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2120 2121 // We use a helper to support these interface and an interceptor mechanism. 2122 // Our helper is threadsafe by himself! 2123 return m_xDispatchHelper->queryDispatches( lDescriptor ); 2124 } 2125 2126 /*-****************************************************************************************************//** 2127 @short register/unregister interceptor for dispatch calls 2128 @descr If you whish to handle some dispatches by himself ... you should be 2129 an interceptor for it. Please see class OInterceptionHelper for further informations. 2130 2131 @seealso class OInterceptionHelper 2132 2133 @param "xInterceptor", reference to your interceptor implementation. 2134 @return - 2135 2136 @onerror Interceptor is ignored. 2137 *//*-*****************************************************************************************************/ 2138 void SAL_CALL Frame::registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ) 2139 { 2140 // We use a helper to support these interface and an interceptor mechanism. 2141 // This helper is threadsafe himself and check incoming parameter too. 2142 // I think we don't need any lock here! 2143 // But we must look for rejected calls. 2144 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2145 2146 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper( m_xDispatchHelper, css::uno::UNO_QUERY ); 2147 xInterceptionHelper->registerDispatchProviderInterceptor( xInterceptor ); 2148 } 2149 2150 //***************************************************************************************************************** 2151 void SAL_CALL Frame::releaseDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ) 2152 { 2153 // We use a helper to support these interface and an interceptor mechanism. 2154 // This helper is threadsafe himself and check incoming parameter too. 2155 // I think we don't need any lock here! 2156 // But we must look for rejected calls ... 2157 // Sometimes we are called during our dispose() method ... => soft exceptions! 2158 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2159 2160 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper( m_xDispatchHelper, css::uno::UNO_QUERY ); 2161 xInterceptionHelper->releaseDispatchProviderInterceptor( xInterceptor ); 2162 } 2163 2164 /*-****************************************************************************************************//** 2165 @short provides information about all possible dispatch functions 2166 inside the currnt frame environment 2167 *//*-*****************************************************************************************************/ 2168 css::uno::Sequence< sal_Int16 > SAL_CALL Frame::getSupportedCommandGroups() 2169 throw(css::uno::RuntimeException) 2170 { 2171 return m_xDispatchInfoHelper->getSupportedCommandGroups(); 2172 } 2173 2174 //***************************************************************************************************************** 2175 css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL Frame::getConfigurableDispatchInformation(sal_Int16 nCommandGroup) 2176 throw(css::uno::RuntimeException) 2177 { 2178 return m_xDispatchInfoHelper->getConfigurableDispatchInformation(nCommandGroup); 2179 } 2180 2181 /*-****************************************************************************************************//** 2182 @short notifications for window events 2183 @descr We are a listener on our container window to forward it to our component window. 2184 2185 @seealso method setComponent() 2186 @seealso member m_xContainerWindow 2187 @seealso member m_xComponentWindow 2188 2189 @param "aEvent" describe source of detected event 2190 @return - 2191 2192 @onerror - 2193 *//*-*****************************************************************************************************/ 2194 void SAL_CALL Frame::windowResized( const css::awt::WindowEvent& 2195 #if OSL_DEBUG_LEVEL > 0 2196 aEvent 2197 #endif 2198 ) throw( css::uno::RuntimeException ) 2199 { 2200 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2201 // Check incoming parameter. 2202 LOG_ASSERT2( implcp_windowResized( aEvent ), "Frame::windowResized()", "Invalid parameter detected." ) 2203 // Look for rejected calls. 2204 // Part of dispose-mechanism => soft exceptions 2205 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2206 2207 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2208 // Impl-method is threadsafe! 2209 // If we have a current component window - we must resize it! 2210 implts_resizeComponentWindow(); 2211 } 2212 2213 //***************************************************************************************************************** 2214 void SAL_CALL Frame::focusGained( const css::awt::FocusEvent& 2215 #if OSL_DEBUG_LEVEL > 0 2216 aEvent 2217 #endif 2218 ) throw( css::uno::RuntimeException ) 2219 { 2220 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2221 // Check incoming parameter. 2222 LOG_ASSERT2( implcp_focusGained( aEvent ), "Frame::focusGained()", "Invalid parameter detected." ) 2223 // Look for rejected calls. 2224 // Part of dispose() mechanism ... => soft exceptions! 2225 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2226 2227 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2228 ReadGuard aReadLock( m_aLock ); 2229 // Make snapshot of member! 2230 css::uno::Reference< css::awt::XWindow > xComponentWindow = m_xComponentWindow; 2231 aReadLock.unlock(); 2232 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2233 2234 if( xComponentWindow.is() == sal_True ) 2235 { 2236 xComponentWindow->setFocus(); 2237 } 2238 } 2239 2240 /*-****************************************************************************************************//** 2241 @short notifications for window events 2242 @descr We are a listener on our container window to forward it to our component window ... 2243 but a XTopWindowListener we are only if we are a top frame! 2244 2245 @seealso method setComponent() 2246 @seealso member m_xContainerWindow 2247 @seealso member m_xComponentWindow 2248 2249 @param "aEvent" describe source of detected event 2250 @return - 2251 2252 @onerror - 2253 *//*-*****************************************************************************************************/ 2254 void SAL_CALL Frame::windowActivated( const css::lang::EventObject& 2255 #if OSL_DEBUG_LEVEL > 0 2256 aEvent 2257 #endif 2258 ) throw( css::uno::RuntimeException ) 2259 { 2260 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2261 // Check incoming parameter. 2262 LOG_ASSERT2( implcp_windowActivated( aEvent ), "Frame::windowActivated()", "Invalid parameter detected." ) 2263 // Look for rejected calls. 2264 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2265 2266 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2267 ReadGuard aReadLock( m_aLock ); 2268 // Make snapshot of member! 2269 EActiveState eState = m_eActiveState; 2270 aReadLock.unlock(); 2271 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2272 // Activate the new active path from here to top. 2273 if( eState == E_INACTIVE ) 2274 { 2275 // CheckMenuCloser_Impl(); 2276 setActiveFrame( css::uno::Reference< css::frame::XFrame >() ); 2277 activate(); 2278 } 2279 } 2280 2281 //***************************************************************************************************************** 2282 void SAL_CALL Frame::windowDeactivated( const css::lang::EventObject& 2283 #if OSL_DEBUG_LEVEL > 0 2284 aEvent 2285 #endif 2286 ) throw( css::uno::RuntimeException ) 2287 { 2288 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2289 // Check incoming parameter. 2290 LOG_ASSERT2( implcp_windowDeactivated( aEvent ), "Frame::windowDeactivated()", "Invalid parameter detected." ) 2291 // Look for rejected calls. 2292 // Sometimes called during dispose() => soft exceptions 2293 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2294 2295 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2296 ReadGuard aReadLock( m_aLock ); 2297 2298 css::uno::Reference< css::frame::XFrame > xParent ( m_xParent, css::uno::UNO_QUERY ); 2299 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; 2300 EActiveState eActiveState = m_eActiveState ; 2301 2302 aReadLock.unlock(); 2303 2304 if( eActiveState != E_INACTIVE ) 2305 { 2306 // Deactivation is always done implicitely by activation of another frame. 2307 // Only if no activation is done, deactivations have to be processed if the activated window 2308 // is a parent window of the last active Window! 2309 ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); 2310 // CheckMenuCloser_Impl(); 2311 Window* pFocusWindow = Application::GetFocusWindow(); 2312 if ( 2313 ( xContainerWindow.is() == sal_True ) && 2314 ( xParent.is() == sal_True ) && 2315 ( (css::uno::Reference< css::frame::XDesktop >( xParent, css::uno::UNO_QUERY )).is() == sal_False ) 2316 ) 2317 { 2318 css::uno::Reference< css::awt::XWindow > xParentWindow = xParent->getContainerWindow() ; 2319 Window* pParentWindow = VCLUnoHelper::GetWindow( xParentWindow ); 2320 //#i70261#: dialogs opend from an OLE object will cause a deactivate on the frame of the OLE object 2321 // on Solaris/Linux at that time pFocusWindow is still NULL because the focus handling is different; right after 2322 // the deactivation the focus will be set into the dialog! 2323 // currently I see no case where a sub frame could get a deactivate with pFocusWindow being NULL permanently 2324 // so for now this case is omitted from handled deactivations 2325 if( pFocusWindow && pParentWindow->IsChild( pFocusWindow ) ) 2326 { 2327 css::uno::Reference< css::frame::XFramesSupplier > xSupplier( xParent, css::uno::UNO_QUERY ); 2328 if( xSupplier.is() == sal_True ) 2329 { 2330 aSolarGuard.clear(); 2331 xSupplier->setActiveFrame( css::uno::Reference< css::frame::XFrame >() ); 2332 } 2333 } 2334 } 2335 } 2336 } 2337 2338 //***************************************************************************************************************** 2339 void SAL_CALL Frame::windowClosing( const css::lang::EventObject& ) throw( css::uno::RuntimeException ) 2340 { 2341 /* #i62088# 2342 Some interceptor objects intercept our "internaly asynchronoues implemented" dispatch call. 2343 And they close this frame directly (means synchronous then). 2344 Means: Frame::windowClosing()->Frame::close() 2345 In such situation its not a good idea to hold this transaction count alive .-) 2346 */ 2347 { 2348 // Look for rejected calls. 2349 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2350 // deactivate this frame ... 2351 deactivate(); 2352 } 2353 2354 // ... and try to close it 2355 // But do it asynchron inside the main thread. 2356 // VCL has no fun to do such things outside his main thread :-( 2357 // Note: The used dispatch make it asynchronous for us .-) 2358 2359 /*ATTENTION! 2360 Don't try to suspend the controller here! Because it's done inside used dispatch(). 2361 Otherwhise the dialog "would you save your changes?" will be shown more then once ... 2362 */ 2363 2364 /* SAFE */ 2365 ReadGuard aReadLock( m_aLock ); 2366 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; 2367 aReadLock.unlock(); 2368 /* SAFE */ 2369 2370 css::util::URL aURL; 2371 aURL.Complete = DECLARE_ASCII(".uno:CloseFrame"); 2372 css::uno::Reference< css::util::XURLTransformer > xParser(xFactory->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); 2373 xParser->parseStrict(aURL); 2374 2375 css::uno::Reference< css::frame::XDispatch > xCloser = queryDispatch(aURL, SPECIALTARGET_SELF, 0); 2376 if (xCloser.is()) 2377 xCloser->dispatch(aURL, css::uno::Sequence< css::beans::PropertyValue >()); 2378 2379 // Attention: If this dispatch works synchronous ... and full fill its job ... 2380 // this line of code will never be reached ... 2381 // Or if it will be reached it will be for sure that all your member are gone .-) 2382 } 2383 2384 /*-****************************************************************************************************//** 2385 @short react for a show event for the internal container window 2386 @descr Normaly we doesn't need this information realy. But we can use it to 2387 implement the special feature "trigger first visible task". 2388 2389 Algorithm: - first we have to check if we are a top (task) frame 2390 It's not enough to be a top frame! Because we MUST have the desktop as parent. 2391 But frames without a parent are top too. So it's not possible to check isTop() here! 2392 We have to look for the type of our parent. 2393 - if we are a task frame, then we have to check if we are the first one. 2394 We use a static variable to do so. They will be reset to afterwards be shure 2395 that further calls of this method doesn't do anything then. 2396 - Then we have to trigger the right event string on the global job executor. 2397 2398 @seealso css::task::JobExecutor 2399 2400 @param aEvent 2401 describes the source of this event 2402 We are not interested on this information. We are interested on the visible state only. 2403 2404 @threadsafe yes 2405 @modified 31.07.2002 07:56, as96863 2406 *//*-*****************************************************************************************************/ 2407 void SAL_CALL Frame::windowShown( const css::lang::EventObject& ) throw(css::uno::RuntimeException) 2408 { 2409 static sal_Bool bFirstVisibleTask = sal_True; 2410 2411 /* SAFE { */ 2412 ReadGuard aReadLock(m_aLock); 2413 css::uno::Reference< css::frame::XDesktop > xDesktopCheck( m_xParent, css::uno::UNO_QUERY ); 2414 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory; 2415 m_bIsHidden = sal_False; 2416 aReadLock.unlock(); 2417 /* } SAFE */ 2418 2419 impl_checkMenuCloser(); 2420 2421 if (xDesktopCheck.is()) 2422 { 2423 /* STATIC SAFE { */ 2424 WriteGuard aStaticWriteLock( LockHelper::getGlobalLock() ); 2425 sal_Bool bMustBeTriggered = bFirstVisibleTask; 2426 bFirstVisibleTask = sal_False; 2427 aStaticWriteLock.unlock(); 2428 /* } STATIC SAFE */ 2429 2430 if (bMustBeTriggered) 2431 { 2432 css::uno::Reference< css::task::XJobExecutor > xExecutor( xFactory->createInstance( SERVICENAME_JOBEXECUTOR ), css::uno::UNO_QUERY ); 2433 if (xExecutor.is()) 2434 { 2435 xExecutor->trigger( DECLARE_ASCII("onFirstVisibleTask") ); 2436 } 2437 } 2438 } 2439 } 2440 2441 void SAL_CALL Frame::windowHidden( const css::lang::EventObject& ) throw(css::uno::RuntimeException) 2442 { 2443 /* SAFE { */ 2444 ReadGuard aReadLock(m_aLock); 2445 m_bIsHidden = sal_True; 2446 aReadLock.unlock(); 2447 /* } SAFE */ 2448 2449 impl_checkMenuCloser(); 2450 } 2451 2452 /*-****************************************************************************************************//** 2453 @short called by dispose of our windows! 2454 @descr This object is forced to release all references to the interfaces given 2455 by the parameter source. We are a listener at our container window and 2456 should listen for his diposing. 2457 2458 @seealso XWindowListener 2459 @seealso XTopWindowListener 2460 @seealso XFocusListener 2461 2462 @param - 2463 @return - 2464 2465 @onerror - 2466 *//*-*****************************************************************************************************/ 2467 void SAL_CALL Frame::disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) 2468 { 2469 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2470 // Check incoming parameter. 2471 LOG_ASSERT2( implcp_disposing( aEvent ), "Frame::disposing()", "Invalid parameter detected." ) 2472 // Look for rejected calls. 2473 // May be we are called during releasing our windows in our in dispose call!? => soft exceptions 2474 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2475 2476 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2477 WriteGuard aWriteLock( m_aLock ); 2478 2479 if( aEvent.Source == m_xContainerWindow ) 2480 { 2481 // NECCESSARY: Impl-method is threadsafe by himself! 2482 aWriteLock.unlock(); 2483 implts_stopWindowListening(); 2484 aWriteLock.lock(); 2485 m_xContainerWindow = css::uno::Reference< css::awt::XWindow >(); 2486 } 2487 } 2488 2489 /*-************************************************************************************************************//** 2490 @interface com.sun.star.document.XActionLockable 2491 @short implement locking of frame/task from outside 2492 @descr Sometimes we have problems to decide if closing of task is allowed. Because; frame/task 2493 could be used for pending loading jobs. So you can lock this object from outside and 2494 prevent instance against closing during using! But - don't do it in a wrong or expensive manner. 2495 Otherwise task couldn't die anymore!!! 2496 2497 @seealso interface XActionLockable 2498 @seeelso method BaseDispatcher::implts_loadIt() 2499 @seeelso method Desktop::loadComponentFromURL() 2500 2501 @param - 2502 @return true if frame/task is locked 2503 false otherwise 2504 2505 @onerror - 2506 @threadsafe yes 2507 *//*-*************************************************************************************************************/ 2508 sal_Bool SAL_CALL Frame::isActionLocked() throw( css::uno::RuntimeException ) 2509 { 2510 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2511 ReadGuard aReadLock( m_aLock ); 2512 return( m_nExternalLockCount!=0); 2513 } 2514 2515 //***************************************************************************************************************** 2516 void SAL_CALL Frame::addActionLock() throw( css::uno::RuntimeException ) 2517 { 2518 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2519 WriteGuard aWriteLock( m_aLock ); 2520 ++m_nExternalLockCount; 2521 } 2522 2523 //***************************************************************************************************************** 2524 void SAL_CALL Frame::removeActionLock() throw( css::uno::RuntimeException ) 2525 { 2526 // Register no transaction here! Otherwhise we wait for ever inside possible 2527 // implts_checkSuicide()/dispose() request ... 2528 2529 /* SAFE AREA */{ 2530 WriteGuard aWriteLock( m_aLock ); 2531 LOG_ASSERT2( m_nExternalLockCount<=0, "Frame::removeActionLock()", "Frame isn't locked! Possible multithreading problem detected." ) 2532 --m_nExternalLockCount; 2533 }/* SAFE */ 2534 2535 implts_checkSuicide(); 2536 } 2537 2538 //***************************************************************************************************************** 2539 void SAL_CALL Frame::setActionLocks( sal_Int16 nLock ) throw( css::uno::RuntimeException ) 2540 { 2541 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2542 WriteGuard aWriteLock( m_aLock ); 2543 // Attention: If somewhere called resetActionLocks() before and get e.g. 5 locks ... 2544 // and tried to set these 5 ones here after his operations ... 2545 // we can't ignore setted requests during these two calls! 2546 // So we must add(!) these 5 locks here. 2547 m_nExternalLockCount = m_nExternalLockCount + nLock; 2548 } 2549 2550 //***************************************************************************************************************** 2551 sal_Int16 SAL_CALL Frame::resetActionLocks() throw( css::uno::RuntimeException ) 2552 { 2553 // Register no transaction here! Otherwhise we wait for ever inside possible 2554 // implts_checkSuicide()/dispose() request ... 2555 2556 sal_Int16 nCurrentLocks = 0; 2557 /* SAFE */{ 2558 WriteGuard aWriteLock( m_aLock ); 2559 nCurrentLocks = m_nExternalLockCount; 2560 m_nExternalLockCount = 0; 2561 }/* SAFE */ 2562 2563 // Attention: 2564 // external lock count is 0 here every time ... but if 2565 // member m_bSelfClose is set to true too .... we call our own close()/dispose(). 2566 // See close() for further informations 2567 implts_checkSuicide(); 2568 2569 return nCurrentLocks; 2570 } 2571 2572 //***************************************************************************************************************** 2573 void Frame::impl_initializePropInfo() 2574 { 2575 impl_setPropertyChangeBroadcaster(static_cast< css::frame::XFrame* >(this)); 2576 2577 impl_addPropertyInfo( 2578 css::beans::Property( 2579 FRAME_PROPNAME_DISPATCHRECORDERSUPPLIER, 2580 FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER, 2581 ::getCppuType((const css::uno::Reference< css::frame::XDispatchRecorderSupplier >*)NULL), 2582 css::beans::PropertyAttribute::TRANSIENT)); 2583 2584 impl_addPropertyInfo( 2585 css::beans::Property( 2586 FRAME_PROPNAME_INDICATORINTERCEPTION, 2587 FRAME_PROPHANDLE_INDICATORINTERCEPTION, 2588 ::getCppuType((const css::uno::Reference< css::task::XStatusIndicator >*)NULL), 2589 css::beans::PropertyAttribute::TRANSIENT)); 2590 2591 impl_addPropertyInfo( 2592 css::beans::Property( 2593 FRAME_PROPNAME_ISHIDDEN, 2594 FRAME_PROPHANDLE_ISHIDDEN, 2595 ::getBooleanCppuType(), 2596 css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY)); 2597 2598 impl_addPropertyInfo( 2599 css::beans::Property( 2600 FRAME_PROPNAME_LAYOUTMANAGER, 2601 FRAME_PROPHANDLE_LAYOUTMANAGER, 2602 ::getCppuType((const css::uno::Reference< ::com::sun::star::frame::XLayoutManager >*)NULL), 2603 css::beans::PropertyAttribute::TRANSIENT)); 2604 2605 impl_addPropertyInfo( 2606 css::beans::Property( 2607 FRAME_PROPNAME_TITLE, 2608 FRAME_PROPHANDLE_TITLE, 2609 ::getCppuType((const ::rtl::OUString*)NULL), 2610 css::beans::PropertyAttribute::TRANSIENT)); 2611 } 2612 2613 //***************************************************************************************************************** 2614 void SAL_CALL Frame::impl_setPropertyValue(const ::rtl::OUString& /*sProperty*/, 2615 sal_Int32 nHandle , 2616 const css::uno::Any& aValue ) 2617 2618 { 2619 static ::rtl::OUString MATERIALPROP_TITLE = ::rtl::OUString::createFromAscii("title"); 2620 2621 /* There is no need to lock any mutex here. Because we share the 2622 solar mutex with our base class. And we said to our base class: "dont release it on calling us" .-) 2623 see ctor of PropertySetHelper for further informations. 2624 */ 2625 2626 /* Attention: You can use nHandle only, if you are sure that all supported 2627 properties has an unique handle. That must be guaranteed 2628 inside method impl_initializePropInfo()! 2629 */ 2630 switch (nHandle) 2631 { 2632 case FRAME_PROPHANDLE_TITLE : 2633 { 2634 ::rtl::OUString sExternalTitle; 2635 aValue >>= sExternalTitle; 2636 setTitle (sExternalTitle); 2637 } 2638 break; 2639 2640 case FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER : 2641 aValue >>= m_xDispatchRecorderSupplier; 2642 break; 2643 2644 case FRAME_PROPHANDLE_LAYOUTMANAGER : 2645 { 2646 css::uno::Reference< css::frame::XLayoutManager > xOldLayoutManager = m_xLayoutManager; 2647 css::uno::Reference< css::frame::XLayoutManager > xNewLayoutManager; 2648 aValue >>= xNewLayoutManager; 2649 2650 if (xOldLayoutManager != xNewLayoutManager) 2651 { 2652 m_xLayoutManager = xNewLayoutManager; 2653 if (xOldLayoutManager.is()) 2654 lcl_disableLayoutManager(xOldLayoutManager, this); 2655 if (xNewLayoutManager.is()) 2656 lcl_enableLayoutManager(xNewLayoutManager, this); 2657 } 2658 } 2659 break; 2660 2661 case FRAME_PROPHANDLE_INDICATORINTERCEPTION : 2662 { 2663 css::uno::Reference< css::task::XStatusIndicator > xProgress; 2664 aValue >>= xProgress; 2665 m_xIndicatorInterception = xProgress; 2666 } 2667 break; 2668 2669 #ifdef ENABLE_WARNINGS 2670 default : 2671 LOG_WARNING( "Frame::setFastPropertyValue_NoBroadcast()", "Invalid handle detected!" ) 2672 break; 2673 #endif 2674 } 2675 } 2676 2677 //***************************************************************************************************************** 2678 css::uno::Any SAL_CALL Frame::impl_getPropertyValue(const ::rtl::OUString& /*sProperty*/, 2679 sal_Int32 nHandle ) 2680 { 2681 /* There is no need to lock any mutex here. Because we share the 2682 solar mutex with our base class. And we said to our base class: "dont release it on calling us" .-) 2683 see ctor of PropertySetHelper for further informations. 2684 */ 2685 2686 /* Attention: You can use nHandle only, if you are sure that all supported 2687 properties has an unique handle. That must be guaranteed 2688 inside method impl_initializePropInfo()! 2689 */ 2690 css::uno::Any aValue; 2691 switch (nHandle) 2692 { 2693 case FRAME_PROPHANDLE_TITLE : 2694 aValue <<= getTitle (); 2695 break; 2696 2697 case FRAME_PROPHANDLE_DISPATCHRECORDERSUPPLIER : 2698 aValue <<= m_xDispatchRecorderSupplier; 2699 break; 2700 2701 case FRAME_PROPHANDLE_ISHIDDEN : 2702 aValue <<= m_bIsHidden; 2703 break; 2704 2705 case FRAME_PROPHANDLE_LAYOUTMANAGER : 2706 aValue <<= m_xLayoutManager; 2707 break; 2708 2709 case FRAME_PROPHANDLE_INDICATORINTERCEPTION : 2710 { 2711 css::uno::Reference< css::task::XStatusIndicator > xProgress(m_xIndicatorInterception.get(), css::uno::UNO_QUERY); 2712 aValue = css::uno::makeAny(xProgress); 2713 } 2714 break; 2715 2716 #ifdef ENABLE_WARNINGS 2717 default : 2718 LOG_WARNING( "Frame::getFastPropertyValue()", "Invalid handle detected!" ) 2719 break; 2720 #endif 2721 } 2722 2723 return aValue; 2724 } 2725 2726 /*-****************************************************************************************************//** 2727 @short dispose old container window and forget his reference 2728 @descr Sometimes we must repair our "modal dialog parent mechanism" too! 2729 2730 @seealso - 2731 2732 @param "xWindow", reference to old container window to dispose it 2733 @return An empty reference. 2734 2735 @onerror - 2736 @threadsafe NO! 2737 *//*-*****************************************************************************************************/ 2738 void Frame::impl_disposeContainerWindow( css::uno::Reference< css::awt::XWindow >& xWindow ) 2739 { 2740 if( xWindow.is() == sal_True ) 2741 { 2742 xWindow->setVisible( sal_False ); 2743 // All VclComponents are XComponents; so call dispose before discarding 2744 // a css::uno::Reference< XVclComponent >, because this frame is the owner of the window 2745 xWindow->dispose(); 2746 xWindow = css::uno::Reference< css::awt::XWindow >(); 2747 } 2748 } 2749 2750 /*-****************************************************************************************************//** 2751 @short send frame action event to our listener 2752 @descr This method is threadsafe AND can be called by our dispose method too! 2753 2754 @seealso - 2755 2756 @param "aAction", describe the event for sending 2757 @return - 2758 2759 @onerror - 2760 *//*-*****************************************************************************************************/ 2761 void Frame::implts_sendFrameActionEvent( const css::frame::FrameAction& aAction ) 2762 { 2763 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2764 // Sometimes used by dispose() => soft exceptions! 2765 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2766 2767 // Log informations about order of events to file! 2768 // (only activated in debug version!) 2769 LOG_FRAMEACTIONEVENT( "Frame", m_sName, aAction ) 2770 2771 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2772 // Send css::frame::FrameAction event to all listener. 2773 // Get container for right listener. 2774 // FOLLOW LINES ARE THREADSAFE!!! 2775 // ( OInterfaceContainerHelper is synchronized with m_aListenerContainer! ) 2776 ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::frame::XFrameActionListener >*) NULL ) ); 2777 2778 if( pContainer != NULL ) 2779 { 2780 // Build action event. 2781 css::frame::FrameActionEvent aFrameActionEvent( static_cast< ::cppu::OWeakObject* >(this), this, aAction ); 2782 2783 // Get iterator for access to listener. 2784 ::cppu::OInterfaceIteratorHelper aIterator( *pContainer ); 2785 // Send message to all listener. 2786 while( aIterator.hasMoreElements() == sal_True ) 2787 { 2788 try 2789 { 2790 ((css::frame::XFrameActionListener*)aIterator.next())->frameAction( aFrameActionEvent ); 2791 } 2792 catch( css::uno::RuntimeException& ) 2793 { 2794 aIterator.remove(); 2795 } 2796 } 2797 } 2798 } 2799 2800 /*-****************************************************************************************************//** 2801 @short helper to resize our component window 2802 @descr A frame contains 2 windows - a container ~ and a component window. 2803 This method resize inner component window to full size of outer container window. 2804 This method is threadsafe AND can be called by our dispose method too! 2805 2806 @seealso - 2807 2808 @param - 2809 @return - 2810 2811 @onerror - 2812 *//*-*****************************************************************************************************/ 2813 void Frame::implts_resizeComponentWindow() 2814 { 2815 // usually the LayoutManager does the resizing 2816 // in case there is no LayoutManager resizing has to be done here 2817 if ( !m_xLayoutManager.is() ) 2818 { 2819 css::uno::Reference< css::awt::XWindow > xComponentWindow( getComponentWindow() ); 2820 if( xComponentWindow.is() == sal_True ) 2821 { 2822 css::uno::Reference< css::awt::XDevice > xDevice( getContainerWindow(), css::uno::UNO_QUERY ); 2823 2824 // Convert relativ size to output size. 2825 css::awt::Rectangle aRectangle = getContainerWindow()->getPosSize(); 2826 css::awt::DeviceInfo aInfo = xDevice->getInfo(); 2827 css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , 2828 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); 2829 2830 // Resize our component window. 2831 xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE ); 2832 } 2833 } 2834 } 2835 2836 /*-****************************************************************************************************//** 2837 @short helper to set icon on our container window (if it is a system window!) 2838 @descr We use our internal set controller (if it exist) to specify which factory he represanted. 2839 These information can be used to find right icon. But our controller can say it us directly 2840 too ... we should ask his optional property set first ... 2841 2842 @seealso method Window::SetIcon() 2843 2844 @param - 2845 @return - 2846 2847 @onerror We do nothing. 2848 *//*-*****************************************************************************************************/ 2849 void Frame::implts_setIconOnWindow() 2850 { 2851 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2852 // Look for rejected calls. 2853 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2854 2855 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2856 // Make snapshot of neccessary members and release lock. 2857 ReadGuard aReadLock( m_aLock ); 2858 css::uno::Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow, css::uno::UNO_QUERY ); 2859 css::uno::Reference< css::frame::XController > xController ( m_xController , css::uno::UNO_QUERY ); 2860 aReadLock.unlock(); 2861 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2862 2863 if( 2864 ( xContainerWindow.is() == sal_True ) && 2865 ( xController.is() == sal_True ) 2866 ) 2867 { 2868 //------------------------------------------------------------------------------------------------------------- 2869 // a) set default value to an invalid one. So we can start further searches for right icon id, if 2870 // first steps failed! 2871 // We must reset it to any fallback value - if no search step returns a valid result. 2872 sal_Int32 nIcon = -1; 2873 2874 //------------------------------------------------------------------------------------------------------------- 2875 // b) try to find information on controller propertyset directly 2876 // Don't forget to catch possible exceptions - because these property is an optional one! 2877 css::uno::Reference< css::beans::XPropertySet > xSet( xController, css::uno::UNO_QUERY ); 2878 if( xSet.is() == sal_True ) 2879 { 2880 try 2881 { 2882 css::uno::Reference< css::beans::XPropertySetInfo > const xPSI( xSet->getPropertySetInfo(), css::uno::UNO_SET_THROW ); 2883 if ( xPSI->hasPropertyByName( CONTROLLER_PROPNAME_ICONID ) ) 2884 xSet->getPropertyValue( CONTROLLER_PROPNAME_ICONID ) >>= nIcon; 2885 } 2886 catch( css::uno::Exception& ) 2887 { 2888 DBG_UNHANDLED_EXCEPTION(); 2889 } 2890 } 2891 2892 //------------------------------------------------------------------------------------------------------------- 2893 // c) if b) failed ... analyze argument list of currently loaded document insde the frame to find the filter. 2894 // He can be used to detect right factory - and these can be used to match factory to icon ... 2895 if( nIcon == -1 ) 2896 { 2897 css::uno::Reference< css::frame::XModel > xModel = xController->getModel(); 2898 if( xModel.is() == sal_True ) 2899 { 2900 SvtModuleOptions::EFactory eFactory = SvtModuleOptions::ClassifyFactoryByModel(xModel); 2901 if (eFactory != SvtModuleOptions::E_UNKNOWN_FACTORY) 2902 nIcon = SvtModuleOptions().GetFactoryIcon( eFactory ); 2903 } 2904 } 2905 2906 //------------------------------------------------------------------------------------------------------------- 2907 // d) if all steps failed - use fallback! 2908 if( nIcon == -1 ) 2909 { 2910 nIcon = 0; 2911 } 2912 2913 //------------------------------------------------------------------------------------------------------------- 2914 // e) set icon on container window now 2915 // Don't forget SolarMutex! We use vcl directly :-( 2916 // Check window pointer for right WorkWindow class too!!! 2917 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2918 ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); 2919 Window* pWindow = (VCLUnoHelper::GetWindow( xContainerWindow )); 2920 if( 2921 ( pWindow != NULL ) && 2922 ( pWindow->GetType() == WINDOW_WORKWINDOW ) 2923 ) 2924 { 2925 WorkWindow* pWorkWindow = (WorkWindow*)pWindow; 2926 pWorkWindow->SetIcon( (sal_uInt16)nIcon ); 2927 } 2928 aSolarGuard.clear(); 2929 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2930 } 2931 } 2932 2933 /*-************************************************************************************************************//** 2934 @short helper to start/stop listeneing for window events on container window 2935 @descr If we get a new container window, we must set it on internal memeber ... 2936 and stop listening at old one ... and start listening on new one! 2937 But sometimes (in dispose() call!) it's neccessary to stop listeneing without starting 2938 on new connections. So we split this functionality to make it easier at use. 2939 2940 @seealso method initialize() 2941 @seealso method dispose() 2942 2943 @param - 2944 @return - 2945 2946 @onerror We do nothing! 2947 @threadsafe yes 2948 *//*-*************************************************************************************************************/ 2949 void Frame::implts_startWindowListening() 2950 { 2951 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2952 TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); 2953 2954 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2955 // Make snapshot of neccessary member! 2956 ReadGuard aReadLock( m_aLock ); 2957 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ; 2958 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory ; 2959 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; 2960 css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 2961 css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 2962 css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 2963 aReadLock.unlock(); 2964 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2965 2966 if( xContainerWindow.is() == sal_True ) 2967 { 2968 xContainerWindow->addWindowListener( xWindowListener); 2969 xContainerWindow->addFocusListener ( xFocusListener ); 2970 2971 css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY ); 2972 if( xTopWindow.is() == sal_True ) 2973 { 2974 xTopWindow->addTopWindowListener( xTopWindowListener ); 2975 2976 css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); 2977 if( xTransfer.is() == sal_True ) 2978 { 2979 css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow ); 2980 if( xDropTarget.is() == sal_True ) 2981 { 2982 xDropTarget->addDropTargetListener( xDragDropListener ); 2983 xDropTarget->setActive( sal_True ); 2984 } 2985 } 2986 } 2987 } 2988 } 2989 2990 //***************************************************************************************************************** 2991 void Frame::implts_stopWindowListening() 2992 { 2993 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 2994 // Sometimes used by dispose() => soft exceptions! 2995 TransactionGuard aTransaction( m_aTransactionManager, E_SOFTEXCEPTIONS ); 2996 2997 /* SAFE AREA ----------------------------------------------------------------------------------------------- */ 2998 // Make snapshot of neccessary member! 2999 ReadGuard aReadLock( m_aLock ); 3000 css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow ; 3001 css::uno::Reference< css::lang::XMultiServiceFactory > xFactory = m_xFactory ; 3002 css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; 3003 css::uno::Reference< css::awt::XWindowListener > xWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 3004 css::uno::Reference< css::awt::XFocusListener > xFocusListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 3005 css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); 3006 aReadLock.unlock(); 3007 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ 3008 3009 if( xContainerWindow.is() == sal_True ) 3010 { 3011 xContainerWindow->removeWindowListener( xWindowListener); 3012 xContainerWindow->removeFocusListener ( xFocusListener ); 3013 3014 css::uno::Reference< css::awt::XTopWindow > xTopWindow( xContainerWindow, css::uno::UNO_QUERY ); 3015 if( xTopWindow.is() == sal_True ) 3016 { 3017 xTopWindow->removeTopWindowListener( xTopWindowListener ); 3018 3019 css::uno::Reference< css::awt::XDataTransferProviderAccess > xTransfer( xFactory->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); 3020 if( xTransfer.is() == sal_True ) 3021 { 3022 css::uno::Reference< css::datatransfer::dnd::XDropTarget > xDropTarget = xTransfer->getDropTarget( xContainerWindow ); 3023 if( xDropTarget.is() == sal_True ) 3024 { 3025 xDropTarget->removeDropTargetListener( xDragDropListener ); 3026 xDropTarget->setActive( sal_False ); 3027 } 3028 } 3029 } 3030 } 3031 } 3032 3033 /*-****************************************************************************************************//** 3034 @short helper to force breaked close() request again 3035 @descr If we self disagree with a close() request, and detect that all external locks are gone ... 3036 then we must try to close this frame again. 3037 3038 @seealso XCloseable::close() 3039 @seealso Frame::close() 3040 @seealso Frame::removeActionLock() 3041 @seealso Frame::resetActionLock() 3042 @seealso m_bSelfClose 3043 @seealso m_nExternalLockCount 3044 3045 @threadsafe yes 3046 @modified 06.05.2002 09:31, as96863 3047 *//*-*****************************************************************************************************/ 3048 void Frame::implts_checkSuicide() 3049 { 3050 /* SAFE */ 3051 ReadGuard aReadLock(m_aLock); 3052 // in case of lock==0 and safed state of previous close() request m_bSelfClose 3053 // we must force close() again. Because we had disagreed with that before. 3054 sal_Bool bSuicide = (m_nExternalLockCount==0 && m_bSelfClose); 3055 m_bSelfClose = sal_False; 3056 aReadLock.unlock(); 3057 /* } SAFE */ 3058 // force close and deliver owner ship to source of possible throwed veto exception 3059 // Attention: Because this method isn't designed to throw such exception we must supress 3060 // it for outside code! 3061 try 3062 { 3063 if (bSuicide) 3064 close(sal_True); 3065 } 3066 catch(const css::util::CloseVetoException&) 3067 {} 3068 catch(const css::lang::DisposedException&) 3069 {} 3070 } 3071 3072 //_______________________________________________________________ 3073 3074 /** little helper to enable/disable the menu closer at the menubar of the given frame. 3075 3076 @param xFrame 3077 we use its layout manager to set/reset a special callback. 3078 Its existence regulate visibility of this closer item. 3079 3080 @param bState 3081 <TRUE/> enable; <FALSE/> disable this state 3082 */ 3083 3084 void Frame::impl_setCloser( /*IN*/ const css::uno::Reference< css::frame::XFrame >& xFrame , 3085 /*IN*/ sal_Bool bState ) 3086 { 3087 // Note: If start module isnt installed - no closer has to be shown! 3088 if (!SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) 3089 return; 3090 3091 try 3092 { 3093 css::uno::Reference< css::beans::XPropertySet > xFrameProps(xFrame, css::uno::UNO_QUERY_THROW); 3094 css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; 3095 xFrameProps->getPropertyValue(FRAME_PROPNAME_LAYOUTMANAGER) >>= xLayoutManager; 3096 css::uno::Reference< css::beans::XPropertySet > xLayoutProps(xLayoutManager, css::uno::UNO_QUERY_THROW); 3097 xLayoutProps->setPropertyValue(LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, css::uno::makeAny(bState)); 3098 } 3099 catch(const css::uno::RuntimeException&) 3100 { throw; } 3101 catch(const css::uno::Exception&) 3102 {} 3103 } 3104 3105 //_______________________________________________________________ 3106 3107 /** it checks, which of the top level task frames must have the special menu closer for 3108 switching to the backing window mode. 3109 3110 It analyze the current list of visible top level frames. Only the last real document 3111 frame can have this symbol. Not the help frame nor the backing task itself. 3112 Here we do anything related to this closer. We remove it from the old frame and set it 3113 for the new one. 3114 */ 3115 3116 void Frame::impl_checkMenuCloser() 3117 { 3118 /* SAFE { */ 3119 ReadGuard aReadLock(m_aLock); 3120 3121 // only top frames, which are part of our desktop hierarchy, can 3122 // do so! By the way - we need the desktop instance to have acess 3123 // to all other top level frames too. 3124 css::uno::Reference< css::frame::XDesktop > xDesktop (m_xParent, css::uno::UNO_QUERY); 3125 css::uno::Reference< css::frame::XFramesSupplier > xTaskSupplier(xDesktop , css::uno::UNO_QUERY); 3126 if ( !xDesktop.is() || !xTaskSupplier.is() ) 3127 return; 3128 3129 aReadLock.unlock(); 3130 /* } SAFE */ 3131 3132 // analyze the list of current open tasks 3133 // Suppress search for other views to the same model ... 3134 // It's not needed here and can be very expensive. 3135 FrameListAnalyzer aAnalyzer( 3136 xTaskSupplier, 3137 this, 3138 FrameListAnalyzer::E_HIDDEN | FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT); 3139 3140 // specify the new frame, which must have this special state ... 3141 css::uno::Reference< css::frame::XFrame > xNewCloserFrame; 3142 3143 // ----------------------------- 3144 // a) 3145 // If there exist ate least one other frame - there are two frames currently open. 3146 // But we can enable this closer only, if one of these two tasks includes the help module. 3147 // The "other frame" couldn't be the help. Because then it wouldn't be part of this "other list". 3148 // In such case it will be seperated to the reference aAnalyzer.m_xHelp! 3149 // But we must check, if weself includes the help ... 3150 // Check aAnalyzer.m_bReferenceIsHelp! 3151 if ( 3152 (aAnalyzer.m_lOtherVisibleFrames.getLength()==1) && 3153 ( 3154 (aAnalyzer.m_bReferenceIsHelp ) || 3155 (aAnalyzer.m_bReferenceIsHidden) 3156 ) 3157 ) 3158 { 3159 // others[0] can't be the backing component! 3160 // Because it's set at the special member aAnalyzer.m_xBackingComponent ... :-) 3161 xNewCloserFrame = aAnalyzer.m_lOtherVisibleFrames[0]; 3162 } 3163 else 3164 // ----------------------------- 3165 // b) 3166 // There is no other frame ... means no other document frame. The help module 3167 // will be handled seperatly and must(!) be ignored here ... excepting weself includes the help. 3168 if ( 3169 (aAnalyzer.m_lOtherVisibleFrames.getLength()==0) && 3170 (!aAnalyzer.m_bReferenceIsHelp ) && 3171 (!aAnalyzer.m_bReferenceIsHidden ) && 3172 (!aAnalyzer.m_bReferenceIsBacking ) 3173 ) 3174 { 3175 xNewCloserFrame = this; 3176 } 3177 3178 // Look for neccessary actions ... 3179 // Only if the closer state must be moved from one frame to another one 3180 // or must be enabled/disabled at all. 3181 /* STATIC SAFE { */ 3182 WriteGuard aStaticWriteLock(LockHelper::getGlobalLock()); 3183 css::uno::Reference< css::frame::XFrame > xCloserFrame (m_xCloserFrame.get(), css::uno::UNO_QUERY); 3184 if (xCloserFrame!=xNewCloserFrame) 3185 { 3186 if (xCloserFrame.is()) 3187 impl_setCloser(xCloserFrame, sal_False); 3188 if (xNewCloserFrame.is()) 3189 impl_setCloser(xNewCloserFrame, sal_True); 3190 m_xCloserFrame = xNewCloserFrame; 3191 } 3192 aStaticWriteLock.unlock(); 3193 /* } STATIC SAFE */ 3194 } 3195 3196 //_________________________________________________________________________________________________________________ 3197 // debug methods 3198 //_________________________________________________________________________________________________________________ 3199 3200 /*----------------------------------------------------------------------------------------------------------------- 3201 The follow methods checks the parameter for other functions. If a parameter or his value is non valid, 3202 we return "sal_True". (otherwise sal_False) This mechanism is used to throw an ASSERT! 3203 -----------------------------------------------------------------------------------------------------------------*/ 3204 3205 #ifdef ENABLE_ASSERTIONS 3206 3207 //***************************************************************************************************************** 3208 // We don't accept null pointer or references! 3209 sal_Bool Frame::implcp_ctor( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ) 3210 { 3211 return ( 3212 ( &xFactory == NULL ) || 3213 ( xFactory.is() == sal_False ) 3214 ); 3215 } 3216 3217 //***************************************************************************************************************** 3218 // Its allowed to reset the active frame membervariable with a NULL-css::uno::Reference but not with a NULL-pointer! 3219 // And we accept frames only! No tasks and desktops! 3220 sal_Bool Frame::implcp_setActiveFrame( const css::uno::Reference< css::frame::XFrame >& xFrame ) 3221 { 3222 return ( 3223 ( &xFrame == NULL ) || 3224 ( css::uno::Reference< css::frame::XDesktop >( xFrame, css::uno::UNO_QUERY ).is() == sal_True ) 3225 ); 3226 } 3227 3228 //***************************************************************************************************************** 3229 sal_Bool Frame::implcp_addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) 3230 { 3231 return ( 3232 ( &xListener == NULL ) || 3233 ( xListener.is() == sal_False ) 3234 ); 3235 } 3236 3237 //***************************************************************************************************************** 3238 sal_Bool Frame::implcp_removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) 3239 { 3240 return ( 3241 ( &xListener == NULL ) || 3242 ( xListener.is() == sal_False ) 3243 ); 3244 } 3245 3246 //***************************************************************************************************************** 3247 sal_Bool Frame::implcp_addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) 3248 { 3249 return ( 3250 ( &xListener == NULL ) || 3251 ( xListener.is() == sal_False ) 3252 ); 3253 } 3254 3255 //***************************************************************************************************************** 3256 sal_Bool Frame::implcp_removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) 3257 { 3258 return ( 3259 ( &xListener == NULL ) || 3260 ( xListener.is() == sal_False ) 3261 ); 3262 } 3263 3264 //***************************************************************************************************************** 3265 sal_Bool Frame::implcp_windowResized( const css::awt::WindowEvent& aEvent ) 3266 { 3267 return ( 3268 ( &aEvent == NULL ) || 3269 ( aEvent.Source.is() == sal_False ) 3270 ); 3271 } 3272 3273 //***************************************************************************************************************** 3274 sal_Bool Frame::implcp_focusGained( const css::awt::FocusEvent& aEvent ) 3275 { 3276 return ( 3277 ( &aEvent == NULL ) || 3278 ( aEvent.Source.is() == sal_False ) 3279 ); 3280 } 3281 3282 //***************************************************************************************************************** 3283 sal_Bool Frame::implcp_windowActivated( const css::lang::EventObject& aEvent ) 3284 { 3285 return ( 3286 ( &aEvent == NULL ) || 3287 ( aEvent.Source.is() == sal_False ) 3288 ); 3289 } 3290 3291 //***************************************************************************************************************** 3292 sal_Bool Frame::implcp_windowDeactivated( const css::lang::EventObject& aEvent ) 3293 { 3294 return ( 3295 ( &aEvent == NULL ) || 3296 ( aEvent.Source.is() == sal_False ) 3297 ); 3298 } 3299 3300 //***************************************************************************************************************** 3301 sal_Bool Frame::implcp_disposing( const css::lang::EventObject& aEvent ) 3302 { 3303 return ( 3304 ( &aEvent == NULL ) || 3305 ( aEvent.Source.is() == sal_False ) 3306 ); 3307 } 3308 3309 #endif // #ifdef ENABLE_ASSERTIONS 3310 3311 } // namespace framework 3312