[Libreoffice-commits] core.git: Branch 'feature/lok_dialog2' - 2 commits - include/vcl vcl/source

Jan Holesovsky kendy at collabora.com
Tue Dec 5 11:24:42 UTC 2017


 include/vcl/window.hxx         |    6 ++++--
 vcl/source/control/ctrl.cxx    |    2 +-
 vcl/source/window/floatwin.cxx |   18 ++++++++++++++----
 vcl/source/window/window.cxx   |   17 ++++++-----------
 4 files changed, 25 insertions(+), 18 deletions(-)

New commits:
commit aaa4cf9ff74bfc96d8abac573fec091bbc24f5e3
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 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)
commit f500727a658275e62c16f65672c71e2888c017c3
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Dec 4 17:30:45 2017 +0100

    lokdialog: Make the Autofilter popup work in Calc.
    
    For the moment we treat it as a 'dialog', but maybe we'll need a separate
    window type for this later.
    
    Change-Id: I21bff0b50b5f3e9f51d323600f7ba6d37c16bc9b

diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 57021be2f8cd..2aa0a08b6b0e 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -611,8 +611,18 @@ void FloatingWindow::StateChanged( StateChangedType nType )
             SetLOKNotifier(pNotifier);
 
             std::vector<vcl::LOKPayloadItem> aItems;
-            aItems.emplace_back(std::make_pair("type", "child"));
-            aItems.emplace_back(std::make_pair("parentId", OString::number(pParent->GetLOKWindowId())));
+            if (pParent == this)
+            {
+                // we are a toplevel window, let's so far pretend to be a
+                // dialog - but maybe we'll need a separate type for this
+                // later
+                aItems.emplace_back(std::make_pair("type", "dialog"));
+            }
+            else
+            {
+                aItems.emplace_back(std::make_pair("type", "child"));
+                aItems.emplace_back(std::make_pair("parentId", OString::number(pParent->GetLOKWindowId())));
+            }
             aItems.emplace_back(std::make_pair("size", GetSizePixel().toString()));
             aItems.emplace_back(std::make_pair("position", mpImplData->maPos.toString()));
             pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems);


More information about the Libreoffice-commits mailing list