chart2/source/controller/main/ChartWindow.cxx | 1 chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx | 7 chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx | 7 desktop/source/lib/init.cxx | 33 -- include/sfx2/sfxsids.hrc | 2 include/sfx2/sidebar/Deck.hxx | 2 include/sfx2/sidebar/SidebarChildWindow.hxx | 5 include/sfx2/sidebar/SidebarDockingWindow.hxx | 9 include/svx/svxids.hrc | 5 sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx | 8 sfx2/sdi/frmslots.sdi | 10 sfx2/sdi/sfx.sdi | 36 ++ sfx2/source/dialog/tabdlg.cxx | 5 sfx2/source/sidebar/Deck.cxx | 60 ---- sfx2/source/sidebar/SidebarChildWindow.cxx | 1 sfx2/source/sidebar/SidebarController.cxx | 23 + sfx2/source/sidebar/SidebarDockingWindow.cxx | 139 +++++++--- sfx2/source/view/lokhelper.cxx | 61 +++- sfx2/source/view/viewfrm.cxx | 19 + vcl/source/window/paint.cxx | 4 20 files changed, 291 insertions(+), 146 deletions(-)
New commits: commit b6f4d3b92789e972d9b079a5561723f3e73e07a6 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Dec 15 21:12:17 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:01 2019 +0000 sfx2: sidebar: new .uno commands to show and hide sidebars Change-Id: I9afba5eec855d6de590086736177b543d52d3b20 Reviewed-on: https://gerrit.libreoffice.org/85192 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 81c02c2c5d22..ad44965df7dd 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3310,12 +3310,12 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin } else if (aMap.find("id") != aMap.end()) { - const OUString sClickAction("CLICK"); - const OUString sSelectAction("SELECT"); - const OUString sClearAction("CLEAR"); - const OUString sTypeAction("TYPE"); - const OUString sUpAction("UP"); - const OUString sDownAction("DOWN"); + static const OUString sClickAction("CLICK"); + static const OUString sSelectAction("SELECT"); + static const OUString sClearAction("CLEAR"); + static const OUString sTypeAction("TYPE"); + static const OUString sUpAction("UP"); + static const OUString sDownAction("DOWN"); try { diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 9fa90a5f6226..f7d77257350c 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -575,6 +575,8 @@ class SvxSearchItem; #define SID_TABLE_BORDER_TYPE (SID_SVX_START + 1065) #define SID_TABLE_BORDER_INDEX (SID_SVX_START + 1066) #define SID_TABLE_BORDER_OFFSET (SID_SVX_START + 1067) +#define SID_SHOW_SIDEBAR (SID_SVX_START + 1200) +#define SID_HIDE_SIDEBAR (SID_SVX_START + 1201) #define FID_SVX_START (SID_LIB_START + 500) #define FID_SEARCH_NOW (FID_SVX_START + 2) diff --git a/include/svx/svxids.hrc b/include/svx/svxids.hrc index f12a326d0d2a..09fa766fbb5b 100644 --- a/include/svx/svxids.hrc +++ b/include/svx/svxids.hrc @@ -999,8 +999,11 @@ class SvxSetItem; #define SID_ULINE_VAL_DOUBLE (SID_SVX_START + 1197) /* double underline */ #define SID_ULINE_VAL_DOTTED (SID_SVX_START + 1198) /* dotted underline */ +// #define SID_SHOW_SIDEBAR ( SID_SVX_START + 1200 ) -> sfxsids.hrc +// #define SID_HIDE_SIDEBAR ( SID_SVX_START + 1201 ) -> sfxsids.hrc + // IMPORTANT NOTE: adjust SID_SVX_FIRSTFREE, when adding new slot id -#define SID_SVX_FIRSTFREE ( SID_SVX_START + 1198 + 1 ) +#define SID_SVX_FIRSTFREE ( SID_HIDE_SIDEBAR + 1 ) // Overflow check for slot IDs #if SID_SVX_FIRSTFREE > SID_SVX_END diff --git a/sfx2/sdi/frmslots.sdi b/sfx2/sdi/frmslots.sdi index 09aafef95b7d..53a13b479a7c 100644 --- a/sfx2/sdi/frmslots.sdi +++ b/sfx2/sdi/frmslots.sdi @@ -43,6 +43,16 @@ interface Window ExecMethod = ChildWindowExecute ; StateMethod = ChildWindowState ; ] + SID_SHOW_SIDEBAR // status(final|play) + [ + ExecMethod = ChildWindowExecute ; + StateMethod = ChildWindowState ; + ] + SID_HIDE_SIDEBAR // status(final|play) + [ + ExecMethod = ChildWindowExecute ; + StateMethod = ChildWindowState ; + ] SID_BROWSER // ole(no) api() [ ExecMethod = ChildWindowExecute ; diff --git a/sfx2/sdi/sfx.sdi b/sfx2/sdi/sfx.sdi index 624abe196661..f95610d07f5c 100644 --- a/sfx2/sdi/sfx.sdi +++ b/sfx2/sdi/sfx.sdi @@ -2594,6 +2594,42 @@ SfxBoolItem Sidebar SID_SIDEBAR GroupId = SfxGroupId::View; ] +SfxBoolItem SidebarShow SID_SHOW_SIDEBAR +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::View; +] + +SfxBoolItem SidebarHide SID_HIDE_SIDEBAR +[ + AutoUpdate = TRUE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Asynchron; + + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::View; +] + SfxBoolItem Menubar SID_MENUBAR [ AutoUpdate = TRUE, diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 335b634da6e3..8d5e7f154650 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1223,7 +1223,7 @@ void SidebarController::RequestCloseDeck() // Mobile. std::stringstream aStream; boost::property_tree::ptree aTree; - aTree.put("id", mpParentWindow->get_id()); // TODO could be missing - sort out + aTree.put("id", mpCurrentDeck->GetLOKWindowId()); aTree.put("type", "dockingwindow"); aTree.put("text", mpParentWindow->GetText()); aTree.put("enabled", false); diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 0ee2117875a5..5f731f6400a7 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -69,7 +69,9 @@ public: { // Mobile. std::stringstream aStream; - boost::property_tree::write_json(aStream, m_rSidebarDockingWin.DumpAsPropertyTree()); + boost::property_tree::ptree aTree = m_rSidebarDockingWin.DumpAsPropertyTree(); + aTree.put("id", m_rSidebarDockingWin.GetLOKWindowId()); + boost::property_tree::write_json(aStream, aTree); const std::string message = aStream.str(); if (message != m_LastNotificationMessage) { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 81f9d1fd4bdd..a19a89a91b91 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -3217,17 +3217,28 @@ void SfxViewFrame::ChildWindowState( SfxItemSet& rState ) else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); } - else if ( nSID == SID_SIDEBAR ) + else if ( nSID == SID_SIDEBAR || nSID == SID_SHOW_SIDEBAR || nSID == SID_HIDE_SIDEBAR ) { - if ( !KnowsChildWindow( nSID ) ) + if ( !KnowsChildWindow( SID_SIDEBAR ) ) { SAL_WARN("sfx.view", "SID_SIDEBAR state requested, but no task pane child window exists for this ID!"); - rState.DisableItem( nSID ); + rState.DisableItem( SID_SIDEBAR ); } - else + else if ( nSID == SID_SIDEBAR ) { + // Toggle. rState.Put( SfxBoolItem( nSID, HasChildWindow( nSID ) ) ); } + else if ( nSID == SID_SHOW_SIDEBAR ) + { + // Show. + rState.Put( SfxBoolItem( nSID, false ) ); + } + else if ( nSID == SID_HIDE_SIDEBAR ) + { + // Hide. + rState.Put( SfxBoolItem( nSID, true ) ); + } } else if ( KnowsChildWindow(nSID) ) rState.Put( SfxBoolItem( nSID, HasChildWindow(nSID) ) ); commit 7542c600dc406bcd29f7a6825e4df7559676c9f7 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Wed Dec 11 18:19:43 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:01 2019 +0000 chart2: clear listener parents in dispose Change-Id: Icdab125589ab0f55255f683a1ea39e036de661b1 Reviewed-on: https://gerrit.libreoffice.org/84997 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index 2a3bd54a85e6..0971fd079ca1 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -74,6 +74,7 @@ ChartWindow::~ChartWindow() void ChartWindow::dispose() { + m_pWindowController = nullptr; m_pViewShellWindow.clear(); vcl::Window::dispose(); } diff --git a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx index b000e55c5aa6..0fa0b793b5b6 100644 --- a/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx +++ b/chart2/source/controller/sidebar/ChartSidebarModifyListener.cxx @@ -27,12 +27,17 @@ ChartSidebarModifyListener::~ChartSidebarModifyListener() void ChartSidebarModifyListener::modified(const css::lang::EventObject& /*rEvent*/) { - mpParent->updateData(); + if (mpParent) + mpParent->updateData(); } void ChartSidebarModifyListener::disposing(const css::lang::EventObject& /*rEvent*/) { + if (!mpParent) + return; + mpParent->modelInvalid(); + mpParent = nullptr; } } } diff --git a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx index e037fc39aa5f..e7d74c656a55 100644 --- a/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx +++ b/chart2/source/controller/sidebar/ChartSidebarSelectionListener.cxx @@ -41,6 +41,9 @@ ChartSidebarSelectionListener::~ChartSidebarSelectionListener() void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObject& rEvent) { + if (!mpParent) + return; + bool bCorrectObjectSelected = false; css::uno::Reference<css::frame::XController> xController(rEvent.Source, css::uno::UNO_QUERY); @@ -66,6 +69,10 @@ void ChartSidebarSelectionListener::selectionChanged(const css::lang::EventObjec void ChartSidebarSelectionListener::disposing(const css::lang::EventObject& /*rEvent*/) { + if (!mpParent) + return; + + mpParent = nullptr; } void ChartSidebarSelectionListener::setAcceptedTypes(const std::vector<ObjectType>& aTypes) commit b9d0e9e2776c4b8945f03b01473435641ee7ce06 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Wed Dec 11 12:23:08 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:01 2019 +0000 sfx2: sidebar: notify mobile when the sidebar closes Change-Id: Idb05346a9ccc8690cad566b74ec86d5fdd3bfb35 Reviewed-on: https://gerrit.libreoffice.org/84973 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 14c78d918494..335b634da6e3 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -53,6 +53,8 @@ #include <sal/log.hxx> #include <officecfg/Office/UI/Sidebar.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/json_parser.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -1215,7 +1217,21 @@ void SidebarController::RequestCloseDeck() if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get()) { const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); - if (pNotifier) + auto pMobileNotifier = SfxViewShell::Current(); + if (pMobileNotifier && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView())) + { + // Mobile. + 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"); } commit de833533ff6f1e994da2abe193b71500c1e231e9 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Dec 8 12:36:58 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:01 2019 +0000 sidebar: sensible line and page sizes and invalidate Change-Id: Icf60480a47d7c93bad44f6457bb05af332e63c6d Reviewed-on: https://gerrit.libreoffice.org/84718 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index d6c485b1f3c8..aeaf6274e6f9 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -65,6 +65,8 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, mpScrollContainer->Show(); mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange)); + mpVerticalScrollBar->SetLineSize(10); + mpVerticalScrollBar->SetPageSize(100); #ifdef DEBUG SetText(OUString("Deck")); @@ -353,6 +355,7 @@ IMPL_LINK_NOARG(Deck, HandleVerticalScrollBarChange, ScrollBar*, void) const sal_Int32 nYOffset (-mpVerticalScrollBar->GetThumbPos()); mpScrollContainer->SetPosPixel(Point(mpScrollContainer->GetPosPixel().X(), nYOffset)); + mpScrollContainer->Invalidate(); } //----- Deck::ScrollContainerWindow ------------------------------------------- commit f60f04cacf403aaeac67dea5861ca3fd2bbaa76b Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Wed Dec 4 08:19:22 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:01 2019 +0000 LOK: don't send LOK notifications while switching views Changing the active view is done for virtually every LOK API, and in some cases simply changing the view results in a flurry of notifications that themselves caues further API calls that need to change the view. This moves the disabling of callbacks during setView to SfxLokHelper to make sure no view gets any notifications. This is needed because even when we disable notifications for the current view, the _other_ view(s) can still get notified as they lose their frame. Change-Id: Ia88a58d6a1162e48c40f4c4ce73c40ecb2c1fb7e Reviewed-on: https://gerrit.libreoffice.org/84417 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 68b75b3d181c..81c02c2c5d22 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -4634,28 +4634,14 @@ static void doc_destroyView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis SfxLokHelper::destroyView(nId); } -static void doc_setView(LibreOfficeKitDocument* pThis, int nId) +static void doc_setView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/, int nId) { comphelper::ProfileZone aZone("doc_setView"); SolarMutexGuard aGuard; SetLastExceptionMsg(); - LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); - const auto handlerIt = pDocument->mpCallbackFlushHandlers.find(nId); - if (handlerIt != pDocument->mpCallbackFlushHandlers.end()) - handlerIt->second->disableCallbacks(); - - try - { - SfxLokHelper::setView(nId); - } - catch (const std::exception&) - { - } - - if (handlerIt != pDocument->mpCallbackFlushHandlers.end()) - handlerIt->second->enableCallbacks(); + SfxLokHelper::setView(nId); } static int doc_getView(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index 4670bd098663..3d549d5cf1e1 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -34,6 +34,36 @@ using namespace com::sun::star; +namespace { +/// Used to disable callbacks. +/// Needed to avoid recursion when switching views, +/// which can cause clients to invoke LOKit API and +/// implicitly set the view, which might cause an +/// infinite recursion if not detected and prevented. +class DisableCallbacks +{ +public: + DisableCallbacks() + { + assert(m_nDisabled >= 0 && "Expected non-negative DisabledCallbacks state when disabling."); + ++m_nDisabled; + } + + ~DisableCallbacks() + { + assert(m_nDisabled > 0 && "Expected positive DisabledCallbacks state when re-enabling."); + --m_nDisabled; + } + + static bool disabled() { return m_nDisabled != 0; } + +private: + static int m_nDisabled; +}; + +int DisableCallbacks::m_nDisabled = 0; +} + int SfxLokHelper::createView() { SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst(); @@ -81,6 +111,8 @@ void SfxLokHelper::setView(int nId) { if (static_cast<sal_Int32>(pViewShell->GetViewShellId()) == nViewShellId) { + DisableCallbacks dc; + // update the current LOK language for the dialog tunneling comphelper::LibreOfficeKit::setLanguageTag(pViewShell->GetLOKLanguageTag()); @@ -166,6 +198,9 @@ static OString lcl_escapeQuotes(const OString &rStr) void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* pOtherView, int nType, const OString& rKey, const OString& rPayload) { + if (DisableCallbacks::disabled()) + return; + OString aPayload = OStringLiteral("{ \"viewId\": \"") + OString::number(SfxLokHelper::getView(pThisView)) + "\", \"part\": \"" + OString::number(pThisView->getPart()) + "\", \"" + rKey + "\": \"" + lcl_escapeQuotes(rPayload) + "\" }"; @@ -175,7 +210,7 @@ void SfxLokHelper::notifyOtherView(SfxViewShell* pThisView, SfxViewShell const* void SfxLokHelper::notifyOtherViews(SfxViewShell* pThisView, int nType, const OString& rKey, const OString& rPayload) { - if (SfxLokHelper::getViewsCount() <= 1) + if (SfxLokHelper::getViewsCount() <= 1 || DisableCallbacks::disabled()) return; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); @@ -212,7 +247,7 @@ namespace { void SfxLokHelper::sendUnoStatus(const SfxViewShell* pShell, const SfxPoolItem* pItem) { - if (!pShell || !pItem || pItem == INVALID_POOL_ITEM) + if (!pShell || !pItem || pItem == INVALID_POOL_ITEM || DisableCallbacks::disabled()) return; boost::property_tree::ptree aItem = pItem->dumpAsJSON(); @@ -236,7 +271,7 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, { assert(pThisView); - if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0) + if (SfxLokHelper::getViewsCount() <= 0 || nLOKWindowId == 0 || DisableCallbacks::disabled()) return; OStringBuffer aPayload; @@ -260,6 +295,10 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* pThisView, void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OString& rPayload) { OStringBuffer aBuf(32); + + if (DisableCallbacks::disabled()) + return; + aBuf.append(rPayload); if (comphelper::LibreOfficeKit::isPartInInvalidation()) { @@ -271,10 +310,7 @@ void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const OStri void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, const OString& rPayload, vcl::ITiledRenderable* pDoc, bool bInvalidateAll) { - if (!comphelper::LibreOfficeKit::isActive()) - return; - - if (!pDoc) + if (!pDoc || !comphelper::LibreOfficeKit::isActive() || DisableCallbacks::disabled()) return; if (bInvalidateAll) @@ -291,7 +327,7 @@ void SfxLokHelper::notifyDocumentSizeChanged(SfxViewShell const* pThisView, cons void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc, bool bInvalidateAll) { - if (!comphelper::LibreOfficeKit::isActive()) + if (!comphelper::LibreOfficeKit::isActive() || DisableCallbacks::disabled()) return; SfxViewShell* pViewShell = SfxViewShell::GetFirst(); @@ -304,6 +340,9 @@ void SfxLokHelper::notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable* pDoc void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisView, const OString& rRectangle) { + if (DisableCallbacks::disabled()) + return; + OString sPayload; if (comphelper::LibreOfficeKit::isViewIdForVisCursorInvalidation()) { @@ -319,6 +358,9 @@ void SfxLokHelper::notifyVisCursorInvalidation(OutlinerViewShell const* pThisVie void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload) { + if (DisableCallbacks::disabled()) + return; + const auto payload = rPayload.getStr(); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) @@ -330,6 +372,9 @@ void SfxLokHelper::notifyAllViews(int nType, const OString& rPayload) void SfxLokHelper::notifyContextChange(SfxViewShell const* pViewShell, const OUString& aApplication, const OUString& aContext) { + if (DisableCallbacks::disabled()) + return; + OString aBuffer = OUStringToOString(aApplication.replace(' ', '_'), RTL_TEXTENCODING_UTF8) + " " + commit 7193fa3f6782f843b5a9adf1d22172f2e85551fe Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Dec 3 17:31:08 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 jsdialogs: make possible to use on multiple mobile devices Change-Id: I1f7867dfd15e423f10622b3cec17ed8039d23c49 Reviewed-on: https://gerrit.libreoffice.org/84367 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 3aba87450c4f..0ee2117875a5 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -59,7 +59,8 @@ public: void Invoke() override { auto pNotifier = m_rSidebarDockingWin.GetLOKNotifier(); - if (!pNotifier || !comphelper::LibreOfficeKit::isActive()) + auto pMobileNotifier = SfxViewShell::Current(); + if (!pNotifier || (!pMobileNotifier && !comphelper::LibreOfficeKit::isActive())) return; try @@ -73,7 +74,7 @@ public: if (message != m_LastNotificationMessage) { m_LastNotificationMessage = message; - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + pMobileNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); } } else commit 6ef7133306e4563c2bb106a8c8c6840033e0bcae Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Tue Dec 3 09:23:27 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 sidebar: always trigger LOK notifications on resize This is critical for the Mobile Wizard, which refreshes by pushing, not pulling (following invalidations). Change-Id: Ie75c2f5c07798fa89c21901d6d0233c42768ea8d Reviewed-on: https://gerrit.libreoffice.org/84359 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index bb6a08e48d8e..3aba87450c4f 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -195,8 +195,9 @@ void SidebarDockingWindow::NotifyResize() LOKClose(); SetLOKNotifier(pCurrentView); - mpIdleNotify->Start(); } + + mpIdleNotify->Start(); } } commit 98ee2b5080ac88bd4c09ce330c9baae924d5be16 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Fri May 24 09:11:11 2019 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 sfx2: LOK: disable the Reset button from tabbed dialogs The reset functionality seems to be confusing to more than one user. Their expectation isn't always matching the functionality, perhaps because it has rough edges(?). Disabling for LOK to avoid this; users can Cancel and start over if they wish to do (which is what the Reset button is supposed to do in effect). (cherry picked from commit c3c28235cf1f853e644250ba110b2715a270a8b5) Change-Id: I4a744dd0263ab72a5858746c1f3572e62990a13b Reviewed-on: https://gerrit.libreoffice.org/83630 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index 9b73516c97c2..e25c30baea5b 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -38,6 +38,7 @@ #include <vcl/virdev.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <comphelper/lok.hxx> #include <sfx2/strings.hrc> #include <helpids.h> @@ -353,6 +354,10 @@ SfxTabDialogController::SfxTabDialogController m_xExampleSet.reset(new SfxItemSet(*m_pSet)); m_pOutSet.reset(new SfxItemSet(*m_pSet->GetPool(), m_pSet->GetRanges())); } + + // The reset functionality seems to be confusing to many; disable in LOK. + if (comphelper::LibreOfficeKit::isActive()) + RemoveResetButton(); } IMPL_LINK_NOARG(SfxTabDialogController, OkHdl, weld::Button&, void) commit f3f7ea23c4611856f051cb6aeca115c27ef5b1e7 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Nov 24 09:56:02 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 sidebar: do not emit unnecessary created notifications This also breaks a potentially recursive cycle where each 'created' notification requests a re-rendering, which triggers view change (when more than one view is open on the doc), which triggers a frame change, which resets the sidebar, causing a 'created' notification, thereby starting the cycle anew. Change-Id: I1aafe7f45871748afb393fa55c357037215e6c33 Reviewed-on: https://gerrit.libreoffice.org/83629 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 15f21057aa0e..bb6a08e48d8e 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -42,19 +42,23 @@ namespace sfx2 { namespace sidebar { class SidebarNotifyIdle : public Idle { - SidebarDockingWindow &mrSidebarDockingWin; + SidebarDockingWindow& m_rSidebarDockingWin; + std::string m_LastNotificationMessage; + vcl::LOKWindowId m_LastLOKWindowId; public: SidebarNotifyIdle(SidebarDockingWindow &rSidebarDockingWin) : Idle("Sidebar notify"), - mrSidebarDockingWin(rSidebarDockingWin) + m_rSidebarDockingWin(rSidebarDockingWin), + m_LastNotificationMessage(), + m_LastLOKWindowId(0) { SetPriority(TaskPriority::POST_PAINT); } void Invoke() override { - auto pNotifier = mrSidebarDockingWin.GetLOKNotifier(); + auto pNotifier = m_rSidebarDockingWin.GetLOKNotifier(); if (!pNotifier || !comphelper::LibreOfficeKit::isActive()) return; @@ -64,19 +68,36 @@ public: { // Mobile. std::stringstream aStream; - boost::property_tree::write_json(aStream, mrSidebarDockingWin.DumpAsPropertyTree()); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); + boost::property_tree::write_json(aStream, m_rSidebarDockingWin.DumpAsPropertyTree()); + const std::string message = aStream.str(); + if (message != m_LastNotificationMessage) + { + m_LastNotificationMessage = message; + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, message.c_str()); + } } else { // On desktop use the classic notifications. - std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back("type", "deck"); - const Point pos = Point(mrSidebarDockingWin.GetOutOffXPixel(), - mrSidebarDockingWin.GetOutOffYPixel()); - aItems.emplace_back("position", pos.toString()); - aItems.emplace_back("size", mrSidebarDockingWin.GetSizePixel().toString()); - pNotifier->notifyWindow(mrSidebarDockingWin.GetLOKWindowId(), "created", aItems); + 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) commit d1739c7fc0713190b2dcbcbdda831490759f331a Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Fri Nov 22 21:07:21 2019 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 sidebar: reset the LOKNotifier when the ViewShell changes The ViewShell (which implements the LOKNotifier interface) changes during the lifetime of the SidebarDockingWindow. This is extremely problematic, because we assign the LOKNotifier to a window, and use it to emit notifications to the LOKit clients. When the ViewShell changes, a window (the SidebarDockingWindow in this case) may end up using an old ViewShell instance, which may have just been destroyed. Now we properly reset the LOKNotifier to make sure we are using the current ViewShell at all times. This is still not ideal, since we may use the wrong ViewShell to send out notifications, but we can't control that as we are at the mercy of the mechanism that changes the current ViewShell. This also removes obsolete flags to control which document-types supported sidebar, as well as other misc cleanups. Change-Id: Ic208f64596a39feb7354958cf4d5e1e033d87b5b Reviewed-on: https://gerrit.libreoffice.org/83627 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/include/sfx2/sidebar/SidebarChildWindow.hxx b/include/sfx2/sidebar/SidebarChildWindow.hxx index 0351c3859d9b..7902fddbfad0 100644 --- a/include/sfx2/sidebar/SidebarChildWindow.hxx +++ b/include/sfx2/sidebar/SidebarChildWindow.hxx @@ -39,11 +39,6 @@ public: SFX_DECL_CHILDWINDOW_WITHID(SidebarChildWindow); static sal_Int32 GetDefaultWidth(vcl::Window const * pWindow); - - bool IsSidebarVisibleInLOK() const { return mbSidebarVisibleInLOK; } - -private: - const bool mbSidebarVisibleInLOK; }; diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 64b45d0f370b..436f5ebce038 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -58,15 +58,13 @@ private: SfxChildAlignment eCurrentAlignment, SfxChildAlignment eRequestedAlignment) override; + /// Notify LOKit that we closed and release the LOKNotifier. + void LOKClose(); + ::rtl::Reference<sfx2::sidebar::SidebarController> mpSidebarController; bool mbIsReadyToDrag; std::unique_ptr<svt::AcceleratorExecute> mpAccel; - void DoDispose(); - - const bool mbSidebarVisibleInLOK; - - const SfxViewShell* mpOldViewShell; std::unique_ptr<SidebarNotifyIdle> mpIdleNotify; }; diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx index 0690061a634b..99f30bed1fef 100644 --- a/sfx2/source/sidebar/SidebarChildWindow.cxx +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -33,7 +33,6 @@ SFX_IMPL_DOCKINGWINDOW_WITHID(SidebarChildWindow, SID_SIDEBAR); SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, SfxChildWinInfo* pInfo) : SfxChildWindow(pParentWindow, nId) - , mbSidebarVisibleInLOK(pInfo && (pInfo->aModule == "scalc" || pInfo->aModule == "simpress" || pInfo->aModule == "swriter")) { auto pDockWin = VclPtr<SidebarDockingWindow>::Create( pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 6daea2ed4d4d..15f21057aa0e 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -91,8 +91,6 @@ SidebarDockingWindow::SidebarDockingWindow(SfxBindings* pSfxBindings, SidebarChi : SfxDockingWindow(pSfxBindings, &rChildWindow, pParentWindow, nBits) , mpSidebarController() , mbIsReadyToDrag(false) - , mbSidebarVisibleInLOK(rChildWindow.IsSidebarVisibleInLOK()) - , mpOldViewShell(SfxViewShell::Current()) , mpIdleNotify(new SidebarNotifyIdle(*this)) { // Get the XFrame from the bindings. @@ -114,27 +112,27 @@ SidebarDockingWindow::~SidebarDockingWindow() } void SidebarDockingWindow::dispose() -{ - DoDispose(); - SfxDockingWindow::dispose(); -} - -void SidebarDockingWindow::DoDispose() { if (comphelper::LibreOfficeKit::isActive()) - { - if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) - { - pNotifier->notifyWindow(GetLOKWindowId(), "close"); - ReleaseLOKNotifier(); - } - } + LOKClose(); Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpSidebarController.get()), UNO_QUERY); mpSidebarController.clear(); if (xComponent.is()) - { xComponent->dispose(); + + SfxDockingWindow::dispose(); +} + +void SidebarDockingWindow::LOKClose() +{ + assert(comphelper::LibreOfficeKit::isActive()); + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + { + mpIdleNotify->Stop(); + + pNotifier->notifyWindow(GetLOKWindowId(), "close"); + ReleaseLOKNotifier(); } } @@ -151,7 +149,9 @@ void SidebarDockingWindow::GetFocus() bool SidebarDockingWindow::Close() { - mpSidebarController->SetFloatingDeckClosed( true ); + if (mpSidebarController.is()) + mpSidebarController->SetFloatingDeckClosed(true); + return SfxDockingWindow::Close(); } @@ -164,25 +164,16 @@ void SidebarDockingWindow::Resize() void SidebarDockingWindow::NotifyResize() { - if (comphelper::LibreOfficeKit::isActive() && SfxViewShell::Current() && mbSidebarVisibleInLOK) + if (comphelper::LibreOfficeKit::isActive() && mpSidebarController.is() && SfxViewShell::Current()) { - // When a new view is attached, and Sidebar is created (SidebarDockingWindow is constructed), - // unfortunately we still have the *old* ViewShell (and ViewFrame). This happens because - // we get multiple NotifyResize are called while SfxBaseController::ConnectSfxFrame_Impl - // goes through the motions of creating and attaching a new frame/view. - // Problem is that once we SetLOKNotifier on a window, we can't change it. So we better - // set the correct one. Worse, if we set the old one, we will change the sidebar of the - // wrong view, messing things up badly for the users. - // Knowing the above, we wait until the dust settles, by observing when the ViewShell is - // changed from the time we were created. - // Note: this means we *cannot* create a sidebar post attaching a new view because the - // ViewShell will not change, and therefore we will never SetLOKNotifier. To avoid that - // we hide sidebars instead of closing (see OnMenuItemSelected in SidebarController). - if (mpSidebarController.is() && !GetLOKNotifier()) - SetLOKNotifier(SfxViewShell::Current()); - - if (GetLOKNotifier()) + const vcl::ILibreOfficeKitNotifier* pCurrentView = SfxViewShell::Current(); + if (GetLOKNotifier() != pCurrentView) { + // ViewShell not yet set, or has changed. Reset it. + // Note GetLOKWindowId will return a new value after resetting, so we must notify clients. + LOKClose(); + + SetLOKNotifier(pCurrentView); mpIdleNotify->Start(); } } commit 03d1d0ae8053838e31b2f43dd0ed6f67dfc6534f Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Nov 20 16:10:33 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 jsdialogs: simply resize to reload Change-Id: I4eaee0f1ec27674d74fc7abfa05abaf39cb97117 Reviewed-on: https://gerrit.libreoffice.org/83326 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 36a37165154c..68b75b3d181c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3359,8 +3359,7 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin } catch(...) {} // force resend - pWindow->Hide(); - pWindow->Show(); + pWindow->Resize(); } } commit dbcb0b2ad47782576b1502ec13deb4652ae214f6 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Tue Nov 19 17:59:17 2019 +0200 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:30:00 2019 +0000 Revert "jsdialogs: don't recreate sidebar on event" This reverts commit 0c75ccd84ea64f2c69afe104a4b4ebd55b3cc215. Change-Id: I127cd0179d24af52f695c9f1ee0792b9573e6e0e Reviewed-on: https://gerrit.libreoffice.org/83219 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e0d5973b5dcd..36a37165154c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3357,6 +3357,10 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin pUIWindow->execute(sClickAction, aMap); } } catch(...) {} + + // force resend + pWindow->Hide(); + pWindow->Show(); } } commit 885784f5d8808b38d86eb9c878472f91b56dad7b Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Nov 14 12:05:11 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 jsdialogs: don't recreate sidebar on event This will allow to use mobile wizard in multiple views. JS listeners on uno commands are used instead. Also vcl events broadcasting is needed. Change-Id: Iddb230bfcf899384749d92da359b0a6a1260bc9f Reviewed-on: https://gerrit.libreoffice.org/82669 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 36a37165154c..e0d5973b5dcd 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3357,10 +3357,6 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin pUIWindow->execute(sClickAction, aMap); } } catch(...) {} - - // force resend - pWindow->Hide(); - pWindow->Show(); } } commit 8955c25c3b4fb44a7d1adcf088917d2329bdc99e Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Sun Nov 11 23:35:03 2018 -0500 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 sd: for_each -> range-for Simpler, more readable, and sensible stacktraces. Change-Id: I8e8a9903e3bf2ce5f31b841db9cb68fe4edc3fb6 (cherry picked from commit a00490bf0d2ee2c94f494978ebfeb8012a02e678) Reviewed-on: https://gerrit.libreoffice.org/82403 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx index 9657957d9ed2..15460fe15f7c 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerResourceManager.cxx @@ -69,12 +69,8 @@ void ConfigurationControllerResourceManager::ActivateResources ( // Iterate in normal order over the resources that are to be // activated so that resources on which others depend are activated // before the depending resources are activated. - ::std::for_each( - rResources.begin(), - rResources.end(), - [&] (Reference<XResourceId> const& xResource) { - return ActivateResource(xResource, rxConfiguration); - } ); + for (const Reference<XResourceId>& xResource : rResources) + ActivateResource(xResource, rxConfiguration); } void ConfigurationControllerResourceManager::DeactivateResources ( commit 98e569f29154c5f295516090186db5836e749a0d Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Thu Oct 31 07:26:34 2019 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 sidebar: check for valid current deck before closing Also, cleanup unused/unnecessary LOKNotifier logic from Deck.cxx and use emplace_back where possible. Change-Id: I300c5158b12593e8130f5b6273c1ea3bcbefea7f Reviewed-on: https://gerrit.libreoffice.org/82402 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index e942cab3887b..d6c485b1f3c8 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -81,9 +81,6 @@ Deck::~Deck() void Deck::dispose() { - if (comphelper::LibreOfficeKit::isActive()) - ReleaseLOKNotifier(); - SharedPanelContainer aPanels; aPanels.swap(maPanels); @@ -318,15 +315,6 @@ void Deck::ShowPanel(const Panel& rPanel) Point( mpScrollContainer->GetPosPixel().X(), -nNewThumbPos)); - - if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) - { - std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back("type", "deck"); - aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); - aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); - pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); - } } static OUString GetWindowClassification(const vcl::Window* pWindow) diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 9214c651f3a6..14c78d918494 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1212,6 +1212,13 @@ IMPL_LINK(SidebarController, OnMenuItemSelected, Menu*, pMenu, bool) void SidebarController::RequestCloseDeck() { + if (comphelper::LibreOfficeKit::isActive() && mpCurrentDeck.get()) + { + const vcl::ILibreOfficeKitNotifier* pNotifier = mpCurrentDeck->GetLOKNotifier(); + if (pNotifier) + pNotifier->notifyWindow(mpCurrentDeck->GetLOKWindowId(), "close"); + } + mbIsDeckRequestedOpen = false; UpdateDeckOpenState(); diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 377d7d46d37a..9aa966814e07 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -1221,11 +1221,11 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) // In case we are routing the window, notify the client std::vector<vcl::LOKPayloadItem> aPayload; if (pRectangle) - aPayload.push_back(std::make_pair(OString("rectangle"), pRectangle->toString())); + aPayload.emplace_back("rectangle", pRectangle->toString()); else { const tools::Rectangle aRect(Point(0, 0), GetSizePixel()); - aPayload.push_back(std::make_pair(OString("rectangle"), aRect.toString())); + aPayload.emplace_back("rectangle", aRect.toString()); } pNotifier->notifyWindow(GetLOKWindowId(), "invalidate", aPayload); commit fb9becb113d718cb4f1313d0ef2ca6bd0560fab9 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Wed Nov 6 19:13:12 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 jsdialogs: refresh after event Change-Id: Ie0128ec38dd442a04d6ea9e24cea254f5bc69791 Reviewed-on: https://gerrit.libreoffice.org/82170 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 8fe8d2c7cf10..36a37165154c 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3359,8 +3359,8 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin } catch(...) {} // force resend - pWindow->GetParent()->Hide(); - pWindow->GetParent()->Show(); + pWindow->Hide(); + pWindow->Show(); } } commit e5a75a718dd5ed3b1170797d82e1e6a36fceb8b3 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Wed Oct 30 06:12:26 2019 -0400 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 sidebars: add JSDialog support to sidebars Currently the JSDialog path is only for mobile and we use the passive notifications for desktop Online. Change-Id: I5d26fee9475ede665f269ca1f7b582455be08e50 Reviewed-on: https://gerrit.libreoffice.org/81754 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/include/sfx2/sidebar/SidebarDockingWindow.hxx b/include/sfx2/sidebar/SidebarDockingWindow.hxx index 33ced4437582..64b45d0f370b 100644 --- a/include/sfx2/sidebar/SidebarDockingWindow.hxx +++ b/include/sfx2/sidebar/SidebarDockingWindow.hxx @@ -33,6 +33,8 @@ class SidebarChildWindow; class SidebarController; +class SidebarNotifyIdle; + class SidebarDockingWindow final : public SfxDockingWindow { public: @@ -63,6 +65,9 @@ private: void DoDispose(); const bool mbSidebarVisibleInLOK; + + const SfxViewShell* mpOldViewShell; + std::unique_ptr<SidebarNotifyIdle> mpIdleNotify; }; } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index bb913838264b..6daea2ed4d4d 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -31,18 +31,69 @@ #include <tools/gen.hxx> #include <vcl/event.hxx> #include <comphelper/lok.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> + +#include <boost/property_tree/json_parser.hpp> using namespace css; using namespace css::uno; namespace sfx2 { namespace sidebar { +class SidebarNotifyIdle : public Idle +{ + SidebarDockingWindow &mrSidebarDockingWin; + +public: + SidebarNotifyIdle(SidebarDockingWindow &rSidebarDockingWin) : + Idle("Sidebar notify"), + mrSidebarDockingWin(rSidebarDockingWin) + { + SetPriority(TaskPriority::POST_PAINT); + } + + void Invoke() override + { + auto pNotifier = mrSidebarDockingWin.GetLOKNotifier(); + if (!pNotifier || !comphelper::LibreOfficeKit::isActive()) + return; + + try + { + if (comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView())) + { + // Mobile. + std::stringstream aStream; + boost::property_tree::write_json(aStream, mrSidebarDockingWin.DumpAsPropertyTree()); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); + } + else + { + // On desktop use the classic notifications. + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + const Point pos = Point(mrSidebarDockingWin.GetOutOffXPixel(), + mrSidebarDockingWin.GetOutOffYPixel()); + aItems.emplace_back("position", pos.toString()); + aItems.emplace_back("size", mrSidebarDockingWin.GetSizePixel().toString()); + pNotifier->notifyWindow(mrSidebarDockingWin.GetLOKWindowId(), "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) , mbSidebarVisibleInLOK(rChildWindow.IsSidebarVisibleInLOK()) + , mpOldViewShell(SfxViewShell::Current()) + , mpIdleNotify(new SidebarNotifyIdle(*this)) { // Get the XFrame from the bindings. if (pSfxBindings==nullptr || pSfxBindings->GetDispatcher()==nullptr) @@ -130,13 +181,9 @@ void SidebarDockingWindow::NotifyResize() if (mpSidebarController.is() && !GetLOKNotifier()) SetLOKNotifier(SfxViewShell::Current()); - if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) + if (GetLOKNotifier()) { - std::vector<vcl::LOKPayloadItem> aItems; - aItems.emplace_back("type", "deck"); - aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); - aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); - pNotifier->notifyWindow(GetLOKWindowId(), "created", aItems); + mpIdleNotify->Start(); } } } commit 17ed1ff1c091c3130839cbbcec182b6ad8b1618f Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Dec 16 11:48:06 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 Revert "jsdialogs: send JSON to the client" This reverts commit 8f5f2ec5d1055f2bb81ad05e23280c51f5e6eb27. Change-Id: I8420813797352a3ab6a00adfb484170c75619b0c diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index a57e16f0c11f..e942cab3887b 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -38,8 +38,6 @@ #include <vcl/IDialogRenderable.hxx> #include <tools/svborder.hxx> #include <sal/log.hxx> -#include <boost/property_tree/json_parser.hpp> -#include <LibreOfficeKit/LibreOfficeKitEnums.h> using namespace css; using namespace css::uno; @@ -184,16 +182,11 @@ void Deck::Resize() if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { - try - { - std::stringstream aStream; - boost::property_tree::write_json(aStream, DumpAsPropertyTree()); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); - } - catch(boost::property_tree::json_parser::json_parser_error& rError) - { - SAL_WARN("sfx.sidebar", rError.message()); - } + std::vector<vcl::LOKPayloadItem> aItems; + aItems.emplace_back("type", "deck"); + aItems.emplace_back(std::make_pair("position", Point(GetOutOffXPixel(), GetOutOffYPixel()).toString())); + aItems.emplace_back(std::make_pair("size", GetSizePixel().toString())); + pNotifier->notifyWindow(GetLOKWindowId(), "size_changed", aItems); } } commit 6134399f7b3b9474263ff311ebc4769a70288b67 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Dec 16 11:45:37 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:59 2019 +0000 Revert "lok: only generate sidebar JSON for mobile views, for now." This reverts commit 2d7d3cc936cb5b0a242ad7a5c714ebde03df574d. diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 91ff5dc340a6..a57e16f0c11f 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -182,10 +182,7 @@ void Deck::Resize() { Window::Resize(); - const vcl::ILibreOfficeKitNotifier *pNotifier; - if (comphelper::LibreOfficeKit::isActive() && - comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) && - (pNotifier = GetLOKNotifier())) + if (const vcl::ILibreOfficeKitNotifier* pNotifier = GetLOKNotifier()) { try { commit b35e97f75c1093db3516b74b637c16c5dc8e43a2 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Dec 16 11:45:17 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:58 2019 +0000 Revert "jsdialogs: emit JSON at idle to avoid repeated emission." This reverts commit 7d9932ade30464abf297f2e3c3690cca68d6bf71. diff --git a/include/sfx2/sidebar/Deck.hxx b/include/sfx2/sidebar/Deck.hxx index 278bb4f49a01..65b44d7efc11 100644 --- a/include/sfx2/sidebar/Deck.hxx +++ b/include/sfx2/sidebar/Deck.hxx @@ -29,7 +29,6 @@ namespace sfx2 { namespace sidebar { class DeckDescriptor; class DeckTitleBar; -class DeckNotifyIdle; /** This is the parent window of the panels. It displays the deck title. @@ -89,7 +88,6 @@ private: sal_Int32 mnMinimalWidth; sal_Int32 mnMinimalHeight; SharedPanelContainer maPanels; - std::unique_ptr<DeckNotifyIdle> mpIdleNotify; VclPtr<DeckTitleBar> mpTitleBar; VclPtr<vcl::Window> mpScrollClipWindow; VclPtr<ScrollContainerWindow> mpScrollContainer; diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index e185e726157a..91ff5dc340a6 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -44,35 +44,8 @@ using namespace css; using namespace css::uno; - namespace sfx2 { namespace sidebar { -class DeckNotifyIdle : public Idle -{ - Deck &mrDeck; -public: - DeckNotifyIdle(Deck &rDeck) : - Idle("Deck notify"), - mrDeck(rDeck) - { - SetPriority(TaskPriority::POST_PAINT); - } - void Invoke() override - { - auto pNotifier = mrDeck.GetLOKNotifier(); - try - { - std::stringstream aStream; - boost::property_tree::write_json(aStream, mrDeck.DumpAsPropertyTree()); - pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); - } - catch(boost::property_tree::json_parser::json_parser_error& rError) - { - SAL_WARN("sfx.sidebar", rError.message()); - } - } -}; - Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, const std::function<void()>& rCloserAction) : Window(pParentWindow, 0) @@ -80,7 +53,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, , mnMinimalWidth(0) , mnMinimalHeight(0) , maPanels() - , mpIdleNotify(new DeckNotifyIdle(*this)) , mpTitleBar(VclPtr<DeckTitleBar>::Create(rDeckDescriptor.msTitle, this, rCloserAction)) , mpScrollClipWindow(VclPtr<vcl::Window>::Create(this)) , mpScrollContainer(VclPtr<ScrollContainerWindow>::Create(mpScrollClipWindow.get())) @@ -210,11 +182,21 @@ void Deck::Resize() { Window::Resize(); + const vcl::ILibreOfficeKitNotifier *pNotifier; if (comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isMobile(SfxLokHelper::getView()) && - GetLOKNotifier()) + (pNotifier = GetLOKNotifier())) { - mpIdleNotify->Start(); + try + { + std::stringstream aStream; + boost::property_tree::write_json(aStream, DumpAsPropertyTree()); + pNotifier->libreOfficeKitViewCallback(LOK_CALLBACK_JSDIALOG, aStream.str().c_str()); + } + catch(boost::property_tree::json_parser::json_parser_error& rError) + { + SAL_WARN("sfx.sidebar", rError.message()); + } } } commit 08f3691996ed7dd4d7bc7c641000e46c6bc00bfc Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Dec 16 11:44:25 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 16 17:29:58 2019 +0000 Revert "jsdialogs: set LOKNotifier in Deck" This reverts commit 5db9bfee77e560c46457a40aee3d2b0752ab2fd8. diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index a2e9024433f6..e185e726157a 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -96,11 +96,6 @@ Deck::Deck(const DeckDescriptor& rDeckDescriptor, vcl::Window* pParentWindow, mpVerticalScrollBar->SetScrollHdl(LINK(this, Deck, HandleVerticalScrollBarChange)); - if (comphelper::LibreOfficeKit::isActive()) - { - SetLOKNotifier(SfxViewShell::Current()); - } - #ifdef DEBUG SetText(OUString("Deck")); mpScrollClipWindow->SetText(OUString("ScrollClipWindow")); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits