LibreOffice Module framework (master) 1
desktop.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <framework/desktop.hxx>
21
22#include <loadenv/loadenv.hxx>
23
25#include <helper/oframes.hxx>
27
31#include <properties.h>
32#include <targets.h>
33
34#include <strings.hrc>
35#include <classes/fwkresid.hxx>
36
37#include <com/sun/star/beans/PropertyAttribute.hpp>
38#include <com/sun/star/frame/FrameSearchFlag.hpp>
39#include <com/sun/star/frame/TerminationVetoException.hpp>
40#include <com/sun/star/task/XInteractionAbort.hpp>
41#include <com/sun/star/task/XInteractionApprove.hpp>
42#include <com/sun/star/document/XInteractionFilterSelect.hpp>
43#include <com/sun/star/task/ErrorCodeRequest.hpp>
44#include <com/sun/star/frame/DispatchResultState.hpp>
45#include <com/sun/star/lang/DisposedException.hpp>
46#include <com/sun/star/util/CloseVetoException.hpp>
47#include <com/sun/star/util/XCloseable.hpp>
48#include <com/sun/star/frame/XTerminateListener2.hpp>
49
52#include <comphelper/lok.hxx>
54#include <utility>
55#include <vcl/svapp.hxx>
57#include <vcl/scheduler.hxx>
58#include <sal/log.hxx>
60#include <vcl/threadex.hxx>
62
63namespace framework{
64
65namespace {
66
67enum PropHandle {
68 ActiveFrame, DispatchRecorderSupplier, IsPlugged, SuspendQuickstartVeto,
69 Title };
70
71}
72
74{
75 return "com.sun.star.comp.framework.Desktop";
76}
77
78sal_Bool SAL_CALL Desktop::supportsService(OUString const & ServiceName)
79{
81}
82
83css::uno::Sequence<OUString> SAL_CALL Desktop::getSupportedServiceNames()
84{
85 return { "com.sun.star.frame.Desktop" };
86}
87
89{
90 // Initialize a new XFrames-helper-object to handle XIndexAccess and XElementAccess.
91 // We hold member as reference ... not as pointer too!
92 // Attention: We share our frame container with this helper. Container is threadsafe himself ... So I think we can do that.
93 // But look on dispose() for right order of deinitialization.
95
96 // Initialize a new dispatchhelper-object to handle dispatches.
97 // We use these helper as slave for our interceptor helper ... not directly!
98 // But he is event listener on THIS instance!
99 rtl::Reference<DispatchProvider> xDispatchProvider = new DispatchProvider( m_xContext, this );
100
101 // Initialize a new interception helper object to handle dispatches and implement an interceptor mechanism.
102 // Set created dispatch provider as slowest slave of it.
103 // Hold interception helper by reference only - not by pointer!
104 // So it's easier to destroy it.
105 m_xDispatchHelper = new InterceptionHelper( this, xDispatchProvider );
106
107 OUString sUntitledPrefix = FwkResId(STR_UNTITLED_DOCUMENT) + " ";
108
109 rtl::Reference<::comphelper::NumberedCollection> pNumbers = new ::comphelper::NumberedCollection ();
110 m_xTitleNumberGenerator = pNumbers;
111 pNumbers->setOwner ( static_cast< ::cppu::OWeakObject* >(this) );
112 pNumbers->setUntitledPrefix ( sUntitledPrefix );
113
114 // Safe impossible cases
115 // We can't work without this helper!
116 SAL_WARN_IF( !m_xFramesHelper.is(), "fwk.desktop", "Desktop::Desktop(): Frames helper is not valid. XFrames, XIndexAccess and XElementAccess are not supported!");
117 SAL_WARN_IF( !m_xDispatchHelper.is(), "fwk.desktop", "Desktop::Desktop(): Dispatch helper is not valid. XDispatch will not work correctly!" );
118
119 // Enable object for real working!
120 // Otherwise all calls will be rejected ...
122}
123
124/*-************************************************************************************************************
125 @short standard constructor to create instance by factory
126 @descr This constructor initialize a new instance of this class by valid factory,
127 and will be set valid values on his member and baseclasses.
128
129 @attention a) Don't use your own reference during a UNO-Service-ctor! There is no guarantee, that you
130 will get over this. (e.g. using of your reference as parameter to initialize some member)
131 Do such things in DEFINE_INIT_SERVICE() method, which is called automatically after your ctor!!!
132 b) Baseclass OBroadcastHelper is a typedef in namespace cppu!
133 The microsoft compiler has some problems to handle it right BY using namespace explicitly ::cppu::OBroadcastHelper.
134 If we write it without a namespace or expand the typedef to OBroadcastHelperVar<...> -> it will be OK!?
135 I don't know why! (other compiler not tested .. but it works!)
136
137 @seealso method DEFINE_INIT_SERVICE()
138
139 @param "xFactory" is the multi service manager, which create this instance.
140 The value must be different from NULL!
141 @onerror We throw an ASSERT in debug version or do nothing in release version.
142*//*-*************************************************************************************************************/
143Desktop::Desktop( css::uno::Reference< css::uno::XComponentContext > xContext )
145 , cppu::OPropertySetHelper( cppu::WeakComponentImplHelperBase::rBHelper )
146 // Init member
147 , m_bIsTerminated(false)
148 , m_bIsShutdown(false) // see dispose() for further information!
149 , m_bSession ( false )
150 , m_xContext (std::move( xContext ))
151 , m_aListenerContainer ( m_aMutex )
152 , m_eLoadState ( E_NOTSET )
153 , m_bSuspendQuickstartVeto( false )
154{
155}
156
157/*-************************************************************************************************************
158 @short standard destructor
159 @descr This one do NOTHING! Use dispose() instead of this.
160
161 @seealso method dispose()
162*//*-*************************************************************************************************************/
164{
165 SAL_WARN_IF(!m_bIsShutdown, "fwk.desktop", "Desktop not terminated before being destructed");
166 SAL_WARN_IF( m_aTransactionManager.getWorkingMode()!=E_CLOSE, "fwk.desktop", "Desktop::~Desktop(): Who forgot to dispose this service?" );
167}
168
169css::uno::Any SAL_CALL Desktop::queryInterface( const css::uno::Type& _rType )
170{
171 css::uno::Any aRet = Desktop_BASE::queryInterface( _rType );
172 if ( !aRet.hasValue() )
173 aRet = OPropertySetHelper::queryInterface( _rType );
174 return aRet;
175}
176
177css::uno::Sequence< css::uno::Type > SAL_CALL Desktop::getTypes( )
178{
180 Desktop_BASE::getTypes(),
182 );
183}
184
186{
189
190 if (m_bIsTerminated)
191 return true;
192
193 css::uno::Reference< css::frame::XTerminateListener > xPipeTerminator = m_xPipeTerminator;
194 css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher = m_xQuickLauncher;
195 css::uno::Reference< css::frame::XTerminateListener > xSWThreadManager = m_xSWThreadManager;
196 css::uno::Reference< css::frame::XTerminateListener > xSfxTerminator = m_xSfxTerminator;
197
198 css::lang::EventObject aEvent ( static_cast< ::cppu::OWeakObject* >(this) );
199 bool bAskQuickStart = !m_bSuspendQuickstartVeto;
200 const bool bRestartableMainLoop = comphelper::LibreOfficeKit::isActive();
201 aGuard.clear();
202
203 // Allow using of any UI ... because Desktop.terminate() was designed as UI functionality in the past.
204
205 // Ask normal terminate listener. They could veto terminating the process.
206 Desktop::TTerminateListenerList lCalledTerminationListener;
207 if (!impl_sendQueryTerminationEvent(lCalledTerminationListener))
208 {
209 impl_sendCancelTerminationEvent(lCalledTerminationListener);
210 return false;
211 }
212
213 // try to close all open frames
214 if (!impl_closeFrames(!bRestartableMainLoop))
215 {
216 impl_sendCancelTerminationEvent(lCalledTerminationListener);
217 return false;
218 }
219
220 // Normal listener had no problem ...
221 // all frames was closed ...
222 // now it's time to ask our specialized listener.
223 // They are handled these way because they wish to hinder the office on termination
224 // but they wish also closing of all frames.
225
226 // Note further:
227 // We shouldn't ask quicklauncher in case it was allowed from outside only.
228 // This is special trick to "ignore existing quick starter" for debug purposes.
229
230 // Attention:
231 // Order of called listener is important!
232 // Some of them are harmless,-)
233 // but some can be dangerous. E.g. it would be dangerous if we close our pipe
234 // and don't terminate in real because another listener throws a veto exception .-)
235
236 try
237 {
238 if( bAskQuickStart && xQuickLauncher.is() )
239 {
240 xQuickLauncher->queryTermination( aEvent );
241 lCalledTerminationListener.push_back( xQuickLauncher );
242 }
243
244 if ( xSWThreadManager.is() )
245 {
246 xSWThreadManager->queryTermination( aEvent );
247 lCalledTerminationListener.push_back( xSWThreadManager );
248 }
249
250 if ( xPipeTerminator.is() )
251 {
252 xPipeTerminator->queryTermination( aEvent );
253 lCalledTerminationListener.push_back( xPipeTerminator );
254 }
255
256 if ( xSfxTerminator.is() )
257 {
258 xSfxTerminator->queryTermination( aEvent );
259 lCalledTerminationListener.push_back( xSfxTerminator );
260 }
261 }
262 catch(const css::frame::TerminationVetoException&)
263 {
264 impl_sendCancelTerminationEvent(lCalledTerminationListener);
265 return false;
266 }
267
268 aGuard.reset();
269 if (m_bIsTerminated)
270 return true;
271 m_bIsTerminated = true;
272
273 if (!bRestartableMainLoop)
274 {
275 CrashReporter::addKeyValue("ShutDown", OUString::boolean(true), CrashReporter::Write);
276
277 // The clipboard listener needs to be the first. It can create copies of the
278 // existing document which needs basically all the available infrastructure.
280 {
281 SolarMutexReleaser aReleaser;
283 }
285
286 if( bAskQuickStart && xQuickLauncher.is() )
287 xQuickLauncher->notifyTermination( aEvent );
288
289 if ( xSWThreadManager.is() )
290 xSWThreadManager->notifyTermination( aEvent );
291
292 if ( xPipeTerminator.is() )
293 xPipeTerminator->notifyTermination( aEvent );
294
295 // further termination is postponed to shutdown, if LO already runs the main loop
297 shutdown();
298 }
299 else
300 m_bIsShutdown = true;
301
302#ifndef IOS // or ANDROID?
303 aGuard.clear();
304 // In the iOS app, posting the ImplQuitMsg user event will be too late, it will not be handled during the
305 // lifetime of the current document, but handled for the next document opened, which thus will break horribly.
307#endif
308
309 return true;
310}
311
313{
315 SolarMutexGuard aGuard;
316
317 if (m_bIsShutdown)
318 return;
319 m_bIsShutdown = true;
320
321 css::uno::Reference<css::frame::XTerminateListener> xSfxTerminator = m_xSfxTerminator;
322 css::lang::EventObject aEvent(static_cast<::cppu::OWeakObject* >(this));
323
324 // we need a copy here as the notifyTermination call might cause a removeTerminateListener call
325 std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners;
326 xComponentDllListeners.swap(m_xComponentDllListeners);
327 for (auto& xListener : xComponentDllListeners)
328 xListener->notifyTermination(aEvent);
329 xComponentDllListeners.clear();
330
331 // Must be really the last listener to be called.
332 // Because it shuts down the whole process asynchronous!
333 if (xSfxTerminator.is())
334 xSfxTerminator->notifyTermination(aEvent);
335}
336
337namespace
338{
339 class QuickstartSuppressor
340 {
341 Desktop* const m_pDesktop;
342 css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher;
343 public:
344 QuickstartSuppressor(Desktop* const pDesktop, css::uno::Reference< css::frame::XTerminateListener > xQuickLauncher)
345 : m_pDesktop(pDesktop)
346 , m_xQuickLauncher(std::move(xQuickLauncher))
347 {
348 SAL_INFO("fwk.desktop", "temporary removing Quickstarter");
349 if(m_xQuickLauncher.is())
350 m_pDesktop->removeTerminateListener(m_xQuickLauncher);
351 }
352 ~QuickstartSuppressor()
353 {
354 SAL_INFO("fwk.desktop", "readding Quickstarter");
355 if(m_xQuickLauncher.is())
356 m_pDesktop->addTerminateListener(m_xQuickLauncher);
357 }
358 };
359}
360
362{
363 QuickstartSuppressor aQuickstartSuppressor(this, m_xQuickLauncher);
364 m_bSession = true;
365 return terminate();
366}
367
368void SAL_CALL Desktop::addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener )
369{
371
372 css::uno::Reference< css::lang::XServiceInfo > xInfo( xListener, css::uno::UNO_QUERY );
373 if ( xInfo.is() )
374 {
375 OUString sImplementationName = xInfo->getImplementationName();
376
378
379 if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
380 {
381 m_xSfxTerminator = xListener;
382 return;
383 }
384 if( sImplementationName == "com.sun.star.comp.RequestHandlerController" )
385 {
386 m_xPipeTerminator = xListener;
387 return;
388 }
389 if( sImplementationName == "com.sun.star.comp.desktop.QuickstartWrapper" )
390 {
391 m_xQuickLauncher = xListener;
392 return;
393 }
394 if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
395 {
396 m_xSWThreadManager = xListener;
397 return;
398 }
399 else if ( sImplementationName == "com.sun.star.comp.ComponentDLLListener" )
400 {
401 m_xComponentDllListeners.push_back(xListener);
402 return;
403 }
404 }
405
406 // No lock required... container is threadsafe by itself.
408}
409
410void SAL_CALL Desktop::removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener )
411{
413
414 css::uno::Reference< css::lang::XServiceInfo > xInfo( xListener, css::uno::UNO_QUERY );
415 if ( xInfo.is() )
416 {
417 OUString sImplementationName = xInfo->getImplementationName();
418
420
421 if( sImplementationName == "com.sun.star.comp.sfx2.SfxTerminateListener" )
422 {
423 m_xSfxTerminator.clear();
424 return;
425 }
426
427 if( sImplementationName == "com.sun.star.comp.RequestHandlerController" )
428 {
429 m_xPipeTerminator.clear();
430 return;
431 }
432
433 if( sImplementationName == "com.sun.star.comp.desktop.QuickstartWrapper" )
434 {
435 m_xQuickLauncher.clear();
436 return;
437 }
438
439 if( sImplementationName == "com.sun.star.util.comp.FinalThreadManager" )
440 {
441 m_xSWThreadManager.clear();
442 return;
443 }
444 else if (sImplementationName == "com.sun.star.comp.ComponentDLLListener")
445 {
447 std::remove(m_xComponentDllListeners.begin(), m_xComponentDllListeners.end(), xListener),
449 return;
450 }
451 }
452
453 // No lock required ... container is threadsafe by itself.
455}
456
457/*-************************************************************************************************************
458 @interface XDesktop
459 @short get access to create enumerations of all current components
460 @descr You will be the owner of the returned object and must delete it if you don't use it again.
461
462 @seealso class TasksAccess
463 @seealso class TasksEnumeration
464 @return A reference to an XEnumerationAccess-object.
465
466 @onerror We return a null-reference.
467 @threadsafe yes
468*//*-*************************************************************************************************************/
469css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL Desktop::getComponents()
470{
471 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
472 // Register transaction and reject wrong calls.
474
475 // We use a helper class OComponentAccess to have access on all child components.
476 // Create it on demand and return it as a reference.
477 return new OComponentAccess( this );
478}
479
480/*-************************************************************************************************************
481 @interface XDesktop
482 @short return the current active component
483 @descr The most current component is the window, model or the controller of the current active frame.
484
485 @seealso method getCurrentFrame()
486 @seealso method impl_getFrameComponent()
487 @return A reference to the component.
488
489 @onerror We return a null-reference.
490 @threadsafe yes
491*//*-*************************************************************************************************************/
492css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::getCurrentComponent()
493{
494 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
495 // Register transaction and reject wrong calls.
497
498 // Set return value if method failed.
499 css::uno::Reference< css::lang::XComponent > xComponent;
500
501 // Get reference to current frame ...
502 // ... get component of this frame ... (It can be the window, the model or the controller.)
503 // ... and return the result.
504 css::uno::Reference< css::frame::XFrame > xCurrentFrame = getCurrentFrame();
505 if( xCurrentFrame.is() )
506 {
507 xComponent = impl_getFrameComponent( xCurrentFrame );
508 }
509 return xComponent;
510}
511
512/*-************************************************************************************************************
513 @interface XDesktop
514 @short return the current active frame in hierarchy
515 @descr There can be more than one different active paths in our frame hierarchy. But only one of them
516 could be the most active frame (normal he has the focus).
517 Don't mix it with getActiveFrame()! That will return our current active frame, which must be
518 a direct child of us and should be a part(!) of an active path.
519
520 @seealso method getActiveFrame()
521 @return A valid reference, if there is an active frame.
522 A null reference , otherwise.
523
524 @onerror We return a null reference.
525 @threadsafe yes
526*//*-*************************************************************************************************************/
527css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::getCurrentFrame()
528{
529 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
530 // Register transaction and reject wrong calls.
532
533 // Start search with our direct active frame (if it exist!).
534 // Search on his children for other active frames too.
535 // Stop if no one could be found and return last of found ones.
536 css::uno::Reference< css::frame::XFramesSupplier > xLast( getActiveFrame(), css::uno::UNO_QUERY );
537 if( xLast.is() )
538 {
539 css::uno::Reference< css::frame::XFramesSupplier > xNext( xLast->getActiveFrame(), css::uno::UNO_QUERY );
540 while( xNext.is() )
541 {
542 xLast = xNext;
543 xNext.set( xNext->getActiveFrame(), css::uno::UNO_QUERY );
544 }
545 }
546 return xLast;
547}
548
549/*-************************************************************************************************************
550 @interface XComponentLoader
551 @short try to load given URL into a task
552 @descr You can give us some information about the content, which you will load into a frame.
553 We search or create this target for you, make a type detection of given URL and try to load it.
554 As result of this operation we return the new created component or nothing, if loading failed.
555 @param "sURL" , URL, which represent the content
556 @param "sTargetFrameName" , name of target frame or special value like "_self", "_blank" ...
557 @param "nSearchFlags" , optional arguments for frame search, if target isn't a special one
558 @param "lArguments" , optional arguments for loading
559 @return A valid component reference, if loading was successful.
560 A null reference otherwise.
561
562 @onerror We return a null reference.
563 @threadsafe yes
564*//*-*************************************************************************************************************/
565css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFromURL( const OUString& sURL ,
566 const OUString& sTargetFrameName,
567 sal_Int32 nSearchFlags ,
568 const css::uno::Sequence< css::beans::PropertyValue >& lArguments )
569{
570 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
571 // Register transaction and reject wrong calls.
573 SAL_INFO( "fwk.desktop", "loadComponentFromURL" );
574
575 css::uno::Reference< css::frame::XComponentLoader > xThis(this);
576
577 utl::MediaDescriptor aDescriptor(lArguments);
578 bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false);
579
580 if (bOnMainThread)
581 {
582 // Make sure that we own the solar mutex, otherwise later
583 // vcl::SolarThreadExecutor::execute() will release the solar mutex, even if it's owned by
584 // another thread, leading to an std::abort() at the end.
586
588 m_xContext, sURL, sTargetFrameName,
589 nSearchFlags, lArguments));
590 }
591 else
592 {
593 return LoadEnv::loadComponentFromURL(xThis, m_xContext, sURL, sTargetFrameName,
594 nSearchFlags, lArguments);
595 }
596}
597
598/*-************************************************************************************************************
599 @interface XTasksSupplier
600 @short get access to create enumerations of our taskchildren
601 @descr Direct children of desktop are tasks every time.
602 Call these method to could create enumerations of it.
603
604But; Don't forget - you will be the owner of returned object and must release it!
605 We use a helper class to implement the access interface. They hold a weakreference to us.
606 It can be, that the desktop is dead - but not your tasksaccess-object! Then they will do nothing!
607 You can't create enumerations then.
608
609 @attention Normally we don't need any lock here. We don't work on internal member!
610
611 @seealso class TasksAccess
612 @return A reference to an accessobject, which can create enumerations of our childtasks.
613
614 @onerror A null reference is returned.
615 @threadsafe yes
616*//*-*************************************************************************************************************/
617css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL Desktop::getTasks()
618{
619 SAL_INFO("fwk.desktop", "Desktop::getTasks(): Use of obsolete interface XTaskSupplier");
620 return nullptr;
621}
622
623/*-************************************************************************************************************
624 @interface XTasksSupplier
625 @short return current active task of our direct children
626 @descr Desktop children are tasks only ! If we have an active path from desktop
627 as top to any frame on bottom, we must have an active direct child. His reference is returned here.
628
629 @attention a) Do not confuse it with getCurrentFrame()! The current frame don't must one of our direct children.
630 It can be every frame in subtree and must have the focus (Is the last one of an active path!).
631 b) We don't need any lock here. Our container is threadsafe himself and live, if we live!
632
633 @seealso method getCurrentFrame()
634 @return A reference to our current active taskchild.
635
636 @onerror A null reference is returned.
637 @threadsafe yes
638*//*-*************************************************************************************************************/
639css::uno::Reference< css::frame::XTask > SAL_CALL Desktop::getActiveTask()
640{
641 SAL_INFO("fwk.desktop", "Desktop::getActiveTask(): Use of obsolete interface XTaskSupplier");
642 return nullptr;
643}
644
645/*-************************************************************************************************************
646 @interface XDispatchProvider
647 @short search a dispatcher for given URL
648 @descr We use a helper implementation (class DispatchProvider) to do so.
649 So we don't must implement this algorithm twice!
650
651 @attention We don't need any lock here. Our helper is threadsafe himself and live, if we live!
652
653 @seealso class DispatchProvider
654
655 @param "aURL" , URL to dispatch
656 @param "sTargetFrameName" , name of target frame, who should dispatch these URL
657 @param "nSearchFlags" , flags to regulate the search
658 @param "lQueries" , list of queryDispatch() calls!
659 @return A reference or list of founded dispatch objects for these URL.
660
661 @onerror A null reference is returned.
662 @threadsafe yes
663*//*-*************************************************************************************************************/
664css::uno::Reference< css::frame::XDispatch > SAL_CALL Desktop::queryDispatch( const css::util::URL& aURL ,
665 const OUString& sTargetFrameName ,
666 sal_Int32 nSearchFlags )
667{
668 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
669 // Register transaction and reject wrong calls.
671
672 // Remove uno and cmd protocol part as we want to support both of them. We store only the command part
673 // in our hash map. All other protocols are stored with the protocol part.
674 OUString aCommand( aURL.Main );
675 if ( aURL.Protocol.equalsIgnoreAsciiCase(".uno:") )
676 aCommand = aURL.Path;
677
680
681 // Make std::unordered_map lookup if the current URL is in the disabled list
682 if (m_xCommandOptions && m_xCommandOptions->LookupDisabled(aCommand))
683 return css::uno::Reference< css::frame::XDispatch >();
684 else
685 {
686 // We use a helper to support these interface and an interceptor mechanism.
687 // Our helper is threadsafe by himself!
688 return m_xDispatchHelper->queryDispatch( aURL, sTargetFrameName, nSearchFlags );
689 }
690}
691
692css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Desktop::queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries )
693{
694 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
695 // Register transaction and reject wrong calls.
697
698 return m_xDispatchHelper->queryDispatches( lQueries );
699}
700
701/*-************************************************************************************************************
702 @interface XDispatchProviderInterception
703 @short supports registration/deregistration of interception objects, which
704 are interested on special dispatches.
705
706 @descr It's really provided by an internal helper, which is used inside the dispatch API too.
707 @param xInterceptor
708 the interceptor object, which wishes to be (de)registered.
709
710 @threadsafe yes
711*//*-*************************************************************************************************************/
712void SAL_CALL Desktop::registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
713{
715
716 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper( m_xDispatchHelper, css::uno::UNO_QUERY );
717 xInterceptionHelper->registerDispatchProviderInterceptor( xInterceptor );
718}
719
720void SAL_CALL Desktop::releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor)
721{
723
724 css::uno::Reference< css::frame::XDispatchProviderInterception > xInterceptionHelper( m_xDispatchHelper, css::uno::UNO_QUERY );
725 xInterceptionHelper->releaseDispatchProviderInterceptor( xInterceptor );
726}
727
728/*-************************************************************************************************************
729 @interface XFramesSupplier
730 @short return access to append or remove children on desktop
731 @descr We don't implement these interface directly. We use a helper class to do this.
732 If you wish to add or delete children to/from the container, call these method to get
733 a reference to the helper.
734
735 @attention Helper is threadsafe himself. So we don't need any lock here.
736
737 @seealso class OFrames
738 @return A reference to the helper.
739
740 @onerror A null reference is returned.
741 @threadsafe yes
742*//*-*************************************************************************************************************/
743css::uno::Reference< css::frame::XFrames > SAL_CALL Desktop::getFrames()
744{
745 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
746 // Register transaction and reject wrong calls.
748
749 return m_xFramesHelper;
750}
751
752/*-************************************************************************************************************
753 @interface XFramesSupplier
754 @short set/get the current active child frame
755 @descr It must be a task. Direct children of desktop are tasks only! No frames are accepted.
756 We don't save this information directly in this class. We use our container-helper
757 to do that.
758
759 @attention Helper is threadsafe himself. So we don't need any lock here.
760
761 @seealso class OFrameContainer
762
763 @param "xFrame", new active frame (must be valid!)
764 @return A reference to our current active childtask, if anyone exist.
765
766 @onerror A null reference is returned.
767 @threadsafe yes
768*//*-*************************************************************************************************************/
769void SAL_CALL Desktop::setActiveFrame( const css::uno::Reference< css::frame::XFrame >& xFrame )
770{
771 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
772 // Register transaction and reject wrong calls.
774
775 // Get old active frame first.
776 // If nothing will change - do nothing!
777 // Otherwise set new active frame ...
778 // and deactivate last frame.
779 // It's necessary for our FrameActionEvent listener on a frame!
780 css::uno::Reference< css::frame::XFrame > xLastActiveChild = m_aChildTaskContainer.getActive();
781 if( xLastActiveChild != xFrame )
782 {
784 if( xLastActiveChild.is() )
785 {
786 xLastActiveChild->deactivate();
787 }
788 }
789}
790
791css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::getActiveFrame()
792{
793 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
794 // Register transaction and reject wrong calls.
796
798}
799
800/*
801 @interface XFrame
802 @short non implemented methods!
803 @descr Some method make no sense for our desktop! He has no window or parent or ...
804 So we should implement it empty and warn programmer, if he use it!
805*/
806void SAL_CALL Desktop::initialize( const css::uno::Reference< css::awt::XWindow >& )
807{
808}
809
810css::uno::Reference< css::awt::XWindow > SAL_CALL Desktop::getContainerWindow()
811{
812 return css::uno::Reference< css::awt::XWindow >();
813}
814
815void SAL_CALL Desktop::setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& /*xCreator*/ )
816{
817}
818
819css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL Desktop::getCreator()
820{
821 return css::uno::Reference< css::frame::XFramesSupplier >();
822}
823
824OUString SAL_CALL Desktop::getName()
825{
827 return m_sName;
828}
829
830void SAL_CALL Desktop::setName( const OUString& sName )
831{
833 m_sName = sName;
834}
835
837{
838 return true;
839}
840
841void SAL_CALL Desktop::activate()
842{
843 // Desktop is active always... but sometimes our frames try to activate
844 // the complete path from bottom to top... And our desktop is the topest frame :-(
845 // So - please don't show any assertions here. Do nothing!
846}
847
848void SAL_CALL Desktop::deactivate()
849{
850 // Desktop is active always... but sometimes our frames try to deactivate
851 // the complete path from bottom to top... And our desktop is the topest frame :-(
852 // So - please don't show any assertions here. Do nothing!
853}
854
856{
857 return true;
858}
859
860sal_Bool SAL_CALL Desktop::setComponent( const css::uno::Reference< css::awt::XWindow >& /*xComponentWindow*/ ,
861 const css::uno::Reference< css::frame::XController >& /*xController*/ )
862{
863 return false;
864}
865
866css::uno::Reference< css::awt::XWindow > SAL_CALL Desktop::getComponentWindow()
867{
868 return css::uno::Reference< css::awt::XWindow >();
869}
870
871css::uno::Reference< css::frame::XController > SAL_CALL Desktop::getController()
872{
873 return css::uno::Reference< css::frame::XController >();
874}
875
877{
878}
879
880void SAL_CALL Desktop::addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& )
881{
882}
883
884// css::frame::XFrame
885void SAL_CALL Desktop::removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& )
886{
887}
888
889/*-************************************************************************************************************
890 @interface XFrame
891 @short try to find a frame with special parameters
892 @descr This method searches for a frame with the specified name.
893 Frames may contain other frames (e.g. a frameset) and may
894 be contained in other frames. This hierarchy is searched by
895 this method.
896 First some special names are taken into account, i.e. "",
897 "_self", "_top", "_parent" etc. The FrameSearchFlags are ignored
898 when comparing these names with aTargetFrameName, further steps are
899 controlled by the FrameSearchFlags. If allowed, the name of the frame
900 itself is compared with the desired one, then ( again if allowed )
901 the method findFrame is called for all children of the frame.
902 If no Frame with the given name is found until the top frames container,
903 a new top Frame is created, if this is allowed by a special
904 FrameSearchFlag. The new Frame also gets the desired name.
905 We use a helper to get right search direction and react in a right manner.
906
907 @seealso class TargetFinder
908
909 @param "sTargetFrameName" , name of searched frame
910 @param "nSearchFlags" , flags to regulate search
911 @return A reference to an existing frame in hierarchy, if it exist.
912
913 @onerror A null reference is returned.
914 @threadsafe yes
915*//*-*************************************************************************************************************/
916css::uno::Reference< css::frame::XFrame > SAL_CALL Desktop::findFrame( const OUString& sTargetFrameName ,
917 sal_Int32 nSearchFlags )
918{
919 css::uno::Reference< css::frame::XFrame > xTarget;
920
921 // 0) Ignore wrong parameter!
922 // We don't support search for following special targets.
923 // If we reject these requests, we must not check for such names
924 // in following code again and again. If we do not, so wrong
925 // search results can occur!
926
927 if (
928 (sTargetFrameName==SPECIALTARGET_DEFAULT ) || // valid for dispatches - not for findFrame()!
929 (sTargetFrameName==SPECIALTARGET_PARENT ) || // we have no parent by definition
930 (sTargetFrameName==SPECIALTARGET_BEAMER ) // beamer frames are allowed as child of tasks only -
931 // and they exist more than ones. We have no idea which our sub tasks is the right one
932 )
933 {
934 return nullptr;
935 }
936
937 // I) check for special defined targets first which must be handled exclusive.
938 // force using of "if() else if() ..."
939
940 // I.I) "_blank"
941 // create a new task as child of this desktop instance
942 // Note: Used helper TaskCreator use us automatically ...
943
944 if ( sTargetFrameName==SPECIALTARGET_BLANK )
945 {
946 TaskCreator aCreator( m_xContext );
947 xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor());
948 }
949
950 // I.II) "_top"
951 // We are top by definition
952
953 else if ( sTargetFrameName==SPECIALTARGET_TOP )
954 {
955 xTarget = this;
956 }
957
958 // I.III) "_self", ""
959 // This mean this "frame" in every case.
960
961 else if (
962 ( sTargetFrameName==SPECIALTARGET_SELF ) ||
963 ( sTargetFrameName.isEmpty() )
964 )
965 {
966 xTarget = this;
967 }
968
969 else
970 {
971
972 // II) otherwise use optional given search flags
973 // force using of combinations of such flags. means no "else" part of use if() statements.
974 // But we ust break further searches if target was already found.
975 // Order of using flags is fix: SELF - CHILDREN - SIBLINGS - PARENT
976 // TASK and CREATE are handled special.
977 // But note: Such flags are not valid for the desktop - especially SIBLINGS or PARENT.
978
979 // II.I) SELF
980 // Check for right name. If it's the searched one return ourself - otherwise
981 // ignore this flag.
982
983 if (
984 (nSearchFlags & css::frame::FrameSearchFlag::SELF) &&
985 (m_sName == sTargetFrameName)
986 )
987 {
988 xTarget = this;
989 }
990
991 // II.II) TASKS
992 // This is a special flag. Normally it regulate search inside tasks and forbid access to parent trees.
993 // But the desktop exists outside such task trees. They are our sub trees. So the desktop implement
994 // a special feature: We use it to start search on our direct children only. That means we suppress
995 // search on ALL child frames. May that can be useful to get access on opened document tasks
996 // only without filter out all non really required sub frames ...
997 // Used helper method on our container doesn't create any frame - it's a search only.
998
999 if (
1000 ( ! xTarget.is() ) &&
1001 (nSearchFlags & css::frame::FrameSearchFlag::TASKS)
1002 )
1003 {
1005 }
1006
1007 // II.III) CHILDREN
1008 // Search on all children for the given target name.
1009 // An empty name value can't occur here - because it must be already handled as "_self"
1010 // before. Used helper function of container doesn't create any frame.
1011 // It makes a deep search only.
1012
1013 if (
1014 ( ! xTarget.is() ) &&
1015 (nSearchFlags & css::frame::FrameSearchFlag::CHILDREN)
1016 )
1017 {
1019 }
1020
1021 // II.IV) CREATE
1022 // If we haven't found any valid target frame by using normal flags - but user allowed us to create
1023 // a new one ... we should do that. Used TaskCreator use us automatically as parent!
1024
1025 if (
1026 ( ! xTarget.is() ) &&
1027 (nSearchFlags & css::frame::FrameSearchFlag::CREATE)
1028 )
1029 {
1030 TaskCreator aCreator( m_xContext );
1031 xTarget = aCreator.createTask(sTargetFrameName, utl::MediaDescriptor());
1032 }
1033 }
1034
1035 return xTarget;
1036}
1037
1038void SAL_CALL Desktop::disposing()
1039{
1040 // Safe impossible cases
1041 // It's a programming error if dispose is called before terminate!
1042
1043 // But if you just ignore the assertion (which happens in unit
1044 // tests for instance in sc/qa/unit) nothing bad happens.
1045 assert(m_bIsShutdown && "Desktop disposed before terminating it");
1046
1047 {
1048 SolarMutexGuard aWriteLock;
1049
1050 {
1052 }
1053
1054 // Disable this instance for further work.
1055 // This will wait for all current running transactions ...
1056 // and reject all new incoming requests!
1058 }
1059
1060 // Following lines of code can be called outside a synchronized block ...
1061 // Because our transaction manager will block all new requests to this object.
1062 // So nobody can use us any longer.
1063 // Exception: Only removing of listener will work ... and this code can't be dangerous.
1064
1065 // First we have to kill all listener connections.
1066 // They might rely on our member and can hinder us on releasing them.
1067 css::uno::Reference< css::uno::XInterface > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY );
1068 css::lang::EventObject aEvent( xThis );
1070
1071 // Clear our child task container and forget all task references hardly.
1072 // Normally all open document was already closed by our terminate() function before ...
1073 // New opened frames will have a problem now .-)
1075
1076 // Dispose our helper too.
1077 css::uno::Reference< css::lang::XEventListener > xFramesHelper( m_xFramesHelper, css::uno::UNO_QUERY );
1078 if( xFramesHelper.is() )
1079 xFramesHelper->disposing( aEvent );
1080
1081 // At least clean up other member references.
1082 m_xDispatchHelper.clear();
1083 m_xFramesHelper.clear();
1084 m_xContext.clear();
1085
1086 m_xPipeTerminator.clear();
1087 m_xQuickLauncher.clear();
1088 m_xSWThreadManager.clear();
1089
1090 // we need a copy because the disposing might call the removeEventListener method
1091 std::vector< css::uno::Reference<css::frame::XTerminateListener> > xComponentDllListeners;
1092 xComponentDllListeners.swap(m_xComponentDllListeners);
1093 for (auto& xListener: xComponentDllListeners)
1094 {
1095 xListener->disposing(aEvent);
1096 }
1097 xComponentDllListeners.clear();
1098 m_xSfxTerminator.clear();
1099 m_xCommandOptions.reset();
1100
1101 // From this point nothing will work further on this object ...
1102 // excepting our dtor() .-)
1104}
1105
1106/*
1107 @interface XComponent
1108 @short add/remove listener for dispose events
1109 @descr Add an event listener to this object, if you wish to get information
1110 about our dying!
1111 You must release this listener reference during your own disposing() method.
1112
1113 @attention Our container is threadsafe himself. So we don't need any lock here.
1114 @param "xListener", reference to valid listener. We don't accept invalid values!
1115 @threadsafe yes
1116*/
1117void SAL_CALL Desktop::addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener )
1118{
1119 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1120 // Safe impossible cases
1121 // Method not defined for all incoming parameter.
1122 SAL_WARN_IF( !xListener.is(), "fwk.desktop", "Desktop::addEventListener(): Invalid parameter detected!" );
1123 // Register transaction and reject wrong calls.
1125
1127}
1128
1129void SAL_CALL Desktop::removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener )
1130{
1131 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1132 // Safe impossible cases
1133 // Method not defined for all incoming parameter.
1134 SAL_WARN_IF( !xListener.is(), "fwk.desktop", "Desktop::removeEventListener(): Invalid parameter detected!" );
1135 // Register transaction and reject wrong calls.
1137
1139}
1140
1141/*-************************************************************************************************************
1142 @interface XDispatchResultListener
1143 @short callback for dispatches
1144 @descr To support our method "loadComponentFromURL()" we are listener on temp. created dispatcher.
1145 They call us back in this method "statusChanged()". As source of given state event, they give us a
1146 reference to the target frame, in which dispatch was loaded! So we can use it to return his component
1147 to caller! If no target exist ... ??!!
1148
1149 @seealso method loadComponentFromURL()
1150
1151 @param "aEvent", state event which (hopefully) valid information
1152 @threadsafe yes
1153*//*-*************************************************************************************************************/
1154void SAL_CALL Desktop::dispatchFinished( const css::frame::DispatchResultEvent& aEvent )
1155{
1156 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1157 // Register transaction and reject wrong calls.
1159
1162 {
1164 if( aEvent.State == css::frame::DispatchResultState::SUCCESS )
1165 {
1166 css::uno::Reference< css::frame::XFrame > xLastFrame;
1167 if ( aEvent.Result >>= xLastFrame )
1169 }
1170 }
1171}
1172
1173/*-************************************************************************************************************
1174 @interface XEventListener
1175 @short not implemented!
1176 @descr We are a status listener ... and so we must be an event listener too ... But we don't need it really!
1177 We are a temp. listener only and our lifetime isn't smaller then of our temp. used dispatcher.
1178
1179 @seealso method loadComponentFromURL()
1180*//*-*************************************************************************************************************/
1181void SAL_CALL Desktop::disposing( const css::lang::EventObject& )
1182{
1183 SAL_WARN( "fwk.desktop", "Desktop::disposing(): Algorithm error! Normally desktop is temp. listener ... not all the time. So this method shouldn't be called." );
1184}
1185
1186/*-************************************************************************************************************
1187 @interface XInteractionHandler
1188 @short callback for loadComponentFromURL for detected exceptions during load process
1189 @descr In this case we must cancel loading and throw these detected exception again as result
1190 of our own called method.
1191
1192 @attention a)
1193 Normal loop in loadComponentFromURL() breaks on set member m_eLoadState during callback statusChanged().
1194 But these interaction feature implements second way to do so! So we must look on different callbacks
1195 for same operation ... and live with it.
1196 b)
1197 Search for given continuations too. If any XInteractionAbort exist ... use it to abort further operations
1198 for currently running operation!
1199
1200 @seealso method loadComponentFromURL()
1201 @seealso member m_eLoadState
1202
1203 @param "xRequest", request for interaction - normal a wrapped target exception from bottom services
1204 @threadsafe yes
1205*//*-*************************************************************************************************************/
1206void SAL_CALL Desktop::handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest )
1207{
1208 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1209 // Register transaction and reject wrong calls.
1211
1212 // Don't check incoming request!
1213 // If somewhere starts interaction without right parameter - he made something wrong.
1214 // loadComponentFromURL() waits for these event - otherwise it yield for ever!
1215
1216 // get packed request and work on it first
1217 // Attention: Don't set it on internal member BEFORE interaction is finished - because
1218 // "loadComponentFromURL()" yield tills this member is changed. If we do it before
1219 // interaction finish we can't guarantee right functionality. May be we cancel load process to earlier...
1220 css::uno::Any aRequest = xRequest->getRequest();
1221
1222 // extract continuations from request
1223 css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > lContinuations = xRequest->getContinuations();
1224 css::uno::Reference< css::task::XInteractionAbort > xAbort;
1225 css::uno::Reference< css::task::XInteractionApprove > xApprove;
1226 css::uno::Reference< css::document::XInteractionFilterSelect > xFilterSelect;
1227 bool bAbort = false;
1228
1229 sal_Int32 nCount=lContinuations.getLength();
1230 for( sal_Int32 nStep=0; nStep<nCount; ++nStep )
1231 {
1232 if( ! xAbort.is() )
1233 xAbort.set( lContinuations[nStep], css::uno::UNO_QUERY );
1234
1235 if( ! xApprove.is() )
1236 xApprove.set( lContinuations[nStep], css::uno::UNO_QUERY );
1237
1238 if( ! xFilterSelect.is() )
1239 xFilterSelect.set( lContinuations[nStep], css::uno::UNO_QUERY );
1240 }
1241
1242 // differ between abortable interactions (error, unknown filter...)
1243 // and other ones (ambiguous but not unknown filter...)
1244 css::task::ErrorCodeRequest aErrorCodeRequest;
1245 if( aRequest >>= aErrorCodeRequest )
1246 {
1247 bool bWarning = ErrCode(aErrorCodeRequest.ErrCode).IsWarning();
1248 if (xApprove.is() && bWarning)
1249 xApprove->select();
1250 else
1251 if (xAbort.is())
1252 {
1253 xAbort->select();
1254 bAbort = true;
1255 }
1256 }
1257 else if( xAbort.is() )
1258 {
1259 xAbort->select();
1260 bAbort = true;
1261 }
1262
1263 // Ok now it's time to break yield loop of loadComponentFromURL().
1264 // But only for really aborted requests!
1265 // For example warnings will be approved and we wait for any success story ...
1266 if (bAbort)
1267 {
1270 }
1271}
1272
1273::sal_Int32 SAL_CALL Desktop::leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent )
1274{
1276 return m_xTitleNumberGenerator->leaseNumber (xComponent);
1277}
1278
1279void SAL_CALL Desktop::releaseNumber( ::sal_Int32 nNumber )
1280{
1282 m_xTitleNumberGenerator->releaseNumber (nNumber);
1283}
1284
1285void SAL_CALL Desktop::releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent )
1286{
1288 m_xTitleNumberGenerator->releaseNumberForComponent (xComponent);
1289}
1290
1292{
1294 return m_xTitleNumberGenerator->getUntitledPrefix ();
1295}
1296
1297/*-************************************************************************************************************
1298 @short try to convert a property value
1299 @descr This method is called from helperclass "OPropertySetHelper".
1300 Don't use this directly!
1301 You must try to convert the value of given PropHandle and
1302 return results of this operation. This will be used to ask vetoable
1303 listener. If no listener has a veto, we will change value really!
1304 ( in method setFastPropertyValue_NoBroadcast(...) )
1305
1306 @attention Methods of OPropertySethelper are safed by using our shared osl mutex! (see ctor!)
1307 So we must use different locks to make our implementation threadsafe.
1308
1309 @seealso class OPropertySetHelper
1310 @seealso method setFastPropertyValue_NoBroadcast()
1311
1312 @param "aConvertedValue" new converted value of property
1313 @param "aOldValue" old value of property
1314 @param "nHandle" handle of property
1315 @param "aValue" new value of property
1316 @return sal_True if value will be changed, sal_FALSE otherway
1317
1318 @onerror IllegalArgumentException, if you call this with an invalid argument
1319 @threadsafe yes
1320*//*-*************************************************************************************************************/
1321sal_Bool SAL_CALL Desktop::convertFastPropertyValue( css::uno::Any& aConvertedValue ,
1322 css::uno::Any& aOldValue ,
1323 sal_Int32 nHandle ,
1324 const css::uno::Any& aValue )
1325{
1326 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1327 // Register transaction and reject wrong calls.
1329
1330 // Initialize state with sal_False !!!
1331 // (Handle can be invalid)
1332 bool bReturn = false;
1333
1334 switch( nHandle )
1335 {
1336 case PropHandle::SuspendQuickstartVeto:
1338 css::uno::Any(m_bSuspendQuickstartVeto),
1339 aValue,
1340 aOldValue,
1341 aConvertedValue);
1342 break;
1343 case PropHandle::DispatchRecorderSupplier :
1345 css::uno::Any(m_xDispatchRecorderSupplier),
1346 aValue,
1347 aOldValue,
1348 aConvertedValue);
1349 break;
1350 case PropHandle::Title :
1352 css::uno::Any(m_sTitle),
1353 aValue,
1354 aOldValue,
1355 aConvertedValue);
1356 break;
1357 }
1358
1359 // Return state of operation.
1360 return bReturn;
1361}
1362
1363/*-************************************************************************************************************
1364 @short set value of a transient property
1365 @descr This method is calling from helperclass "OPropertySetHelper".
1366 Don't use this directly!
1367 Handle and value are valid everyway! You must set the new value only.
1368 After this, baseclass send messages to all listener automatically.
1369
1370 @seealso class OPropertySetHelper
1371
1372 @param "nHandle" handle of property to change
1373 @param "aValue" new value of property
1374 @onerror An exception is thrown.
1375 @threadsafe yes
1376*//*-*************************************************************************************************************/
1377void SAL_CALL Desktop::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
1378 const css::uno::Any& aValue )
1379{
1380 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1381 // Register transaction and reject wrong calls.
1383
1384 switch( nHandle )
1385 {
1386 case PropHandle::SuspendQuickstartVeto: aValue >>= m_bSuspendQuickstartVeto;
1387 break;
1388 case PropHandle::DispatchRecorderSupplier: aValue >>= m_xDispatchRecorderSupplier;
1389 break;
1390 case PropHandle::Title: aValue >>= m_sTitle;
1391 break;
1392 }
1393}
1394
1395/*-************************************************************************************************************
1396 @short get value of a transient property
1397 @descr This method is calling from helperclass "OPropertySetHelper".
1398 Don't use this directly!
1399
1400 @attention We don't need any mutex or lock here ... We use threadsafe container or methods here only!
1401
1402 @seealso class OPropertySetHelper
1403
1404 @param "nHandle" handle of property to change
1405 @param "aValue" current value of property
1406 @threadsafe yes
1407*//*-*************************************************************************************************************/
1408void SAL_CALL Desktop::getFastPropertyValue( css::uno::Any& aValue ,
1409 sal_Int32 nHandle ) const
1410{
1411 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1412 // Register transaction and reject wrong calls.
1414
1415 switch( nHandle )
1416 {
1417 case PropHandle::ActiveFrame : aValue <<= m_aChildTaskContainer.getActive();
1418 break;
1419 case PropHandle::IsPlugged : aValue <<= false;
1420 break;
1421 case PropHandle::SuspendQuickstartVeto: aValue <<= m_bSuspendQuickstartVeto;
1422 break;
1423 case PropHandle::DispatchRecorderSupplier: aValue <<= m_xDispatchRecorderSupplier;
1424 break;
1425 case PropHandle::Title: aValue <<= m_sTitle;
1426 break;
1427 }
1428}
1429
1431{
1432 static cppu::OPropertyArrayHelper HELPER =
1433 [] () {
1435 {{"ActiveFrame", PropHandle::ActiveFrame,
1437 (css::beans::PropertyAttribute::TRANSIENT
1438 | css::beans::PropertyAttribute::READONLY)},
1439 {"DispatchRecorderSupplier",
1440 PropHandle::DispatchRecorderSupplier,
1442 css::beans::PropertyAttribute::TRANSIENT},
1443 {"IsPlugged",
1444 PropHandle::IsPlugged, cppu::UnoType<bool>::get(),
1445 (css::beans::PropertyAttribute::TRANSIENT
1446 | css::beans::PropertyAttribute::READONLY)},
1447 {"SuspendQuickstartVeto", PropHandle::SuspendQuickstartVeto,
1449 css::beans::PropertyAttribute::TRANSIENT},
1450 {"Title", PropHandle::Title, cppu::UnoType<OUString>::get(),
1451 css::beans::PropertyAttribute::TRANSIENT}},
1452 true};
1453 }();
1454 return HELPER;
1455}
1456
1457/*-************************************************************************************************************
1458 @short return propertysetinfo
1459 @descr You can call this method to get information about transient properties
1460 of this object.
1461
1462 @attention You must use global lock (method use static variable) ... and it must be the shareable osl mutex of it.
1463 Because; our baseclass use this mutex to make his code threadsafe. We use our lock!
1464 So we could have two different mutex/lock mechanism at the same object.
1465
1466 @seealso class OPropertySetHelper
1467 @seealso interface XPropertySet
1468 @seealso interface XMultiPropertySet
1469 @return reference to object with information [XPropertySetInfo]
1470 @threadsafe yes
1471*//*-*************************************************************************************************************/
1472css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL Desktop::getPropertySetInfo()
1473{
1474 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1475 // Register transaction and reject wrong calls.
1477
1478 // Create structure of propertysetinfo for baseclass "OPropertySetHelper".
1479 // (Use method "getInfoHelper()".)
1480 static css::uno::Reference< css::beans::XPropertySetInfo > xInfo(
1482
1483 return xInfo;
1484}
1485
1486/*-************************************************************************************************************
1487 @short return current component of current frame
1488 @descr The desktop himself has no component. But every frame in subtree.
1489 If somewhere call getCurrentComponent() at this class, we try to find the right frame and
1490 then we try to become his component. It can be a VCL-component, the model or the controller
1491 of founded frame.
1492
1493 @attention We don't work on internal member ... so we don't need any lock here.
1494
1495 @seealso method getCurrentComponent();
1496
1497 @param "xFrame", reference to valid frame in hierarchy. Method is not defined for invalid values.
1498 But we don't check these. It's an IMPL-method and caller must use it right!
1499 @return A reference to found component.
1500
1501 @onerror A null reference is returned.
1502 @threadsafe yes
1503*//*-*************************************************************************************************************/
1504css::uno::Reference< css::lang::XComponent > Desktop::impl_getFrameComponent( const css::uno::Reference< css::frame::XFrame >& xFrame ) const
1505{
1506 /* UNSAFE AREA --------------------------------------------------------------------------------------------- */
1507 // Register transaction and reject wrong calls.
1509
1510 // Set default return value, if method failed.
1511 css::uno::Reference< css::lang::XComponent > xComponent;
1512 // Does no controller exists?
1513 css::uno::Reference< css::frame::XController > xController = xFrame->getController();
1514 if( !xController.is() )
1515 {
1516 // Controller not exist - use the VCL-component.
1517 xComponent = xFrame->getComponentWindow();
1518 }
1519 else
1520 {
1521 // Does no model exists?
1522 css::uno::Reference< css::frame::XModel > xModel = xController->getModel();
1523 if( xModel.is() )
1524 {
1525 // Model exist - use the model as component.
1526 xComponent = xModel;
1527 }
1528 else
1529 {
1530 // Model not exist - use the controller as component.
1531 xComponent = xController;
1532 }
1533 }
1534
1535 return xComponent;
1536}
1537
1539{
1541
1543 if ( ! pContainer )
1544 return true;
1545
1546 css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) );
1547
1548 comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer );
1549 while ( aIterator.hasMoreElements() )
1550 {
1551 try
1552 {
1553 css::uno::Reference< css::frame::XTerminateListener > xListener(aIterator.next(), css::uno::UNO_QUERY);
1554 if ( ! xListener.is() )
1555 continue;
1556 xListener->queryTermination( aEvent );
1557 lCalledListener.push_back(xListener);
1558 }
1559 catch( const css::frame::TerminationVetoException& )
1560 {
1561 // first veto will stop the query loop.
1562 return false;
1563 }
1564 catch( const css::uno::Exception& )
1565 {
1566 // clean up container.
1567 // E.g. dead remote listener objects can make trouble otherwise.
1568 // Iterator implementation allows removing objects during it's used !
1569 aIterator.remove();
1570 }
1571 }
1572
1573 return true;
1574}
1575
1577{
1579
1580 css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) );
1581 for (const css::uno::Reference<css::frame::XTerminateListener>& xListener : lCalledListener)
1582 {
1583 try
1584 {
1585 // Note: cancelTermination() is a new and optional interface method !
1586 css::uno::Reference< css::frame::XTerminateListener2 > xListenerGeneration2(xListener, css::uno::UNO_QUERY);
1587 if ( ! xListenerGeneration2.is() )
1588 continue;
1589 xListenerGeneration2->cancelTermination( aEvent );
1590 }
1591 catch( const css::uno::Exception& )
1592 {}
1593 }
1594}
1595
1597{
1599
1601 if ( ! pContainer )
1602 return;
1603
1604 comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer );
1605 while ( aIterator.hasMoreElements() )
1606 {
1607 try
1608 {
1609 css::frame::XTerminateListener* pTerminateListener =
1610 static_cast< css::frame::XTerminateListener* >(aIterator.next());
1611 css::uno::Reference< css::lang::XServiceInfo > xInfo( pTerminateListener, css::uno::UNO_QUERY );
1612 if ( !xInfo.is() )
1613 continue;
1614
1615 if ( xInfo->getImplementationName() != "com.sun.star.comp.svt.TransferableHelperTerminateListener" )
1616 continue;
1617
1618 css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) );
1619 pTerminateListener->notifyTermination( aEvent );
1620
1621 // don't notify twice
1622 aIterator.remove();
1623 }
1624 catch( const css::uno::Exception& )
1625 {
1626 // clean up container.
1627 // E.g. dead remote listener objects can make trouble otherwise.
1628 // Iterator implementation allows removing objects during it's used !
1629 aIterator.remove();
1630 }
1631 }
1632}
1633
1635{
1637
1639 if ( ! pContainer )
1640 return;
1641
1642 css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) );
1643
1644 comphelper::OInterfaceIteratorHelper2 aIterator( *pContainer );
1645 while ( aIterator.hasMoreElements() )
1646 {
1647 try
1648 {
1649 static_cast< css::frame::XTerminateListener* >(aIterator.next())->notifyTermination( aEvent );
1650 }
1651 catch( const css::uno::Exception& )
1652 {
1653 // clean up container.
1654 // E.g. dead remote listener objects can make trouble otherwise.
1655 // Iterator implementation allows removing objects during it's used !
1656 aIterator.remove();
1657 }
1658 }
1659}
1660
1661bool Desktop::impl_closeFrames(bool bAllowUI)
1662{
1663 SolarMutexClearableGuard aReadLock;
1664 css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > lFrames = m_aChildTaskContainer.getAllElements();
1665 aReadLock.clear();
1666
1667 ::sal_Int32 c = lFrames.getLength();
1668 ::sal_Int32 i = 0;
1669 ::sal_Int32 nNonClosedFrames = 0;
1670
1671 for( i=0; i<c; ++i )
1672 {
1673 try
1674 {
1675 css::uno::Reference< css::frame::XFrame > xFrame = lFrames[i];
1676
1677 // XController.suspend() will show a UI ...
1678 // Use it in case it was allowed from outside only.
1679 bool bSuspended = false;
1680 css::uno::Reference< css::frame::XController > xController = xFrame->getController();
1681 if ( bAllowUI && xController.is() )
1682 {
1683 bSuspended = xController->suspend( true );
1684 if ( ! bSuspended )
1685 {
1686 ++nNonClosedFrames;
1687 if(m_bSession)
1688 break;
1689 else
1690 continue;
1691 }
1692 }
1693
1694 // Try to close frame (in case no UI was allowed without calling XController->suspend() before!)
1695 // But don't deliver ownership to any other one!
1696 // This method can be called again.
1697 css::uno::Reference< css::util::XCloseable > xClose( xFrame, css::uno::UNO_QUERY );
1698 if ( xClose.is() )
1699 {
1700 try
1701 {
1702 xClose->close(false);
1703 }
1704 catch(const css::util::CloseVetoException&)
1705 {
1706 // Any internal process of this frame disagree with our request.
1707 // Safe this state but don't break these loop. Other frames has to be closed!
1708 ++nNonClosedFrames;
1709
1710 // Reactivate controller.
1711 // It can happen that XController.suspend() returned true... but a registered close listener
1712 // threw these veto exception. Then the controller has to be reactivated. Otherwise
1713 // these document doesn't work any more.
1714 if ( bSuspended && xController.is())
1715 xController->suspend(false);
1716 }
1717
1718 // If interface XClosable interface exists and was used...
1719 // it's not allowed to use XComponent->dispose() also!
1720 continue;
1721 }
1722
1723 // XClosable not supported ?
1724 // Then we have to dispose these frame hardly.
1725 if ( xFrame.is() )
1726 xFrame->dispose();
1727
1728 // Don't remove these frame from our child container!
1729 // A frame do it by itself inside close()/dispose() method.
1730 }
1731 catch(const css::lang::DisposedException&)
1732 {
1733 // Dispose frames are closed frames.
1734 // So we can count it here .-)
1735 }
1736 }
1737
1738 // reset the session
1739 m_bSession = false;
1740
1741 return (nNonClosedFrames < 1);
1742}
1743
1744} // namespace framework
1745
1746namespace {
1747
1749 css::uno::Reference<css::uno::XComponentContext> const & context)
1750{
1751 SolarMutexGuard g; // tdf#114025 init with SolarMutex to avoid deadlock
1753 desktop->constructorInit();
1754 return desktop;
1755}
1756
1757}
1758
1760 css::uno::Reference<css::uno::XComponentContext> const & context)
1761{
1762 static auto const instance = createDesktop(context);
1763 return instance;
1764}
1765
1766extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
1768 css::uno::XComponentContext *context,
1769 css::uno::Sequence<css::uno::Any> const &)
1770{
1771 return cppu::acquire(framework::getDesktop(context).get());
1772}
1773
1774/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sImplementationName
AnyEventRef aEvent
static bool IsInExecute()
static void Quit()
static void addKeyValue(SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER const OUString &, SAL_UNUSED_PARAMETER tAddKeyHandling)
bool IsWarning() const
static void ProcessEventsToIdle()
css::uno::XInterface * next()
OInterfaceContainerHelper2 * getContainer(const css::uno::Type &rKey) const
sal_Int32 removeInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &rxIFace)
sal_Int32 addInterface(const css::uno::Type &rKey, const css::uno::Reference< css::uno::XInterface > &r)
void disposeAndClear(const css::lang::EventObject &rEvt)
static css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL createPropertySetInfo(IPropertyArrayHelper &rProperties)
css::uno::Sequence< css::uno::Type > getTypes()
css::uno::Type const & get()
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL(const OUString &sURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags, const css::uno::Sequence< css::beans::PropertyValue > &lArguments) override
Definition: desktop.cxx:565
virtual void SAL_CALL setName(const OUString &sName) override
Definition: desktop.cxx:830
bool terminateQuickstarterToo()
Definition: desktop.cxx:361
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &aValue) override
Definition: desktop.cxx:1377
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents() override
Definition: desktop.cxx:469
virtual void SAL_CALL activate() override
Definition: desktop.cxx:841
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer
array of child tasks (children of desktop are tasks; and tasks are also frames - But pure frames are ...
Definition: desktop.hxx:398
virtual void SAL_CALL setCreator(const css::uno::Reference< css::frame::XFramesSupplier > &xCreator) override
Definition: desktop.cxx:815
bool m_bSession
when true, the call came from session manager the method is Desktop::terminateQuickstarterToo() this ...
Definition: desktop.hxx:394
virtual void SAL_CALL deactivate() override
Definition: desktop.cxx:848
OUString m_sName
ref counted class to support disabling commands defined by configuration file
Definition: desktop.hxx:404
virtual ::sal_Int32 SAL_CALL leaseNumber(const css::uno::Reference< css::uno::XInterface > &xComponent) override
Definition: desktop.cxx:1273
FrameContainer m_aChildTaskContainer
reference to factory, which has create this instance
Definition: desktop.hxx:397
void constructorInit()
Definition: desktop.cxx:88
virtual void SAL_CALL setActiveFrame(const css::uno::Reference< css::frame::XFrame > &xFrame) override
Definition: desktop.cxx:769
ELoadState m_eLoadState
helper to dispatch something for new tasks, created by "_blank"!
Definition: desktop.hxx:401
css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager
special terminate listener which loads images asynchronous for current open documents.
Definition: desktop.hxx:427
virtual void SAL_CALL dispatchFinished(const css::frame::DispatchResultEvent &aEvent) override
Definition: desktop.cxx:1154
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks() override
Definition: desktop.cxx:617
bool m_bIsShutdown
check flag to protect us against dispose before terminate! see dispose() for further information!
Definition: desktop.hxx:383
virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame() override
Definition: desktop.cxx:527
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() override
Definition: desktop.cxx:810
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: desktop.cxx:1129
virtual OUString SAL_CALL getUntitledPrefix() override
Definition: desktop.cxx:1291
virtual OUString SAL_CALL getName() override
Definition: desktop.cxx:824
std::vector< css::uno::Reference< css::frame::XTerminateListener > > m_xComponentDllListeners
Definition: desktop.hxx:446
virtual void SAL_CALL addTerminateListener(const css::uno::Reference< css::frame::XTerminateListener > &xListener) override
Definition: desktop.cxx:368
css::uno::Reference< css::uno::XComponentContext > m_xContext
Definition: desktop.hxx:396
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: desktop.cxx:1117
virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch(const css::util::URL &aURL, const OUString &sTargetFrameName, sal_Int32 nSearchFlags) override
Definition: desktop.cxx:664
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: desktop.cxx:83
virtual OUString SAL_CALL getImplementationName() override
Definition: desktop.cxx:73
virtual void SAL_CALL disposing() override
Definition: desktop.cxx:1038
virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame(const OUString &sTargetFrameName, sal_Int32 nSearchFlags) override
Definition: desktop.cxx:916
Desktop(css::uno::Reference< css::uno::XComponentContext > xContext)
Definition: desktop.cxx:143
virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() override
Definition: desktop.cxx:866
virtual ~Desktop() override
Definition: desktop.cxx:163
virtual void SAL_CALL releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &xInterceptor) override
Definition: desktop.cxx:720
bool m_bSuspendQuickstartVeto
hold information about state of asynchron loading of component for loadComponentFromURL()!
Definition: desktop.hxx:402
virtual void SAL_CALL removeFrameActionListener(const css::uno::Reference< css::frame::XFrameActionListener > &xListener) override
Definition: desktop.cxx:885
void impl_sendNotifyTerminationEvent()
calls notifyTermination() on every registered termination listener.
Definition: desktop.cxx:1634
css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper
helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer!
Definition: desktop.hxx:400
bool m_bIsTerminated
check flag to protect against multiple terminate runs
Definition: desktop.hxx:378
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &aValue, sal_Int32 nHandle) const override
Definition: desktop.cxx:1408
virtual sal_Bool SAL_CALL setComponent(const css::uno::Reference< css::awt::XWindow > &xComponentWindow, const css::uno::Reference< css::frame::XController > &xController) override
Definition: desktop.cxx:860
virtual sal_Bool SAL_CALL terminate() override
Definition: desktop.cxx:185
virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask() override
Definition: desktop.cxx:639
virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator() override
Definition: desktop.cxx:819
virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame() override
Definition: desktop.cxx:791
bool impl_closeFrames(bool bAllowUI)
try to close all open frames.
Definition: desktop.cxx:1661
virtual void SAL_CALL releaseNumberForComponent(const css::uno::Reference< css::uno::XInterface > &xComponent) override
Definition: desktop.cxx:1285
css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator
special terminate listener shutting down the SfxApplication.
Definition: desktop.hxx:442
css::uno::Reference< css::lang::XComponent > impl_getFrameComponent(const css::uno::Reference< css::frame::XFrame > &xFrame) const
Definition: desktop.cxx:1504
css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator
special terminate listener to close pipe and block external requests during/after termination process...
Definition: desktop.hxx:411
virtual sal_Bool SAL_CALL isActive() override
Definition: desktop.cxx:855
virtual void SAL_CALL removeTerminateListener(const css::uno::Reference< css::frame::XTerminateListener > &xListener) override
Definition: desktop.cxx:410
css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher
special terminate listener shown inside system tray (quick starter) Will hinder the office on shutdow...
Definition: desktop.hxx:418
virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent() override
Definition: desktop.cxx:492
virtual css::uno::Reference< css::frame::XController > SAL_CALL getController() override
Definition: desktop.cxx:871
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
Definition: desktop.cxx:78
virtual void SAL_CALL registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor > &xInterceptor) override
Definition: desktop.cxx:712
virtual void SAL_CALL initialize(const css::uno::Reference< css::awt::XWindow > &xWindow) override
Definition: desktop.cxx:806
virtual void SAL_CALL contextChanged() override
Definition: desktop.cxx:876
css::uno::Reference< css::frame::XFrames > m_xFramesHelper
container for ALL Listener
Definition: desktop.hxx:399
virtual sal_Bool SAL_CALL isTop() override
Definition: desktop.cxx:836
bool impl_sendQueryTerminationEvent(TTerminateListenerList &lCalledListener)
calls queryTermination() on every registered termination listener.
Definition: desktop.cxx:1538
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &type) override
Definition: desktop.cxx:169
void impl_sendCancelTerminationEvent(const TTerminateListenerList &lCalledListener)
calls cancelTermination() on every termination listener where queryTermination() was called before.
Definition: desktop.cxx:1576
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: desktop.cxx:1472
virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches(const css::uno::Sequence< css::frame::DispatchDescriptor > &lQueries) override
Definition: desktop.cxx:692
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: desktop.cxx:177
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
Definition: desktop.cxx:1430
css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier
Definition: desktop.hxx:406
::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList
used temporary to know which listener was already called or not.
Definition: desktop.hxx:107
virtual void SAL_CALL addFrameActionListener(const css::uno::Reference< css::frame::XFrameActionListener > &xListener) override
Definition: desktop.cxx:880
css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator
Definition: desktop.hxx:444
virtual void SAL_CALL handle(const css::uno::Reference< css::task::XInteractionRequest > &xRequest) override
Definition: desktop.cxx:1206
void impl_sendTerminateToClipboard()
calls notifyTermination() on the clipboard listener
Definition: desktop.cxx:1596
virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames() override
Definition: desktop.cxx:743
OUString m_sTitle
Definition: desktop.hxx:405
TransactionManager m_aTransactionManager
Definition: desktop.hxx:374
std::unique_ptr< SvtCommandOptions > m_xCommandOptions
don't ask quickstart for a veto
Definition: desktop.hxx:403
virtual void SAL_CALL releaseNumber(::sal_Int32 nNumber) override
Definition: desktop.cxx:1279
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &aConvertedValue, css::uno::Any &aOldValue, sal_Int32 nHandle, const css::uno::Any &aValue) override
Definition: desktop.cxx:1321
implement a helper for XDispatchProvider interface @descr The result of a queryDispatch() call depend...
void clear()
-****************************************************************************************************...
void setActive(const css::uno::Reference< css::frame::XFrame > &xFrame)
-****************************************************************************************************...
css::uno::Reference< css::frame::XFrame > searchOnAllChildrens(const OUString &sName) const
special helper for Frame::findFrame()
css::uno::Reference< css::frame::XFrame > getActive() const
-****************************************************************************************************...
css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > getAllElements() const
replacement for deprecated index access
css::uno::Reference< css::frame::XFrame > searchOnDirectChildrens(std::u16string_view sName) const
-****************************************************************************************************...
implements a helper to support interception with additional functionality.
static css::uno::Reference< css::lang::XComponent > loadComponentFromURL(const css::uno::Reference< css::frame::XComponentLoader > &xLoader, const css::uno::Reference< css::uno::XComponentContext > &xContext, const OUString &sURL, const OUString &sTarget, sal_Int32 nFlags, const css::uno::Sequence< css::beans::PropertyValue > &lArgs)
Definition: loadenv.cxx:149
implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services @descr Use this ...
Definition: oframes.hxx:45
static bool willPropertyBeChanged(const css::uno::Any &aCurrentValue, const css::uno::Any &aNewValue, css::uno::Any &aOldValue, css::uno::Any &aChangedValue)
checks if given property will be changed by this settings.
Definition: properties.h:112
css::uno::Reference< css::frame::XFrame > createTask(const OUString &sName, const utl::MediaDescriptor &rDescriptor)
Definition: taskcreator.cxx:56
void setWorkingMode(EWorkingMode eMode)
static bool IsFuzzing()
int nCount
Desktop *const m_pDesktop
Definition: desktop.cxx:341
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_Desktop_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Definition: desktop.cxx:1767
css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher
Definition: desktop.cxx:342
URL aURL
Reference< XInterface > xTarget
OUString sName
OUString FwkResId(TranslateId aId)
Definition: fwkresid.cxx:22
css::uno::Reference< css::uno::XComponentContext > m_xContext
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr OUStringLiteral SPECIALTARGET_BEAMER
Definition: targets.h:33
constexpr OUStringLiteral SPECIALTARGET_TOP
Definition: targets.h:30
@ E_NOTSET
Definition: desktop.hxx:60
@ E_SUCCESSFUL
Definition: desktop.hxx:61
@ E_INTERACTION
Definition: desktop.hxx:63
@ E_FAILED
Definition: desktop.hxx:62
constexpr OUStringLiteral SPECIALTARGET_BLANK
Definition: targets.h:31
FWK_DLLPUBLIC const rtl::Reference< Desktop > & getDesktop(css::uno::Reference< css::uno::XComponentContext > const &context)
Definition: desktop.cxx:1759
constexpr OUStringLiteral SPECIALTARGET_DEFAULT
Definition: targets.h:32
cppu::WeakComponentImplHelper< css::lang::XServiceInfo, css::frame::XDesktop2, css::frame::XTasksSupplier, css::frame::XDispatchResultListener, css::task::XInteractionHandler, css::frame::XUntitledNumbers > Desktop_BASE
Definition: desktop.hxx:97
constexpr OUStringLiteral SPECIALTARGET_SELF
Definition: targets.h:28
int i
Title
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
auto syncExecute(FuncT const &func) -> decltype(func())
sal_Int32 nHandle
Reference< XController > xController
Reference< XFrame > xFrame
Reference< XModel > xModel
#define SPECIALTARGET_PARENT
Definition: targets.h:29
OUString aCommand
unsigned char sal_Bool
std::mutex m_aMutex