summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-12-04 17:55:21 +0100
committerJan Holesovsky <kendy@collabora.com>2017-12-05 12:23:30 +0100
commitaaa4cf9ff74bfc96d8abac573fec091bbc24f5e3 (patch)
tree4eca800ef1b7e620531cb34e13f14d57622b85cc
parentf500727a658275e62c16f65672c71e2888c017c3 (diff)
lokdialog: Window* -> VclPtr<Window>, and a small simplification.feature/lok_dialog2
Change-Id: I853e2d6ec2e55c78894a9942aa201763a57fe195
-rw-r--r--include/vcl/window.hxx6
-rw-r--r--vcl/source/control/ctrl.cxx2
-rw-r--r--vcl/source/window/floatwin.cxx4
-rw-r--r--vcl/source/window/window.cxx17
4 files changed, 13 insertions, 16 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 9af0a918435f..f02acf125d23 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1207,13 +1207,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 itself 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 37dc3dcdad8a..03ceb04adcac 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -421,7 +421,7 @@ void Control::LogicInvalidate(const tools::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 2aa0a08b6b0e..d8b5cc2738d7 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -587,7 +587,7 @@ bool FloatingWindow::EventNotify( NotifyEvent& rNEvt )
void FloatingWindow::LogicInvalidate(const tools::Rectangle* /*pRectangle*/)
{
- if (vcl::Window* pParent = GetParentWithLOKNotifier())
+ if (VclPtr<vcl::Window> pParent = GetParentWithLOKNotifier())
{
const vcl::ILibreOfficeKitNotifier* pNotifier = pParent->GetLOKNotifier();
pNotifier->notifyWindow(GetLOKWindowId(), "invalidate");
@@ -603,7 +603,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 f93ee26e901e..065b566fda39 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3203,19 +3203,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)