diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-16 15:03:31 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-16 16:20:32 -0400 |
commit | df51f7d486cafb2795a38ae9fedd8fde8827d8a4 (patch) | |
tree | b3bc4801b0ba2ebb15080a2e9e51701fabc65633 /sc | |
parent | 48a48e4ea4bdd7afb322e6d0b81c29eb7e7a66a0 (diff) |
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
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 2226ab176caf..ff7693dc758d 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -64,6 +64,7 @@ #include <com/sun/star/awt/MouseButton.hpp> #include <com/sun/star/script/vba/VBAEventId.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> +#include <com/sun/star/text/textfield/Type.hpp> #include "gridwin.hxx" #include "tabvwsh.hxx" @@ -5205,11 +5206,43 @@ boost::shared_ptr<ScFieldEditEngine> createEditEngine( ScDocShell* pDocSh, const 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, 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? SCsCOL nPosX; SCsROW nPosY; @@ -5318,27 +5351,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, bool bRet = false; MapMode aOld = GetMapMode(); SetMapMode(aEditMode); // kein return mehr - - 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; - } - } - + bRet = extractURLInfo(aTempView.GetFieldUnderMousePointer(), pName, pUrl, pTarget); SetMapMode(aOld); return bRet; |