desktop/qa/desktop_lib/test_desktop_lib.cxx | 4 ++++ desktop/source/lib/init.cxx | 16 ++++++++++++++++ sfx2/source/sidebar/SidebarChildWindow.cxx | 10 +++++++--- 3 files changed, 27 insertions(+), 3 deletions(-)
New commits: commit 70d3bbe11e56f12a339a5b8759b53a96b4fe84ab Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> AuthorDate: Thu May 2 23:16:30 2019 -0400 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jul 30 18:52:48 2019 +0200 sfx2: Enable sidebar on calc and writer, but not in impress Added by Noel to this commit: And add a special deregister mode to doc_registerCallback so we can unregister stack-based callback objects in the presence of multiple views. Reviewed-on: https://gerrit.libreoffice.org/71715 Reviewed-by: Jan Holesovsky <ke...@collabora.com> Tested-by: Jan Holesovsky <ke...@collabora.com> (cherry picked from commit fba6d4267b3f827269d6550dcb003cc56b31e493) Change-Id: I8d846bc1f794cf16fd45486fd83ef87f43fd52c7 Reviewed-on: https://gerrit.libreoffice.org/76555 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index e0647da2f6af..112f29f4c59e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1939,6 +1939,7 @@ void DesktopLOKTest::testWriterCommentInsertCursor() CPPUNIT_ASSERT(aView1.m_aOwnCursor.IsEmpty()); Scheduler::ProcessEventsToIdle(); + pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast<void*>(1)); } #if HAVE_MORE_FONTS @@ -2210,6 +2211,8 @@ void DesktopLOKTest::testCommentsCallbacksWriter() CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(5), aTree.get_child("comments").size()); + + pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast<void*>(1)); } void DesktopLOKTest::testRunMacro() @@ -2629,6 +2632,7 @@ void DesktopLOKTest::testShowHideDialog() Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT_EQUAL(std::string("invalidate"), aView.m_aCallbackWindowResult.get<std::string>("action")); + pDocument->m_pDocumentClass->registerCallback(pDocument, nullptr, reinterpret_cast<void*>(1)); } namespace { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f8d93534f44a..89078209ef43 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2828,6 +2828,22 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis); + // This is used by unit-tests to unregister stack-local callback objects where we have multiple views + // so we cannot rely on SfxLokHelper::getView + if (pCallback == nullptr && pData != nullptr) + { + for (auto& pair1 : pDocument->mpCallbackFlushHandlers) + { + int nView = pair1.first; + for (auto& pair2 : pDocument->mpCallbackFlushHandlers) + { + pair2.second->removeViewStates(nView); + } + pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pThis, nullptr, nullptr)); + } + return; + } + int nView = SfxLokHelper::getView(); if (nView < 0) return; diff --git a/sfx2/source/sidebar/SidebarChildWindow.cxx b/sfx2/source/sidebar/SidebarChildWindow.cxx index 678c5538aa0b..b958d840dd3b 100644 --- a/sfx2/source/sidebar/SidebarChildWindow.cxx +++ b/sfx2/source/sidebar/SidebarChildWindow.cxx @@ -33,7 +33,7 @@ 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 == "simpress") + , mbSidebarVisibleInLOK(pInfo && (pInfo->aModule == "scalc" || pInfo->aModule == "swriter")) { auto pDockWin = VclPtr<SidebarDockingWindow>::Create( pBindings, *this, pParentWindow, WB_STDDOCKWIN | WB_OWNERDRAWDECORATION | WB_CLIPCHILDREN @@ -53,8 +53,12 @@ SidebarChildWindow::SidebarChildWindow(vcl::Window* pParentWindow, sal_uInt16 nI // HACK: unfortunately I haven't found a clean solution to do // this, so do it this way: // - pDockWin->SetSizePixel(Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), - pDockWin->GetSizePixel().Height())); + if (!comphelper::LibreOfficeKit::isActive()) + { + pDockWin->SetSizePixel( + Size(TabBar::GetDefaultWidth() * GetWindow()->GetDPIScaleFactor(), + pDockWin->GetSizePixel().Height())); + } } pDockWin->Initialize(pInfo); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits