[Libreoffice-commits] core.git: Branch 'feature/lok_dialog-backport' - include/vcl vcl/source
Jan Holesovsky
kendy at collabora.com
Mon Dec 4 16:56:53 UTC 2017
include/vcl/window.hxx | 6 ++++--
vcl/source/control/ctrl.cxx | 2 +-
vcl/source/window/floatwin.cxx | 4 ++--
vcl/source/window/window.cxx | 17 ++++++-----------
4 files changed, 13 insertions(+), 16 deletions(-)
New commits:
commit 35094a3f687280f01a53ed6e25c938821ac63717
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon Dec 4 17:55:21 2017 +0100
lokdialog: Window* -> VclPtr<Window>, and a small simplification.
Change-Id: I853e2d6ec2e55c78894a9942aa201763a57fe195
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index c17c8ab3b108..2fe7540ffff0 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1208,13 +1208,15 @@ public:
void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier);
const vcl::ILibreOfficeKitNotifier* GetLOKNotifier() const;
vcl::LOKWindowId GetLOKWindowId() const;
- vcl::Window* GetParentWithLOKNotifier();
+
+ /// Find the nearest parent with LOK Notifier; can be iteself if this Window has LOK notifier set.
+ VclPtr<vcl::Window> GetParentWithLOKNotifier();
/// Indicate that LOK is not going to use this dialog any more.
void ReleaseLOKNotifier();
/// Find an existing Window based on the LOKWindowId.
- static VclPtr<Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
+ static VclPtr<vcl::Window> FindLOKWindow(vcl::LOKWindowId nWindowId);
/// Dialog / window tunneling related methods.
Size PaintActiveFloatingWindow(VirtualDevice& rDevice) const;
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 9b5b16a7509a..b2adcb1d7ccf 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -425,7 +425,7 @@ void Control::LogicInvalidate(const Rectangle* /*pRectangle*/)
// ignore all of those
if (comphelper::LibreOfficeKit::isActive() && !comphelper::LibreOfficeKit::isDialogPainting())
{
- if (vcl::Window* pParent = GetParentWithLOKNotifier())
+ if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
// invalidate the complete floating window for now
if (pParent->ImplIsFloatingWindow())
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 4c2eae984c54..676c3f0dbb06 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -597,7 +597,7 @@ bool FloatingWindow::Notify( NotifyEvent& rNEvt )
void FloatingWindow::LogicInvalidate(const Rectangle* /*pRectangle*/)
{
- if (vcl::Window* pParent = GetParentWithLOKNotifier())
+ if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
pNotifier->notifyWindow(GetLOKWindowId(), "invalidate");
@@ -613,7 +613,7 @@ void FloatingWindow::StateChanged( StateChangedType nType )
SystemWindow::StateChanged( nType );
- if (vcl::Window* pParent = GetParentWithLOKNotifier())
+ if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
if (nType == StateChangedType::InitShow && IsVisible())
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 0bc0fe7bd33b..962c90904c43 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3240,19 +3240,14 @@ vcl::LOKWindowId Window::GetLOKWindowId() const
return mpWindowImpl->mnLOKWindowId;
}
-vcl::Window* Window::GetParentWithLOKNotifier()
+VclPtr<vcl::Window> Window::GetParentWithLOKNotifier()
{
- vcl::Window* pWindow = this;
- bool found = false;
- while (pWindow && !found)
- {
- if (pWindow->GetLOKNotifier())
- found = true;
- else
- pWindow = pWindow->GetParent();
- }
+ VclPtr<vcl::Window> pWindow(this);
+
+ while (pWindow && !pWindow->GetLOKNotifier())
+ pWindow = pWindow->GetParent();
- return found ? pWindow : nullptr;
+ return pWindow;
}
void Window::LogicMouseButtonDown(const MouseEvent& rMouseEvent)
More information about the Libreoffice-commits
mailing list