summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-02 14:47:21 +0200
committerJan Holesovsky <kendy@collabora.com>2015-06-02 15:44:02 +0200
commit69d68246ea505bb89cfb5fe453a4bb7c618afc77 (patch)
treecf88f4efc25b9ec48c88cf0f25befe8a5bf4d6eb /sw
parent665da4646f1f58a663710e2a250904b42b5cff03 (diff)
sw: LOK_CALLBACK_TEXT_SELECTION should be the union of all selections
E.g. if searching for a keyword and it's inside a text frame, then we have two cursors: one is an empty selection at the anchor point, and the other is the real selection. What happened is that we emitted two events for the two cursors, instead of merging them together. Fix the problem by not emitting the events in SwSelPaintRects::Show(), instead do it at once in SwShellCrsr::Show(). Change-Id: Ie2c7691aaaea7ba8a32b5cfa718a45cba571f791
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/viscrs.hxx2
-rw-r--r--sw/source/core/crsr/viscrs.cxx29
2 files changed, 27 insertions, 4 deletions
diff --git a/sw/inc/viscrs.hxx b/sw/inc/viscrs.hxx
index a15dbd30b04b..159fb2ffbc41 100644
--- a/sw/inc/viscrs.hxx
+++ b/sw/inc/viscrs.hxx
@@ -96,7 +96,7 @@ public:
// make a complete swap access to m_pCursorOverlay is needed there
void swapContent(SwSelPaintRects& rSwap);
- void Show();
+ void Show(std::vector<OString>* pSelectionRectangles = 0);
void Hide();
void Invalidate( const SwRect& rRect );
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 38e6ef867ef8..c3d591c8c215 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -280,7 +280,7 @@ void SwShellCrsr::FillStartEnd(SwRect& rStart, SwRect& rEnd) const
rEnd = lcl_getLayoutRect(pCursor->GetEndPos(), *pCursor->End());
}
-void SwSelPaintRects::Show()
+void SwSelPaintRects::Show(std::vector<OString>* pSelectionRectangles)
{
SdrView *const pView = const_cast<SdrView*>(m_pCursorShell->GetDrawView());
@@ -379,7 +379,10 @@ void SwSelPaintRects::Show()
ss << rRect.SVRect().toString().getStr();
}
OString sRect = ss.str().c_str();
- GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+ if (!pSelectionRectangles)
+ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
+ else
+ pSelectionRectangles->push_back(sRect);
}
}
}
@@ -566,11 +569,31 @@ void SwShellCrsr::FillRects()
void SwShellCrsr::Show()
{
+ std::vector<OString> aSelectionRectangles;
for(SwPaM& rPaM : GetRingContainer())
{
SwShellCrsr* pShCrsr = dynamic_cast<SwShellCrsr*>(&rPaM);
if(pShCrsr)
- pShCrsr->SwSelPaintRects::Show();
+ pShCrsr->SwSelPaintRects::Show(&aSelectionRectangles);
+ }
+
+ if (GetShell()->isTiledRendering())
+ {
+ std::stringstream ss;
+ bool bFirst = true;
+ for (size_t i = 0; i < aSelectionRectangles.size(); ++i)
+ {
+ const OString& rSelectionRectangle = aSelectionRectangles[i];
+ if (rSelectionRectangle.isEmpty())
+ continue;
+ if (bFirst)
+ bFirst = false;
+ else
+ ss << "; ";
+ ss << rSelectionRectangle.getStr();
+ }
+ OString sRect = ss.str().c_str();
+ GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr());
}
}