[Libreoffice-commits] core.git: framework/source include/vcl vcl/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Mar 21 17:51:25 UTC 2019
framework/source/layoutmanager/toolbarlayoutmanager.cxx | 36 ++++++++++++----
include/vcl/floatwin.hxx | 1
vcl/source/window/floatwin.cxx | 14 +++++-
3 files changed, 43 insertions(+), 8 deletions(-)
New commits:
commit 428d5f2449df8556b87c22663a7a48d1eec06bb7
Author: Ilhan Yesil <ilhanyesil at gmx.de>
AuthorDate: Tue Nov 27 09:39:41 2018 +0100
Commit: Katarina Behrens <Katarina.Behrens at cib.de>
CommitDate: Thu Mar 21 18:51:00 2019 +0100
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 at cib.de>
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);
+ }
+ }
+ }
+ }
}
}
}
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index a9ac32958110..75dd4c1fec10 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -153,6 +153,7 @@ public:
void SetPopupModeEndHdl( const Link<FloatingWindow*,void>& rLink ) { maPopupModeEndHdl = rLink; }
bool GrabsFocus() const { return mbGrabFocus; }
+ bool UpdatePositionData();
static Point CalcFloatingPosition( vcl::Window* pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex );
};
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index e632f97696b3..d6b44034c5bf 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -888,10 +888,22 @@ void FloatingWindow::EndPopupMode( FloatWinPopupEndFlags nFlags )
ImplEndPopupMode(nFlags, mxPrevFocusWin);
}
-void FloatingWindow::AddPopupModeWindow( vcl::Window* pWindow )
+void FloatingWindow::AddPopupModeWindow(vcl::Window* pWindow)
{
// !!! up-to-now only 1 window and not yet a list
mpFirstPopupModeWin = pWindow;
}
+bool FloatingWindow::UpdatePositionData()
+{
+ auto pWin = ImplGetParent();
+ if (pWin)
+ {
+ // Simulate Move, so the relative position of the floating window will be recalculated
+ pWin->ImplCallMove();
+ return true;
+ }
+
+ return false;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list