summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2024-02-09 19:04:33 +0100
committerTomaž Vajngerl <quikee@gmail.com>2024-03-20 11:17:09 +0100
commit99bd13feb386587262c40d6c474d4fa817da31bd (patch)
tree9358c6038f70815dad547aa559eb10d7a542d112
parent6c97cd3691ea0f7d9e580b1c4ea0fca81d47758a (diff)
lok calc: show cell cursor on in place editing
On in place editing cell cursor overlay matches the output area. In this way the user has a better guess about the edited area. Change-Id: Iba3370d942a9deaedeed23298a7cb7a6c6c0f5f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164701 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit cc88ad715f80b13efb29744673d044df9c16550c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164992 Tested-by: Jenkins
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/viewdata.cxx26
2 files changed, 28 insertions, 0 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 71364aaf172a..c24435aaa903 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -6179,6 +6179,8 @@ void ScGridWindow::UpdateAllOverlays()
void ScGridWindow::DeleteCursorOverlay()
{
+ if (comphelper::LibreOfficeKit::isActive() && mrViewData.HasEditView(eWhich))
+ return;
ScTabViewShell* pViewShell = mrViewData.GetViewShell();
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"_ostr);
SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"_ostr);
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 83975c6b0ee9..aa691ddfebde 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -71,6 +71,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/NamedPropertyValues.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
using namespace com::sun::star;
@@ -1520,6 +1521,22 @@ tools::Rectangle ScViewData::GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW
GetEditArea( pPattern, bForceToTop );
}
+namespace {
+
+void notifyCellCursorAt(const ScTabViewShell* pViewShell, SCCOL nCol, SCROW nRow,
+ const tools::Rectangle& rCursor)
+{
+ std::stringstream ss;
+ ss << rCursor.getX() << ", " << rCursor.getY() << ", " << rCursor.GetWidth() << ", "
+ << rCursor.GetHeight() << ", " << nCol << ", " << nRow;
+
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, ss.str().c_str());
+ SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle",
+ ss.str().c_str());
+}
+
+}
+
void ScViewData::SetEditEngine( ScSplitPos eWhich,
ScEditEngineDefaulter* pNewEngine,
vcl::Window* pWin, SCCOL nNewX, SCROW nNewY )
@@ -1635,6 +1652,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich,
tools::Rectangle aOutputArea = pWin->PixelToLogic( aPixRect, GetLogicMode() );
pEditView[eWhich]->SetOutputArea( aOutputArea );
+ if (bLOKPrintTwips)
+ notifyCellCursorAt(GetViewShell(), nNewX, nNewY, aPTwipsRect);
+
if ( bActive && eWhich == GetActivePart() )
{
// keep the part that has the active edit view available after
@@ -2120,6 +2140,9 @@ void ScViewData::EditGrowX()
pCurView->SetOutputArea(aArea);
+ if (bLOKPrintTwips)
+ notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips);
+
// In vertical mode, the whole text is moved to the next cell (right-aligned),
// so everything must be repainted. Otherwise, paint only the new area.
// If growing in centered alignment, if the cells left and right have different sizes,
@@ -2233,6 +2256,9 @@ void ScViewData::EditGrowY( bool bInitial )
pCurView->SetOutputArea(aArea);
+ if (bLOKPrintTwips)
+ notifyCellCursorAt(GetViewShell(), nEditCol, nEditRow, aAreaPTwips);
+
if (nEditEndRow >= nBottom || bMaxReached)
{
if (!(nControl & EVControlBits::AUTOSCROLL))