summaryrefslogtreecommitdiff
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
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>
-rw-r--r--include/sfx2/sidebar/SidebarDockingWindow.hxx4
-rw-r--r--sfx2/source/sidebar/SidebarController.cxx20
-rw-r--r--sfx2/source/sidebar/SidebarDockingWindow.cxx79
-rw-r--r--vcl/jsdialog/jsdialogbuilder.cxx4
4 files changed, 3 insertions, 104 deletions
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 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 (
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index af68f2c48319..896225aef311 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());