summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-03-16 16:20:04 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-23 09:18:58 +0100
commit2f31ac76be64953d19a72e3d8eae42b1ac5c5473 (patch)
tree7644241a2e32da4e8deced845234ea796af9a5df /editeng/source
parent2a081a0f9ba8c73a0eba55020b6c39ee7778f9c9 (diff)
editeng tiled rendering: allow resetting selection with a single click
The problem was that when not tiled rendering, the selection is painted with the inverse color, and so killing the selection can be achieved with just painting it again -- using the inverse color again. For the tiled rendering case, use IsInSelectionMode() to see if we're killing the selection, and if so, just emit the empty selection. Change-Id: I045f5b100ae8d4f5802b16f68376aa21de08b994
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/impedit.cxx43
1 files changed, 24 insertions, 19 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 44209707454c..8435e0d8bd29 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -324,29 +324,34 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou
if (isTiledRendering())
{
- std::vector<Rectangle> aRectangles;
- pRegion->GetRegionRectangles(aRectangles);
-
- if (!aRectangles.empty())
+ OString sRectangle;
+ // If we are not in selection mode, then the exported selection should be empty.
+ if (pEditEngine->pImpEditEngine->IsInSelectionMode())
{
- Rectangle& rStart = aRectangles.front();
- Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom());
- libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
+ std::vector<Rectangle> aRectangles;
+ pRegion->GetRegionRectangles(aRectangles);
- Rectangle& rEnd = aRectangles.back();
- Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom());
- libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
- }
+ if (!aRectangles.empty())
+ {
+ Rectangle& rStart = aRectangles.front();
+ Rectangle aStart = Rectangle(rStart.Left(), rStart.Top(), rStart.Left() + 1, rStart.Bottom());
+ libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr());
- std::stringstream ss;
- for (size_t i = 0; i < aRectangles.size(); ++i)
- {
- const Rectangle& rRectangle = aRectangles[i];
- if (i)
- ss << "; ";
- ss << rRectangle.toString().getStr();
+ Rectangle& rEnd = aRectangles.back();
+ Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom());
+ libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr());
+ }
+
+ std::stringstream ss;
+ for (size_t i = 0; i < aRectangles.size(); ++i)
+ {
+ const Rectangle& rRectangle = aRectangles[i];
+ if (i)
+ ss << "; ";
+ ss << rRectangle.toString().getStr();
+ }
+ sRectangle = ss.str().c_str();
}
- OString sRectangle = ss.str().c_str();
libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr());
}