[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - editeng/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Mar 16 08:32:43 PDT 2015
editeng/source/editeng/impedit.cxx | 43 ++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 19 deletions(-)
New commits:
commit af4f60ddb24e1410b0d9b7d96d7ce57fc4849640
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Mar 16 16:20:04 2015 +0100
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
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 5f102f5..e24e407 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());
}
More information about the Libreoffice-commits
mailing list