editeng/source/editeng/impedit2.cxx | 10 +++
sc/source/ui/inc/gridwin.hxx|8 ++
sc/source/ui/inc/output.hxx |4 +
sc/source/ui/view/gridwin.cxx | 108 +---
sc/source/ui/view/output2.cxx | 33 +--
5 files changed, 147 insertions(+), 16 deletions(-)
New commits:
commit 771bb58c1c547a874c80d05be59f73cbf68343df
Author: Jan Holesovsky ke...@collabora.com
Date: Tue Apr 14 12:08:39 2015 +0200
editeng tiled editing: Don't overwrite bInSelection.
Setting bInSelection in MouseButtonUp() feels wrong, and against of its
other
handling elsewhere. Also it breaks the selection handling in the tiled
rendering case - on further redraw, selections may disappear.
But it has been so since the initial check-in of the OOo code, so I have no
idea what corner case I might break by deleting this, so let's guard the
behavior by isTiledReneding() for now.
Change-Id: I7f7b237f9f0f427e317266e05481bac439c3c8ad
diff --git a/editeng/source/editeng/impedit2.cxx
b/editeng/source/editeng/impedit2.cxx
index 7fc5c43..7d4f1c8 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -567,7 +567,15 @@ bool ImpEditEngine::MouseButtonUp( const MouseEvent
rMEvt, EditView* pView )
{
GetSelEngine().SetCurView( pView );
GetSelEngine().SelMouseButtonUp( rMEvt );
-bInSelection = false;
+
+// in the tiled rendering case, setting bInSelection here has unexpected
+// consequences - further tiles painting removes the selection
+// FIXME I believe resetting bInSelection should not be here even in the
+// non-tiled-rendering case, but it has been here since 2000 (and before)
+// so who knows what corner case it was supposed to solve back then
+if (!pView-pImpEditView-isTiledRendering())
+bInSelection = false;
+
// Special treatments
EditSelection aCurSel( pView-pImpEditView-GetEditSelection() );
if ( !aCurSel.HasRange() )
commit 3f04bfef9e12e947f336aaa441d784f6c77f8e6a
Author: Jan Holesovsky ke...@collabora.com
Date: Tue Apr 14 12:05:00 2015 +0200
sc tiled editing: Implement long-touch to select word in overflowing text.
Normally, the text overflowing from other cells is completely ignored by
Calc,
and the user always works with the underlying cells.
On Android / mobile, it is though more natural to be able to select the text
directly; so implement a compromise:
* tap places the text cursor, so that the user can write into the
cells hidden by the text too
* long-tap selects the word in the text, even if the text 'just' overflows
from another cell
Change-Id: Ibe8666301ff1df0414c0206c1f3336842485433b
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 259844e..0221e60 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -278,6 +278,14 @@ class ScGridWindow : public vcl::Window, public
DropTargetHelper, public DragSou
sal_uInt16 HitPageBreak( const Point rMouse, ScRange* pSource =
NULL,
SCCOLROW* pBreak = NULL, SCCOLROW* pPrev =
NULL );
+/** The cell may be covered by text that overflows from a previous cell.
+
+@return if true, the given cell is covered by (overflowing) text and
+rTextStartPosX returns the column where the text that overflows
+starts.
+*/
+boolIsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB
nTab, SCsCOL rTextStartPosX);
+
voidPasteSelection( const Point rPosPixel );
voidSelectForContextMenu( const Point rPosPixel, SCsCOL
nCellX, SCsROW nCellY );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 2b0ca4c..838318e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1657,6 +1657,72 @@ void ScGridWindow::MouseButtonDown( const MouseEvent
rMEvt )
nNestedButtonState = SC_NESTEDBUTTON_NONE;
}
+bool ScGridWindow::IsCellCoveredByText(SCsCOL nPosX, SCsROW nPosY, SCTAB nTab,
SCsCOL rTextStartPosX)
+{
+ScDocument* pDoc = pViewData-GetDocument();
+
+// find the first non-empty cell (this, or to the left)
+ScRefCellValue aCell;
+SCsCOL nNonEmptyX = nPosX;
+for (; nNonEmptyX = 0; --nNonEmptyX)
+{
+aCell.assign(*pDoc, ScAddress(nNonEmptyX, nPosY, nTab));
+if (!aCell.isEmpty())
+break;
+}
+
+// the inital cell already contains text
+if (nNonEmptyX == nPosX)
+{
+rTextStartPosX = nNonEmptyX;
+return true;
+}
+
+// to the left, there is no cell that would contain (potentially
+// overrunning) text
+if (nNonEmptyX 0 || pDoc-HasAttrib(nNonEmptyX, nPosY, nTab, nPosX,
nPosY, nTab, HASATTR_MERGED | HASATTR_OVERLAPPED))
+return false;
+
+double nPPTX = pViewData-GetPPTX();
+double