28#include <com/sun/star/awt/PosSize.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
30#include <com/sun/star/ui/UIElementType.hpp>
31#include <com/sun/star/container/XNameReplace.hpp>
32#include <com/sun/star/container/XNameContainer.hpp>
33#include <com/sun/star/ui/XUIElementSettings.hpp>
34#include <com/sun/star/ui/XUIFunctionListener.hpp>
57 uno::Reference< uno::XComponentContext > xContext,
58 uno::Reference< ui::XUIElementFactory > xUIElementFactory,
61 m_xUIElementFactoryManager(
std::move( xUIElementFactory )),
62 m_pParentLayouter( pParentLayouter ),
63 m_aDockingArea(0, 0, 0, 0),
64 m_aDockingAreaOffsets(0, 0, 0, 0),
65 m_eDockOperation( DOCKOP_ON_COLROW ),
66 m_ePreviewDetection( PREVIEWFRAME_UNKNOWN ),
67 m_bComponentAttached( false ),
68 m_bLayoutDirty( false ),
69 m_bGlobalSettings( false ),
70 m_bDockingInProgress( false ),
71 m_bLayoutInProgress( false ),
72 m_bToolbarCreation( false )
86 OWeakObject::acquire();
91 OWeakObject::release();
96 uno::Any a = ::cppu::queryInterface( rType,
97 static_cast< awt::XDockableWindowListener*
>(
this),
98 static_cast< ui::XUIConfigurationListener*
>(
this),
99 static_cast< awt::XWindowListener*
>(
this));
104 return OWeakObject::queryInterface( rType );
145 uno::Reference< awt::XWindow > xTopDockAreaWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_TOP)] );
146 uno::Reference< awt::XWindow > xBottomDockAreaWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_BOTTOM)] );
147 uno::Reference< awt::XWindow > xLeftDockAreaWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_LEFT)] );
148 uno::Reference< awt::XWindow > xRightDockAreaWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_RIGHT)] );
151 uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY );
154 awt::Rectangle aRectangle = xContainerWindow->getPosSize();
155 awt::DeviceInfo aInfo = xDevice->getInfo();
156 awt::Size aContainerClientSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset ,
157 aRectangle.Height - aInfo.TopInset - aInfo.BottomInset );
160 sal_Int32 nLeftRightDockingAreaHeight( aContainerClientSize.Height );
161 if ( rBorderSpace.Y >= 0 )
164 xTopDockAreaWindow->setPosSize( 0, 0, aContainerClientSize.Width, rBorderSpace.Y, awt::PosSize::POSSIZE );
165 xTopDockAreaWindow->setVisible(
true );
166 nLeftRightDockingAreaHeight -= rBorderSpace.Y;
169 if ( rBorderSpace.Height >= 0 )
172 sal_Int32 nBottomPos = std::max( sal_Int32( aContainerClientSize.Height - rBorderSpace.Height - aStatusBarHeight + 1 ), sal_Int32( 0 ));
173 sal_Int32 nHeight = ( nBottomPos == 0 ) ? 0 : rBorderSpace.Height;
175 xBottomDockAreaWindow->setPosSize( 0, nBottomPos, aContainerClientSize.Width, nHeight, awt::PosSize::POSSIZE );
176 xBottomDockAreaWindow->setVisible(
true );
177 nLeftRightDockingAreaHeight -= nHeight - 1;
180 nLeftRightDockingAreaHeight -= aStatusBarHeight;
181 if ( rBorderSpace.X >= 0 || nLeftRightDockingAreaHeight > 0 )
185 sal_Int32 nHeight = std::max<sal_Int32>( 0, nLeftRightDockingAreaHeight );
187 xLeftDockAreaWindow->setPosSize( 0, rBorderSpace.Y, rBorderSpace.X, nHeight, awt::PosSize::POSSIZE );
188 xLeftDockAreaWindow->setVisible(
true );
190 if ( rBorderSpace.Width >= 0 || nLeftRightDockingAreaHeight > 0 )
194 sal_Int32 nLeftPos = std::max<sal_Int32>( 0, aContainerClientSize.Width - rBorderSpace.Width );
195 sal_Int32 nHeight = std::max<sal_Int32>( 0, nLeftRightDockingAreaHeight );
196 sal_Int32 nWidth = ( nLeftPos == 0 ) ? 0 : rBorderSpace.Width;
198 xRightDockAreaWindow->setPosSize( nLeftPos, rBorderSpace.Y, nWidth, nHeight, awt::PosSize::POSSIZE );
199 xRightDockAreaWindow->setVisible(
true );
212 if ( bLayoutInProgress )
219 std::vector< SingleRowColumnWindowData > aRowColumnsWindowData;
223 sal_Int32 nOffset( 0 );
224 const sal_uInt32
nCount = aRowColumnsWindowData.size();
225 for ( sal_uInt32 j = 0; j <
nCount; ++j )
229 nOffset += aRowColumnsWindowData[j].nStaticSize;
258 sal_Int32 nCurrRowColumn( 0 );
259 sal_Int32 nCurrPos( 0 );
260 ui::DockingArea nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP );
267 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].clear();
268 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].push_back( 0 );
270 for (
auto const& window : aWindowVector)
272 if ( window.m_xUIElement.is() )
274 uno::Reference< awt::XWindow > xWindow( window.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
275 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
276 if ( xWindow.is() && xDockWindow.is() )
281 if ( pWindow && !xDockWindow->isFloating() && window.m_bVisible && !window.m_bMasterHide )
283 awt::Rectangle aPosSize = xWindow->getPosSize();
284 if ( window.m_aDockedData.m_nDockedArea != nCurrDockingArea )
286 nCurrDockingArea = window.m_aDockedData.m_nDockedArea;
289 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].clear();
290 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].push_back( 0 );
293 if ( window.m_aDockedData.m_nDockedArea == nCurrDockingArea )
297 if ( window.m_aDockedData.m_aPos.Y > nCurrPos )
300 nCurrPos = window.m_aDockedData.m_aPos.Y;
301 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].push_back( 0 );
304 if ( aPosSize.Height > aRowColumnSizes[
static_cast<int>(nCurrDockingArea)][nCurrRowColumn] )
305 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)][nCurrRowColumn] = aPosSize.Height;
309 if ( window.m_aDockedData.m_aPos.X > nCurrPos )
312 nCurrPos = window.m_aDockedData.m_aPos.X;
313 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)].push_back( 0 );
316 if ( aPosSize.Width > aRowColumnSizes[
static_cast<int>(nCurrDockingArea)][nCurrRowColumn] )
317 aRowColumnSizes[
static_cast<int>(nCurrDockingArea)][nCurrRowColumn] = aPosSize.Width;
326 if ( !aWindowVector.empty() )
328 for ( sal_Int32
i = 0;
i <= sal_Int32(ui::DockingArea_DOCKINGAREA_RIGHT);
i++ )
330 sal_Int32 nSize( 0 );
331 const sal_uInt32
nCount = aRowColumnSizes[
i].size();
332 for ( sal_uInt32 j = 0; j <
nCount; j++ )
333 nSize += aRowColumnSizes[
i][j];
335 if (
i == sal_Int32(ui::DockingArea_DOCKINGAREA_TOP) )
336 aBorderSpace.
SetTop( nSize );
337 else if (
i == sal_Int32(ui::DockingArea_DOCKINGAREA_BOTTOM) )
339 else if (
i == sal_Int32(ui::DockingArea_DOCKINGAREA_LEFT) )
364 const uno::Reference< frame::XFrame >& xFrame,
365 const uno::Reference< ui::XUIConfigurationManager >& xModuleCfgMgr,
366 const uno::Reference< ui::XUIConfigurationManager >& xDocCfgMgr,
367 const uno::Reference< container::XNameAccess >& xPersistentWindowState )
409 bool bNotify(
false );
410 bool bMustCallCreate(
false );
411 uno::Reference< ui::XUIElement > xUIElement;
414 if ( aRequestedToolbar.
m_aName != rResourceURL )
416 bMustCallCreate =
true;
417 aRequestedToolbar.
m_aName = rResourceURL;
424 if ( !xUIElement.is() )
425 bMustCallCreate =
true;
429 if ( bCreateOrShowToolbar )
437 bool bNotify(
false );
439 uno::Reference<frame::XFrame>
xFrame;
440 uno::Reference<awt::XWindow2> xContainerWindow;
447 if ( !
xFrame.is() || !xContainerWindow.is() )
453 uno::Reference< ui::XUIElement > xUIElement;
455 uno::Sequence< beans::PropertyValue > aPropSeq{
459 uno::Reference<ui::XUIElementFactory> xUIElementFactory;
468 if ( xUIElementFactory.is() )
469 xUIElement = xUIElementFactory->createUIElement( rResourceURL, aPropSeq );
471 catch (
const container::NoSuchElementException&)
474 catch (
const lang::IllegalArgumentException&)
479 if ( xUIElement.is() )
481 uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
482 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
483 if ( xDockWindow.is() && xWindow.is() )
487 xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(
this) );
488 xWindow->addWindowListener( uno::Reference< awt::XWindowListener >(
this) );
489 xDockWindow->enableDocking(
true );
491 catch (
const uno::Exception&)
497 bool bFloating =
false;
511 uno::Reference<lang::XComponent>
const xC(xUIElement, uno::UNO_QUERY);
515 if (!rElement.
m_aName.isEmpty())
542 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
547 pToolbar->
SetMenuType( nMenuType & ~ToolBoxMenuType::Customize );
549 pToolbar->
SetMenuType( nMenuType | ToolBoxMenuType::Customize );
565 uno::Reference< lang::XComponent > xComponent;
567 bool bNotify(
false );
568 bool bMustBeSorted(
false );
569 bool bMustLayouted(
false );
570 bool bMustBeDestroyed( !
o3tl::starts_with(rResourceURL,
u"private:resource/toolbar/addon_") );
576 if (elem.m_aName == rResourceURL)
578 xComponent.set(elem.m_xUIElement, uno::UNO_QUERY);
579 if (bMustBeDestroyed)
580 elem.m_xUIElement.clear();
582 elem.m_bVisible =
false;
588 uno::Reference< ui::XUIElement > xUIElement( xComponent, uno::UNO_QUERY );
589 if ( xUIElement.is() )
591 uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
592 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
594 if ( bMustBeDestroyed )
599 xWindow->removeWindowListener( uno::Reference< awt::XWindowListener >(
this) );
601 catch (
const uno::Exception&)
607 if ( xDockWindow.is() )
608 xDockWindow->removeDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(
this) );
610 catch (
const uno::Exception&)
617 xWindow->setVisible(
false );
621 if ( !xDockWindow->isFloating() )
622 bMustLayouted =
true;
623 bMustBeSorted =
true;
626 if ( bMustBeDestroyed )
628 if ( xComponent.is() )
629 xComponent->dispose();
653 for (
auto const& elem : aUIElementVector)
655 uno::Reference< lang::XComponent > xComponent( elem.m_xUIElement, uno::UNO_QUERY );
656 if ( xComponent.is() )
657 xComponent->dispose();
680 pWindow->
Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
700 pWindow->
Show(
false );
717 if ( !bAutomaticToolbars )
724 for (
auto const& elem : aUIElementVector)
727 ( elem.m_bVisible != aUIElement.
m_bVisible ) && !elem.m_bMasterHide )
731 if ( rUIElement.
m_aName == elem.m_aName )
746 for (
auto const& elem : aUIElementVector)
749 if ( pWindow && elem.m_bFloating )
753 if ( elem.m_bVisible && !elem.m_bMasterHide )
754 pWindow->
Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
757 pWindow->
Show(
false );
768 for (
auto & elem : aUIElementVector)
770 if (!elem.m_bFloating)
780 bool bSetVisible( elem.m_bVisible &&
bVisible );
785 if ( elem.m_bFloating )
786 pWindow->
Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
804 uno::Reference< awt::XWindow > xWindow( aUIElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
805 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
806 if ( xDockWindow.is() )
808 if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT )
814 if ( !xDockWindow->isFloating() )
822 if ( pWindow && pWindow->
GetType() == WindowType::TOOLBOX )
824 pToolBox =
static_cast<ToolBox *
>(pWindow);
855 if ( xDockWindow->isFloating() )
859 xDockWindow->setFloatingMode(
false );
872 catch (
const lang::DisposedException&)
881 std::vector< OUString > aToolBarNameVector;
887 if (elem.m_aType ==
"toolbar" && elem.m_xUIElement.is() && elem.m_bFloating
889 aToolBarNameVector.push_back(elem.m_aName);
894 const sal_uInt32
nCount = aToolBarNameVector.size();
895 for ( sal_uInt32
i = 0;
i <
nCount; ++
i )
899 bResult &=
dockToolbar( aToolBarNameVector[
i], ui::DockingArea_DOCKINGAREA_DEFAULT, aPoint );
910 auto pWindowEvent =
dynamic_cast< const VclWindowEvent*
>(pEvent);
914 if ( pEvent->
GetId() == VclEventId::ToolboxSelect )
916 OUString aToolbarName;
928 if ( !aToolbarName.isEmpty() && !
aCommand.isEmpty() )
931 ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray;
935 if ( elem.m_xUIElement.is() )
937 uno::Reference< ui::XUIFunctionListener > xListener( elem.m_xUIElement, uno::UNO_QUERY );
938 if ( xListener.is() )
939 aListenerArray.push_back( xListener );
944 const sal_uInt32
nCount = aListenerArray.size();
945 for ( sal_uInt32
i = 0;
i <
nCount; ++
i )
949 aListenerArray[
i]->functionExecute( aToolbarName,
aCommand );
951 catch (
const uno::RuntimeException&)
955 catch (
const uno::Exception&)
961 else if ( pEvent->
GetId() == VclEventId::ToolboxFormatChanged )
969 if ( !aToolbarName.isEmpty() )
971 OUString aToolbarUrl =
"private:resource/toolbar/" + aToolbarName;
988 uno::Reference< awt::XWindow > xTopDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_TOP)] );
989 uno::Reference< awt::XWindow > xLeftDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_LEFT)] );
990 uno::Reference< awt::XWindow > xRightDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_RIGHT)] );
991 uno::Reference< awt::XWindow > xBottomDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_BOTTOM)] );
994 if ( xTopDockingWindow.is() )
995 xTopDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
996 if ( xLeftDockingWindow.is() )
997 xLeftDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
998 if ( xRightDockingWindow.is() )
999 xRightDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
1000 if ( xBottomDockingWindow.is() )
1001 xBottomDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE );
1005 const uno::Reference< awt::XVclWindowPeer >& xParentWindow )
1007 static const char DOCKINGAREASTRING[] =
"dockingarea";
1023 if ( xParentWindow.is() )
1028 pWindow->SetAlign( WindowAlign::Top );
1031 pWindow->SetAlign( WindowAlign::Bottom );
1034 pWindow->SetAlign( WindowAlign::Left );
1037 pWindow->SetAlign( WindowAlign::Right );
1056 OUString aAddonGenericTitle(
FwkResId(STR_TOOLBAR_TITLE_ADDON));
1059 OUString aNumStr = rI18nHelper.
GetNum( nNumber, 0,
false,
false );
1060 aAddonGenericTitle = aAddonGenericTitle.replaceFirst(
"%num%", aNumStr );
1062 return aAddonGenericTitle;
1078 uno::Sequence< uno::Sequence< beans::PropertyValue > > aAddonToolBarData;
1079 uno::Reference< ui::XUIElement > xUIElement;
1083 uno::Sequence< beans::PropertyValue > aPropSeq( 2 );
1084 auto pPropSeq = aPropSeq.getArray();
1085 pPropSeq[0].Name =
"Frame";
1086 pPropSeq[0].Value <<=
xFrame;
1087 pPropSeq[1].Name =
"ConfigurationData";
1088 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
1090 OUString aAddonToolBarName(
"private:resource/toolbar/addon_" +
1093 pPropSeq[1].Value <<= aAddonToolBarData;
1105 xUIElement = xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq );
1106 if ( xUIElement.is() )
1108 uno::Reference< awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
1109 if ( xDockWindow.is() )
1113 xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(
this) );
1114 xDockWindow->enableDocking(
true );
1115 uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY );
1117 xWindow->addWindowListener( uno::Reference< awt::XWindowListener >(
this) );
1119 catch (
const uno::Exception&)
1126 if ( !aElement.
m_aName.isEmpty() )
1134 aElement.
m_aUIName = aGenericAddonTitle;
1141 UIElement aNewToolbar( aAddonToolBarName,
"toolbar", xUIElement );
1147 aNewToolbar.
m_aUIName = aGenericAddonTitle;
1153 uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY );
1159 if ( pWindow->GetText().isEmpty() )
1160 pWindow->SetText( aGenericAddonTitle );
1161 if ( pWindow->GetType() == WindowType::TOOLBOX )
1169 catch (
const container::NoSuchElementException&)
1172 catch (
const lang::IllegalArgumentException&)
1185 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr =
m_xModuleCfgMgr;
1186 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr =
m_xDocCfgMgr;
1195 uno::Sequence< uno::Sequence< beans::PropertyValue > > aTbxSeq;
1196 if ( xDocCfgMgr.is() )
1198 aTbxSeq = xDocCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
1201 if ( xModuleCfgMgr.is() )
1203 aTbxSeq = xModuleCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR );
1221 std::vector< OUString > aMakeVisibleToolbars;
1225 const uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames();
1227 if ( aToolbarNames.hasElements() )
1229 OUString aElementType;
1230 OUString aElementName;
1232 aMakeVisibleToolbars.reserve(aToolbarNames.getLength());
1236 for ( OUString
const &
aName : aToolbarNames )
1243 if ( aElementType.equalsIgnoreAsciiCase(
"toolbar") &&
1244 aElementName.indexOf(
"custom_" ) == -1 )
1255 aMakeVisibleToolbars.push_back(
aName );
1261 catch (
const uno::RuntimeException&)
1265 catch (
const uno::Exception&)
1269 for (
auto const& rURL : aMakeVisibleToolbars)
1277 for (
const uno::Sequence< beans::PropertyValue >& rTbxSeq : aTbxSeqSeq )
1279 OUString aTbxResName;
1281 for (
const beans::PropertyValue& rProp : rTbxSeq )
1283 if ( rProp.Name ==
"ResourceURL" )
1284 rProp.Value >>= aTbxResName;
1285 else if ( rProp.Name ==
"UIName" )
1286 rProp.Value >>= aTbxTitle;
1290 if ( !aTbxResName.isEmpty() && ( aTbxResName.indexOf(
"custom_" ) != -1 ) )
1297 if ( aTbxResName.isEmpty() )
1301 SAL_WARN(
"fwk.uielement",
"ToolbarLayoutManager cannot create custom toolbar");
1303 uno::Reference< ui::XUIElement > xUIElement =
getToolbar( aTbxResName );
1305 if ( !aTitle.isEmpty() && xUIElement.is() )
1327 if ( !pContainerWindow )
1330 for (
auto const& elem : aUIElementVector)
1332 uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
1333 if ( xUIElement.is() )
1335 uno::Reference< awt::XWindow > xWindow;
1340 xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY );
1342 catch (
const uno::RuntimeException&)
1346 catch (
const uno::Exception&)
1354 if ( elem.m_bFloating )
1355 pWindow->SetParent( pContainerWindow );
1358 if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
1359 pWindow->SetParent( pTopDockWindow );
1360 else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
1361 pWindow->SetParent( pBottomDockWindow );
1362 else if ( elem.m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
1363 pWindow->SetParent( pLeftDockWindow );
1365 pWindow->SetParent( pRightDockWindow );
1390 uno::Reference< awt::XWindow2 > xWindow( rDockWindow, uno::UNO_QUERY );
1395 if ( !(rDockWindow.is() && xWindow.is()) )
1403 OUString aText = pWindow->
GetText();
1404 if ( aText.isEmpty() )
1408 if ( pWindow->
GetType() == WindowType::TOOLBOX )
1409 pToolBox =
static_cast<ToolBox *
>(pWindow);
1424 OUString aText = pWindow->
GetText();
1425 if ( aText.isEmpty() )
1430 bool bWriteData(
false );
1434 rDockWindow->setFloatingMode(
true );
1463 xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
1467 if ( bShowElement && pWindow )
1470 pWindow->
Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
1475 bool bSetSize(
false );
1484 rDockWindow->setFloatingMode(
false );
1486 rDockWindow->lock();
1492 awt::Point aDockPos;
1498 xWindow->setPosSize( aPixelPos.
X(), aPixelPos.
Y(), 0, 0, awt::PosSize::POS );
1500 xWindow->setOutputSize(
AWTSize( aSize) );
1505 if ( !bShowElement )
1514 uno::Reference< awt::XWindow > xTopDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_TOP)] );
1515 uno::Reference< awt::XWindow > xLeftDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_LEFT)] );
1516 uno::Reference< awt::XWindow > xRightDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_RIGHT)] );
1517 uno::Reference< awt::XWindow > xBottomDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_BOTTOM)] );
1525 xTopDockingWindow->dispose();
1526 xLeftDockingWindow->dispose();
1527 xRightDockingWindow->dispose();
1528 xBottomDockingWindow->dispose();
1545 bool bPersistent(
false );
1546 uno::Reference< beans::XPropertySet > xPropSet( rElementData.
m_xUIElement, uno::UNO_QUERY );
1547 if ( xPropSet.is() )
1552 xPropSet->getPropertyValue(
"Persistent") >>= bPersistent;
1554 catch (
const beans::UnknownPropertyException&)
1558 catch (
const lang::WrappedTargetException&)
1563 if ( !(bPersistent && xPersistentWindowState.is()) )
1568 uno::Sequence<beans::PropertyValue> aWindowState{
1583 static_cast<sal_uInt16
>(rElementData.
m_nStyle))
1587 if ( xPersistentWindowState->hasByName(
aName ))
1589 uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
1594 uno::Reference< container::XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY );
1598 catch (
const uno::Exception&)
1614 if ( elem.m_aName ==
aName )
1618 return aEmptyElement;
1634 if ( elem.m_xUIElement.is() )
1636 uno::Reference< uno::XInterface > xIfac( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
1637 if ( xIfac == xToolbar )
1650 uno::Reference< awt::XWindow > xWindow;
1655 if ( elem.m_aName ==
aName && elem.m_xUIElement.is() )
1657 xWindow.set( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
1676 bool bFound(
false );
1677 bool bResult(
false );
1709 const sal_Int32 nHotZoneX = 50;
1710 const sal_Int32 nHotZoneY = 50;
1711 const sal_Int32 nCascadeIndentX = 15;
1712 const sal_Int32 nCascadeIndentY = 15;
1716 uno::Reference< awt::XWindow > xTopDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_TOP)] );
1717 uno::Reference< awt::XWindow > xLeftDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_LEFT)] );
1720 awt::Point aStartPos( nCascadeIndentX, nCascadeIndentY );
1721 awt::Point aCurrPos( aStartPos );
1723 if ( xContainerWindow.is() )
1727 if ( pContainerWindow )
1728 aStartPos =
AWTPoint(pContainerWindow->OutputToScreenPixel(
VCLPoint(aStartPos)));
1732 awt::Rectangle aTopRect( xTopDockingWindow->getPosSize() );
1733 awt::Rectangle aLeftRect( xLeftDockingWindow->getPosSize() );
1735 aStartPos.X += aLeftRect.Width + nCascadeIndentX;
1736 aStartPos.Y += aTopRect.Height + nCascadeIndentY;
1737 aCurrPos = aStartPos;
1742 if ( elem.m_xUIElement.is() )
1744 uno::Reference< awt::XDockableWindow > xDockWindow( elem.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
1745 uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY );
1746 if ( xDockWindow.is() && xDockWindow->isFloating() )
1750 if ( pWindow && pWindow->IsVisible() )
1752 awt::Rectangle aFloatRect = xWindow->getPosSize();
1753 if ((( aFloatRect.X - nHotZoneX ) <= aCurrPos.X ) &&
1754 ( aFloatRect.X >= aCurrPos.X ) &&
1755 (( aFloatRect.Y - nHotZoneY ) <= aCurrPos.Y ) &&
1756 ( aFloatRect.Y >= aCurrPos.Y ))
1758 aCurrPos.X = aFloatRect.X + nCascadeIndentX;
1759 aCurrPos.Y = aFloatRect.Y + nCascadeIndentY;
1777 elem.m_bUserActive =
false;
1789 uno::Reference< awt::XWindow > xTopDockingAreaWindow;
1790 uno::Reference< awt::XWindow > xBottomDockingAreaWindow;
1798 if ( xTopDockingAreaWindow.is() )
1799 aSize.
setWidth( xTopDockingAreaWindow->getPosSize().Height );
1800 if ( xBottomDockingAreaWindow.is() )
1801 aSize.
setHeight( xBottomDockingAreaWindow->getPosSize().Height );
1808 std::vector< UIElement > aWindowVector;
1810 if (( eDockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
1811 eDockingArea = ui::DockingArea_DOCKINGAREA_TOP;
1813 uno::Reference< awt::XWindow > xDockAreaWindow;
1822 if (elem.m_aDockedData.m_nDockedArea == eDockingArea && elem.m_bVisible)
1824 uno::Reference<ui::XUIElement> xUIElement(elem.m_xUIElement);
1825 if (xUIElement.is())
1827 uno::Reference<awt::XWindow> xWindow(xUIElement->getRealInterface(),
1829 uno::Reference<awt::XDockableWindow> xDockWindow(xWindow, uno::UNO_QUERY);
1830 if (xDockWindow.is())
1832 if (!elem.m_bFloating)
1835 aWindowVector.push_back(elem);
1842 if (pDockMgr !=
nullptr)
1845 if (pFloatingWindow)
1850 awt::Rectangle aTmpRect = xWindow->getPosSize();
1853 = awt::Point(aTmpRect.X, aTmpRect.Y);
1867 rRowColumnsWindowData.clear();
1872 sal_Int32 nLastPos( 0 );
1873 sal_Int32 nCurrPos( -1 );
1874 sal_Int32 nLastRowColPixelPos( 0 );
1875 awt::Rectangle aDockAreaRect;
1877 if ( xDockAreaWindow.is() )
1878 aDockAreaRect = xDockAreaWindow->getPosSize();
1880 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP )
1881 nLastRowColPixelPos = 0;
1882 else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
1883 nLastRowColPixelPos = aDockAreaRect.Height;
1884 else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
1885 nLastRowColPixelPos = 0;
1887 nLastRowColPixelPos = aDockAreaRect.Width;
1889 const sal_uInt32
nCount = aWindowVector.size();
1890 for ( j = 0; j < sal_Int32(
nCount); j++ )
1892 const UIElement& rElement = aWindowVector[j];
1893 uno::Reference< awt::XWindow > xWindow;
1894 uno::Reference< ui::XUIElement > xUIElement( rElement.
m_xUIElement );
1895 awt::Rectangle aPosSize;
1901 if ( nCurrPos == -1 )
1908 rRowColumnsWindowData.push_back( aRowColumnWindowData );
1911 sal_Int32 nSpace( 0 );
1914 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP )
1915 nLastRowColPixelPos += rRowColumnsWindowData[
nIndex].nStaticSize;
1917 nLastRowColPixelPos -= rRowColumnsWindowData[
nIndex].nStaticSize;
1923 rRowColumnsWindowData.push_back( aRowColumnWindowData );
1930 rRowColumnsWindowData[
nIndex].nSpace += nSpace;
1936 nLastPos += aPosSize.Width;
1938 rRowColumnsWindowData[
nIndex].aRowColumnSpace.push_back( nSpace );
1940 rRowColumnsWindowData[
nIndex].aRowColumnWindows.push_back( xWindow );
1941 rRowColumnsWindowData[
nIndex].aUIElementNames.push_back( rElement.
m_aName );
1942 rRowColumnsWindowData[
nIndex].aRowColumnWindowSizes.emplace_back(
1947 if ( rRowColumnsWindowData[
nIndex].nStaticSize < aPosSize.Height )
1948 rRowColumnsWindowData[
nIndex].nStaticSize = aPosSize.Height;
1949 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP )
1950 rRowColumnsWindowData[
nIndex].aRowColumnRect = awt::Rectangle( 0, nLastRowColPixelPos,
1951 aDockAreaRect.Width, aPosSize.Height );
1953 rRowColumnsWindowData[
nIndex].aRowColumnRect = awt::Rectangle( 0, ( nLastRowColPixelPos - aPosSize.Height ),
1954 aDockAreaRect.Width, aPosSize.Height );
1955 rRowColumnsWindowData[
nIndex].nVarSize += aPosSize.Width + nSpace;
1959 if ( nCurrPos == -1 )
1966 rRowColumnsWindowData.push_back( aRowColumnWindowData );
1969 sal_Int32 nSpace( 0 );
1972 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
1973 nLastRowColPixelPos += rRowColumnsWindowData[
nIndex].nStaticSize;
1975 nLastRowColPixelPos -= rRowColumnsWindowData[
nIndex].nStaticSize;
1981 rRowColumnsWindowData.push_back( aRowColumnWindowData );
1988 rRowColumnsWindowData[
nIndex].nSpace += nSpace;
1994 nLastPos += aPosSize.Height;
1996 rRowColumnsWindowData[
nIndex].aRowColumnSpace.push_back( nSpace );
1998 rRowColumnsWindowData[
nIndex].aRowColumnWindows.push_back( xWindow );
1999 rRowColumnsWindowData[
nIndex].aUIElementNames.push_back( rElement.
m_aName );
2000 rRowColumnsWindowData[
nIndex].aRowColumnWindowSizes.emplace_back(
2005 if ( rRowColumnsWindowData[
nIndex].nStaticSize < aPosSize.Width )
2006 rRowColumnsWindowData[
nIndex].nStaticSize = aPosSize.Width;
2007 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
2008 rRowColumnsWindowData[
nIndex].aRowColumnRect = awt::Rectangle( nLastRowColPixelPos, 0,
2009 aPosSize.Width, aDockAreaRect.Height );
2011 rRowColumnsWindowData[
nIndex].aRowColumnRect = awt::Rectangle( ( nLastRowColPixelPos - aPosSize.Width ), 0,
2012 aPosSize.Width, aDockAreaRect.Height );
2013 rRowColumnsWindowData[
nIndex].nVarSize += aPosSize.Height + nSpace;
2020 std::vector< UIElement > aWindowVector;
2022 if (( eDockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
2023 eDockingArea = ui::DockingArea_DOCKINGAREA_TOP;
2032 if (elem.m_aDockedData.m_nDockedArea == eDockingArea)
2034 bool bSameRowCol = bHorzDockArea ? (elem.m_aDockedData.m_aPos.Y == nRowCol)
2035 : (elem.m_aDockedData.m_aPos.X == nRowCol);
2036 uno::Reference<ui::XUIElement> xUIElement(elem.m_xUIElement);
2038 if (bSameRowCol && xUIElement.is())
2040 uno::Reference<awt::XWindow> xWindow(xUIElement->getRealInterface(),
2046 uno::Reference<awt::XDockableWindow> xDockWindow(xWindow, uno::UNO_QUERY);
2047 if (pWindow && elem.m_bVisible && xDockWindow.is() && !elem.m_bFloating)
2048 aWindowVector.push_back(elem);
2063 rRowColumnWindowData.
nSpace = 0;
2068 sal_Int32 nLastPos( 0 );
2070 const sal_uInt32
nCount = aWindowVector.size();
2071 for ( j = 0; j < sal_Int32(
nCount); j++ )
2073 const UIElement& rElement = aWindowVector[j];
2074 uno::Reference< awt::XWindow > xWindow;
2075 uno::Reference< ui::XUIElement > xUIElement( rElement.
m_xUIElement );
2076 awt::Rectangle aPosSize;
2087 rRowColumnWindowData.
nSpace += nSpace;
2095 aPosSize.Width, aPosSize.Height );
2096 if ( rRowColumnWindowData.
nStaticSize < aPosSize.Height )
2097 rRowColumnWindowData.
nStaticSize = aPosSize.Height;
2098 rRowColumnWindowData.
nVarSize += aPosSize.Width;
2105 rRowColumnWindowData.
nSpace += nSpace;
2113 aPosSize.Width, aPosSize.Height );
2114 if ( rRowColumnWindowData.
nStaticSize < aPosSize.Width )
2115 rRowColumnWindowData.
nStaticSize = aPosSize.Width;
2116 rRowColumnWindowData.
nVarSize += aPosSize.Height;
2122 rRowColumnWindowData.
nVarSize += nSpace;
2127 ui::DockingArea DockingArea,
2129 const ::Point& rMousePos,
2130 std::u16string_view rExcludeElementName )
2134 if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
2135 DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
2150 if ( pDockingAreaWindow && pContainerWindow )
2153 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
2155 awt::Rectangle aWindowRect = rRowColumnWindowData.
aRowColumnWindows[
i]->getPosSize();
2156 ::tools::Rectangle aRect( aWindowRect.X, aWindowRect.Y, aWindowRect.X+aWindowRect.Width, aWindowRect.Y+aWindowRect.Height );
2157 aRect.
SetPos( pContainerWindow->ScreenToOutputPixel( pDockingAreaWindow->OutputToScreenPixel( aRect.
TopLeft() )));
2175 ui::DockingArea eDockingArea,
2177 const ::tools::Rectangle& rDockedElementRect,
2178 std::u16string_view rMovedElementName,
2179 const ::tools::Rectangle& rMovedElementRect )
2186 return rMovedElementRect;
2189 sal_Int32 nSpace( 0 );
2192 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
2194 if ( bHorzDockArea )
2224 sal_Int32 nMove = std::min( nSpace,
static_cast<sal_Int32
>(aFrontDockingRect.
getOpenWidth()) );
2225 if ( bHorzDockArea )
2226 aFrontDockingRect.
Move( -nMove, 0 );
2228 aFrontDockingRect.
Move( 0, -nMove );
2231 return aFrontDockingRect;
2238 if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT ))
2239 DockingArea = ui::DockingArea_DOCKINGAREA_TOP;
2240 uno::Reference< awt::XWindow > xDockingWindow(
m_xDockAreaWindows[
static_cast<int>(DockingArea)] );
2245 if ( pDockingWindow )
2249 sal_Int32 nFreeRowColPixelPos( 0 );
2250 sal_Int32 nMaxSpace( 0 );
2251 sal_Int32 nNeededSpace( 0 );
2252 sal_Int32 nTopDockingAreaSize( 0 );
2256 nMaxSpace = aDockingWinSize.
Width();
2257 nNeededSpace = aUIElementSize.Width();
2261 nMaxSpace = aDockingWinSize.
Height();
2262 nNeededSpace = aUIElementSize.Height();
2266 std::vector< SingleRowColumnWindowData > aRowColumnsWindowData;
2269 sal_Int32 nPixelPos( 0 );
2270 const sal_uInt32
nCount = aRowColumnsWindowData.size();
2271 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
2275 if (( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) ||
2276 ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT ))
2279 if ((( nMaxSpace - rRowColumnWindowData.
nVarSize ) >= nNeededSpace ) ||
2280 ( rRowColumnWindowData.
nSpace >= nNeededSpace ))
2283 sal_Int32 nCurrPos( 0 );
2285 for ( sal_uInt32 j = 0; j < nWindowSizesCount; j++ )
2291 if ( rSpace >= nNeededSpace )
2293 rVirtualPos = awt::Point( nCurrPos, rRowColumnWindowData.
nRowColumn );
2294 if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP )
2295 rPixelPos =
::Point( nCurrPos, nPixelPos );
2297 rPixelPos =
::Point( nCurrPos, aDockingWinSize.
Height() - nPixelPos );
2300 nCurrPos = rRect.X + rRect.Width;
2304 if ( rSpace >= nNeededSpace )
2306 rVirtualPos = awt::Point( rRowColumnWindowData.
nRowColumn, nCurrPos );
2307 if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
2308 rPixelPos =
::Point( nPixelPos, nTopDockingAreaSize + nCurrPos );
2310 rPixelPos =
::Point( aDockingWinSize.
Width() - nPixelPos , nTopDockingAreaSize + nCurrPos );
2313 nCurrPos = rRect.Y + rRect.Height;
2317 if (( nCurrPos + nNeededSpace ) <= nMaxSpace )
2321 rVirtualPos = awt::Point( nCurrPos, rRowColumnWindowData.
nRowColumn );
2322 if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP )
2323 rPixelPos =
::Point( nCurrPos, nPixelPos );
2325 rPixelPos =
::Point( nCurrPos, aDockingWinSize.
Height() - nPixelPos );
2330 rVirtualPos = awt::Point( rRowColumnWindowData.
nRowColumn, nCurrPos );
2331 if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
2332 rPixelPos =
::Point( nPixelPos, nTopDockingAreaSize + nCurrPos );
2334 rPixelPos =
::Point( aDockingWinSize.
Width() - nPixelPos , nTopDockingAreaSize + nCurrPos );
2340 if (( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ))
2344 sal_Int32 nNextFreeRowCol( 0 );
2345 sal_Int32 nRowColumnsCount = aRowColumnsWindowData.size();
2346 if ( nRowColumnsCount > 0 )
2347 nNextFreeRowCol = aRowColumnsWindowData[nRowColumnsCount-1].nRowColumn+1;
2349 nNextFreeRowCol = 0;
2351 if ( nNextFreeRowCol == 0 )
2353 if ( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
2354 nFreeRowColPixelPos = aDockingWinSize.
Height() - aUIElementSize.Height();
2355 else if ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT )
2356 nFreeRowColPixelPos = aDockingWinSize.
Width() - aUIElementSize.Width();
2361 rVirtualPos = awt::Point( 0, nNextFreeRowCol );
2362 if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP )
2363 rPixelPos =
::Point( 0, nFreeRowColPixelPos );
2365 rPixelPos =
::Point( 0, aDockingWinSize.
Height() - nFreeRowColPixelPos );
2369 rVirtualPos = awt::Point( nNextFreeRowCol, 0 );
2370 rPixelPos =
::Point( aDockingWinSize.
Width() - nFreeRowColPixelPos, 0 );
2375 sal_Int32 nDockingArea,
2378 const ::Size& rContainerSize )
2381 sal_Int32 nRCSpace( rRowColumnWindowData.
nSpace );
2382 sal_Int32 nContainerClientSize(0);
2389 nContainerClientSize = rContainerSize.Width();
2390 nDiff = nContainerClientSize - rRowColumnWindowData.
nVarSize;
2396 nContainerClientSize = ( rContainerSize.Height() - nTopDockingAreaSize - nBottomDockingAreaSize );
2397 nDiff = nContainerClientSize - rRowColumnWindowData.
nVarSize;
2401 if (( nDiff < 0 ) && ( nRCSpace > 0 ))
2408 if ( nSpace >= -nDiff )
2413 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2419 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2426 else if ( nSpace > 0 )
2431 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2437 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2450 sal_Int32
i = sal_Int32(
nCount - 1 );
2460 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
2461 aMinSize =
static_cast<ToolBox *
>(pWindow.
get())->CalcMinimumWindowSizePixel();
2468 sal_Int32 nMaxReducation = rWinRect.Width - aMinSize.
Width();
2469 if ( nMaxReducation >= -nDiff )
2471 rWinRect.Width = rWinRect.Width + nDiff;
2476 rWinRect.Width = aMinSize.
Width();
2477 nDiff += nMaxReducation;
2481 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2486 sal_Int32 nMaxReducation = rWinRect.Height - aMinSize.
Height();
2487 if ( nMaxReducation >= -nDiff )
2489 rWinRect.Height = rWinRect.Height + nDiff;
2494 rWinRect.Height = aMinSize.
Height();
2495 nDiff += nMaxReducation;
2499 for ( sal_uInt32 j =
i; j <
nCount; j++ )
2515 sal_Int32 nCurrPos( 0 );
2518 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
2522 vcl::Window* pOldParentWindow = pWindow->GetParent();
2524 if ( pDockAreaWindow != pOldParentWindow )
2525 pWindow->SetParent( pDockAreaWindow );
2530 if ( aWinRect.X < nCurrPos )
2531 aWinRect.X = nCurrPos;
2532 pWindow->SetPosSizePixel(
::Point( aWinRect.X, nOffset ),
::Size( aWinRect.Width, rRowColumnWindowData.
nStaticSize ));
2533 pWindow->Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
2534 nCurrPos += ( aWinRect.X - nCurrPos ) + aWinRect.Width;
2538 if ( aWinRect.Y < nCurrPos )
2539 aWinRect.Y = nCurrPos;
2540 pWindow->SetPosSizePixel(
::Point( nOffset, aWinRect.Y ),
::Size( rRowColumnWindowData.
nStaticSize, aWinRect.Height ));
2541 pWindow->Show(
true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
2542 nCurrPos += ( aWinRect.Y - nCurrPos ) + aWinRect.Height;
2575 const Point& rMousePos )
2579 ::Size aContainerWinSize;
2598 uno::Reference< awt::XWindow > xWindow( rUIElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
2599 uno::Reference< awt::XWindow > xDockingAreaWindow;
2604 bool bHorizontalDockArea(( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) ||
2605 ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ));
2606 sal_Int32 nMaxLeftRightDockAreaSize = aContainerWinSize.
Height() -
2607 nTopDockingAreaSize -
2608 nBottomDockingAreaSize -
2609 aDockingAreaOffsets.
Top() -
2610 aDockingAreaOffsets.
Bottom();
2622 if ( pDockWindow && pDockWindow->GetType() == WindowType::TOOLBOX )
2623 pToolBox =
static_cast<ToolBox *
>(pDockWindow.
get());
2635 bool bOpOutsideOfDockingArea( !aDockingAreaRect.
Contains( rMousePos ));
2637 std::vector< SingleRowColumnWindowData > aRowColumnsWindowData;
2643 sal_Int32 nMaxRowCol( -1 );
2645 const sal_uInt32
nCount = aRowColumnsWindowData.size();
2646 for ( sal_uInt32
i = 0;
i <
nCount;
i++ )
2648 if ( aRowColumnsWindowData[
i].nRowColumn > nMaxRowCol )
2649 nMaxRowCol = aRowColumnsWindowData[
i].nRowColumn;
2650 if ( aRowColumnsWindowData[
i].nRowColumn < nMinRowCol )
2651 nMinRowCol = aRowColumnsWindowData[
i].nRowColumn;
2654 if ( !bOpOutsideOfDockingArea )
2658 sal_Int32 nRowCol( -1 );
2662 const sal_uInt32 nWindowDataCount = aRowColumnsWindowData.size();
2663 for ( sal_uInt32
i = 0;
i < nWindowDataCount;
i++ )
2666 aRowColumnsWindowData[
i].aRowColumnRect.Y,
2667 aRowColumnsWindowData[
i].aRowColumnRect.X + aRowColumnsWindowData[
i].aRowColumnRect.Width,
2668 aRowColumnsWindowData[
i].aRowColumnRect.Y + aRowColumnsWindowData[
i].aRowColumnRect.Height );
2676 bool bIsInsideRowCol( aRect.
Contains( rMousePos ) );
2677 if ( bIsInsideRowCol )
2680 nRowCol = aRowColumnsWindowData[
i].nRowColumn;
2683 aRowColumnRect = aRect;
2688 OSL_ENSURE( (
nIndex >= 0 ) && ( nRowCol >= 0 ),
"Impossible case - no row/column found but mouse pointer is inside our docking area" );
2689 if ((
nIndex >= 0 ) && ( nRowCol >= 0 ))
2699 sal_Int32 nMiddle( bHorizontalDockArea ? ( aWindowRect.
Left() + aWindowRect.
getOpenWidth() / 2 ) :
2701 bool bInsertBefore( bHorizontalDockArea ? ( rMousePos.
X() < nMiddle ) : ( rMousePos.
Y() < nMiddle ));
2702 if ( bInsertBefore )
2704 if ( bHorizontalDockArea )
2706 sal_Int32 nSize = std::clamp( sal_Int32(aContainerWinSize.
Width() - aWindowRect.
Left()),
2707 sal_Int32(0), sal_Int32(aTrackingRect.
getOpenWidth()) );
2720 sal_Int32 nSize = std::clamp( sal_Int32(nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.
Top()),
2735 rTrackingRect = aWindowRect;
2740 if ( bHorizontalDockArea )
2742 sal_Int32 nSize = ::std::clamp( sal_Int32(aContainerWinSize.
Width() - aWindowRect.
Right()),
2743 sal_Int32(0), sal_Int32(aTrackingRect.
getOpenWidth()) );
2763 sal_Int32 nSize = std::clamp( sal_Int32(nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.
Bottom()),
2769 sal_Int32 nPosY( 0 );
2779 rTrackingRect = aUIElementRect;
2787 eDockedArea, nRowCol, rUIElement,
2788 aTrackingRect, aRowColumnRect, aContainerWinSize );
2796 bOpOutsideOfDockingArea =
true;
2802 eDockedArea, nRowCol, rUIElement,
2803 aTrackingRect, aRowColumnRect, aContainerWinSize );
2805 sal_Int32 nOffsetX( 0 );
2806 sal_Int32 nOffsetY( 0 );
2807 if ( bHorizontalDockArea )
2808 nOffsetY = sal_Int32( floor( aRowColumnRect.
getOpenHeight() / 2.0 + 0.5 ));
2810 nOffsetX = sal_Int32( floor( aRowColumnRect.
getOpenWidth() / 2.0 + 0.5 ));
2814 if (( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ))
2825 if (( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) || ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT ))
2836 if ( bHorizontalDockArea )
2841 rTrackingRect.
Move( nOffsetX, nOffsetY );
2850 if ( !bOpOutsideOfDockingArea )
2855 rTrackingRect = aTrackingRect;
2857 if ( bHorizontalDockArea )
2859 sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.
Left()), sal_Int32( 0 )));
2861 nPosX = std::min( nPosX,
2862 std::max( sal_Int32( aContainerWinSize.
Width() - rTrackingRect.
getOpenWidth() ),
2865 sal_Int32 nSize = std::min( aContainerWinSize.
Width(), rTrackingRect.
getOpenWidth() );
2866 sal_Int32 nDockHeight = std::max(
static_cast<sal_Int32
>(aDockingAreaRect.
getOpenHeight()), sal_Int32( 0 ));
2867 if ( nDockHeight == 0 )
2869 sal_Int32 nPosY( std::max( aDockingAreaRect.
Top(), aDockingAreaRect.
Bottom() ));
2870 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
2875 else if ( rMousePos.
Y() < ( aDockingAreaRect.
Top() + ( nDockHeight / 2 )))
2878 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
2887 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP )
2904 sal_Int32 nMaxDockingAreaHeight = std::max<sal_Int32>( 0, nMaxLeftRightDockAreaSize );
2905 sal_Int32 nPosY( std::max<sal_Int32>( aTrackingRect.
Top(), nTopDockingAreaSize ));
2906 if (( nPosY + aTrackingRect.
getOpenHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight ))
2907 nPosY = std::min( nPosY,
2908 std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.
getOpenHeight() ),
2909 nTopDockingAreaSize ));
2911 sal_Int32 nSize = std::min( nMaxDockingAreaHeight,
static_cast<sal_Int32
>(aTrackingRect.
getOpenHeight()) );
2912 sal_Int32 nDockWidth = std::max(
static_cast<sal_Int32
>(aDockingAreaRect.
getOpenWidth()), sal_Int32( 0 ));
2913 if ( nDockWidth == 0 )
2915 sal_Int32 nPosX( std::max( aDockingAreaRect.
Left(), aDockingAreaRect.
Right() ));
2916 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT )
2921 else if ( rMousePos.
X() < ( aDockingAreaRect.
Left() + ( nDockWidth / 2 )))
2924 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
2933 if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )
2951 ui::DockingArea DockingArea,
2952 const ::tools::Rectangle& rRowColRect,
2953 const Point& rMousePos )
2955 constexpr sal_Int32 nHorzVerticalRegionSize = 6;
2956 constexpr sal_Int32 nHorzVerticalMoveRegion = 4;
2958 if ( rRowColRect.Contains( rMousePos ))
2962 sal_Int32 nRegion = rRowColRect.getOpenHeight() / nHorzVerticalRegionSize;
2963 sal_Int32 nPosY = rRowColRect.Top() + nRegion;
2965 if ( rMousePos.
Y() < nPosY )
2967 else if ( rMousePos.
Y() < ( nPosY + nRegion*nHorzVerticalMoveRegion ))
2974 sal_Int32 nRegion = rRowColRect.getOpenWidth() / nHorzVerticalRegionSize;
2975 sal_Int32 nPosX = rRowColRect.Left() + nRegion;
2977 if ( rMousePos.
X() < nPosX )
2979 else if ( rMousePos.
X() < ( nPosX + nRegion*nHorzVerticalMoveRegion ))
2990 ui::DockingArea eDockingArea,
2993 const ::tools::Rectangle& rTrackingRect,
2994 const ::tools::Rectangle& rRowColumnRect,
2995 const ::Size& rContainerWinSize )
3006 sal_Int32 nMaxLeftRightDockAreaSize = rContainerWinSize.Height() -
3007 nTopDockingAreaSize -
3008 nBottomDockingAreaSize -
3009 aDockingAreaOffsets.
Top() -
3010 aDockingAreaOffsets.
Bottom();
3013 if ( bHorizontalDockArea )
3015 sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 )));
3016 if (( nPosX + rTrackingRect.getOpenWidth()) > rContainerWinSize.Width() )
3017 nPosX = std::min( nPosX,
3018 std::max( sal_Int32( rContainerWinSize.Width() - rTrackingRect.getOpenWidth() ),
3021 sal_Int32 nSize = std::min( rContainerWinSize.Width(), rTrackingRect.getOpenWidth() );
3023 aTrackingRect.
SetPos(
::Point( nPosX, rRowColumnRect.Top() ));
3025 aTrackingRect.
setHeight( rRowColumnRect.getOpenHeight() );
3033 sal_Int32 nMaxDockingAreaHeight = std::max<sal_Int32>( 0, nMaxLeftRightDockAreaSize );
3035 sal_Int32 nPosY( std::max<sal_Int32>( aTrackingRect.
Top(), nTopDockingAreaSize ));
3036 if (( nPosY + aTrackingRect.
getOpenHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight ))
3037 nPosY = std::min( nPosY,
3038 std::max<sal_Int32>( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.
getOpenHeight() ),
3039 nTopDockingAreaSize ));
3041 sal_Int32 nSize = std::min( nMaxDockingAreaHeight,
static_cast<sal_Int32
>(aTrackingRect.
getOpenHeight()) );
3043 aTrackingRect.
SetPos(
::Point( rRowColumnRect.Left(), nPosY ));
3044 aTrackingRect.
setWidth( rRowColumnRect.getOpenWidth() );
3048 uno::Reference< awt::XWindow > xDockingAreaWindow(
m_xDockAreaWindows[
static_cast<int>(eDockingArea)] );
3052 sal_Int32 nDockPosY( 0 );
3065 return aTrackingRect;
3072 aPoint.
setX( rMousePos.X() );
3074 aPoint.
setY( rMousePos.Y() );
3075 rTrackingRect.
SetPos( aPoint );
3079 ui::DockingArea eDockingArea,
3094 if ((elem.m_aDockedData.m_nDockedArea == eDockingArea)
3095 && (elem.m_aName != rUIElement.
m_aName))
3101 sal_Int32 nWindowRowCol
3102 = bHorzDockingArea ? elem.m_aDockedData.m_aPos.Y : elem.m_aDockedData.m_aPos.X;
3103 if (nWindowRowCol >= nRowCol)
3105 if (bHorzDockingArea)
3106 elem.m_aDockedData.m_aPos.Y += 1;
3108 elem.m_aDockedData.m_aPos.X += 1;
3116 if ( !xPersistentWindowState.is() )
3121 const uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames();
3122 for ( OUString
const & rWindowElementName : aWindowElements )
3124 if ( rUIElement.
m_aName != rWindowElementName )
3128 uno::Sequence< beans::PropertyValue > aPropValueSeq;
3129 awt::Point aDockedPos;
3130 ui::DockingArea nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT );
3132 xPersistentWindowState->getByName( rWindowElementName ) >>= aPropValueSeq;
3133 for ( beans::PropertyValue
const & rProp : std::as_const(aPropValueSeq) )
3136 rProp.Value >>= nDockedArea;
3138 rProp.Value >>= aDockedPos;
3145 sal_Int32 nWindowRowCol = bHorzDockingArea ? aDockedPos.Y : aDockedPos.X;
3146 if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol ))
3148 if ( bHorzDockingArea )
3153 uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
3154 xReplace->replaceByName( rWindowElementName, css::uno::Any( aPropValueSeq ));
3157 catch (
const uno::Exception&)
3163 catch (
const uno::Exception&)
3181 if ( bLocked || bLayoutInProgress )
3184 bool bNotify(
false );
3185 uno::Reference< awt::XWindow > xWindow(
aEvent.Source, uno::UNO_QUERY );
3192 uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
3196 awt::Rectangle aPos = xWindow2->getPosSize();
3197 awt::Size aSize = xWindow2->getOutputSize();
3198 bool bVisible = xWindow2->isVisible();
3235 bool bWinFound(
false );
3238 uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY );
3246 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
3247 if ( xDockWindow->isFloating() )
3249 awt::Rectangle aPos = xWindow->getPosSize();
3250 awt::Size aSize = xWindow->getOutputSize();
3258 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
3275 constexpr sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25;
3276 constexpr sal_Int32 MAGNETIC_DISTANCE_DOCK = 20;
3279 awt::DockingData aDockingData;
3280 uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY );
3281 uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY );
3282 uno::Reference< awt::XWindow > xTopDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_TOP)] );
3283 uno::Reference< awt::XWindow > xLeftDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_LEFT)] );
3284 uno::Reference< awt::XWindow > xRightDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_RIGHT)] );
3285 uno::Reference< awt::XWindow > xBottomDockingWindow(
m_xDockAreaWindows[
int(ui::DockingArea_DOCKINGAREA_BOTTOM)] );
3292 if ( bDockingInProgress )
3293 aDockingData.TrackingRectangle = e.TrackingRectangle;
3295 if ( bDockingInProgress && xDockWindow.is() && xWindow.is() )
3302 ui::DockingArea eDockingArea( ui::DockingArea(-1) );
3303 sal_Int32 nMagneticZone( aUIDockingElement.
m_bFloating ? MAGNETIC_DISTANCE_DOCK : MAGNETIC_DISTANCE_UNDOCK );
3305 ( e.TrackingRectangle.X + e.TrackingRectangle.Width ),
3306 ( e.TrackingRectangle.Y + e.TrackingRectangle.Height ));
3308 awt::Rectangle aTmpRect = xTopDockingWindow->getPosSize();
3309 ::tools::Rectangle aTopDockRect( aTmpRect.X, aTmpRect.Y, aTmpRect.Width, aTmpRect.Height );
3312 aTmpRect = xBottomDockingWindow->getPosSize();
3313 ::tools::Rectangle aBottomDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width), ( aTmpRect.Y + aTmpRect.Height ));
3316 aTmpRect = xLeftDockingWindow->getPosSize();
3317 ::tools::Rectangle aLeftDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height ));
3320 aTmpRect = xRightDockingWindow->getPosSize();
3321 ::tools::Rectangle aRightDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height ));
3325 ::Point aMousePos( pContainerWindow->ScreenToOutputPixel(
::Point( e.MousePos.X, e.MousePos.Y )));
3327 if ( aHotZoneTopDockRect.
Contains( aMousePos ))
3328 eDockingArea = ui::DockingArea_DOCKINGAREA_TOP;
3329 else if ( aHotZoneBottomDockRect.
Contains( aMousePos ))
3330 eDockingArea = ui::DockingArea_DOCKINGAREA_BOTTOM;
3331 else if ( aHotZoneLeftDockRect.
Contains( aMousePos ))
3332 eDockingArea = ui::DockingArea_DOCKINGAREA_LEFT;
3333 else if ( aHotZoneRightDockRect.
Contains( aMousePos ))
3334 eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT;
3337 if ( aTopDockRect.
Contains( aMousePos ))
3338 eDockingArea = ui::DockingArea_DOCKINGAREA_TOP;
3339 else if ( aBottomDockRect.
Contains( aMousePos ))
3340 eDockingArea = ui::DockingArea_DOCKINGAREA_BOTTOM;
3341 else if ( aLeftDockRect.
Contains( aMousePos ))
3342 eDockingArea = ui::DockingArea_DOCKINGAREA_LEFT;
3343 else if ( aRightDockRect.
Contains( aMousePos ))
3344 eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT;
3349 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
3350 pToolBox =
static_cast<ToolBox *
>(pWindow.
get());
3352 if ( eDockingArea != ui::DockingArea(-1) )
3354 if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP )
3359 else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )
3364 else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT )
3369 else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_RIGHT )
3375 ::Point aOutputPos = pContainerWindow->ScreenToOutputPixel( aTrackingRect.
TopLeft() );
3376 aTrackingRect.
SetPos( aOutputPos );
3382 ::Point aScreenPos = pContainerWindow->OutputToScreenPixel( aNewDockingRect.
TopLeft() );
3383 aDockingData.TrackingRectangle = awt::Rectangle( aScreenPos.
X(), aScreenPos.
Y(),
3390 if ( aFloatSize.Width > 0 && aFloatSize.Height > 0 )
3393 aDockingData.TrackingRectangle.Height = aFloatSize.Height;
3394 aDockingData.TrackingRectangle.Width = aFloatSize.Width;
3399 if ( !bIsHorizontal )
3403 sal_Int32 nTemp = aFloatSize.Height;
3404 aFloatSize.Height = aFloatSize.Width;
3405 aFloatSize.Width = nTemp;
3408 aDockingData.TrackingRectangle.Height = aFloatSize.Height;
3409 aDockingData.TrackingRectangle.Width = aFloatSize.Width;
3418 aDockingData.TrackingRectangle.X = e.MousePos.X;
3419 aDockingData.TrackingRectangle.Y = e.MousePos.Y;
3422 aDockingData.bFloating = ( eDockingArea == ui::DockingArea(-1) );
3427 if ( !aDockingData.bFloating )
3436 catch (
const uno::Exception&)
3441 return aDockingData;
3449 bool bDockingInProgress(
false );
3450 bool bStartDockFloated(
false );
3451 bool bFloating(
false );
3466 uno::Reference< awt::XWindow > xWindow( aUIDockingElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
3468 awt::Rectangle aTmpRect = xWindow->getPosSize();
3498 if ( bDockingInProgress )
3503 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
3504 pToolBox =
static_cast<ToolBox *
>(pWindow.
get());
3513 pToolBox->
SetAlign( WindowAlign::Left );
3549 bool bWinFound( !aUIDockingElement.
m_aName.isEmpty() );
3550 uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY );
3552 if ( !bWinFound || !xWindow.is() )
3555 if ( bDockingInProgress )
3558 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
3559 if ( !xDockWindow->isFloating() )
3565 if ( pWindow && pWindow->GetType() == WindowType::TOOLBOX )
3588 if ( bDockingInProgress )
3594 uno::Reference< awt::XWindow2 > xWindow;
3598 xWindow.set( e.Source, uno::UNO_QUERY );
3601 if ( pWindow && pWindow->
GetType() == WindowType::TOOLBOX )
3602 pToolBox =
static_cast<ToolBox *
>(pWindow);
3605 if ( !bDockingInProgress )
3608 bool bWinFound = !aUIDockingElement.
m_aName.isEmpty();
3610 if ( bWinFound && xWindow.is() )
3625 pToolBox->
SetAlign( WindowAlign::Left );
3644 0, 0, awt::PosSize::POS );
3654 awt::Point aDockPos;
3674 awt::Rectangle aRect = xWindow->getPosSize();
3675 xWindow->setPosSize( aRect.X, aRect.Y, 0, 0, awt::PosSize::POS );
3676 xWindow->setOutputSize(
AWTSize( aSize ) );
3690 if ( pParentLayouter )
3704 pToolBox->
SetAlign( WindowAlign::Left );
3721 uno::Reference<ui::XUIElement> xUIElement(elem.m_xUIElement);
3722 if (xUIElement.is())
3724 uno::Reference<uno::XInterface> xIfac(xUIElement->getRealInterface(),
3726 if (xIfac == e.Source)
3728 aName = elem.m_aName;
3733 if (!elem.m_bContextSensitive)
3734 elem.m_bVisible =
false;
3744 if (
aName.isEmpty() )
3755 if ( bLayoutDirty && pParentLayouter )
3769 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.
m_xUIElement, uno::UNO_QUERY );
3770 if ( xElementSettings.is() )
3772 uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
3773 if ( xPropSet.is() )
3775 if ( rEvent.Source == uno::Reference< uno::XInterface >(
m_xDocCfgMgr, uno::UNO_QUERY ))
3776 xPropSet->setPropertyValue(
"ConfigurationSource", css::uno::Any(
m_xDocCfgMgr ));
3778 xElementSettings->updateSettings();
3782 OUString aElementType;
3783 OUString aElementName;
3785 if ( aElementName.indexOf(
"custom_" ) != -1 )
3789 uno::Reference< ui::XUIElement > xUIElement =
getToolbar( rEvent.ResourceURL );
3790 if ( xUIElement.is() )
3793 uno::Reference< ui::XUIConfigurationManager > xCfgMgr;
3794 uno::Reference< beans::XPropertySet > xPropSet;
3798 xCfgMgr.set( rEvent.Source, uno::UNO_QUERY );
3799 xPropSet.set( xCfgMgr->getSettings( rEvent.ResourceURL,
false ), uno::UNO_QUERY );
3801 if ( xPropSet.is() )
3802 xPropSet->getPropertyValue(
"UIName") >>=
aUIName;
3804 catch (
const container::NoSuchElementException&)
3807 catch (
const beans::UnknownPropertyException&)
3810 catch (
const lang::WrappedTargetException&)
3831 uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr(
m_xModuleCfgMgr );
3832 uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr(
m_xDocCfgMgr );
3836 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.
m_xUIElement, uno::UNO_QUERY );
3837 if ( !xElementSettings.is() )
3840 bool bNoSettings(
false );
3841 OUString aConfigSourcePropName(
"ConfigurationSource" );
3842 uno::Reference< uno::XInterface > xElementCfgMgr;
3843 uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
3845 if ( xPropSet.is() )
3846 xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
3848 if ( !xElementCfgMgr.is() )
3852 if ( rEvent.Source == xElementCfgMgr )
3855 if ( rEvent.Source == uno::Reference< uno::XInterface >( xDocCfgMgr, uno::UNO_QUERY ))
3858 if ( xModuleCfgMgr->hasSettings( rEvent.ResourceURL ))
3860 xPropSet->setPropertyValue( aConfigSourcePropName, css::uno::Any( xModuleCfgMgr ));
3861 xElementSettings->updateSettings();
3870 if ( xContainerWindow.is() && bNoSettings )
3878 uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.
m_xUIElement, uno::UNO_QUERY );
3879 if ( !xElementSettings.is() )
3882 uno::Reference< uno::XInterface > xElementCfgMgr;
3883 uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
3885 if ( xPropSet.is() )
3886 xPropSet->getPropertyValue(
"ConfigurationSource" ) >>= xElementCfgMgr;
3888 if ( !xElementCfgMgr.is() )
3892 if ( rEvent.Source != xElementCfgMgr )
3895 xElementSettings->updateSettings();
3903 if ( bNotify && pParentLayouter )
3913 uno::Reference< ui::XUIElementSettings > xElementSettings(elem.m_xUIElement, uno::UNO_QUERY);
3914 if (!xElementSettings.is())
3916 xElementSettings->updateSettings();
3928 uno::Sequence< uno::Reference< ui::XUIElement > >
aSeq;
3936 if ( elem.m_xUIElement.is() )
3940 aSeq.getArray()[
nCount-1] = elem.m_xUIElement;
3956 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
3957 if ( xDockWindow.is() && !xDockWindow->isFloating() )
3961 xDockWindow->setFloatingMode(
true );
3968 catch (
const lang::DisposedException&)
3983 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
3984 if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() )
3988 xDockWindow->lock();
3995 catch (
const lang::DisposedException&)
4010 uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.
m_xUIElement->getRealInterface(), uno::UNO_QUERY );
4011 if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() )
4015 xDockWindow->unlock();
4022 catch (
const lang::DisposedException&)
4031 uno::Reference< awt::XWindow2 > xWindow2(
implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4032 return ( xWindow2.is() && xWindow2->isVisible() );
4037 uno::Reference< awt::XDockableWindow > xDockWindow(
implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4038 return ( xDockWindow.is() && xDockWindow->isFloating() );
4048 uno::Reference< awt::XDockableWindow > xDockWindow(
implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4049 return ( xDockWindow.is() && xDockWindow->isLocked() );
4062 aWinSize.Height = aSize.
Height();
4079 awt::Rectangle aRect = xWindow->getPosSize();
4092 uno::Reference< awt::XWindow2 > xWindow(
implts_getXWindow( rResourceURL ), uno::UNO_QUERY );
4093 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4096 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4098 xWindow->setOutputSize( aSize );
4109 uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
4112 if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() )
4114 xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS );
const vcl::I18nHelper & GetUILocaleI18nHelper() const
static const AllSettings & GetSettings()
SystemWindow * GetFloatingWindow(const vcl::Window *pWin)
void SetOutputSizePixel(const Size &rNewSize) override
Point GetPosPixel() const override
void SetFloatStyle(WinBits nWinStyle)
Size GetOutputSizePixel() const
WinBits GetFloatStyle() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
bool LookupDisabled(const OUString &aCommandURL) const
bool UpdatePositionData()
static vcl::Window * GetWindow(const css::uno::Reference< css::awt::XWindow > &rxWindow)
reference_type * get() const
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.
OUString GetNum(tools::Long nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
Point OutputToScreenPixel(const Point &rPos) const
void SetStyle(WinBits nStyle)
WindowType GetType() const
static DockingManager * GetDockingManager()
virtual Point GetPosPixel() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
virtual void SetText(const OUString &rStr)
virtual OUString GetText() const
Point ScreenToOutputPixel(const Point &rPos) const
css::awt::Size AWTSize(const Size &rVCLSize)
css::awt::Point AWTPoint(const ::Point &rVCLPoint)
inline ::Point VCLPoint(const css::awt::Point &rAWTPoint)
OUString FwkResId(TranslateId aId)
css::uno::Reference< css::uno::XComponentContext > m_xContext
constexpr OUStringLiteral UIRESOURCETYPE_TOOLBAR
Sequence< sal_Int8 > aSeq
#define SAL_WARN(area, stream)
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
css::awt::Rectangle putRectangleValueToAWT(const ::tools::Rectangle &rRect)
WindowAlign ImplConvertAlignment(ui::DockingArea aAlignment)
void parseResourceURL(std::u16string_view aResourceURL, OUString &aElementType, OUString &aElementName)
OUString retrieveToolbarNameFromHelpURL(vcl::Window *pWindow)
bool isHorizontalDockingArea(const ui::DockingArea &nDockingArea)
ToolBox * getToolboxPtr(vcl::Window *pWindow)
uno::Reference< awt::XVclWindowPeer > createToolkitWindow(const uno::Reference< uno::XComponentContext > &rxContext, const uno::Reference< awt::XVclWindowPeer > &rParent, const char *pService)
::tools::Rectangle putAWTToRectangle(const css::awt::Rectangle &rRect)
bool isToolboxHorizontalAligned(ToolBox const *pToolBox)
vcl::Window * getWindowFromXUIElement(const uno::Reference< ui::XUIElement > &xUIElement)
uno::Reference< frame::XModel > impl_getModelFromFrame(const uno::Reference< frame::XFrame > &rFrame)
bool implts_isPreviewModel(const uno::Reference< frame::XModel > &xModel)
bool hasEmptySize(const css::awt::Size &rSize)
bool isReverseOrderDockingArea(const sal_Int32 nDockArea)
bool lcl_checkUIElement(const uno::Reference< ui::XUIElement > &xUIElement, awt::Rectangle &_rPosSize, uno::Reference< awt::XWindow > &_xWindow)
bool isDefaultPos(const css::awt::Point &rPos)
bool hasDefaultPosValue(const css::awt::Point &rPos)
constexpr bool starts_with(std::basic_string_view< charT, traits > sv, std::basic_string_view< charT, traits > x) noexcept
const wchar_t *typedef int(__stdcall *DllNativeUnregProc)(int
css::ui::DockingArea m_nDockedArea
ToolBox::ImplToolItems::size_type m_nLines
FloatingData m_aFloatingData
css::uno::Reference< css::ui::XUIElement > m_xUIElement
Reference< XFrame > xFrame
Reference< XModel > xModel
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_SIZE
constexpr OUStringLiteral WINDOWSTATE_PROPERTY_UINAME
WinBits const WB_CLOSEABLE