From 4cb2a43c66b393ffd28d91e5fb27d782eaf7acb0 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 18 Sep 2015 14:29:18 +0200 Subject: [PATCH 154/398] sw: implement per-view LOK_CALLBACK_TEXT_SELECTION Also: - let the unit test set the global LOK flag, as sw code now depends on that - in framework, don't return early after emitting the LOK status indicator callback, otherwise CppunitTest_sw_tiledrendering shows how sw LOK callbacks are missing Change-Id: I0c4ac12f2ef5118d29afd131676bcb27d5db7746 (cherry picked from commit 1a83f30ebe2c56b00804ce774537b34f1049be84) --- framework/source/helper/statusindicator.cxx | 2 -- sw/qa/extras/tiledrendering/tiledrendering.cxx | 4 ++++ sw/source/core/crsr/viscrs.cxx | 26 ++++++++++++++++++++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/framework/source/helper/statusindicator.cxx b/framework/source/helper/statusindicator.cxx index 5c9dafc5ba81..ce8310a07cf5 100644 --- a/framework/source/helper/statusindicator.cxx +++ b/framework/source/helper/statusindicator.cxx @@ -43,7 +43,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText , m_nLastCallbackPercent = -1; comphelper::LibreOfficeKit::statusIndicatorStart(); - return; } css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); @@ -60,7 +59,6 @@ void SAL_CALL StatusIndicator::end() if (comphelper::LibreOfficeKit::isActive()) { comphelper::LibreOfficeKit::statusIndicatorFinish(); - return; } css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 07dd7e34b29c..e7ab14942f79 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -383,6 +383,8 @@ void SwTiledRenderingTest::testSearchViewArea() void SwTiledRenderingTest::testSearchTextFrame() { #if !defined(WNT) && !defined(MACOSX) + comphelper::LibreOfficeKit::setActive(); + SwXTextDocument* pXTextDocument = createDoc("search.odt"); pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); uno::Sequence aPropertyValues(comphelper::InitPropertySequence( @@ -393,6 +395,8 @@ void SwTiledRenderingTest::testSearchTextFrame() comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); // This was empty: nothing was highlighted after searching for 'TextFrame'. CPPUNIT_ASSERT(!m_aTextSelection.isEmpty()); + + comphelper::LibreOfficeKit::setActive(false); #endif } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 13cfcd89b22b..808756159545 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) // talks about "the" cursor at the moment. As long as that's true, // don't say anything about the Writer cursor till a draw object is // being edited. - if (GetShell()->isTiledRendering() && !pView->GetTextEditObject()) + if (comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject()) { if (!empty()) { @@ -377,12 +377,18 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) if (aStartRect.HasArea()) { OString sRect = aStartRect.SVRect().toString(); - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); + else + GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); } if (aEndRect.HasArea()) { OString sRect = aEndRect.SVRect().toString(); - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); + else + GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); } } @@ -396,7 +402,12 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) } OString sRect = ss.str().c_str(); if (!pSelectionRectangles) - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + { + if (comphelper::LibreOfficeKit::isViewCallback()) + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + else + GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + } else pSelectionRectangles->push_back(sRect); } @@ -593,7 +604,7 @@ void SwShellCrsr::Show() pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles); } - if (GetShell()->isTiledRendering()) + if (comphelper::LibreOfficeKit::isActive()) { std::stringstream ss; bool bFirst = true; @@ -609,7 +620,10 @@ void SwShellCrsr::Show() ss << rSelectionRectangle.getStr(); } OString sRect = ss.str().c_str(); - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + else + GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); } } -- 2.12.0