Kaydet (Commit) df51f7d4 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#77315: When in cell edit mode, use the EditView instance already there.

This prevents creation of a temporary EditView instance which would mess up
the cursor state while the mouse pointer is hovering.

Change-Id: I7759667b105b4389dd4de2673cd2fbe32082c95d
üst 48a48e4e
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/script/vba/VBAEventId.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp>
#include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
#include <com/sun/star/text/textfield/Type.hpp>
#include "gridwin.hxx" #include "gridwin.hxx"
#include "tabvwsh.hxx" #include "tabvwsh.hxx"
...@@ -5205,11 +5206,43 @@ boost::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const ...@@ -5205,11 +5206,43 @@ boost::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const
return pEngine; return pEngine;
} }
bool extractURLInfo( const SvxFieldItem* pFieldItem, OUString* pName, OUString* pUrl, OUString* pTarget )
{
if (!pFieldItem)
return false;
const SvxFieldData* pField = pFieldItem->GetField();
if (pField->GetClassId() != text::textfield::Type::URL)
return false;
const SvxURLField* pURLField = static_cast<const SvxURLField*>(pField);
if (pName)
*pName = pURLField->GetRepresentation();
if (pUrl)
*pUrl = pURLField->GetURL();
if (pTarget)
*pTarget = pURLField->GetTargetFrame();
return true;
}
} }
bool ScGridWindow::GetEditUrl( const Point& rPos, bool ScGridWindow::GetEditUrl( const Point& rPos,
OUString* pName, OUString* pUrl, OUString* pTarget ) OUString* pName, OUString* pUrl, OUString* pTarget )
{ {
ScTabViewShell* pViewSh = pViewData->GetViewShell();
ScInputHandler* pInputHdl = NULL;
if (pViewSh)
pInputHdl = pViewSh->GetInputHandler();
if (pInputHdl->IsInputMode())
{
EditView* pView = pInputHdl->GetTableView();
return extractURLInfo(pView->GetFieldUnderMousePointer(), pName, pUrl, pTarget);
}
//! nPosX/Y mit uebergeben? //! nPosX/Y mit uebergeben?
SCsCOL nPosX; SCsCOL nPosX;
SCsROW nPosY; SCsROW nPosY;
...@@ -5318,27 +5351,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, ...@@ -5318,27 +5351,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos,
bool bRet = false; bool bRet = false;
MapMode aOld = GetMapMode(); MapMode aOld = GetMapMode();
SetMapMode(aEditMode); // kein return mehr SetMapMode(aEditMode); // kein return mehr
bRet = extractURLInfo(aTempView.GetFieldUnderMousePointer(), pName, pUrl, pTarget);
const SvxFieldItem* pFieldItem = aTempView.GetFieldUnderMousePointer();
if (pFieldItem)
{
const SvxFieldData* pField = pFieldItem->GetField();
if ( pField && pField->ISA(SvxURLField) )
{
if ( pName || pUrl || pTarget )
{
const SvxURLField* pURLField = (const SvxURLField*)pField;
if (pName)
*pName = pURLField->GetRepresentation();
if (pUrl)
*pUrl = pURLField->GetURL();
if (pTarget)
*pTarget = pURLField->GetTargetFrame();
}
bRet = true;
}
}
SetMapMode(aOld); SetMapMode(aOld);
return bRet; return bRet;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment