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