summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorIlhan Yesil <ilhanyesil@gmx.de>2018-11-27 09:39:41 +0100
committerKatarina Behrens <Katarina.Behrens@cib.de>2019-03-21 18:51:00 +0100
commit428d5f2449df8556b87c22663a7a48d1eec06bb7 (patch)
tree92bd5348d2e7552e863c4e115b9bffe9938f8173 /framework
parente33e0e00788c268a6567520bcaaf0ebe23bc261c (diff)
tdf#121671 Floating toolbars remain their position after reopen
Calculate the relative position of the floating toolbars by calling the ImplCallMove function, where the current position is read from the real window. Change-Id: I6a142055c3340dda2339980fbc5a7ebb431e228b Reviewed-on: https://gerrit.libreoffice.org/64093 Tested-by: Jenkins Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx36
1 files changed, 29 insertions, 7 deletions
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 9396171848f2..1bd85e56b171 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -45,6 +45,7 @@
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
#include <sal/log.hxx>
+#include <tools/gen.hxx>
using namespace ::com::sun::star;
@@ -428,10 +429,6 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL )
bool bCreateOrShowToolbar( aRequestedToolbar.m_bVisible && !aRequestedToolbar.m_bMasterHide );
- uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY );
- if ( xContainerWindow.is() && aRequestedToolbar.m_bFloating )
- bCreateOrShowToolbar &= bool( xContainerWindow->isActive());
-
if ( bCreateOrShowToolbar )
bNotify = bMustCallCreate ? createToolbar( rResourceURL ) : showToolbar( rResourceURL );
@@ -1835,7 +1832,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
xDockAreaWindow = m_xDockAreaWindows[static_cast<int>(eDockingArea)];
for (auto const& elem : m_aUIElements)
{
- if ( elem.m_aDockedData.m_nDockedArea == eDockingArea && elem.m_bVisible && !elem.m_bFloating )
+ if ( elem.m_aDockedData.m_nDockedArea == eDockingArea && elem.m_bVisible )
{
uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
if ( xUIElement.is() )
@@ -1844,8 +1841,33 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
if ( xDockWindow.is() )
{
- // docked windows
- aWindowVector.push_back(elem);
+ if (!elem.m_bFloating)
+ {
+ // docked windows
+ aWindowVector.push_back(elem);
+ }
+ else
+ {
+ // floating windows
+ VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow(xWindow);
+ DockingManager* pDockMgr = vcl::Window::GetDockingManager();
+ if (pDockMgr != nullptr)
+ {
+ ImplDockingWindowWrapper* pWrapper = pDockMgr->GetDockingWindowWrapper(pWindow);
+ if (pWrapper != nullptr && pWrapper->GetFloatingWindow())
+ {
+ // update the position data of the floating window
+ if (pWrapper->GetFloatingWindow()->UpdatePositionData())
+ {
+ awt::Rectangle aTmpRect = xWindow->getPosSize();
+ UIElement uiElem = elem;
+ uiElem.m_aFloatingData.m_aPos = awt::Point(aTmpRect.X, aTmpRect.Y);
+ implts_setToolbar(uiElem);
+ implts_writeWindowStateData(uiElem);
+ }
+ }
+ }
+ }
}
}
}