diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-05-16 15:03:31 -0400 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-05-17 03:25:35 +0000 |
commit | d758875cd0ea87f8c7bbe1bbb78e49d06254cbee (patch) | |
tree | 9002b1ee11d6548ba2eebfae158fdd5285a98b86 | |
parent | 8549d1dbe648ce01e4a351eb301dcf146c62676d (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.
(cherry picked from commit df51f7d486cafb2795a38ae9fedd8fde8827d8a4)
(cherry picked from commit 8c8de51cc954aaae07f76732e6202398e33afeb7)
Conflicts:
sc/source/ui/view/gridwin.cxx
Change-Id: I7759667b105b4389dd4de2673cd2fbe32082c95d
Reviewed-on: https://gerrit.libreoffice.org/9386
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-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 c49d9ea826f4..1fa83c563e6e 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -63,6 +63,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" @@ -5190,11 +5191,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 && pInputHdl->IsInputMode()) + { + EditView* pView = pInputHdl->GetTableView(); + return extractURLInfo(pView->GetFieldUnderMousePointer(), pName, pUrl, pTarget); + } + //! nPosX/Y mit uebergeben? SCsCOL nPosX; SCsROW nPosY; @@ -5303,27 +5336,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, sal_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 = sal_True; - } - } - + bRet = extractURLInfo(aTempView.GetFieldUnderMousePointer(), pName, pUrl, pTarget); SetMapMode(aOld); return bRet; |