Kaydet (Commit) 8f95f341 authored tarafından Miklos Vajna's avatar Miklos Vajna

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 1a83f30e)
üst 8dc6418d
...@@ -43,7 +43,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText , ...@@ -43,7 +43,6 @@ void SAL_CALL StatusIndicator::start(const OUString& sText ,
m_nLastCallbackPercent = -1; m_nLastCallbackPercent = -1;
comphelper::LibreOfficeKit::statusIndicatorStart(); comphelper::LibreOfficeKit::statusIndicatorStart();
return;
} }
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
...@@ -60,7 +59,6 @@ void SAL_CALL StatusIndicator::end() ...@@ -60,7 +59,6 @@ void SAL_CALL StatusIndicator::end()
if (comphelper::LibreOfficeKit::isActive()) if (comphelper::LibreOfficeKit::isActive())
{ {
comphelper::LibreOfficeKit::statusIndicatorFinish(); comphelper::LibreOfficeKit::statusIndicatorFinish();
return;
} }
css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory); css::uno::Reference< css::task::XStatusIndicatorFactory > xFactory(m_xFactory);
......
...@@ -383,6 +383,8 @@ void SwTiledRenderingTest::testSearchViewArea() ...@@ -383,6 +383,8 @@ void SwTiledRenderingTest::testSearchViewArea()
void SwTiledRenderingTest::testSearchTextFrame() void SwTiledRenderingTest::testSearchTextFrame()
{ {
#if !defined(WNT) && !defined(MACOSX) #if !defined(WNT) && !defined(MACOSX)
comphelper::LibreOfficeKit::setActive();
SwXTextDocument* pXTextDocument = createDoc("search.odt"); SwXTextDocument* pXTextDocument = createDoc("search.odt");
pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this); pXTextDocument->registerCallback(&SwTiledRenderingTest::callback, this);
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence( uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
...@@ -393,6 +395,8 @@ void SwTiledRenderingTest::testSearchTextFrame() ...@@ -393,6 +395,8 @@ void SwTiledRenderingTest::testSearchTextFrame()
comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues); comphelper::dispatchCommand(".uno:ExecuteSearch", aPropertyValues);
// This was empty: nothing was highlighted after searching for 'TextFrame'. // This was empty: nothing was highlighted after searching for 'TextFrame'.
CPPUNIT_ASSERT(!m_aTextSelection.isEmpty()); CPPUNIT_ASSERT(!m_aTextSelection.isEmpty());
comphelper::LibreOfficeKit::setActive(false);
#endif #endif
} }
......
...@@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) ...@@ -361,7 +361,7 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
// talks about "the" cursor at the moment. As long as that's true, // 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 // don't say anything about the Writer cursor till a draw object is
// being edited. // being edited.
if (GetShell()->isTiledRendering() && !pView->GetTextEditObject()) if (comphelper::LibreOfficeKit::isActive() && !pView->GetTextEditObject())
{ {
if (!empty()) if (!empty())
{ {
...@@ -377,12 +377,18 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles) ...@@ -377,12 +377,18 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
if (aStartRect.HasArea()) if (aStartRect.HasArea())
{ {
OString sRect = aStartRect.SVRect().toString(); 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()) if (aEndRect.HasArea())
{ {
OString sRect = aEndRect.SVRect().toString(); 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) ...@@ -396,7 +402,12 @@ void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
} }
OString sRect = ss.str().c_str(); OString sRect = ss.str().c_str();
if (!pSelectionRectangles) 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 else
pSelectionRectangles->push_back(sRect); pSelectionRectangles->push_back(sRect);
} }
...@@ -593,7 +604,7 @@ void SwShellCrsr::Show() ...@@ -593,7 +604,7 @@ void SwShellCrsr::Show()
pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles); pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles);
} }
if (GetShell()->isTiledRendering()) if (comphelper::LibreOfficeKit::isActive())
{ {
std::stringstream ss; std::stringstream ss;
bool bFirst = true; bool bFirst = true;
...@@ -609,7 +620,10 @@ void SwShellCrsr::Show() ...@@ -609,7 +620,10 @@ void SwShellCrsr::Show()
ss << rSelectionRectangle.getStr(); ss << rSelectionRectangle.getStr();
} }
OString sRect = ss.str().c_str(); 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());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment