[Libreoffice-commits] core.git: Branch 'distro/collabora/co-2021' - include/sfx2 sfx2/source vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 10 09:30:26 UTC 2021


 include/sfx2/sidebar/SidebarDockingWindow.hxx |    4 -
 sfx2/source/sidebar/SidebarController.cxx     |   22 -------
 sfx2/source/sidebar/SidebarDockingWindow.cxx  |   77 --------------------------
 vcl/jsdialog/jsdialogbuilder.cxx              |    4 -
 4 files changed, 2 insertions(+), 105 deletions(-)

New commits:
commit 64bd4dd2f80b247cb5df3f3e6c54bf2d47bc41a7
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Thu Jun 10 10:43:05 2021 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jun 10 11:29:53 2021 +0200

    jsdialog: sidebar: remove code for tunneled one
    
    Change-Id: Idb60fdfc03729dd3755d5ef1ba61b2f9376e9556
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116965
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>

diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx
index 903db6f42bf0..ff7f2d2aff38 100644
--- a/include/sfx2/sidebar/SidebarDockingWindow.hxx
+++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx
@@ -32,8 +32,6 @@ class SidebarChildWindow;
 
 class SidebarController;
 
-class SidebarNotifyIdle;
-
 class SFX2_DLLPUBLIC SidebarDockingWindow final : public SfxDockingWindow
 {
 public:
@@ -66,8 +64,6 @@ private:
     ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController;
     bool mbIsReadyToDrag;
     std::unique_ptr<svt::AcceleratorExecute> mpAccel;
-
-    std::unique_ptr<SidebarNotifyIdle> mpIdleNotify;
 };
 
 } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 51304f07bc9d..c120a9cc301c 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1210,28 +1210,6 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OString&, rCurItemId,
 
 void SidebarController::RequestCloseDeck()
 {
-    if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck)
-    {
-        const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier();
-        auto pMobileNotifier = SfxViewShell::Current();
-        const SfxViewShell* pViewShell = SfxViewShell::Current();
-        if (pMobileNotifier && pViewShell && pViewShell->isLOKMobilePhone())
-        {
-            // Mobile phone.
-            std::stringstream aStream;
-            boost::property_tree::ptree aTree;
-            aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out
-            aTree.put("type", "dockingwindow");
-            aTree.put("text", mpParentWindow->GetText());
-            aTree.put("enabled", false);
-            boost::property_tree::write_json(aStream, aTree);
-            const std::string message = aStream.str();
-            pMobileNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
-        }
-        else if (pNotifier)
-            pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close");
-    }
-
     mbIsDeckRequestedOpen = false;
     UpdateDeckOpenState();
 
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index a7b752af67eb..c40cc06a952b 100644
--- a/sfx2/source/sidebar/SidebarDockingWindow.cxx
+++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx
@@ -41,81 +41,11 @@ using namespace css::uno;
 
 namespace sfx2::sidebar {
 
-class SidebarNotifyIdle : public Idle
-{
-    SidebarDockingWindow& m_rSidebarDockingWin;
-    std::string m_LastNotificationMessage;
-    vcl::LOKWindowId m_LastLOKWindowId;
-
-public:
-    SidebarNotifyIdle(SidebarDockingWindow &rSidebarDockingWin) :
-        Idle("Sidebar notify"),
-        m_rSidebarDockingWin(rSidebarDockingWin),
-        m_LastNotificationMessage(),
-        m_LastLOKWindowId(0)
-    {
-        SetPriority(TaskPriority::POST_PAINT);
-    }
-
-    void Invoke() override
-    {
-        auto pNotifier = m_rSidebarDockingWin.GetLOKNotifier();
-        if (!pNotifier || !comphelper::LibreOfficeKit::isActive())
-            return;
-
-        try
-        {
-            const SfxViewShell* pOwnerView = dynamic_cast<const SfxViewShell*>(pNotifier);
-            if (pOwnerView && pOwnerView->isLOKMobilePhone())
-            {
-                // Mobile phone.
-                tools::JsonWriter aJsonWriter;
-                m_rSidebarDockingWin.DumpAsPropertyTree(aJsonWriter);
-                aJsonWriter.put("id", m_rSidebarDockingWin.GetLOKWindowId());
-                std::unique_ptr<char[]> data( aJsonWriter.extractData());
-                std::string_view message(data.get());
-                if (message != m_LastNotificationMessage)
-                {
-                    m_LastNotificationMessage = message;
-                    pOwnerView->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, m_LastNotificationMessage.c_str());
-                }
-            }
-
-            // Notify the sidebar is created, and its LOKWindowId, which
-            // is needed on mobile phones, tablets, and desktop.
-            const Point pos(m_rSidebarDockingWin.GetOutOffXPixel(),
-                            m_rSidebarDockingWin.GetOutOffYPixel());
-            const OString posMessage = pos.toString();
-            const OString sizeMessage = m_rSidebarDockingWin.GetSizePixel().toString();
-
-            const std::string message = OString(posMessage + sizeMessage).getStr();
-            const vcl::LOKWindowId lokWindowId = m_rSidebarDockingWin.GetLOKWindowId();
-
-            if (lokWindowId != m_LastLOKWindowId || message != m_LastNotificationMessage)
-            {
-                m_LastLOKWindowId = lokWindowId;
-                m_LastNotificationMessage = message;
-
-                std::vector<vcl::LOKPayloadItem> aItems;
-                aItems.emplace_back("type", "deck");
-                aItems.emplace_back("position", posMessage);
-                aItems.emplace_back("size", sizeMessage);
-                pNotifier->notifyWindow(lokWindowId, "created", aItems);
-            }
-        }
-        catch (boost::property_tree::json_parser::json_parser_error& rError)
-        {
-            SAL_WARN("sfx.sidebar", rError.message());
-        }
-    }
-};
-
 SidebarDockingWindow::SidebarDockingWindow(SfxBindings* pSfxBindings, SidebarChildWindow& rChildWindow,
                                            vcl::Window* pParentWindow, WinBits nBits)
     : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits)
     , mpSidebarController()
     , mbIsReadyToDrag(false)
-    , mpIdleNotify(new SidebarNotifyIdle(*this))
 {
     // Get the XFrame from the bindings.
     if (pSfxBindings==nullptr || pSfxBindings->GetDispatcher()==nullptr)
@@ -152,12 +82,7 @@ void SidebarDockingWindow::LOKClose()
 {
     assert(comphelper::LibreOfficeKit::isActive());
     if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
-    {
-        mpIdleNotify->Stop();
-
-        pNotifier->notifyWindow(GetLOKWindowId(), "close");
         ReleaseLOKNotifier();
-    }
 }
 
 void SidebarDockingWindow::GetFocus()
@@ -206,8 +131,6 @@ void SidebarDockingWindow::NotifyResize()
 
         SetLOKNotifier(pCurrentView);
     }
-
-    mpIdleNotify->Start();
 }
 
 SfxChildAlignment SidebarDockingWindow::CheckAlignment (
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 6bc1248660d0..5cb55ed4f5d3 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -419,8 +419,6 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
 {
     vcl::Window* pRoot = m_xBuilder->get_widget_root();
 
-    m_aParentDialog = pRoot->GetParentWithLOKNotifier();
-
     if (rUIFile == "sfx/ui/panel.ui")
     {
         // builder for Panel, get SidebarDockingWindow as m_aContentWindow
@@ -436,6 +434,8 @@ JSInstanceBuilder::JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIR
             m_aContentWindow = m_aContentWindow->GetParent();
     }
 
+    m_aParentDialog = m_aContentWindow;
+
     InsertWindowToMap(m_nWindowId);
 
     initializeSender(GetNotifierWindow(), GetContentWindow(), GetTypeOfJSON());


More information about the Libreoffice-commits mailing list