LibreOffice Module framework (master) 1
layoutmanager.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 <memory>
21#include <config_feature_desktop.h>
22
23#include <properties.h>
25#include "helpers.hxx"
26
33
34#include <com/sun/star/beans/XPropertySet.hpp>
35#include <com/sun/star/beans/PropertyAttribute.hpp>
36#include <com/sun/star/frame/ModuleManager.hpp>
37#include <com/sun/star/frame/XModel.hpp>
38#include <com/sun/star/frame/FrameAction.hpp>
39#include <com/sun/star/awt/PosSize.hpp>
40#include <com/sun/star/awt/XDevice.hpp>
41#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
42#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
43#include <com/sun/star/ui/theWindowStateConfiguration.hpp>
44#include <com/sun/star/ui/theUIElementFactoryManager.hpp>
45#include <com/sun/star/container/XNameReplace.hpp>
46#include <com/sun/star/container/XNameContainer.hpp>
47#include <com/sun/star/frame/LayoutManagerEvents.hpp>
48#include <com/sun/star/frame/XDispatchProvider.hpp>
49#include <com/sun/star/frame/DispatchHelper.hpp>
50#include <com/sun/star/lang/DisposedException.hpp>
51#include <com/sun/star/util/URLTransformer.hpp>
52
53#include <comphelper/lok.hxx>
55#include <vcl/status.hxx>
56#include <vcl/settings.hxx>
57#include <vcl/window.hxx>
58#include <vcl/svapp.hxx>
61#include <comphelper/uno3.hxx>
62#include <officecfg/Office/Compatibility.hxx>
63
64#include <rtl/ref.hxx>
65#include <sal/log.hxx>
66#include <o3tl/string_view.hxx>
67
68#include <algorithm>
69
70// using namespace
71using namespace ::com::sun::star;
72using namespace ::com::sun::star::uno;
73using namespace ::com::sun::star::beans;
74using namespace ::com::sun::star::util;
75using namespace ::com::sun::star::lang;
76using namespace ::com::sun::star::container;
77using namespace ::com::sun::star::ui;
78using namespace ::com::sun::star::frame;
79
80constexpr OUStringLiteral STATUS_BAR_ALIAS = u"private:resource/statusbar/statusbar";
81
82namespace framework
83{
84
87
88LayoutManager::LayoutManager( const Reference< XComponentContext >& xContext ) :
89 ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >(m_aMutex)
90 , LayoutManager_PBase( *static_cast< ::cppu::OBroadcastHelper* >(this) )
91 , m_xContext( xContext )
92 , m_xURLTransformer( URLTransformer::create(xContext) )
93 , m_nLockCount( 0 )
94 , m_bInplaceMenuSet( false )
95 , m_bMenuVisible( true )
96 , m_bVisible( true )
97 , m_bParentWindowVisible( false )
98 , m_bMustDoLayout( true )
99#if HAVE_FEATURE_DESKTOP
100 , m_bAutomaticToolbars( true )
101#else
102 , m_bAutomaticToolbars( false )
103#endif
104 , m_bHideCurrentUI( false )
105 , m_bGlobalSettings( false )
106 , m_bPreserveContentSize( false )
107 , m_bMenuBarCloseButton( false )
108 , m_xModuleManager( ModuleManager::create( xContext ))
109 , m_xUIElementFactoryManager( ui::theUIElementFactoryManager::get(xContext) )
110 , m_xPersistentWindowStateSupplier( ui::theWindowStateConfiguration::get( xContext ) )
111 , m_aAsyncLayoutTimer( "framework::LayoutManager m_aAsyncLayoutTimer" )
112 , m_aListenerContainer( m_aMutex )
113{
114 // Initialize statusbar member
115 m_aStatusBarElement.m_aType = "statusbar";
116 m_aStatusBarElement.m_aName = STATUS_BAR_ALIAS;
117
119 {
120 m_xToolbarManager = new ToolbarLayoutManager( xContext, Reference<XUIElementFactory>(m_xUIElementFactoryManager, UNO_QUERY_THROW), this );
121 }
122
123 m_aAsyncLayoutTimer.SetPriority( TaskPriority::HIGH_IDLE );
124 m_aAsyncLayoutTimer.SetTimeout( 50 );
125 m_aAsyncLayoutTimer.SetInvokeHandler( LINK( this, LayoutManager, AsyncLayoutHdl ) );
126
127 registerProperty( LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, css::beans::PropertyAttribute::TRANSIENT, &m_bAutomaticToolbars, cppu::UnoType<decltype(m_bAutomaticToolbars)>::get() );
128 registerProperty( LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, cppu::UnoType<decltype(m_bHideCurrentUI)>::get() );
129 registerProperty( LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::READONLY, &m_nLockCount, cppu::UnoType<decltype(m_nLockCount)>::get() );
130 registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloseButton, cppu::UnoType<decltype(m_bMenuBarCloseButton)>::get() );
131 registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, beans::PropertyAttribute::TRANSIENT, cppu::UnoType<bool>::get(), css::uno::Any(false) );
132 registerProperty( LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, cppu::UnoType<decltype(m_bPreserveContentSize)>::get() );
133 registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP, LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP, beans::PropertyAttribute::TRANSIENT, cppu::UnoType<bool>::get(), css::uno::Any(false) );
134}
135
137{
139 setDockingAreaAcceptor(nullptr);
140 m_pGlobalSettings.reset();
141}
142
143void LayoutManager::implts_createMenuBar(const OUString& rMenuBarName)
144{
145 SolarMutexGuard aWriteLock;
146
147 // Create a customized menu if compatibility mode is on
148 if (m_aModuleIdentifier == "com.sun.star.text.TextDocument" && officecfg::Office::Compatibility::View::MSCompatibleFormsMenu::get())
149 {
151 }
152
153 // Create the default menubar otherwise
154 if (m_bInplaceMenuSet || m_xMenuBar.is())
155 return;
156
157 m_xMenuBar = implts_createElement( rMenuBarName );
158 if ( !m_xMenuBar.is() )
159 return;
160
162 if ( !pSysWindow )
163 return;
164
165 Reference< awt::XMenuBar > xMenuBar;
166
167 Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
168 if ( xPropSet.is() )
169 {
170 try
171 {
172 xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
173 }
174 catch (const beans::UnknownPropertyException&)
175 {
176 }
177 catch (const lang::WrappedTargetException&)
178 {
179 }
180 }
181
182 if ( !xMenuBar.is() )
183 return;
184
185 VCLXMenu* pAwtMenuBar = dynamic_cast<VCLXMenu*>( xMenuBar.get() );
186 if ( pAwtMenuBar )
187 {
188 MenuBar* pMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
189 if ( pMenuBar )
190 {
191 pSysWindow->SetMenuBar(pMenuBar);
192 pMenuBar->SetDisplayable( m_bMenuVisible );
194 }
195 }
196}
197
198// Internal helper function
200{
201 implts_lock();
202
203 // Clear up VCL menu bar to prepare shutdown
204 if ( m_xContainerWindow.is() )
205 {
206 SolarMutexGuard aGuard;
207
209 if ( pSysWindow )
210 {
211 MenuBar* pSetMenuBar = nullptr;
212 if ( m_xInplaceMenuBar.is() )
213 pSetMenuBar = static_cast<MenuBar *>(m_xInplaceMenuBar->GetMenuBar());
214 else
215 {
216 Reference< awt::XMenuBar > xMenuBar;
217
218 Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY );
219 if ( xPropSet.is() )
220 {
221 try
222 {
223 xPropSet->getPropertyValue("XMenuBar") >>= xMenuBar;
224 }
225 catch (const beans::UnknownPropertyException&)
226 {
227 }
228 catch (const lang::WrappedTargetException&)
229 {
230 }
231 }
232
233 VCLXMenu* pAwtMenuBar = dynamic_cast<VCLXMenu*>( xMenuBar.get() );
234 if ( pAwtMenuBar )
235 pSetMenuBar = static_cast<MenuBar*>(pAwtMenuBar->GetMenu());
236 }
237
238 MenuBar* pTopMenuBar = pSysWindow->GetMenuBar();
239 if ( pSetMenuBar == pTopMenuBar )
240 pSysWindow->SetMenuBar( nullptr );
241 }
242 }
243
244 // reset inplace menubar manager
245 VclPtr<Menu> pMenuBar;
246 if (m_xInplaceMenuBar.is())
247 {
248 pMenuBar = m_xInplaceMenuBar->GetMenuBar();
249 m_xInplaceMenuBar->dispose();
250 m_xInplaceMenuBar.clear();
251 }
252 pMenuBar.disposeAndClear();
253 m_bInplaceMenuSet = false;
254
255 Reference< XComponent > xComp( m_xMenuBar, UNO_QUERY );
256 if ( xComp.is() )
257 xComp->dispose();
258 m_xMenuBar.clear();
260}
261
263{
265 ++m_nLockCount;
266}
267
269{
271 m_nLockCount = std::max( m_nLockCount-1, static_cast<sal_Int32>(0) );
272 return ( m_nLockCount == 0 );
273}
274
275void LayoutManager::implts_reset( bool bAttached )
276{
277 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
278 SolarMutexClearableGuard aReadLock;
279 Reference< XFrame > xFrame = m_xFrame;
280 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
281 Reference< XUIConfiguration > xModuleCfgMgr( m_xModuleCfgMgr, UNO_QUERY );
282 Reference< XUIConfiguration > xDocCfgMgr( m_xDocCfgMgr, UNO_QUERY );
283 Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
284 Reference< XComponentContext > xContext( m_xContext );
285 Reference< XNameAccess > xPersistentWindowStateSupplier( m_xPersistentWindowStateSupplier );
287 OUString aModuleIdentifier( m_aModuleIdentifier );
288 bool bAutomaticToolbars( m_bAutomaticToolbars );
289 aReadLock.clear();
290 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
291
292 implts_lock();
293
294 Reference< XModel > xModel;
295 if ( xFrame.is() )
296 {
297 if ( bAttached )
298 {
299 OUString aOldModuleIdentifier( aModuleIdentifier );
300 try
301 {
302 aModuleIdentifier = m_xModuleManager->identify( xFrame );
303 }
304 catch( const Exception& ) {}
305
306 if ( !aModuleIdentifier.isEmpty() && aOldModuleIdentifier != aModuleIdentifier )
307 {
308 Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier;
309 if ( xContext.is() )
310 xModuleCfgSupplier = theModuleUIConfigurationManagerSupplier::get( xContext );
311
312 if ( xModuleCfgMgr.is() )
313 {
314 try
315 {
316 // Remove listener to old module ui configuration manager
317 xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >(this) );
318 }
319 catch (const Exception&)
320 {
321 }
322 }
323
324 try
325 {
326 // Add listener to new module ui configuration manager
327 xModuleCfgMgr.set( xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ), UNO_QUERY );
328 if ( xModuleCfgMgr.is() )
329 xModuleCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >(this) );
330 }
331 catch (const Exception&)
332 {
333 }
334
335 try
336 {
337 // Retrieve persistent window state reference for our new module
338 if ( xPersistentWindowStateSupplier.is() )
339 xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= xPersistentWindowState;
340 }
341 catch (const NoSuchElementException&)
342 {
343 }
344 catch (const WrappedTargetException&)
345 {
346 }
347 }
348
350 if ( xModel.is() )
351 {
352 Reference< XUIConfigurationManagerSupplier > xUIConfigurationManagerSupplier( xModel, UNO_QUERY );
353 if ( xUIConfigurationManagerSupplier.is() )
354 {
355 if ( xDocCfgMgr.is() )
356 {
357 try
358 {
359 // Remove listener to old ui configuration manager
360 xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >(this) );
361 }
362 catch (const Exception&)
363 {
364 }
365 }
366
367 try
368 {
369 xDocCfgMgr.set( xUIConfigurationManagerSupplier->getUIConfigurationManager(), UNO_QUERY );
370 if ( xDocCfgMgr.is() )
371 xDocCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >(this) );
372 }
373 catch (const Exception&)
374 {
375 }
376 }
377 }
378 }
379 else
380 {
381 // Remove configuration listeners before we can release our references
382 if ( xModuleCfgMgr.is() )
383 {
384 try
385 {
386 xModuleCfgMgr->removeConfigurationListener(
387 Reference< XUIConfigurationListener >(this) );
388 }
389 catch (const Exception&)
390 {
391 }
392 }
393
394 if ( xDocCfgMgr.is() )
395 {
396 try
397 {
398 xDocCfgMgr->removeConfigurationListener(
399 Reference< XUIConfigurationListener >(this) );
400 }
401 catch (const Exception&)
402 {
403 }
404 }
405
406 // Release references to our configuration managers as we currently don't have
407 // an attached module.
408 xModuleCfgMgr.clear();
409 xDocCfgMgr.clear();
410 xPersistentWindowState.clear();
411 aModuleIdentifier.clear();
412 }
413
414 Reference< XUIConfigurationManager > xModCfgMgr( xModuleCfgMgr, UNO_QUERY );
415 Reference< XUIConfigurationManager > xDokCfgMgr( xDocCfgMgr, UNO_QUERY );
416
417 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
418 SolarMutexClearableGuard aWriteLock;
419 m_aDockingArea = awt::Rectangle();
420 m_aModuleIdentifier = aModuleIdentifier;
421 m_xModuleCfgMgr = xModCfgMgr;
422 m_xDocCfgMgr = xDokCfgMgr;
423 m_xPersistentWindowState = xPersistentWindowState;
424 m_aStatusBarElement.m_bStateRead = false; // reset state to read data again!
425 aWriteLock.clear();
426 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
427
428 // reset/notify toolbar layout manager
429 if ( xToolbarManager.is() )
430 {
431 if ( bAttached )
432 {
433 xToolbarManager->attach( xFrame, xModCfgMgr, xDokCfgMgr, xPersistentWindowState );
434 uno::Reference< awt::XVclWindowPeer > xParent( xContainerWindow, UNO_QUERY );
435 xToolbarManager->setParentWindow( xParent );
436 if ( bAutomaticToolbars )
437 xToolbarManager->createStaticToolbars();
438 }
439 else
440 {
441 xToolbarManager->reset();
443 }
444 }
445 }
446
448}
449
451{
452 SolarMutexClearableGuard aReadLock;
453 Reference< XFrame > xFrame = m_xFrame;
454 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
455 aReadLock.clear();
456
457 Reference< awt::XWindow > xFrameContainerWindow = xFrame->getContainerWindow();
458 return xFrameContainerWindow != xContainerWindow;
459}
460
462{
463 SolarMutexResettableGuard aWriteLock;
464 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
465 aWriteLock.clear();
466
467 if ( pToolbarManager )
468 pToolbarManager->destroyToolbars();
469
471
472 aWriteLock.reset();
474 aWriteLock.clear();
475}
476
478{
479 SolarMutexClearableGuard aReadLock;
480 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
481 aReadLock.clear();
482
483 if ( pToolbarManager )
484 pToolbarManager->setFloatingToolbarsVisibility( bActive );
485}
486
487uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( std::u16string_view aName )
488{
489 OUString aElementType;
490 OUString aElementName;
491
492 parseResourceURL( aName, aElementType, aElementName );
493 if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
494 aElementName.equalsIgnoreAsciiCase("menubar") )
495 return m_xMenuBar;
496 else if (( aElementType.equalsIgnoreAsciiCase("statusbar") &&
497 aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
500 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
501 aElementName.equalsIgnoreAsciiCase("progressbar") )
503
504 return uno::Reference< ui::XUIElement >();
505}
506
507bool LayoutManager::implts_readWindowStateData( const OUString& aName, UIElement& rElementData )
508{
511}
512
513bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElementData,
514 const Reference< XNameAccess > &rPersistentWindowState,
515 std::unique_ptr<GlobalSettings> &rGlobalSettings, bool &bInGlobalSettings,
516 const Reference< XComponentContext > &rComponentContext )
517{
518 if ( !rPersistentWindowState.is() )
519 return false;
520
521 bool bGetSettingsState( false );
522
523 SolarMutexClearableGuard aWriteLock;
524 bool bGlobalSettings( bInGlobalSettings );
525 if ( rGlobalSettings == nullptr )
526 {
527 rGlobalSettings.reset( new GlobalSettings( rComponentContext ) );
528 bGetSettingsState = true;
529 }
530 GlobalSettings* pGlobalSettings = rGlobalSettings.get();
531 aWriteLock.clear();
532
533 try
534 {
535 Sequence< PropertyValue > aWindowState;
536 if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) )
537 {
538 bool bValue( false );
539 for ( PropertyValue const & rProp : std::as_const(aWindowState) )
540 {
541 if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED )
542 {
543 if ( rProp.Value >>= bValue )
544 rElementData.m_bFloating = !bValue;
545 }
546 else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE )
547 {
548 if ( rProp.Value >>= bValue )
549 rElementData.m_bVisible = bValue;
550 }
551 else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA )
552 {
553 ui::DockingArea eDockingArea;
554 if ( rProp.Value >>= eDockingArea )
555 rElementData.m_aDockedData.m_nDockedArea = eDockingArea;
556 }
557 else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS )
558 {
559 awt::Point aPoint;
560 if (rProp.Value >>= aPoint)
561 {
562 //tdf#90256 repair these broken Docking positions
563 if (aPoint.X < 0)
564 aPoint.X = SAL_MAX_INT32;
565 if (aPoint.Y < 0)
566 aPoint.Y = SAL_MAX_INT32;
567 rElementData.m_aDockedData.m_aPos = aPoint;
568 }
569 }
570 else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS )
571 {
572 awt::Point aPoint;
573 if ( rProp.Value >>= aPoint )
574 rElementData.m_aFloatingData.m_aPos = aPoint;
575 }
576 else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE )
577 {
578 awt::Size aSize;
579 if ( rProp.Value >>= aSize )
580 rElementData.m_aFloatingData.m_aSize = aSize;
581 }
582 else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME )
583 rProp.Value >>= rElementData.m_aUIName;
584 else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE )
585 {
586 sal_Int32 nStyle = 0;
587 if ( rProp.Value >>= nStyle )
588 rElementData.m_nStyle = static_cast<ButtonType>( nStyle );
589 }
590 else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED )
591 {
592 if ( rProp.Value >>= bValue )
593 rElementData.m_aDockedData.m_bLocked = bValue;
594 }
595 else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT )
596 {
597 if ( rProp.Value >>= bValue )
598 rElementData.m_bContextSensitive = bValue;
599 }
600 else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE )
601 {
602 if ( rProp.Value >>= bValue )
603 rElementData.m_bNoClose = bValue;
604 }
605 }
606 }
607
608 // oversteer values with global settings
609 if (bGetSettingsState || bGlobalSettings)
610 {
611 if ( pGlobalSettings->HasToolbarStatesInfo())
612 {
613 {
614 SolarMutexGuard aWriteLock2;
615 bInGlobalSettings = true;
616 }
617
618 uno::Any aValue;
619 if ( pGlobalSettings->GetToolbarStateInfo(
621 aValue ))
622 aValue >>= rElementData.m_aDockedData.m_bLocked;
623 if ( pGlobalSettings->GetToolbarStateInfo(
625 aValue ))
626 {
627 bool bValue;
628 if ( aValue >>= bValue )
629 rElementData.m_bFloating = !bValue;
630 }
631 }
632 }
633
634 const bool bDockingSupportCrippled = !StyleSettings::GetDockingFloatsSupported();
635 if (bDockingSupportCrippled)
636 rElementData.m_bFloating = false;
637
638 return true;
639 }
640 catch (const NoSuchElementException&)
641 {
642 }
643
644 return false;
645}
646
647void LayoutManager::implts_writeWindowStateData( const OUString& aName, const UIElement& rElementData )
648{
649 SolarMutexClearableGuard aWriteLock;
650 Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
651
652 aWriteLock.clear();
653
654 bool bPersistent( false );
655 Reference< XPropertySet > xPropSet( rElementData.m_xUIElement, UNO_QUERY );
656 if ( xPropSet.is() )
657 {
658 try
659 {
660 // Check persistent flag of the user interface element
661 xPropSet->getPropertyValue("Persistent") >>= bPersistent;
662 }
663 catch (const beans::UnknownPropertyException&)
664 {
665 // Non-configurable elements should at least store their dimension/position
666 bPersistent = true;
667 }
668 catch (const lang::WrappedTargetException&)
669 {
670 }
671 }
672
673 if ( !(bPersistent && xPersistentWindowState.is()) )
674 return;
675
676 try
677 {
678 Sequence< PropertyValue > aWindowState{
682 rElementData.m_aDockedData.m_nDockedArea),
684 rElementData.m_aDockedData.m_aPos),
686 rElementData.m_aFloatingData.m_aPos),
688 rElementData.m_aFloatingData.m_aSize),
691 rElementData.m_aDockedData.m_bLocked)
692 };
693
694 if ( xPersistentWindowState->hasByName( aName ))
695 {
696 Reference< XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
697 xReplace->replaceByName( aName, Any( aWindowState ));
698 }
699 else
700 {
701 Reference< XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
702 xInsert->insertByName( aName, Any( aWindowState ));
703 }
704 }
705 catch (const Exception&)
706 {
707 }
708}
709
711{
712 ::Size aContainerWinSize;
713 vcl::Window* pContainerWindow( nullptr );
714
715 // Retrieve output size from container Window
716 SolarMutexGuard aGuard;
717 pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow );
718 if ( pContainerWindow )
719 aContainerWinSize = pContainerWindow->GetOutputSizePixel();
720
721 return aContainerWinSize;
722}
723
724Reference< XUIElement > LayoutManager::implts_createElement( const OUString& aName )
725{
726 Reference< ui::XUIElement > xUIElement;
727
729 Sequence< PropertyValue > aPropSeq{ comphelper::makePropertyValue("Frame", m_xFrame),
730 comphelper::makePropertyValue("Persistent", true) };
731
732 try
733 {
734 xUIElement = m_xUIElementFactoryManager->createUIElement( aName, aPropSeq );
735 }
736 catch (const NoSuchElementException&)
737 {
738 }
739 catch (const IllegalArgumentException&)
740 {
741 }
742
743 return xUIElement;
744}
745
747{
748 {
749 SolarMutexGuard aWriteLock;
751 }
752
754}
755
757{
758 // notify listeners
759 uno::Any a;
760 if ( bSetVisible )
761 implts_notifyListeners( frame::LayoutManagerEvents::VISIBLE, a );
762 else
763 implts_notifyListeners( frame::LayoutManagerEvents::INVISIBLE, a );
764
765 SolarMutexResettableGuard aWriteLock;
766 Reference< XUIElement > xMenuBar = m_xMenuBar;
767 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
769 aWriteLock.clear();
770
771 if (( xMenuBar.is() || xInplaceMenuBar.is() ) && xContainerWindow.is() )
772 {
773 SolarMutexGuard aGuard;
774
775 MenuBar* pMenuBar( nullptr );
776 if ( xInplaceMenuBar.is() )
777 pMenuBar = static_cast<MenuBar *>(xInplaceMenuBar->GetMenuBar());
778 else
779 {
780 MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* >(xMenuBar.get());
781 pMenuBar = static_cast<MenuBar *>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar());
782 }
783
784 SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
785 if ( pSysWindow )
786 {
787 if ( bSetVisible )
788 {
789 pSysWindow->SetMenuBar(pMenuBar);
790 }
791 else
792 pSysWindow->SetMenuBar( nullptr );
793 }
794 }
795
796 bool bMustDoLayout;
797 // Hide/show the statusbar according to bSetVisible
798 if ( bSetVisible )
799 bMustDoLayout = !implts_showStatusBar();
800 else
801 bMustDoLayout = !implts_hideStatusBar();
802
803 aWriteLock.reset();
804 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
805 aWriteLock.clear();
806
807 if ( pToolbarManager )
808 {
809 pToolbarManager->setVisible( bSetVisible );
810 bMustDoLayout = pToolbarManager->isLayoutDirty();
811 }
812
813 if ( bMustDoLayout )
814 implts_doLayout_notify( false );
815}
816
818{
819 {
820 SolarMutexGuard aWriteLock;
823 else if (bShow && m_aStatusBarElement.m_bVisible)
825 }
826
828}
829
831{
832 Reference< XComponent > xCompStatusBar;
833
834 SolarMutexClearableGuard aWriteLock;
836 xCompStatusBar.set( m_aStatusBarElement.m_xUIElement, UNO_QUERY );
838 aWriteLock.clear();
839
840 if ( xCompStatusBar.is() )
841 xCompStatusBar->dispose();
842
844}
845
846void LayoutManager::implts_createStatusBar( const OUString& aStatusBarName )
847{
848 {
849 SolarMutexGuard aWriteLock;
851 {
852 implts_readStatusBarState(aStatusBarName);
853 m_aStatusBarElement.m_aName = aStatusBarName;
855 }
856 }
857
859}
860
861void LayoutManager::implts_readStatusBarState( const OUString& rStatusBarName )
862{
865 {
866 // Read persistent data for status bar if not yet read!
867 if ( implts_readWindowStateData( rStatusBarName, m_aStatusBarElement ))
869 }
870}
871
873{
874 Reference< XUIElement > xStatusBar;
875 Reference< XUIElement > xProgressBar;
876 Reference< XUIElement > xProgressBarBackup;
877 Reference< awt::XWindow > xContainerWindow;
878
879 SolarMutexResettableGuard aWriteLock;
881 xProgressBar = m_aProgressBarElement.m_xUIElement;
882 xProgressBarBackup = m_xProgressBarBackup;
883 m_xProgressBarBackup.clear();
884 xContainerWindow = m_xContainerWindow;
885 aWriteLock.clear();
886
887 bool bRecycled = xProgressBarBackup.is();
889 if ( bRecycled )
890 pWrapper = static_cast<ProgressBarWrapper*>(xProgressBarBackup.get());
891 else if ( xProgressBar.is() )
892 pWrapper = static_cast<ProgressBarWrapper*>(xProgressBar.get());
893 else
894 pWrapper = new ProgressBarWrapper();
895
896 if ( xStatusBar.is() )
897 {
898 Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY );
899 pWrapper->setStatusBar( xWindow );
900 }
901 else
902 {
903 Reference< awt::XWindow > xStatusBarWindow = pWrapper->getStatusBar();
904
905 SolarMutexGuard aGuard;
906 VclPtr<vcl::Window> pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow );
907 if ( !pStatusBarWnd )
908 {
909 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xContainerWindow );
910 if ( pWindow )
911 {
912 VclPtrInstance<StatusBar> pStatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) );
913 Reference< awt::XWindow > xStatusBarWindow2( VCLUnoHelper::GetInterface( pStatusBar ));
914 pWrapper->setStatusBar( xStatusBarWindow2, true );
915 }
916 }
917 }
918
919 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
920 aWriteLock.reset();
922 aWriteLock.clear();
923 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
924
925 if ( bRecycled )
927}
928
930{
932
933 if (m_xProgressBarBackup.is())
934 return;
935
936 // safe a backup copy of the current progress!
937 // This copy will be used automatically inside createProgressBar() which is called
938 // implicitly from implts_doLayout() .-)
940
941 // remove the relation between this old progress bar and our old status bar.
942 // Otherwise we work on disposed items ...
943 // The internal used ProgressBarWrapper can handle a NULL reference.
944 if ( m_xProgressBarBackup.is() )
945 {
946 ProgressBarWrapper* pWrapper = static_cast<ProgressBarWrapper*>(m_xProgressBarBackup.get());
947 if ( pWrapper )
948 pWrapper->setStatusBar( Reference< awt::XWindow >() );
949 }
950
951 // prevent us from dispose() the m_aProgressBarElement.m_xUIElement inside implts_reset()
953}
954
956{
957 // don't remove the progressbar in general
958 // We must reuse it if a new status bar is created later.
959 // Of course there exists one backup only.
960 // And further this backup will be released inside our dtor.
962}
963
964void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Size& rSize )
965{
966 Reference< XUIElement > xStatusBar;
967 Reference< XUIElement > xProgressBar;
968 Reference< awt::XWindow > xContainerWindow;
969
970 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
971 SolarMutexClearableGuard aReadLock;
973 xProgressBar = m_aProgressBarElement.m_xUIElement;
974 xContainerWindow = m_xContainerWindow;
975
976 Reference< awt::XWindow > xWindow;
977 if ( xStatusBar.is() )
978 xWindow.set( xStatusBar->getRealInterface(), UNO_QUERY );
979 else if ( xProgressBar.is() )
980 {
981 ProgressBarWrapper* pWrapper = static_cast<ProgressBarWrapper*>(xProgressBar.get());
982 if ( pWrapper )
983 xWindow = pWrapper->getStatusBar();
984 }
985 aReadLock.clear();
986 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
987
988 if ( !xWindow.is() )
989 return;
990
991 SolarMutexGuard aGuard;
992 VclPtr<vcl::Window> pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow );
993 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
994 if ( pParentWindow && ( pWindow && pWindow->GetType() == WindowType::STATUSBAR ))
995 {
996 vcl::Window* pOldParentWindow = pWindow->GetParent();
997 if ( pParentWindow != pOldParentWindow )
998 pWindow->SetParent( pParentWindow );
999 static_cast<StatusBar *>(pWindow.get())->SetPosSizePixel( rPos, rSize );
1000 }
1001}
1002
1004{
1005 Reference< XUIElement > xStatusBar;
1006 Reference< XUIElement > xProgressBar;
1007 Reference< awt::XWindow > xWindow;
1008
1009 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1010 SolarMutexGuard aWriteLock;
1011 xStatusBar = m_aStatusBarElement.m_xUIElement;
1012 xProgressBar = m_aProgressBarElement.m_xUIElement;
1013 bool bVisible( m_bVisible );
1014
1016 if ( bVisible )
1017 {
1018 if ( xStatusBar.is() && !m_aStatusBarElement.m_bMasterHide )
1019 {
1020 xWindow.set( xStatusBar->getRealInterface(), UNO_QUERY );
1021 }
1022 else if ( xProgressBar.is() )
1023 {
1024 ProgressBarWrapper* pWrapper = static_cast<ProgressBarWrapper*>(xProgressBar.get());
1025 if ( pWrapper )
1026 xWindow = pWrapper->getStatusBar();
1027 }
1028 }
1029
1030 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
1031 if ( pWindow )
1032 {
1033 if ( !pWindow->IsVisible() )
1034 {
1035 implts_setOffset( pWindow->GetSizePixel().Height() );
1036 pWindow->Show();
1037 implts_doLayout_notify( false );
1038 }
1039 return true;
1040 }
1041
1042 return false;
1043}
1044
1046{
1047 Reference< XUIElement > xProgressBar;
1048 Reference< awt::XWindow > xWindow;
1049 bool bHideStatusBar( false );
1050
1052 xProgressBar = m_aProgressBarElement.m_xUIElement;
1053
1054 bool bInternalStatusBar( false );
1055 if ( xProgressBar.is() )
1056 {
1057 Reference< awt::XWindow > xStatusBar;
1058 ProgressBarWrapper* pWrapper = static_cast<ProgressBarWrapper*>(xProgressBar.get());
1059 if ( pWrapper )
1060 xWindow = pWrapper->getStatusBar();
1061 Reference< ui::XUIElement > xStatusBarElement = m_aStatusBarElement.m_xUIElement;
1062 if ( xStatusBarElement.is() )
1063 xStatusBar.set( xStatusBarElement->getRealInterface(), UNO_QUERY );
1064 bInternalStatusBar = xStatusBar != xWindow;
1065 }
1068 bHideStatusBar = !m_aStatusBarElement.m_bVisible;
1069
1070 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
1071 if ( pWindow && pWindow->IsVisible() && ( bHideStatusBar || bInternalStatusBar ))
1072 {
1073 implts_setOffset( 0 );
1074 pWindow->Hide();
1075 implts_doLayout_notify( false );
1076 return true;
1077 }
1078
1079 return false;
1080}
1081
1083{
1084 SolarMutexClearableGuard aWriteLock;
1085 Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement;
1086 if ( bStoreState )
1088 aWriteLock.clear();
1089
1090 if ( xStatusBar.is() )
1091 {
1092 Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY );
1093
1094 SolarMutexGuard aGuard;
1095 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
1096 if ( pWindow && !pWindow->IsVisible() )
1097 {
1098 implts_setOffset( pWindow->GetSizePixel().Height() );
1099 pWindow->Show();
1100 implts_doLayout_notify( false );
1101 return true;
1102 }
1103 }
1104
1105 return false;
1106}
1107
1109{
1110 SolarMutexClearableGuard aWriteLock;
1111 Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement;
1112 if ( bStoreState )
1114 aWriteLock.clear();
1115
1116 if ( xStatusBar.is() )
1117 {
1118 Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY );
1119
1120 SolarMutexGuard aGuard;
1121 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
1122 if ( pWindow && pWindow->IsVisible() )
1123 {
1124 implts_setOffset( 0 );
1125 pWindow->Hide();
1126 implts_doLayout_notify( false );
1127 return true;
1128 }
1129 }
1130
1131 return false;
1132}
1133
1134void LayoutManager::implts_setOffset( const sal_Int32 nBottomOffset )
1135{
1136 if ( m_xToolbarManager.is() )
1137 m_xToolbarManager->setDockingAreaOffsets({ 0, 0, 0, nBottomOffset });
1138}
1139
1140void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& xMergedMenuBar )
1141{
1142 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1143 SolarMutexClearableGuard aWriteLock;
1144
1145 if ( m_bInplaceMenuSet )
1146 return;
1147
1148 SolarMutexGuard aGuard;
1149
1150 // Reset old inplace menubar!
1151 VclPtr<Menu> pOldMenuBar;
1152 if (m_xInplaceMenuBar.is())
1153 {
1154 pOldMenuBar = m_xInplaceMenuBar->GetMenuBar();
1155 m_xInplaceMenuBar->dispose();
1156 m_xInplaceMenuBar.clear();
1157 }
1158 pOldMenuBar.disposeAndClear();
1159
1160 m_bInplaceMenuSet = false;
1161
1162 if ( m_xFrame.is() && m_xContainerWindow.is() )
1163 {
1164 Reference< XDispatchProvider > xDispatchProvider;
1165
1167 m_xInplaceMenuBar = new MenuBarManager( m_xContext, m_xFrame, m_xURLTransformer, xDispatchProvider, OUString(), pMenuBar, true );
1168 m_xInplaceMenuBar->SetItemContainer( xMergedMenuBar );
1169
1171 if ( pSysWindow )
1172 pSysWindow->SetMenuBar(pMenuBar);
1173
1174 m_bInplaceMenuSet = true;
1175 }
1176
1177 aWriteLock.clear();
1178 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1179
1181}
1182
1184{
1186 m_bInplaceMenuSet = false;
1187
1188 if ( m_xContainerWindow.is() )
1189 {
1190 SolarMutexGuard aGuard;
1191 MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* >(m_xMenuBar.get());
1193 if ( pSysWindow )
1194 {
1195 if ( pMenuBarWrapper )
1196 pSysWindow->SetMenuBar(static_cast<MenuBar *>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar()));
1197 else
1198 pSysWindow->SetMenuBar(nullptr);
1199 }
1200 }
1201
1202 // Remove inplace menu bar
1203 VclPtr<Menu> pMenuBar;
1204 if (m_xInplaceMenuBar.is())
1205 {
1206 pMenuBar = m_xInplaceMenuBar->GetMenuBar();
1207 m_xInplaceMenuBar->dispose();
1208 m_xInplaceMenuBar.clear();
1209 }
1210 pMenuBar.disposeAndClear();
1211}
1212
1213void SAL_CALL LayoutManager::attachFrame( const Reference< XFrame >& xFrame )
1214{
1216 m_xFrame = xFrame;
1217}
1218
1220{
1221 implts_reset( true );
1222}
1223
1224// XMenuBarMergingAcceptor
1225
1227 const Reference< XIndexAccess >& xMergedMenuBar )
1228{
1229 implts_setInplaceMenuBar( xMergedMenuBar );
1230
1231 uno::Any a;
1232 implts_notifyListeners( frame::LayoutManagerEvents::MERGEDMENUBAR, a );
1233 return true;
1234}
1235
1237{
1239}
1240
1242{
1244 return m_aDockingArea;
1245}
1246
1247Reference< XDockingAreaAcceptor > SAL_CALL LayoutManager::getDockingAreaAcceptor()
1248{
1251}
1252
1253void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDockingAreaAcceptor >& xDockingAreaAcceptor )
1254{
1255 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1256 SolarMutexClearableGuard aWriteLock;
1257
1258 if (( m_xDockingAreaAcceptor == xDockingAreaAcceptor ) || !m_xFrame.is() )
1259 return;
1260
1261 // IMPORTANT: Be sure to stop layout timer if don't have a docking area acceptor!
1262 if ( !xDockingAreaAcceptor.is() )
1264
1265 bool bAutomaticToolbars( m_bAutomaticToolbars );
1266
1267 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1268
1269 if ( !xDockingAreaAcceptor.is() )
1271
1272 // Remove listener from old docking area acceptor
1273 if ( m_xDockingAreaAcceptor.is() )
1274 {
1275 Reference< awt::XWindow > xWindow( m_xDockingAreaAcceptor->getContainerWindow() );
1276 if ( xWindow.is() && ( m_xFrame->getContainerWindow() != m_xContainerWindow || !xDockingAreaAcceptor.is() ) )
1277 xWindow->removeWindowListener( Reference< awt::XWindowListener >(this) );
1278
1279 m_aDockingArea = awt::Rectangle();
1280 if ( pToolbarManager )
1281 pToolbarManager->resetDockingArea();
1282
1283 VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xWindow );
1284 if ( pContainerWindow )
1285 pContainerWindow->RemoveChildEventListener( LINK( this, LayoutManager, WindowEventListener ) );
1286 }
1287
1288 m_xDockingAreaAcceptor = xDockingAreaAcceptor;
1289 if ( m_xDockingAreaAcceptor.is() )
1290 {
1291 m_aDockingArea = awt::Rectangle();
1292 m_xContainerWindow = m_xDockingAreaAcceptor->getContainerWindow();
1293 m_xContainerTopWindow.set( m_xContainerWindow, UNO_QUERY );
1294 m_xContainerWindow->addWindowListener( Reference< awt::XWindowListener >(this) );
1295
1296 // we always must keep a connection to the window of our frame for resize events
1297 if ( m_xContainerWindow != m_xFrame->getContainerWindow() )
1298 m_xFrame->getContainerWindow()->addWindowListener( Reference< awt::XWindowListener >(this) );
1299
1300 // #i37884# set initial visibility state - in the plugin case the container window is already shown
1301 // and we get no notification anymore
1302 {
1304 if( pContainerWindow )
1305 m_bParentWindowVisible = pContainerWindow->IsVisible();
1306 }
1307 }
1308
1309 aWriteLock.clear();
1310 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1311
1312 if ( xDockingAreaAcceptor.is() )
1313 {
1314 SolarMutexGuard aGuard;
1315
1316 // Add layout manager as listener to get notifications about toolbar button activities
1318 if ( pContainerWindow )
1319 pContainerWindow->AddChildEventListener( LINK( this, LayoutManager, WindowEventListener ) );
1320
1321 // We have now a new container window, reparent all child windows!
1323 }
1324 else
1325 implts_destroyElements(); // remove all elements
1326
1327 if ( pToolbarManager && xDockingAreaAcceptor.is() )
1328 {
1329 if ( bAutomaticToolbars )
1330 {
1331 lock();
1332 pToolbarManager->createStaticToolbars();
1333 unlock();
1334 }
1335 implts_doLayout( true, false );
1336 }
1337}
1338
1340{
1341 SolarMutexResettableGuard aWriteLock;
1342 UIElement aStatusBarElement = m_aStatusBarElement;
1343 uno::Reference< awt::XWindow > xContainerWindow = m_xContainerWindow;
1344 aWriteLock.clear();
1345
1346 uno::Reference< awt::XWindow > xStatusBarWindow;
1347 if ( aStatusBarElement.m_xUIElement.is() )
1348 {
1349 try
1350 {
1351 xStatusBarWindow.set( aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY );
1352 }
1353 catch (const RuntimeException&)
1354 {
1355 throw;
1356 }
1357 catch (const Exception&)
1358 {
1359 }
1360 }
1361
1362 if ( xStatusBarWindow.is() )
1363 {
1364 SolarMutexGuard aGuard;
1365 VclPtr<vcl::Window> pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
1366 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow );
1367 if ( pWindow && pContainerWindow )
1368 pWindow->SetParent( pContainerWindow );
1369 }
1370
1372
1373 aWriteLock.reset();
1374 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1375 if ( pToolbarManager )
1376 pToolbarManager->setParentWindow( uno::Reference< awt::XVclWindowPeer >( xContainerWindow, uno::UNO_QUERY ));
1377 aWriteLock.clear();
1378}
1379
1380uno::Reference< ui::XUIElement > LayoutManager::implts_createDockingWindow( const OUString& aElementName )
1381{
1382 Reference< XUIElement > xUIElement = implts_createElement( aElementName );
1383 return xUIElement;
1384}
1385
1386IMPL_LINK( LayoutManager, WindowEventListener, VclWindowEvent&, rEvent, void )
1387{
1388 vcl::Window* pWindow = rEvent.GetWindow();
1389 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
1390 {
1391 SolarMutexClearableGuard aReadLock;
1392 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
1393 aReadLock.clear();
1394
1395 if ( pToolbarManager )
1396 pToolbarManager->childWindowEvent( &rEvent );
1397 }
1398}
1399
1400void SAL_CALL LayoutManager::createElement( const OUString& aName )
1401{
1402 SAL_INFO( "fwk", "LayoutManager::createElement " << aName );
1403
1404 SolarMutexClearableGuard aReadLock;
1405 Reference< XFrame > xFrame = m_xFrame;
1406 aReadLock.clear();
1407
1408 if ( !xFrame.is() )
1409 return;
1410
1411 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1412 SolarMutexClearableGuard aWriteLock;
1413
1414 bool bMustBeLayouted( false );
1415 bool bNotify( false );
1416
1417 bool bPreviewFrame;
1418 if (m_xToolbarManager.is())
1419 // Assumes that we created the ToolbarLayoutManager with our frame, if
1420 // not then we're somewhat fouled up ...
1421 bPreviewFrame = m_xToolbarManager->isPreviewFrame();
1422 else
1423 {
1424 Reference< XModel > xModel( impl_getModelFromFrame( xFrame ) );
1425 bPreviewFrame = implts_isPreviewModel( xModel );
1426 }
1427
1428 if ( m_xContainerWindow.is() && !bPreviewFrame ) // no UI elements on preview frames
1429 {
1430 OUString aElementType;
1431 OUString aElementName;
1432
1433 parseResourceURL( aName, aElementType, aElementName );
1434
1435 if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ) && m_xToolbarManager.is() )
1436 {
1437 bNotify = m_xToolbarManager->createToolbar( aName );
1438 bMustBeLayouted = m_xToolbarManager->isLayoutDirty();
1439 }
1440 else if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
1441 aElementName.equalsIgnoreAsciiCase("menubar") &&
1443 {
1445 if (m_bMenuVisible)
1446 bNotify = true;
1447
1448 aWriteLock.clear();
1449 }
1450 else if ( aElementType.equalsIgnoreAsciiCase("statusbar") &&
1452 {
1454 bNotify = true;
1455 }
1456 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
1457 aElementName.equalsIgnoreAsciiCase("progressbar") &&
1459 {
1461 bNotify = true;
1462 }
1463 else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
1464 {
1465 // Add layout manager as listener for docking and other window events
1466 uno::Reference< uno::XInterface > xThis( static_cast< OWeakObject* >(this), uno::UNO_QUERY );
1467 uno::Reference< ui::XUIElement > xUIElement( implts_createDockingWindow( aName ));
1468
1469 if ( xUIElement.is() )
1470 {
1471 impl_addWindowListeners( xThis, xUIElement );
1472 }
1473
1474 // The docking window is created by a factory method located in the sfx2 library.
1475// CreateDockingWindow( xFrame, aElementName );
1476 }
1477 }
1478
1479 if ( bMustBeLayouted )
1480 implts_doLayout_notify( true );
1481
1482 if ( bNotify )
1483 {
1484 // UI element is invisible - provide information to listeners
1485 implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::Any( aName ) );
1486 }
1487}
1488
1489void SAL_CALL LayoutManager::destroyElement( const OUString& aName )
1490{
1491 SAL_INFO( "fwk", "LayoutManager::destroyElement " << aName );
1492
1493 bool bMustBeLayouted(false);
1494 bool bNotify(false);
1495 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1496 {
1497 SolarMutexClearableGuard aWriteLock;
1498
1499 OUString aElementType;
1500 OUString aElementName;
1501
1502 parseResourceURL(aName, aElementType, aElementName);
1503
1504 if (aElementType.equalsIgnoreAsciiCase("menubar")
1505 && aElementName.equalsIgnoreAsciiCase("menubar"))
1506 {
1507 if (!m_bInplaceMenuSet)
1508 {
1510 m_xMenuBar.clear();
1511 bNotify = true;
1512 }
1513 }
1514 else if ((aElementType.equalsIgnoreAsciiCase("statusbar")
1515 && aElementName.equalsIgnoreAsciiCase("statusbar"))
1517 {
1518 aWriteLock.clear();
1520 bMustBeLayouted = true;
1521 bNotify = true;
1522 }
1523 else if (aElementType.equalsIgnoreAsciiCase("progressbar")
1524 && aElementName.equalsIgnoreAsciiCase("progressbar"))
1525 {
1526 aWriteLock.clear();
1528 bMustBeLayouted = true;
1529 bNotify = true;
1530 }
1531 else if (aElementType.equalsIgnoreAsciiCase(UIRESOURCETYPE_TOOLBAR)
1532 && m_xToolbarManager.is())
1533 {
1534 aWriteLock.clear();
1535 bNotify = m_xToolbarManager->destroyToolbar(aName);
1536 bMustBeLayouted = m_xToolbarManager->isLayoutDirty();
1537 }
1538 else if (aElementType.equalsIgnoreAsciiCase("dockingwindow"))
1539 {
1540 uno::Reference<frame::XFrame> xFrame(m_xFrame);
1541 uno::Reference<XComponentContext> xContext(m_xContext);
1542 aWriteLock.clear();
1543
1544 impl_setDockingWindowVisibility(xContext, xFrame, aElementName, false);
1545 bMustBeLayouted = false;
1546 bNotify = false;
1547 }
1548 }
1549 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
1550
1551 if ( bMustBeLayouted )
1552 doLayout();
1553
1554 if ( bNotify )
1555 implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::Any( aName ) );
1556}
1557
1558sal_Bool SAL_CALL LayoutManager::requestElement( const OUString& rResourceURL )
1559{
1560 bool bResult( false );
1561 bool bNotify( false );
1562 OUString aElementType;
1563 OUString aElementName;
1564
1565 parseResourceURL( rResourceURL, aElementType, aElementName );
1566
1567 SolarMutexClearableGuard aWriteLock;
1568
1569 OString aResName = OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US );
1570 SAL_INFO( "fwk", "LayoutManager::requestElement " << aResName );
1571
1572 if (( aElementType.equalsIgnoreAsciiCase("statusbar") &&
1573 aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
1574 ( m_aStatusBarElement.m_aName == rResourceURL ))
1575 {
1576 implts_readStatusBarState( rResourceURL );
1578 {
1579 aWriteLock.clear();
1580 createElement( rResourceURL );
1581
1582 // There are some situation where we are not able to create an element.
1583 // Therefore we have to check the reference before further action.
1584 // See #i70019#
1585 uno::Reference< ui::XUIElement > xUIElement( m_aStatusBarElement.m_xUIElement );
1586 if ( xUIElement.is() )
1587 {
1588 // we need VCL here to pass special flags to Show()
1589 SolarMutexGuard aGuard;
1590 Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY );
1591 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
1592 if ( pWindow )
1593 {
1594 pWindow->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
1595 bResult = true;
1596 bNotify = true;
1597 }
1598 }
1599 }
1600 }
1601 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
1602 aElementName.equalsIgnoreAsciiCase("progressbar") )
1603 {
1604 aWriteLock.clear();
1606 bResult = true;
1607 bNotify = true;
1608 }
1609 else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ) && m_bVisible )
1610 {
1611 bool bComponentAttached( !m_aModuleIdentifier.isEmpty() );
1612 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1613 aWriteLock.clear();
1614
1615 if ( pToolbarManager && bComponentAttached )
1616 {
1617 bNotify = pToolbarManager->requestToolbar( rResourceURL );
1618 }
1619 }
1620 else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
1621 {
1622 uno::Reference< frame::XFrame > xFrame( m_xFrame );
1623 aWriteLock.clear();
1624
1625 CreateDockingWindow( xFrame, aElementName );
1626 }
1627
1628 if ( bNotify )
1629 implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::Any( rResourceURL ) );
1630
1631 return bResult;
1632}
1633
1634Reference< XUIElement > SAL_CALL LayoutManager::getElement( const OUString& aName )
1635{
1636 Reference< XUIElement > xUIElement = implts_findElement( aName );
1637 if ( !xUIElement.is() )
1638 {
1639 SolarMutexClearableGuard aReadLock;
1640 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
1641 aReadLock.clear();
1642
1643 if ( pToolbarManager )
1644 xUIElement = pToolbarManager->getToolbar( aName );
1645 }
1646
1647 return xUIElement;
1648}
1649
1650Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements()
1651{
1652 SolarMutexClearableGuard aReadLock;
1653 uno::Reference< ui::XUIElement > xMenuBar( m_xMenuBar );
1654 uno::Reference< ui::XUIElement > xStatusBar( m_aStatusBarElement.m_xUIElement );
1655 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
1656 aReadLock.clear();
1657
1658 Sequence< Reference< ui::XUIElement > > aSeq;
1659 if ( pToolbarManager )
1660 aSeq = pToolbarManager->getToolbars();
1661
1662 sal_Int32 nSize = aSeq.getLength();
1663 sal_Int32 nMenuBarIndex(-1);
1664 sal_Int32 nStatusBarIndex(-1);
1665 if ( xMenuBar.is() )
1666 {
1667 nMenuBarIndex = nSize;
1668 ++nSize;
1669 }
1670 if ( xStatusBar.is() )
1671 {
1672 nStatusBarIndex = nSize;
1673 ++nSize;
1674 }
1675
1676 aSeq.realloc(nSize);
1677 auto pSeq = aSeq.getArray();
1678 if ( nMenuBarIndex >= 0 )
1679 pSeq[nMenuBarIndex] = xMenuBar;
1680 if ( nStatusBarIndex >= 0 )
1681 pSeq[nStatusBarIndex] = xStatusBar;
1682
1683 return aSeq;
1684}
1685
1686sal_Bool SAL_CALL LayoutManager::showElement( const OUString& aName )
1687{
1688 bool bResult( false );
1689 bool bNotify( false );
1690 bool bMustLayout( false );
1691 OUString aElementType;
1692 OUString aElementName;
1693
1694 parseResourceURL( aName, aElementType, aElementName );
1695
1696 OString aResName = OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US );
1697 SAL_INFO( "fwk", "LayoutManager::showElement " << aResName );
1698
1699 if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
1700 aElementName.equalsIgnoreAsciiCase("menubar") )
1701 {
1702 {
1703 SolarMutexGuard aWriteLock;
1704 m_bMenuVisible = true;
1705 }
1706
1707 bResult = implts_resetMenuBar();
1708 bNotify = bResult;
1709 }
1710 else if (( aElementType.equalsIgnoreAsciiCase("statusbar") &&
1711 aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
1713 {
1714 SolarMutexClearableGuard aWriteLock;
1716 implts_showStatusBar( true ))
1717 {
1718 aWriteLock.clear();
1719
1721 bMustLayout = true;
1722 bResult = true;
1723 bNotify = true;
1724 }
1725 }
1726 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
1727 aElementName.equalsIgnoreAsciiCase("progressbar") )
1728 {
1729 bNotify = bResult = implts_showProgressBar();
1730 }
1731 else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
1732 {
1733 SolarMutexClearableGuard aReadLock;
1734 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1735 aReadLock.clear();
1736
1737 if ( pToolbarManager )
1738 {
1739 bNotify = pToolbarManager->showToolbar( aName );
1740 bMustLayout = pToolbarManager->isLayoutDirty();
1741 }
1742 }
1743 else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
1744 {
1745 SolarMutexClearableGuard aReadGuard;
1746 uno::Reference< frame::XFrame > xFrame( m_xFrame );
1747 uno::Reference< XComponentContext > xContext( m_xContext );
1748 aReadGuard.clear();
1749
1750 impl_setDockingWindowVisibility( xContext, xFrame, aElementName, true );
1751 }
1752
1753 if ( bMustLayout )
1754 doLayout();
1755
1756 if ( bNotify )
1757 implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::Any( aName ) );
1758
1759 return bResult;
1760}
1761
1762sal_Bool SAL_CALL LayoutManager::hideElement( const OUString& aName )
1763{
1764 bool bNotify( false );
1765 bool bMustLayout( false );
1766 OUString aElementType;
1767 OUString aElementName;
1768
1769 parseResourceURL( aName, aElementType, aElementName );
1770 OString aResName = OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US );
1771 SAL_INFO( "fwk", "LayoutManager::hideElement " << aResName );
1772
1773 if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
1774 aElementName.equalsIgnoreAsciiCase("menubar") )
1775 {
1777
1778 if ( m_xContainerWindow.is() )
1779 {
1780 m_bMenuVisible = false;
1781
1782 SolarMutexGuard aGuard;
1784 if ( pSysWindow )
1785 {
1786 MenuBar* pMenuBar = pSysWindow->GetMenuBar();
1787 if ( pMenuBar )
1788 {
1789 pMenuBar->SetDisplayable( false );
1790 bNotify = true;
1791 }
1792 }
1793 }
1794 }
1795 else if (( aElementType.equalsIgnoreAsciiCase("statusbar") &&
1796 aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
1798 {
1801 implts_hideStatusBar( true ))
1802 {
1804 bMustLayout = true;
1805 bNotify = true;
1806 }
1807 }
1808 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
1809 aElementName.equalsIgnoreAsciiCase("progressbar") )
1810 {
1811 bNotify = implts_hideProgressBar();
1812 }
1813 else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
1814 {
1815 SolarMutexClearableGuard aReadLock;
1816 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1817 aReadLock.clear();
1818
1819 if ( pToolbarManager )
1820 {
1821 bNotify = pToolbarManager->hideToolbar( aName );
1822 bMustLayout = pToolbarManager->isLayoutDirty();
1823 }
1824 }
1825 else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
1826 {
1827 SolarMutexClearableGuard aReadGuard;
1828 uno::Reference< frame::XFrame > xFrame( m_xFrame );
1829 uno::Reference< XComponentContext > xContext( m_xContext );
1830 aReadGuard.clear();
1831
1832 impl_setDockingWindowVisibility( xContext, xFrame, aElementName, false );
1833 }
1834
1835 if ( bMustLayout )
1836 doLayout();
1837
1838 if ( bNotify )
1839 implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::Any( aName ) );
1840
1841 return false;
1842}
1843
1844sal_Bool SAL_CALL LayoutManager::dockWindow( const OUString& aName, DockingArea DockingArea, const awt::Point& Pos )
1845{
1846 OUString aElementType;
1847 OUString aElementName;
1848
1849 parseResourceURL( aName, aElementType, aElementName );
1850 if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
1851 {
1852 SolarMutexClearableGuard aReadLock;
1853 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1854 aReadLock.clear();
1855
1856 if ( pToolbarManager )
1857 {
1858 pToolbarManager->dockToolbar( aName, DockingArea, Pos );
1859 if ( pToolbarManager->isLayoutDirty() )
1860 doLayout();
1861 }
1862 }
1863 return false;
1864}
1865
1866sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 /*nElementType*/ )
1867{
1868 SolarMutexClearableGuard aReadLock;
1869 bool bResult( false );
1870 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1871 aReadLock.clear();
1872
1873 if ( pToolbarManager )
1874 {
1875 bResult = pToolbarManager->dockAllToolbars();
1876 if ( pToolbarManager->isLayoutDirty() )
1877 doLayout();
1878 }
1879 return bResult;
1880}
1881
1882sal_Bool SAL_CALL LayoutManager::floatWindow( const OUString& aName )
1883{
1884 bool bResult( false );
1886 {
1887 SolarMutexClearableGuard aReadLock;
1888 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1889 aReadLock.clear();
1890
1891 if ( pToolbarManager )
1892 {
1893 bResult = pToolbarManager->floatToolbar( aName );
1894 if ( pToolbarManager->isLayoutDirty() )
1895 doLayout();
1896 }
1897 }
1898 return bResult;
1899}
1900
1901sal_Bool SAL_CALL LayoutManager::lockWindow( const OUString& aName )
1902{
1903 bool bResult( false );
1905 {
1906 SolarMutexClearableGuard aReadLock;
1907 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1908 aReadLock.clear();
1909
1910 if ( pToolbarManager )
1911 {
1912 bResult = pToolbarManager->lockToolbar( aName );
1913 if ( pToolbarManager->isLayoutDirty() )
1914 doLayout();
1915 }
1916 }
1917 return bResult;
1918}
1919
1920sal_Bool SAL_CALL LayoutManager::unlockWindow( const OUString& aName )
1921{
1922 bool bResult( false );
1924 {
1925 SolarMutexClearableGuard aReadLock;
1926 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1927 aReadLock.clear();
1928
1929 if ( pToolbarManager )
1930 {
1931 bResult = pToolbarManager->unlockToolbar( aName );
1932 if ( pToolbarManager->isLayoutDirty() )
1933 doLayout();
1934 }
1935 }
1936 return bResult;
1937}
1938
1939void SAL_CALL LayoutManager::setElementSize( const OUString& aName, const awt::Size& aSize )
1940{
1942 return;
1943
1944 SolarMutexClearableGuard aReadLock;
1945 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
1946 aReadLock.clear();
1947
1948 if ( pToolbarManager )
1949 {
1950 pToolbarManager->setToolbarSize( aName, aSize );
1951 if ( pToolbarManager->isLayoutDirty() )
1952 doLayout();
1953 }
1954}
1955
1956void SAL_CALL LayoutManager::setElementPos( const OUString& aName, const awt::Point& aPos )
1957{
1959 return;
1960
1961 SolarMutexClearableGuard aReadLock;
1962 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
1963 aReadLock.clear();
1964
1965 if ( pToolbarManager )
1966 {
1967 pToolbarManager->setToolbarPos( aName, aPos );
1968 if ( pToolbarManager->isLayoutDirty() )
1969 doLayout();
1970 }
1971}
1972
1973void SAL_CALL LayoutManager::setElementPosSize( const OUString& aName, const awt::Point& aPos, const awt::Size& aSize )
1974{
1976 return;
1977
1978 SolarMutexClearableGuard aReadLock;
1979 ToolbarLayoutManager* pToolbarManager( m_xToolbarManager.get() );
1980 aReadLock.clear();
1981
1982 if ( pToolbarManager )
1983 {
1984 pToolbarManager->setToolbarPosSize( aName, aPos, aSize );
1985 if ( pToolbarManager->isLayoutDirty() )
1986 doLayout();
1987 }
1988}
1989
1990sal_Bool SAL_CALL LayoutManager::isElementVisible( const OUString& aName )
1991{
1992 OUString aElementType;
1993 OUString aElementName;
1994
1995 parseResourceURL( aName, aElementType, aElementName );
1996 if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
1997 aElementName.equalsIgnoreAsciiCase("menubar") )
1998 {
1999 SolarMutexResettableGuard aReadLock;
2000 if ( m_xContainerWindow.is() )
2001 {
2002 aReadLock.clear();
2003
2004 SolarMutexGuard aGuard;
2006 if ( pSysWindow )
2007 {
2008 MenuBar* pMenuBar = pSysWindow->GetMenuBar();
2009 if ( pMenuBar && pMenuBar->IsDisplayable() )
2010 return true;
2011 }
2012 else
2013 {
2014 aReadLock.reset();
2015 return m_bMenuVisible;
2016 }
2017 }
2018 }
2019 else if (( aElementType.equalsIgnoreAsciiCase("statusbar") &&
2020 aElementName.equalsIgnoreAsciiCase("statusbar") ) ||
2022 {
2024 {
2025 Reference< awt::XWindow > xWindow( m_aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY );
2026 if ( xWindow.is() )
2027 {
2029 VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
2030 if ( pWindow && pWindow->IsVisible() )
2031 return true;
2032 else
2033 return false;
2034 }
2035 }
2036 }
2037 else if ( aElementType.equalsIgnoreAsciiCase("progressbar") &&
2038 aElementName.equalsIgnoreAsciiCase("progressbar") )
2039 {
2042 }
2043 else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
2044 {
2045 SolarMutexClearableGuard aReadLock;
2046 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2047 aReadLock.clear();
2048
2049 if ( pToolbarManager )
2050 return pToolbarManager->isToolbarVisible( aName );
2051 }
2052 else if ( aElementType.equalsIgnoreAsciiCase("dockingwindow"))
2053 {
2054 SolarMutexClearableGuard aReadGuard;
2055 uno::Reference< frame::XFrame > xFrame( m_xFrame );
2056 aReadGuard.clear();
2057
2058 return IsDockingWindowVisible( xFrame, aElementName );
2059 }
2060
2061 return false;
2062}
2063
2064sal_Bool SAL_CALL LayoutManager::isElementFloating( const OUString& aName )
2065{
2067 {
2068 SolarMutexClearableGuard aReadLock;
2069 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2070 aReadLock.clear();
2071
2072 if ( pToolbarManager )
2073 return pToolbarManager->isToolbarFloating( aName );
2074 }
2075
2076 return false;
2077}
2078
2079sal_Bool SAL_CALL LayoutManager::isElementDocked( const OUString& aName )
2080{
2082 {
2083 SolarMutexClearableGuard aReadLock;
2084 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2085 aReadLock.clear();
2086
2087 if ( pToolbarManager )
2088 return pToolbarManager->isToolbarDocked( aName );
2089 }
2090
2091 return false;
2092}
2093
2094sal_Bool SAL_CALL LayoutManager::isElementLocked( const OUString& aName )
2095{
2097 {
2098 SolarMutexClearableGuard aReadLock;
2099 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2100 aReadLock.clear();
2101
2102 if ( pToolbarManager )
2103 return pToolbarManager->isToolbarLocked( aName );
2104 }
2105
2106 return false;
2107}
2108
2109awt::Size SAL_CALL LayoutManager::getElementSize( const OUString& aName )
2110{
2112 {
2113 SolarMutexClearableGuard aReadLock;
2114 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2115 aReadLock.clear();
2116
2117 if ( pToolbarManager )
2118 return pToolbarManager->getToolbarSize( aName );
2119 }
2120
2121 return awt::Size();
2122}
2123
2124awt::Point SAL_CALL LayoutManager::getElementPos( const OUString& aName )
2125{
2127 {
2128 SolarMutexClearableGuard aReadLock;
2129 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2130 aReadLock.clear();
2131
2132 if ( pToolbarManager )
2133 return pToolbarManager->getToolbarPos( aName );
2134 }
2135
2136 return awt::Point();
2137}
2138
2139void SAL_CALL LayoutManager::lock()
2140{
2141 implts_lock();
2142
2143 SolarMutexClearableGuard aReadLock;
2144 sal_Int32 nLockCount( m_nLockCount );
2145 aReadLock.clear();
2146
2147 SAL_INFO( "fwk", "LayoutManager::lock " << reinterpret_cast<sal_Int64>(this) << " - " << nLockCount );
2148
2149 Any a( nLockCount );
2150 implts_notifyListeners( frame::LayoutManagerEvents::LOCK, a );
2151}
2152
2154{
2155 bool bDoLayout( implts_unlock() );
2156
2157 SolarMutexClearableGuard aReadLock;
2158 sal_Int32 nLockCount( m_nLockCount );
2159 aReadLock.clear();
2160
2161 SAL_INFO( "fwk", "LayoutManager::unlock " << reinterpret_cast<sal_Int64>(this) << " - " << nLockCount);
2162
2163 // conform to documentation: unlock with lock count == 0 means force a layout
2164
2165 {
2166 SolarMutexGuard aWriteLock;
2167 if (bDoLayout)
2169 }
2170
2171 Any a( nLockCount );
2172 implts_notifyListeners( frame::LayoutManagerEvents::UNLOCK, a );
2173
2174 if ( bDoLayout )
2175 implts_doLayout_notify( true );
2176}
2177
2179{
2180 implts_doLayout_notify( true );
2181}
2182
2183// ILayoutNotifications
2184
2186{
2187 doLayout();
2188}
2189
2191{
2192 bool bLayouted = implts_doLayout( false, bOuterResize );
2193 if ( bLayouted )
2194 implts_notifyListeners( frame::LayoutManagerEvents::LAYOUT, Any() );
2195}
2196
2197bool LayoutManager::implts_doLayout( bool bForceRequestBorderSpace, bool bOuterResize )
2198{
2199 SAL_INFO( "fwk", "LayoutManager::implts_doLayout" );
2200
2201 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
2202 SolarMutexClearableGuard aReadLock;
2203
2204 if ( !m_xFrame.is() || !m_bParentWindowVisible )
2205 return false;
2206
2207 bool bPreserveContentSize( m_bPreserveContentSize );
2208 bool bMustDoLayout( m_bMustDoLayout );
2209 bool bNoLock = ( m_nLockCount == 0 );
2210 awt::Rectangle aCurrBorderSpace( m_aDockingArea );
2211 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2212 Reference< awt::XTopWindow2 > xContainerTopWindow( m_xContainerTopWindow );
2213 Reference< awt::XWindow > xComponentWindow;
2214 try {
2215 xComponentWindow = m_xFrame->getComponentWindow();
2216 } catch (css::lang::DisposedException &) {
2217 // There can be a race between one thread calling Frame::dispose
2218 // (framework/source/services/frame.cxx) -> Frame::disableLayoutManager
2219 // -> LayoutManager::attachFrame(null) setting m_xFrame to null, and
2220 // the main thread firing the timer-triggered
2221 // LayoutManager::AsyncLayoutHdl -> LayoutManager::implts_doLayout and
2222 // calling into the in-dispose m_xFrame here, so silently ignore a
2223 // DisposedException here:
2224 return false;
2225 }
2226 Reference< XDockingAreaAcceptor > xDockingAreaAcceptor( m_xDockingAreaAcceptor );
2227 aReadLock.clear();
2228 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
2229
2230 bool bLayouted( false );
2231
2232 if ( bNoLock && xDockingAreaAcceptor.is() && xContainerWindow.is() && xComponentWindow.is() )
2233 {
2234 bLayouted = true;
2235
2236 awt::Rectangle aDockSpace( implts_calcDockingAreaSizes() );
2237 awt::Rectangle aBorderSpace( aDockSpace );
2238 bool bGotRequestedBorderSpace( true );
2239
2240 // We have to add the height of a possible status bar
2241 aBorderSpace.Height += implts_getStatusBarSize().Height();
2242
2243 if ( !equalRectangles( aBorderSpace, aCurrBorderSpace ) || bForceRequestBorderSpace || bMustDoLayout )
2244 {
2245 // we always resize the content window (instead of the complete container window) if we're not set up
2246 // to (attempt to) preserve the content window's size
2247 if ( bOuterResize && !bPreserveContentSize )
2248 bOuterResize = false;
2249
2250 // maximized windows can resized their content window only, not their container window
2251 if ( bOuterResize && xContainerTopWindow.is() && xContainerTopWindow->getIsMaximized() )
2252 bOuterResize = false;
2253
2254 // if the component window does not have a size (yet), then we can't use it to calc the container
2255 // window size
2256 awt::Rectangle aComponentRect = xComponentWindow->getPosSize();
2257 if ( bOuterResize && ( aComponentRect.Width == 0 ) && ( aComponentRect.Height == 0 ) )
2258 bOuterResize = false;
2259
2260 bGotRequestedBorderSpace = false;
2261 if ( bOuterResize )
2262 {
2263 Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
2264 awt::DeviceInfo aContainerInfo = xDevice->getInfo();
2265
2266 awt::Size aRequestedSize( aComponentRect.Width + aContainerInfo.LeftInset + aContainerInfo.RightInset + aBorderSpace.X + aBorderSpace.Width,
2267 aComponentRect.Height + aContainerInfo.TopInset + aContainerInfo.BottomInset + aBorderSpace.Y + aBorderSpace.Height );
2268 awt::Point aComponentPos( aBorderSpace.X, aBorderSpace.Y );
2269
2270 bGotRequestedBorderSpace = implts_resizeContainerWindow( aRequestedSize, aComponentPos );
2271 }
2272
2273 // if we did not do a container window resize, or it failed, then use the DockingAcceptor as usual
2274 if ( !bGotRequestedBorderSpace )
2275 bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace );
2276
2277 if ( bGotRequestedBorderSpace )
2278 {
2279 SolarMutexGuard aWriteGuard;
2280 m_aDockingArea = aBorderSpace;
2281 m_bMustDoLayout = false;
2282 }
2283 }
2284
2285 if ( bGotRequestedBorderSpace )
2286 {
2287 ::Size aContainerSize;
2288 ::Size aStatusBarSize;
2289
2290 // Interim solution to let the layout method within the
2291 // toolbar layout manager.
2293 if ( m_xToolbarManager.is() )
2294 m_xToolbarManager->setDockingArea( aDockSpace );
2295
2296 // Subtract status bar size from our container output size. Docking area windows
2297 // don't contain the status bar!
2298 aStatusBarSize = implts_getStatusBarSize();
2299 aContainerSize = implts_getContainerWindowOutputSize();
2300 aContainerSize.AdjustHeight( -(aStatusBarSize.Height()) );
2301
2302 if ( m_xToolbarManager.is() )
2303 m_xToolbarManager->doLayout(aContainerSize);
2304
2305 // Position the status bar
2306 if ( aStatusBarSize.Height() > 0 )
2307 {
2308 implts_setStatusBarPosSize( ::Point( 0, std::max(( aContainerSize.Height() ), tools::Long( 0 ))),
2309 ::Size( aContainerSize.Width(),aStatusBarSize.Height() ));
2310 }
2311
2312 xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace );
2313 }
2314 }
2315
2316 return bLayouted;
2317}
2318
2319bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSize,
2320 const awt::Point& rComponentPos )
2321{
2322 SolarMutexClearableGuard aReadLock;
2323 Reference< awt::XWindow > xContainerWindow = m_xContainerWindow;
2324 Reference< awt::XTopWindow2 > xContainerTopWindow = m_xContainerTopWindow;
2325 Reference< awt::XWindow > xComponentWindow = m_xFrame->getComponentWindow();
2326 aReadLock.clear();
2327
2328 // calculate the maximum size we have for the container window
2329 sal_Int32 nDisplay = xContainerTopWindow->getDisplay();
2331
2332 if (!aWorkArea.IsEmpty())
2333 {
2334 if (( rContainerSize.Width > aWorkArea.GetWidth() ) || ( rContainerSize.Height > aWorkArea.GetHeight() ))
2335 return false;
2336 // Strictly, this is not correct. If we have a multi-screen display (css.awt.DisplayAccess.MultiDisplay == true),
2337 // the "effective work area" would be much larger than the work area of a single display, since we could in theory
2338 // position the container window across multiple screens.
2339 // However, this should suffice as a heuristics here ... (nobody really wants to check whether the different screens are
2340 // stacked horizontally or vertically, whether their work areas can really be combined, or are separated by non-work-areas,
2341 // and the like ... right?)
2342 }
2343
2344 // resize our container window
2345 xContainerWindow->setPosSize( 0, 0, rContainerSize.Width, rContainerSize.Height, awt::PosSize::SIZE );
2346 // position the component window
2347 xComponentWindow->setPosSize( rComponentPos.X, rComponentPos.Y, 0, 0, awt::PosSize::POS );
2348 return true;
2349}
2350
2352{
2353 SolarMutexClearableGuard aWriteLock;
2354 bool bWasVisible( m_bVisible );
2356 aWriteLock.clear();
2357
2358 if ( bWasVisible != bool(bVisible) )
2360}
2361
2363{
2365 return m_bVisible;
2366}
2367
2369{
2370 SolarMutexClearableGuard aReadLock;
2371 bool bStatusBarVisible( isElementVisible( STATUS_BAR_ALIAS ));
2372 bool bProgressBarVisible( isElementVisible( "private:resource/progressbar/progressbar" ));
2373 bool bVisible( m_bVisible );
2374 Reference< XUIElement > xStatusBar( m_aStatusBarElement.m_xUIElement );
2375 Reference< XUIElement > xProgressBar( m_aProgressBarElement.m_xUIElement );
2376
2377 Reference< awt::XWindow > xWindow;
2378 if ( bStatusBarVisible && bVisible && xStatusBar.is() )
2379 xWindow.set( xStatusBar->getRealInterface(), UNO_QUERY );
2380 else if ( xProgressBar.is() && !xStatusBar.is() && bProgressBarVisible )
2381 {
2382 ProgressBarWrapper* pWrapper = static_cast<ProgressBarWrapper*>(xProgressBar.get());
2383 if ( pWrapper )
2384 xWindow = pWrapper->getStatusBar();
2385 }
2386 aReadLock.clear();
2387
2388 if ( xWindow.is() )
2389 {
2390 awt::Rectangle aPosSize = xWindow->getPosSize();
2391 return ::Size( aPosSize.Width, aPosSize.Height );
2392 }
2393 else
2394 return ::Size();
2395}
2396
2398{
2399 SolarMutexClearableGuard aReadLock;
2400 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2401 Reference< XDockingAreaAcceptor > xDockingAreaAcceptor( m_xDockingAreaAcceptor );
2402 aReadLock.clear();
2403
2404 awt::Rectangle aBorderSpace;
2405 if ( m_xToolbarManager.is() && xDockingAreaAcceptor.is() && xContainerWindow.is() )
2406 aBorderSpace = m_xToolbarManager->getDockingArea();
2407
2408 return aBorderSpace;
2409}
2410
2412{
2413 SolarMutexClearableGuard aReadLock;
2414 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2415 aReadLock.clear();
2416
2417 uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
2418 // Convert relative size to output size.
2419 awt::Rectangle aRectangle = xContainerWindow->getPosSize();
2420 awt::DeviceInfo aInfo = xDevice->getInfo();
2421 awt::Size aContainerClientSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset,
2422 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
2423 ::Size aStatusBarSize = implts_getStatusBarSize();
2424
2425 // Position the status bar
2426 if ( aStatusBarSize.Height() > 0 )
2427 {
2428 implts_setStatusBarPosSize( ::Point( 0, std::max(( aContainerClientSize.Height - aStatusBarSize.Height() ), tools::Long( 0 ))),
2429 ::Size( aContainerClientSize.Width, aStatusBarSize.Height() ));
2430 }
2431}
2432
2434{
2435 SolarMutexClearableGuard aWriteLock;
2436 bool bShowCloseButton( m_bMenuBarCloseButton );
2437 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2438 aWriteLock.clear();
2439
2440 if ( !xContainerWindow.is() )
2441 return;
2442
2443 SolarMutexGuard aGuard;
2444
2445 SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
2446 if ( pSysWindow )
2447 {
2448 MenuBar* pMenuBar = pSysWindow->GetMenuBar();
2449 if ( pMenuBar )
2450 {
2451 // TODO remove link on sal_False ?!
2452 pMenuBar->ShowCloseButton(bShowCloseButton);
2453 pMenuBar->SetCloseButtonClickHdl(LINK(this, LayoutManager, MenuBarClose));
2454 }
2455 }
2456}
2457
2459{
2460 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
2461 SolarMutexGuard aWriteLock;
2462 bool bMenuVisible( m_bMenuVisible );
2463 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2464
2465 MenuBar* pSetMenuBar = nullptr;
2466 if ( m_xInplaceMenuBar.is() )
2467 pSetMenuBar = static_cast<MenuBar *>(m_xInplaceMenuBar->GetMenuBar());
2468 else
2469 {
2470 MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* >( m_xMenuBar.get() );
2471 if ( pMenuBarWrapper )
2472 pSetMenuBar = static_cast<MenuBar*>(pMenuBarWrapper->GetMenuBarManager()->GetMenuBar());
2473 }
2474
2475 SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
2476 if ( pSysWindow && bMenuVisible && pSetMenuBar )
2477 {
2478 pSysWindow->SetMenuBar(pSetMenuBar);
2479 pSetMenuBar->SetDisplayable( true );
2480 return true;
2481 }
2482
2483 return false;
2484}
2485
2487{
2488 SolarMutexGuard aWriteLock;
2489
2490 // Find Form menu in the original menubar
2492 uno::Reference< XUIElementSettings > xMenuBarSettings(m_xMenuBar, UNO_QUERY);
2493 uno::Reference< container::XIndexReplace > xMenuIndex(xMenuBarSettings->getSettings(true), UNO_QUERY);
2494
2495 sal_Int32 nFormsMenu = -1;
2496 for (sal_Int32 nIndex = 0; nIndex < xMenuIndex->getCount(); ++nIndex)
2497 {
2498 uno::Sequence< beans::PropertyValue > aProps;
2499 xMenuIndex->getByIndex( nIndex ) >>= aProps;
2500 OUString aCommand;
2501 for ( beans::PropertyValue const & rProp : std::as_const(aProps) )
2502 {
2503 if (rProp.Name == "CommandURL")
2504 {
2505 rProp.Value >>= aCommand;
2506 break;
2507 }
2508 }
2509
2510 if (aCommand == ".uno:FormatFormMenu")
2511 nFormsMenu = nIndex;
2512 }
2513 assert(nFormsMenu != -1);
2514
2515 // Create the MS compatible Form menu
2516 css::uno::Reference< css::ui::XUIElement > xFormsMenu = implts_createElement( "private:resource/menubar/mscompatibleformsmenu" );
2517 if(!xFormsMenu.is())
2518 return;
2519
2520 // Merge the MS compatible Form menu into the menubar
2521 uno::Reference< XUIElementSettings > xFormsMenuSettings(xFormsMenu, UNO_QUERY);
2522 uno::Reference< container::XIndexAccess > xFormsMenuIndex(xFormsMenuSettings->getSettings(true));
2523
2524 assert(xFormsMenuIndex->getCount() >= 1);
2525 uno::Sequence< beans::PropertyValue > aNewFormsMenu;
2526 xFormsMenuIndex->getByIndex( 0 ) >>= aNewFormsMenu;
2527 xMenuIndex->replaceByIndex(nFormsMenu, uno::Any(aNewFormsMenu));
2528
2529 setMergedMenuBar( xMenuIndex );
2530
2531 // Clear up the temporal forms menubar
2532 Reference< XComponent > xFormsMenuComp( xFormsMenu, UNO_QUERY );
2533 if ( xFormsMenuComp.is() )
2534 xFormsMenuComp->dispose();
2535 xFormsMenu.clear();
2536}
2537
2538IMPL_LINK_NOARG(LayoutManager, MenuBarClose, void*, void)
2539{
2540 SolarMutexClearableGuard aReadLock;
2541 uno::Reference< frame::XDispatchProvider > xProvider(m_xFrame, uno::UNO_QUERY);
2542 uno::Reference< XComponentContext > xContext( m_xContext );
2543 aReadLock.clear();
2544
2545 if ( !xProvider.is())
2546 return;
2547
2548 uno::Reference< frame::XDispatchHelper > xDispatcher = frame::DispatchHelper::create( xContext );
2549
2550 xDispatcher->executeDispatch(
2551 xProvider,
2552 ".uno:CloseWin",
2553 "_self",
2554 0,
2555 uno::Sequence< beans::PropertyValue >());
2556}
2557
2558// XLayoutManagerEventBroadcaster
2559
2560void SAL_CALL LayoutManager::addLayoutManagerEventListener( const uno::Reference< frame::XLayoutManagerListener >& xListener )
2561{
2563}
2564
2565void SAL_CALL LayoutManager::removeLayoutManagerEventListener( const uno::Reference< frame::XLayoutManagerListener >& xListener )
2566{
2568}
2569
2570void LayoutManager::implts_notifyListeners(short nEvent, const uno::Any& rInfoParam)
2571{
2573 if (pContainer==nullptr)
2574 return;
2575
2576 lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>(this) );
2577 comphelper::OInterfaceIteratorHelper2 pIterator(*pContainer);
2578 while (pIterator.hasMoreElements())
2579 {
2580 try
2581 {
2582 static_cast<frame::XLayoutManagerListener*>(pIterator.next())->layoutEvent(aSource, nEvent, rInfoParam);
2583 }
2584 catch( const uno::RuntimeException& )
2585 {
2586 pIterator.remove();
2587 }
2588 }
2589}
2590
2591// XWindowListener
2592
2593void SAL_CALL LayoutManager::windowResized( const awt::WindowEvent& aEvent )
2594{
2596 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2597
2598 Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY );
2599 if ( xIfac == aEvent.Source && m_bVisible )
2600 {
2601 // We have to call our resize handler at least once synchronously, as some
2602 // application modules need this. So we have to check if this is the first
2603 // call after the async layout time expired.
2604 m_bMustDoLayout = true;
2606 {
2608 if ( m_nLockCount == 0 )
2610 }
2611 }
2612 else if ( m_xFrame.is() && aEvent.Source == m_xFrame->getContainerWindow() )
2613 {
2614 // the container window of my DockingAreaAcceptor is not the same as of my frame
2615 // I still have to resize my frames' window as nobody else will do it
2616 Reference< awt::XWindow > xComponentWindow( m_xFrame->getComponentWindow() );
2617 if( xComponentWindow.is() )
2618 {
2619 uno::Reference< awt::XDevice > xDevice( m_xFrame->getContainerWindow(), uno::UNO_QUERY );
2620
2621 // Convert relative size to output size.
2622 awt::Rectangle aRectangle = m_xFrame->getContainerWindow()->getPosSize();
2623 awt::DeviceInfo aInfo = xDevice->getInfo();
2624 awt::Size aSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
2625 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
2626
2627 // Resize our component window.
2628 xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, awt::PosSize::POSSIZE );
2629 }
2630 }
2631}
2632
2633void SAL_CALL LayoutManager::windowMoved( const awt::WindowEvent& )
2634{
2635}
2636
2637void SAL_CALL LayoutManager::windowShown( const lang::EventObject& aEvent )
2638{
2639 SolarMutexClearableGuard aReadLock;
2640 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2641 bool bParentWindowVisible( m_bParentWindowVisible );
2642 aReadLock.clear();
2643
2644 Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY );
2645 if ( xIfac == aEvent.Source )
2646 {
2647 SolarMutexClearableGuard aWriteLock;
2649 bool bSetVisible = ( m_bParentWindowVisible != bParentWindowVisible );
2650 aWriteLock.clear();
2651
2652 if ( bSetVisible )
2654 }
2655}
2656
2657void SAL_CALL LayoutManager::windowHidden( const lang::EventObject& aEvent )
2658{
2659 SolarMutexClearableGuard aReadLock;
2660 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2661 bool bParentWindowVisible( m_bParentWindowVisible );
2662 aReadLock.clear();
2663
2664 Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY );
2665 if ( xIfac == aEvent.Source )
2666 {
2667 SolarMutexClearableGuard aWriteLock;
2668 m_bParentWindowVisible = false;
2669 bool bSetInvisible = ( m_bParentWindowVisible != bParentWindowVisible );
2670 aWriteLock.clear();
2671
2672 if ( bSetInvisible )
2674 }
2675}
2676
2677IMPL_LINK_NOARG(LayoutManager, AsyncLayoutHdl, Timer *, void)
2678{
2679 {
2680 SolarMutexGuard aReadLock;
2681
2682 if (!m_xContainerWindow.is())
2683 return;
2684 }
2685
2686 implts_setDockingAreaWindowSizes();
2687 implts_doLayout( true, false );
2688}
2689
2690// XFrameActionListener
2691
2692void SAL_CALL LayoutManager::frameAction( const FrameActionEvent& aEvent )
2693{
2694 if (( aEvent.Action == FrameAction_COMPONENT_ATTACHED ) || ( aEvent.Action == FrameAction_COMPONENT_REATTACHED ))
2695 {
2696 SAL_INFO( "fwk", "LayoutManager::frameAction (COMPONENT_ATTACHED|REATTACHED)" );
2697
2698 {
2699 SolarMutexGuard aWriteLock;
2700 m_bMustDoLayout = true;
2701 }
2702
2703 implts_reset( true );
2704 implts_doLayout( true, false );
2705 implts_doLayout( true, true );
2706 }
2707 else if (( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ) || ( aEvent.Action == FrameAction_FRAME_UI_DEACTIVATING ))
2708 {
2709 SAL_INFO( "fwk", "LayoutManager::frameAction (FRAME_UI_ACTIVATED|DEACTIVATING)" );
2710
2711 implts_toggleFloatingUIElementsVisibility( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED );
2712 }
2713 else if ( aEvent.Action == FrameAction_COMPONENT_DETACHING )
2714 {
2715 SAL_INFO( "fwk", "LayoutManager::frameAction (COMPONENT_DETACHING)" );
2716
2717 implts_reset( false );
2718 }
2719}
2720
2721void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent )
2722{
2723 bool bDisposeAndClear( false );
2724
2725 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
2726 {
2727 SolarMutexGuard aWriteLock;
2728
2729 if (rEvent.Source == Reference<XInterface>(m_xFrame, UNO_QUERY))
2730 {
2731 // Our frame gets disposed, release all our references that depends on a working frame reference.
2732
2733 setDockingAreaAcceptor(Reference<ui::XDockingAreaAcceptor>());
2734
2735 // destroy all elements, it's possible that detaching is NOT called!
2738 m_xMenuBar.clear();
2739 VclPtr<Menu> pMenuBar;
2740 if (m_xInplaceMenuBar.is())
2741 {
2742 pMenuBar = m_xInplaceMenuBar->GetMenuBar();
2743 m_xInplaceMenuBar->dispose();
2744 m_xInplaceMenuBar.clear();
2745 }
2746 pMenuBar.disposeAndClear();
2747 m_xContainerWindow.clear();
2748 m_xContainerTopWindow.clear();
2749
2750 // forward disposing call to toolbar manager
2751 if (m_xToolbarManager.is())
2752 m_xToolbarManager->disposing(rEvent);
2753
2754 if (m_xModuleCfgMgr.is())
2755 {
2756 try
2757 {
2758 Reference<XUIConfiguration> xModuleCfgMgr(m_xModuleCfgMgr, UNO_QUERY);
2759 xModuleCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>(this));
2760 }
2761 catch (const Exception&)
2762 {
2763 }
2764 }
2765
2766 if (m_xDocCfgMgr.is())
2767 {
2768 try
2769 {
2770 Reference<XUIConfiguration> xDocCfgMgr(m_xDocCfgMgr, UNO_QUERY);
2771 xDocCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>(this));
2772 }
2773 catch (const Exception&)
2774 {
2775 }
2776 }
2777
2778 m_xDocCfgMgr.clear();
2779 m_xModuleCfgMgr.clear();
2780 m_xFrame.clear();
2781 m_pGlobalSettings.reset();
2782
2783 bDisposeAndClear = true;
2784 }
2785 else if (rEvent.Source == Reference<XInterface>(m_xContainerWindow, UNO_QUERY))
2786 {
2787 // Our container window gets disposed. Remove all user interface elements.
2788 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
2789 if (pToolbarManager)
2790 {
2791 uno::Reference<awt::XVclWindowPeer> aEmptyWindowPeer;
2792 pToolbarManager->setParentWindow(aEmptyWindowPeer);
2793 }
2795 m_xMenuBar.clear();
2796 VclPtr<Menu> pMenuBar;
2797 if (m_xInplaceMenuBar.is())
2798 {
2799 pMenuBar = m_xInplaceMenuBar->GetMenuBar();
2800 m_xInplaceMenuBar->dispose();
2801 m_xInplaceMenuBar.clear();
2802 }
2803 pMenuBar.disposeAndClear();
2804 m_xContainerWindow.clear();
2805 m_xContainerTopWindow.clear();
2806 }
2807 else if (rEvent.Source == Reference<XInterface>(m_xDocCfgMgr, UNO_QUERY))
2808 m_xDocCfgMgr.clear();
2809 else if (rEvent.Source == Reference<XInterface>(m_xModuleCfgMgr, UNO_QUERY))
2810 m_xModuleCfgMgr.clear();
2811 }
2812 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
2813
2814 // Send disposing to our listener when we have lost our frame.
2815 if ( bDisposeAndClear )
2816 {
2817 // Send message to all listener and forget her references.
2818 uno::Reference< frame::XLayoutManager > xThis(this);
2819 lang::EventObject aEvent( xThis );
2821 }
2822}
2823
2824void SAL_CALL LayoutManager::elementInserted( const ui::ConfigurationEvent& Event )
2825{
2826 SolarMutexClearableGuard aReadLock;
2827 Reference< XFrame > xFrame( m_xFrame );
2829 aReadLock.clear();
2830
2831 if ( !xFrame.is() )
2832 return;
2833
2834 OUString aElementType;
2835 OUString aElementName;
2836 bool bRefreshLayout(false);
2837
2838 parseResourceURL( Event.ResourceURL, aElementType, aElementName );
2839 if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
2840 {
2841 if ( xToolbarManager.is() )
2842 {
2843 xToolbarManager->elementInserted( Event );
2844 bRefreshLayout = xToolbarManager->isLayoutDirty();
2845 }
2846 }
2847 else if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_MENUBAR ))
2848 {
2849 Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
2850 Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
2851 if ( xElementSettings.is() )
2852 {
2853 uno::Reference< XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
2854 if ( xPropSet.is() )
2855 {
2856 if ( Event.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY ))
2857 xPropSet->setPropertyValue( "ConfigurationSource", Any( m_xDocCfgMgr ));
2858 }
2859 xElementSettings->updateSettings();
2860 }
2861 }
2862
2863 if ( bRefreshLayout )
2864 doLayout();
2865}
2866
2867void SAL_CALL LayoutManager::elementRemoved( const ui::ConfigurationEvent& Event )
2868{
2869 SolarMutexClearableGuard aReadLock;
2870 Reference< frame::XFrame > xFrame( m_xFrame );
2872 Reference< awt::XWindow > xContainerWindow( m_xContainerWindow );
2873 Reference< ui::XUIElement > xMenuBar( m_xMenuBar );
2874 Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr );
2875 Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr );
2876 aReadLock.clear();
2877
2878 if ( !xFrame.is() )
2879 return;
2880
2881 OUString aElementType;
2882 OUString aElementName;
2883 bool bRefreshLayout(false);
2884
2885 parseResourceURL( Event.ResourceURL, aElementType, aElementName );
2886 if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
2887 {
2888 if ( xToolbarManager.is() )
2889 {
2890 xToolbarManager->elementRemoved( Event );
2891 bRefreshLayout = xToolbarManager->isLayoutDirty();
2892 }
2893 }
2894 else
2895 {
2896 Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
2897 Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
2898 if ( xElementSettings.is() )
2899 {
2900 bool bNoSettings( false );
2901 OUString aConfigSourcePropName( "ConfigurationSource" );
2902 Reference< XInterface > xElementCfgMgr;
2903 Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
2904
2905 if ( xPropSet.is() )
2906 xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
2907
2908 if ( !xElementCfgMgr.is() )
2909 return;
2910
2911 // Check if the same UI configuration manager has changed => check further
2912 if ( Event.Source == xElementCfgMgr )
2913 {
2914 // Same UI configuration manager where our element has its settings
2915 if ( Event.Source == Reference< XInterface >( xDocCfgMgr, UNO_QUERY ))
2916 {
2917 // document settings removed
2918 if ( xModuleCfgMgr->hasSettings( Event.ResourceURL ))
2919 {
2920 xPropSet->setPropertyValue( aConfigSourcePropName, Any( m_xModuleCfgMgr ));
2921 xElementSettings->updateSettings();
2922 return;
2923 }
2924 }
2925
2926 bNoSettings = true;
2927 }
2928
2929 // No settings anymore, element must be destroyed
2930 if ( xContainerWindow.is() && bNoSettings )
2931 {
2932 if ( aElementType.equalsIgnoreAsciiCase("menubar") &&
2933 aElementName.equalsIgnoreAsciiCase("menubar") )
2934 {
2935 SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow );
2936 if ( pSysWindow && !m_bInplaceMenuSet )
2937 pSysWindow->SetMenuBar( nullptr );
2938
2939 Reference< XComponent > xComp( xMenuBar, UNO_QUERY );
2940 if ( xComp.is() )
2941 xComp->dispose();
2942
2944 m_xMenuBar.clear();
2945 }
2946 }
2947 }
2948 }
2949
2950 if ( bRefreshLayout )
2951 doLayout();
2952}
2953
2954void SAL_CALL LayoutManager::elementReplaced( const ui::ConfigurationEvent& Event )
2955{
2956 SolarMutexClearableGuard aReadLock;
2957 Reference< XFrame > xFrame( m_xFrame );
2959 aReadLock.clear();
2960
2961 if ( !xFrame.is() )
2962 return;
2963
2964 OUString aElementType;
2965 OUString aElementName;
2966 bool bRefreshLayout(false);
2967
2968 parseResourceURL( Event.ResourceURL, aElementType, aElementName );
2969 if ( aElementType.equalsIgnoreAsciiCase( UIRESOURCETYPE_TOOLBAR ))
2970 {
2971 if ( xToolbarManager.is() )
2972 {
2973 xToolbarManager->elementReplaced( Event );
2974 bRefreshLayout = xToolbarManager->isLayoutDirty();
2975 }
2976 }
2977 else
2978 {
2979 Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL );
2980 Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY );
2981 if ( xElementSettings.is() )
2982 {
2983 Reference< XInterface > xElementCfgMgr;
2984 Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY );
2985
2986 if ( xPropSet.is() )
2987 xPropSet->getPropertyValue( "ConfigurationSource" ) >>= xElementCfgMgr;
2988
2989 if ( !xElementCfgMgr.is() )
2990 return;
2991
2992 // Check if the same UI configuration manager has changed => update settings
2993 if ( Event.Source == xElementCfgMgr )
2994 xElementSettings->updateSettings();
2995 }
2996 }
2997
2998 if ( bRefreshLayout )
2999 doLayout();
3000}
3001
3003 const uno::Any& aValue )
3004{
3007
3008 switch( nHandle )
3009 {
3012 break;
3013
3015 {
3016 bool bValue(false);
3017 if (( aValue >>= bValue ) && bValue )
3018 {
3019 SolarMutexClearableGuard aReadLock;
3020 ToolbarLayoutManager* pToolbarManager = m_xToolbarManager.get();
3021 bool bAutomaticToolbars( m_bAutomaticToolbars );
3022 aReadLock.clear();
3023
3024 if ( pToolbarManager )
3025 pToolbarManager->refreshToolbarsVisibility( bAutomaticToolbars );
3026 }
3027 break;
3028 }
3029
3032 break;
3033
3035 if (m_xToolbarManager.is())
3036 m_xToolbarManager->updateToolbarsTips();
3037 break;
3038
3039 default: break;
3040 }
3041}
3042
3043namespace detail
3044{
3046 {
3047 private:
3048 std::unique_ptr<::cppu::OPropertyArrayHelper> m_pInfoHelper;
3049 public:
3050 explicit InfoHelperBuilder(const LayoutManager &rManager)
3051 {
3052 uno::Sequence< beans::Property > aProperties;
3054 m_pInfoHelper.reset( new ::cppu::OPropertyArrayHelper(aProperties, true) );
3055 }
3058
3060 };
3061}
3062
3064{
3065 static detail::InfoHelperBuilder INFO(*this);
3066 return INFO.getHelper();
3067}
3068
3069uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo()
3070{
3071 static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
3072
3073 return xInfo;
3074}
3075
3076} // namespace framework
3077
3078extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
3080 css::uno::XComponentContext *context,
3081 css::uno::Sequence<css::uno::Any> const &)
3082{
3083 return cppu::acquire(new framework::LayoutManager(context));
3084}
3085
3086/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
PropertiesInfo aProperties
css::uno::Reference< css::lang::XComponent > m_xFrame
AnyEventRef aEvent
static tools::Rectangle GetScreenPosSizePixel(unsigned int nScreen)
void SetDisplayable(bool bDisplayable)
bool IsDisplayable() const
void SetCloseButtonClickHdl(const Link< void *, void > &rLink)
void ShowCloseButton(bool bShow)
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
constexpr tools::Long Width() const
static bool GetDockingFloatsSupported()
MenuBar * GetMenuBar() const
void SetMenuBar(MenuBar *pMenuBar)
bool IsActive() const
void Stop()
virtual void Start(bool bStartTimer=true) override
virtual void Invoke() override
static css::uno::Reference< css::awt::XWindow > GetInterface(vcl::Window *pWindow)
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
Menu * GetMenu() const
void disposeAndClear()
reference_type * get() const
static VclPtr< reference_type > Create(Arg &&... arg)
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)
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
bool GetToolbarStateInfo(StateInfo eStateInfo, css::uno::Any &aValue)
css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowStateSupplier
virtual void SAL_CALL reset() override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &aEvent) override
css::uno::Reference< css::ui::XUIElement > m_xProgressBarBackup
virtual void SAL_CALL windowHidden(const css::lang::EventObject &aEvent) override
css::uno::Reference< css::frame::XFrame > m_xFrame
css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow
virtual sal_Bool SAL_CALL hideElement(const OUString &aName) override
virtual css::awt::Size SAL_CALL getElementSize(const OUString &aName) override
virtual sal_Bool SAL_CALL dockAllWindows(::sal_Int16 nElementType) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL setElementSize(const OUString &aName, const css::awt::Size &aSize) override
css::uno::Reference< css::container::XNameAccess > m_xPersistentWindowState
css::uno::Reference< css::ui::XUIElement > implts_createDockingWindow(const OUString &aElementName)
bool implts_showStatusBar(bool bStoreState=false)
css::awt::Rectangle implts_calcDockingAreaSizes()
virtual void SAL_CALL removeLayoutManagerEventListener(const css::uno::Reference< css::frame::XLayoutManagerListener > &aLayoutManagerListener) override
virtual sal_Bool SAL_CALL lockWindow(const OUString &ResourceURL) override
void implts_setCurrentUIVisibility(bool bShow)
void implts_setStatusBarPosSize(const ::Point &rPos, const ::Size &rSize)
virtual sal_Bool SAL_CALL isElementLocked(const OUString &ResourceURL) override
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &aEvent) override
virtual void SAL_CALL elementRemoved(const css::ui::ConfigurationEvent &Event) override
void implts_notifyListeners(short nEvent, const css::uno::Any &rInfoParam)
css::uno::Reference< css::ui::XUIConfigurationManager > m_xModuleCfgMgr
virtual css::uno::Sequence< css::uno::Reference< css::ui::XUIElement > > SAL_CALL getElements() override
virtual void SAL_CALL elementReplaced(const css::ui::ConfigurationEvent &Event) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &aValue) override
virtual void SAL_CALL setDockingAreaAcceptor(const css::uno::Reference< css::ui::XDockingAreaAcceptor > &xDockingAreaAcceptor) final override
css::uno::Reference< css::ui::XUIElement > implts_findElement(std::u16string_view aName)
bool implts_doLayout(bool bForceRequestBorderSpace, bool bOuterResize)
css::uno::Reference< css::awt::XWindow > m_xContainerWindow
css::uno::Reference< css::ui::XUIElementFactoryManager > m_xUIElementFactoryManager
virtual css::awt::Rectangle SAL_CALL getCurrentDockingArea() override
void implts_setVisibleState(bool bShow)
virtual void SAL_CALL setVisible(sal_Bool bVisible) override
virtual sal_Bool SAL_CALL setMergedMenuBar(const css::uno::Reference< css::container::XIndexAccess > &xMergedMenuBar) override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual ~LayoutManager() override
virtual void SAL_CALL createElement(const OUString &aName) override
void implts_doLayout_notify(bool bOuterResize)
virtual sal_Bool SAL_CALL unlockWindow(const OUString &ResourceURL) override
void implts_toggleFloatingUIElementsVisibility(bool bActive)
rtl::Reference< ToolbarLayoutManager > m_xToolbarManager
::Size implts_getContainerWindowOutputSize()
virtual void SAL_CALL addLayoutManagerEventListener(const css::uno::Reference< css::frame::XLayoutManagerListener > &aLayoutManagerListener) override
virtual sal_Bool SAL_CALL floatWindow(const OUString &aName) override
void implts_createMSCompatibleMenuBar(const OUString &rName)
virtual sal_Bool SAL_CALL isElementVisible(const OUString &aName) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual void SAL_CALL attachFrame(const css::uno::Reference< css::frame::XFrame > &Frame) override
void implts_writeWindowStateData(const OUString &rName, const UIElement &rElementData)
virtual void SAL_CALL destroyElement(const OUString &aName) override
virtual css::uno::Reference< css::ui::XDockingAreaAcceptor > SAL_CALL getDockingAreaAcceptor() override
rtl::Reference< MenuBarManager > m_xInplaceMenuBar
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &aEvent) override
void implts_setOffset(const sal_Int32 nBottomOffset)
virtual sal_Bool SAL_CALL showElement(const OUString &aName) override
virtual sal_Bool SAL_CALL requestElement(const OUString &ResourceURL) override
virtual css::uno::Reference< css::ui::XUIElement > SAL_CALL getElement(const OUString &aName) override
css::uno::Reference< css::frame::XModuleManager2 > m_xModuleManager
css::uno::Reference< css::ui::XUIElement > implts_createElement(const OUString &aName)
css::uno::Reference< css::ui::XDockingAreaAcceptor > m_xDockingAreaAcceptor
virtual void SAL_CALL lock() override
bool implts_resizeContainerWindow(const css::awt::Size &rContainerSize, const css::awt::Point &rComponentPos)
virtual sal_Bool SAL_CALL dockWindow(const OUString &aName, css::ui::DockingArea DockingArea, const css::awt::Point &Pos) override
void implts_reset(bool bAttach)
void implts_readStatusBarState(const OUString &rStatusBarName)
bool implts_isEmbeddedLayoutManager() const
virtual css::awt::Point SAL_CALL getElementPos(const OUString &aName) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &aEvent) override
css::awt::Rectangle m_aDockingArea
css::uno::Reference< css::ui::XUIConfigurationManager > m_xDocCfgMgr
css::uno::Reference< css::ui::XUIElement > m_xMenuBar
std::unique_ptr< GlobalSettings > m_pGlobalSettings
virtual void SAL_CALL elementInserted(const css::ui::ConfigurationEvent &Event) override
void implts_updateUIElementsVisibleState(bool bShow)
virtual sal_Bool SAL_CALL isVisible() override
virtual sal_Bool SAL_CALL isElementDocked(const OUString &aName) override
css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer
reference to factory, which has created this instance.
virtual void SAL_CALL doLayout() override
void implts_setInplaceMenuBar(const css::uno::Reference< css::container::XIndexAccess > &xMergedMenuBar)
virtual void SAL_CALL disposing(const css::lang::EventObject &aEvent) override
virtual void SAL_CALL unlock() override
static bool readWindowStateData(const OUString &rName, UIElement &rElementData, const css::uno::Reference< css::container::XNameAccess > &rPersistentWindowState, std::unique_ptr< GlobalSettings > &rGlobalSettings, bool &bInGlobalSettings, const css::uno::Reference< css::uno::XComponentContext > &rComponentContext)
Reading of settings - shared with ToolbarLayoutManager.
bool implts_readWindowStateData(const OUString &rName, UIElement &rElementData)
void implts_createMenuBar(const OUString &rMenuBarName)
void implts_createStatusBar(const OUString &rStatusBarName)
virtual void SAL_CALL setElementPosSize(const OUString &aName, const css::awt::Point &aPos, const css::awt::Size &aSize) override
bool implts_hideStatusBar(bool bStoreState=false)
virtual void SAL_CALL removeMergedMenuBar() override
virtual sal_Bool SAL_CALL isElementFloating(const OUString &aName) override
virtual void SAL_CALL setElementPos(const OUString &aName, const css::awt::Point &aPos) override
comphelper::OMultiTypeInterfaceContainerHelper2 m_aListenerContainer
MenuBarManager * GetMenuBarManager() const
css::uno::Reference< css::awt::XWindow > getStatusBar() const
void setStatusBar(const css::uno::Reference< css::awt::XWindow > &rStatusBar, bool bOwnsInstance=false)
void setFloatingToolbarsVisibility(bool bVisible)
css::uno::Reference< css::ui::XUIElement > getToolbar(std::u16string_view aName)
void setParentWindow(const css::uno::Reference< css::awt::XVclWindowPeer > &xParentWindow)
bool floatToolbar(std::u16string_view rResourceURL)
void childWindowEvent(VclSimpleEvent const *pEvent)
void refreshToolbarsVisibility(bool bAutomaticToolbars)
bool showToolbar(std::u16string_view rResourceURL)
void setToolbarSize(std::u16string_view rResourceURL, const css::awt::Size &aSize)
bool isToolbarVisible(std::u16string_view rResourceURL)
void setToolbarPos(std::u16string_view rResourceURL, const css::awt::Point &aPos)
bool isToolbarFloating(std::u16string_view rResourceURL)
bool lockToolbar(std::u16string_view rResourceURL)
bool unlockToolbar(std::u16string_view rResourceURL)
css::awt::Size getToolbarSize(std::u16string_view rResourceURL)
css::awt::Point getToolbarPos(std::u16string_view rResourceURL)
bool dockToolbar(std::u16string_view rResourceURL, css::ui::DockingArea eDockingArea, const css::awt::Point &aPos)
void setToolbarPosSize(std::u16string_view rResourceURL, const css::awt::Point &aPos, const css::awt::Size &aSize)
bool hideToolbar(std::u16string_view rResourceURL)
bool isToolbarLocked(std::u16string_view rResourceURL)
bool requestToolbar(const OUString &rResourceURL)
css::uno::Sequence< css::uno::Reference< css::ui::XUIElement > > getToolbars()
bool isToolbarDocked(std::u16string_view rResourceURL)
std::unique_ptr<::cppu::OPropertyArrayHelper > m_pInfoHelper
InfoHelperBuilder & operator=(const InfoHelperBuilder &)=delete
::cppu::OPropertyArrayHelper & getHelper()
InfoHelperBuilder(const InfoHelperBuilder &)=delete
InfoHelperBuilder(const LayoutManager &rManager)
constexpr tools::Long GetWidth() const
constexpr tools::Long GetHeight() const
constexpr bool IsEmpty() const
WindowType GetType() const
Size GetOutputSizePixel() const
float u
css::uno::Reference< css::uno::XComponentContext > m_xContext
constexpr OUStringLiteral UIRESOURCETYPE_TOOLBAR
Definition: helpers.hxx:34
#define UIRESOURCETYPE_MENUBAR
Definition: helpers.hxx:35
sal_Int32 nIndex
OUString aName
uno_Any a
constexpr OUStringLiteral STATUS_BAR_ALIAS
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_framework_LayoutManager_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
Sequence< sal_Int8 > aSeq
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
@ Exception
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_PRESERVE_CONTENT_SIZE
Definition: properties.h:51
void parseResourceURL(std::u16string_view aResourceURL, OUString &aElementType, OUString &aElementName)
Definition: helpers.cxx:201
::cppu::WeakImplHelper< css::lang::XServiceInfo, css::frame::XLayoutManager2, css::awt::XWindowListener > LayoutManager_Base
bool IsDockingWindowVisible(const css::uno::Reference< css::frame::XFrame > &rFrame, std::u16string_view rResourceURL)
IMPL_LINK(WindowCommandDispatch, impl_notifyCommand, VclWindowEvent &, rEvent, void)
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_AUTOMATICTOOLBARS
Definition: properties.h:47
void impl_addWindowListeners(const css::uno::Reference< css::uno::XInterface > &xThis, const css::uno::Reference< css::ui::XUIElement > &xUIElement)
Definition: helpers.cxx:315
void CreateDockingWindow(const css::uno::Reference< css::frame::XFrame > &rFrame, std::u16string_view rResourceURL)
IMPL_LINK_NOARG(CloseDispatcher, impl_asyncCallback, LinkParamNone *, void)
asynchronous callback @descr We start all actions inside this object asynchronous (see comments there...
SystemWindow * getTopSystemWindow(const uno::Reference< awt::XWindow > &xWindow)
Definition: helpers.cxx:120
uno::Reference< frame::XModel > impl_getModelFromFrame(const uno::Reference< frame::XFrame > &rFrame)
Definition: helpers.cxx:242
void impl_setDockingWindowVisibility(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XFrame > &rFrame, std::u16string_view rDockingWindowName, bool bVisible)
Definition: helpers.cxx:290
std::u16string_view getElementTypeFromResourceURL(std::u16string_view aResourceURL)
Definition: helpers.cxx:190
bool implts_isPreviewModel(const uno::Reference< frame::XModel > &xModel)
Definition: helpers.cxx:256
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_REFRESHTOOLTIP
Definition: properties.h:52
bool implts_isFrameOrWindowTop(const uno::Reference< frame::XFrame > &xFrame)
Definition: helpers.cxx:272
::comphelper::OPropertyContainer LayoutManager_PBase
bool equalRectangles(const css::awt::Rectangle &rRect1, const css::awt::Rectangle &rRect2)
Definition: helpers.cxx:233
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_HIDECURRENTUI
Definition: properties.h:49
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_LOCKCOUNT
Definition: properties.h:50
constexpr OUStringLiteral LAYOUTMANAGER_PROPNAME_ASCII_REFRESHVISIBILITY
Definition: properties.h:48
bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
IMPLEMENT_FORWARD_XTYPEPROVIDER2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
IMPLEMENT_FORWARD_XINTERFACE2(ChildWindowPane, ChildWindowPaneInterfaceBase, Pane)
long Long
#define LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER
Definition: properties.h:56
#define LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE
Definition: properties.h:61
#define LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT
Definition: properties.h:60
#define LAYOUTMANAGER_PROPNAME_MENUBARCLOSER
Definition: properties.h:54
#define LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS
Definition: properties.h:57
#define LAYOUTMANAGER_PROPHANDLE_REFRESHTOOLTIP
Definition: properties.h:62
#define LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI
Definition: properties.h:59
#define LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY
Definition: properties.h:58
sal_Int32 nHandle
css::ui::DockingArea m_nDockedArea
Definition: uielement.hxx:41
css::awt::Point m_aPos
Definition: uielement.hxx:40
css::awt::Size m_aSize
Definition: uielement.hxx:52
css::awt::Point m_aPos
Definition: uielement.hxx:51
ButtonType m_nStyle
Definition: uielement.hxx:97
FloatingData m_aFloatingData
Definition: uielement.hxx:99
DockedData m_aDockedData
Definition: uielement.hxx:98
css::uno::Reference< css::ui::XUIElement > m_xUIElement
Definition: uielement.hxx:89
Reference< XFrame > xFrame
Reference< XModel > xModel
bool bVisible
OUString aCommand
#define SAL_MAX_INT32
unsigned char sal_Bool
std::mutex m_aMutex
ButtonType
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_VISIBLE
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_DOCKINGAREA
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_POS
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_LOCKED
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_STYLE
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_DOCKPOS
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_DOCKED
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_NOCLOSE
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_SIZE
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_UINAME
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_CONTEXT
sal_Int64 WinBits
WinBits const WB_3DLOOK
WinBits const WB_LEFT