diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-18 14:29:18 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-09-21 07:30:27 +0200 |
commit | 1a83f30ebe2c56b00804ce774537b34f1049be84 (patch) | |
tree | 9ee2aeb5ad6dc3378027a63bed2344b2c271e9e6 /sw | |
parent | af29b2b57cc07490cc36ff02d5ff3f3844e7c102 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/tiledrendering/tiledrendering.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/crsr/viscrs.cxx | 26 |
2 files changed, 24 insertions, 6 deletions
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<beans::PropertyValue> 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 cd47accc7035..01a2da7e6e73 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector<OString>* 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<OString>* 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<OString>* 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()); } } |