factor out dialog hacks
Change-Id: Iceefc8d739fb93b97adfa1e35d8308f0c48f02e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88600 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
@@ -126,7 +126,7 @@
|
|||||||
#include <vcl/virdev.hxx>
|
#include <vcl/virdev.hxx>
|
||||||
#include <vcl/ImageTree.hxx>
|
#include <vcl/ImageTree.hxx>
|
||||||
#include <vcl/ITiledRenderable.hxx>
|
#include <vcl/ITiledRenderable.hxx>
|
||||||
#include <vcl/dialog.hxx>
|
#include <vcl/dialoghelper.hxx>
|
||||||
#include <unicode/uchar.h>
|
#include <unicode/uchar.h>
|
||||||
#include <unotools/syslocaleoptions.hxx>
|
#include <unotools/syslocaleoptions.hxx>
|
||||||
#include <unotools/mediadescriptor.hxx>
|
#include <unotools/mediadescriptor.hxx>
|
||||||
@@ -3813,10 +3813,7 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
|
|||||||
const Point aPos(nX, nY);
|
const Point aPos(nX, nY);
|
||||||
MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
|
MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
|
||||||
|
|
||||||
if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
|
vcl::EnableDialogInput(pWindow);
|
||||||
{
|
|
||||||
pDialog->EnableInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (nType)
|
switch (nType)
|
||||||
{
|
{
|
||||||
@@ -3865,10 +3862,7 @@ static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsign
|
|||||||
PanningOrientation::Vertical,
|
PanningOrientation::Vertical,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
|
vcl::EnableDialogInput(pWindow);
|
||||||
{
|
|
||||||
pDialog->EnableInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent);
|
Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent);
|
||||||
}
|
}
|
||||||
@@ -5174,10 +5168,12 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo
|
|||||||
|
|
||||||
if (nAction == LOK_WINDOW_CLOSE)
|
if (nAction == LOK_WINDOW_CLOSE)
|
||||||
{
|
{
|
||||||
if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
|
bool bWasDialog = vcl::CloseDialog(pWindow);
|
||||||
pDialog->Close();
|
if (!bWasDialog)
|
||||||
else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow.get()))
|
{
|
||||||
pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
|
if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow.get()))
|
||||||
|
pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (nAction == LOK_WINDOW_PASTE)
|
else if (nAction == LOK_WINDOW_PASTE)
|
||||||
{
|
{
|
||||||
|
@@ -131,7 +131,6 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
void EndDialog( long nResult = RET_CANCEL );
|
void EndDialog( long nResult = RET_CANCEL );
|
||||||
static void EndAllDialogs( vcl::Window const * pParent );
|
|
||||||
|
|
||||||
void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
|
void GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
|
||||||
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
|
sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const;
|
||||||
|
29
include/vcl/dialoghelper.hxx
Normal file
29
include/vcl/dialoghelper.hxx
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||||
|
/*
|
||||||
|
* This file is part of the LibreOffice project.
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <vcl/dllapi.h>
|
||||||
|
|
||||||
|
namespace vcl
|
||||||
|
{
|
||||||
|
class Window;
|
||||||
|
|
||||||
|
/* cancel dialogs that are a child of pParent
|
||||||
|
this is used by com.sun.star.embed.DocumentCloser which itself is only used by
|
||||||
|
extensions/source/activex/SOActiveX.cxx see extensions/source/activex/README.txt
|
||||||
|
posibly dubious if this actually works as expected
|
||||||
|
*/
|
||||||
|
|
||||||
|
VCL_DLLPUBLIC void EndAllDialogs(vcl::Window const* pParent);
|
||||||
|
|
||||||
|
/* for LibreOffice kit */
|
||||||
|
VCL_DLLPUBLIC void EnableDialogInput(vcl::Window* pDialog);
|
||||||
|
VCL_DLLPUBLIC bool CloseDialog(vcl::Window* pDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
@@ -30,7 +30,8 @@
|
|||||||
#include <cppuhelper/supportsservice.hxx>
|
#include <cppuhelper/supportsservice.hxx>
|
||||||
#include <osl/mutex.hxx>
|
#include <osl/mutex.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
#include <vcl/dialog.hxx>
|
#include <vcl/dialoghelper.hxx>
|
||||||
|
#include <vcl/window.hxx>
|
||||||
#include <tools/link.hxx>
|
#include <tools/link.hxx>
|
||||||
#include <toolkit/helper/vclunohelper.hxx>
|
#include <toolkit/helper/vclunohelper.hxx>
|
||||||
|
|
||||||
@@ -115,8 +116,8 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, void*, p, void )
|
|||||||
xWinPeer->setProperty( "PluginParent", uno::makeAny( sal_Int64(0) ) );
|
xWinPeer->setProperty( "PluginParent", uno::makeAny( sal_Int64(0) ) );
|
||||||
|
|
||||||
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
|
VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow );
|
||||||
if ( pWindow )
|
if (pWindow)
|
||||||
Dialog::EndAllDialogs( pWindow );
|
vcl::EndAllDialogs(pWindow);
|
||||||
}
|
}
|
||||||
catch( uno::Exception& )
|
catch( uno::Exception& )
|
||||||
{
|
{
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#include <unotools/syslocaleoptions.hxx>
|
#include <unotools/syslocaleoptions.hxx>
|
||||||
|
|
||||||
#include <vcl/dialog.hxx>
|
#include <vcl/dialog.hxx>
|
||||||
|
#include <vcl/dialoghelper.hxx>
|
||||||
#include <vcl/lok.hxx>
|
#include <vcl/lok.hxx>
|
||||||
#include <vcl/floatwin.hxx>
|
#include <vcl/floatwin.hxx>
|
||||||
#include <vcl/settings.hxx>
|
#include <vcl/settings.hxx>
|
||||||
@@ -300,7 +301,7 @@ IMPL_STATIC_LINK_NOARG( ImplSVAppData, ImplEndAllDialogsMsg, void*, void )
|
|||||||
vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow();
|
vcl::Window* pAppWindow = Application::GetFirstTopLevelWindow();
|
||||||
while (pAppWindow)
|
while (pAppWindow)
|
||||||
{
|
{
|
||||||
Dialog::EndAllDialogs(pAppWindow);
|
vcl::EndAllDialogs(pAppWindow);
|
||||||
pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
|
pAppWindow = Application::GetNextTopLevelWindow(pAppWindow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -50,6 +50,7 @@
|
|||||||
#include <vcl/button.hxx>
|
#include <vcl/button.hxx>
|
||||||
#include <vcl/mnemonic.hxx>
|
#include <vcl/mnemonic.hxx>
|
||||||
#include <vcl/dialog.hxx>
|
#include <vcl/dialog.hxx>
|
||||||
|
#include <vcl/dialoghelper.hxx>
|
||||||
#include <vcl/settings.hxx>
|
#include <vcl/settings.hxx>
|
||||||
#include <vcl/virdev.hxx>
|
#include <vcl/virdev.hxx>
|
||||||
#include <vcl/weld.hxx>
|
#include <vcl/weld.hxx>
|
||||||
@@ -1135,19 +1136,40 @@ void Dialog::EndDialog( long nResult )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::EndAllDialogs( vcl::Window const * pParent )
|
namespace vcl
|
||||||
{
|
{
|
||||||
ImplSVData* pSVData = ImplGetSVData();
|
void EndAllDialogs( vcl::Window const * pParent )
|
||||||
auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
|
|
||||||
|
|
||||||
for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
|
|
||||||
{
|
{
|
||||||
if (!pParent || pParent->IsWindowOrChild(*it, true))
|
ImplSVData* pSVData = ImplGetSVData();
|
||||||
|
auto& rExecuteDialogs = pSVData->mpWinData->mpExecuteDialogs;
|
||||||
|
|
||||||
|
for (auto it = rExecuteDialogs.rbegin(); it != rExecuteDialogs.rend(); ++it)
|
||||||
{
|
{
|
||||||
(*it)->EndDialog();
|
if (!pParent || pParent->IsWindowOrChild(*it, true))
|
||||||
(*it)->PostUserEvent(Link<void*, void>());
|
{
|
||||||
|
(*it)->EndDialog();
|
||||||
|
(*it)->PostUserEvent(Link<void*, void>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnableDialogInput(vcl::Window* pWindow)
|
||||||
|
{
|
||||||
|
if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
|
||||||
|
{
|
||||||
|
pDialog->EnableInput();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CloseDialog(vcl::Window* pWindow)
|
||||||
|
{
|
||||||
|
if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow))
|
||||||
|
{
|
||||||
|
pDialog->Close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::SetModalInputMode( bool bModal )
|
void Dialog::SetModalInputMode( bool bModal )
|
||||||
|
Reference in New Issue
Block a user