summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-12-04 17:55:21 +0100
committerJan Holesovsky <kendy@collabora.com>2017-12-06 12:16:22 +0100
commit5df0f751d8b117eeb9b1df8d1bc34e36659d1492 (patch)
treebc005ca9fe6dec2ddef0368db1a5a92fd1090564 /vcl
parent86393f03702fd4c695612754fa89f80dac69eab9 (diff)
lokdialog: Window* -> VclPtr<Window>, and a small simplification.
Change-Id: I853e2d6ec2e55c78894a9942aa201763a57fe195 Reviewed-on: https://gerrit.libreoffice.org/45900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/ctrl.cxx2
-rw-r--r--vcl/source/window/floatwin.cxx4
-rw-r--r--vcl/source/window/window.cxx17
3 files changed, 9 insertions, 14 deletions
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 57021be2f8cd..59b12539e20a 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 747368bf6524..4ca9e449e683 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3220,19 +3220,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)