Kaydet (Commit) 428d5f24 authored tarafından Ilhan Yesil's avatar Ilhan Yesil Kaydeden (comit) Katarina Behrens

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: 's avatarKatarina Behrens <Katarina.Behrens@cib.de>
üst e33e0e00
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include <vcl/settings.hxx> #include <vcl/settings.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <sal/log.hxx> #include <sal/log.hxx>
#include <tools/gen.hxx>
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -428,10 +429,6 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL ) ...@@ -428,10 +429,6 @@ bool ToolbarLayoutManager::requestToolbar( const OUString& rResourceURL )
bool bCreateOrShowToolbar( aRequestedToolbar.m_bVisible && !aRequestedToolbar.m_bMasterHide ); 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 ) if ( bCreateOrShowToolbar )
bNotify = bMustCallCreate ? createToolbar( rResourceURL ) : showToolbar( rResourceURL ); bNotify = bMustCallCreate ? createToolbar( rResourceURL ) : showToolbar( rResourceURL );
...@@ -1835,7 +1832,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD ...@@ -1835,7 +1832,7 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
xDockAreaWindow = m_xDockAreaWindows[static_cast<int>(eDockingArea)]; xDockAreaWindow = m_xDockAreaWindows[static_cast<int>(eDockingArea)];
for (auto const& elem : m_aUIElements) 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 ); uno::Reference< ui::XUIElement > xUIElement( elem.m_xUIElement );
if ( xUIElement.is() ) if ( xUIElement.is() )
...@@ -1844,8 +1841,33 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD ...@@ -1844,8 +1841,33 @@ void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eD
uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
if ( xDockWindow.is() ) if ( xDockWindow.is() )
{ {
// docked windows if (!elem.m_bFloating)
aWindowVector.push_back(elem); {
// 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);
}
}
}
}
} }
} }
} }
......
...@@ -153,6 +153,7 @@ public: ...@@ -153,6 +153,7 @@ public:
void SetPopupModeEndHdl( const Link<FloatingWindow*,void>& rLink ) { maPopupModeEndHdl = rLink; } void SetPopupModeEndHdl( const Link<FloatingWindow*,void>& rLink ) { maPopupModeEndHdl = rLink; }
bool GrabsFocus() const { return mbGrabFocus; } bool GrabsFocus() const { return mbGrabFocus; }
bool UpdatePositionData();
static Point CalcFloatingPosition( vcl::Window* pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex ); static Point CalcFloatingPosition( vcl::Window* pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags, sal_uInt16& rArrangeIndex );
}; };
......
...@@ -888,10 +888,22 @@ void FloatingWindow::EndPopupMode( FloatWinPopupEndFlags nFlags ) ...@@ -888,10 +888,22 @@ void FloatingWindow::EndPopupMode( FloatWinPopupEndFlags nFlags )
ImplEndPopupMode(nFlags, mxPrevFocusWin); 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 // !!! up-to-now only 1 window and not yet a list
mpFirstPopupModeWin = pWindow; 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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment