summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2021-06-10 10:43:05 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2021-07-27 14:19:49 +0200
commitaf0786c3d7e22e961a92e0ccb2fc2c6f504e576e (patch)
tree79f7425ed17e362571112aea4ca0730aab8c3728 /sfx2
parent6cb3c79b84e396959a982070f6fc4d439a9c396d (diff)
jsdialog: sidebar: remove code for tunneled one
Change-Id: Idb60fdfc03729dd3755d5ef1ba61b2f9376e9556 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116965 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119542 Tested-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx20
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx79
2 files changed, 1 insertions, 98 deletions
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 3ca7ca9655f1..116af3e8c8bf 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -1230,26 +1230,6 @@ IMPL_LINK(SidebarController, OnSubMenuItemSelected, const OString&, rCurItemId,
void SidebarController::RequestCloseDeck()
{
- if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck)
- {
- const SfxViewShell* pViewShell = SfxViewShell::Current();
- if (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();
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str());
- }
- else if (const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier())
- pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close");
- }
-
mbIsDeckRequestedOpen = false;
UpdateDeckOpenState();
diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx
index b5b19b10bf74..f8405e7989a9 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[], o3tl::free_delete> 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)
@@ -151,13 +81,8 @@ void SidebarDockingWindow::dispose()
void SidebarDockingWindow::LOKClose()
{
assert(comphelper::LibreOfficeKit::isActive());
- if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier())
- {
- mpIdleNotify->Stop();
-
- pNotifier->notifyWindow(GetLOKWindowId(), "close");
+ if (GetLOKNotifier())
ReleaseLOKNotifier();
- }
}
void SidebarDockingWindow::GetFocus()
@@ -206,8 +131,6 @@ void SidebarDockingWindow::NotifyResize()
SetLOKNotifier(pCurrentView);
}
-
- mpIdleNotify->Start();
}
SfxChildAlignment SidebarDockingWindow::CheckAlignment (