summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/drviewsf.cxx
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-12 08:53:35 +0200
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-07-12 13:39:33 +0200
commit9945c2458d75947b94e9cdb45b7aca7ed6336c12 (patch)
treed2c49423cf9b298752ec69d9ad3dbb22e4022f98 /sd/source/ui/view/drviewsf.cxx
parent60dffd80468e5ca4471bc67d02c58c8c784a86f1 (diff)
Move remove url code to editeng
so that the code can be reused by sc and sw Change-Id: I0d3c778c7bb7847fcf690d0e76994afdd0645285 Reviewed-on: https://gerrit.libreoffice.org/75477 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'sd/source/ui/view/drviewsf.cxx')
-rw-r--r--sd/source/ui/view/drviewsf.cxx35
1 files changed, 2 insertions, 33 deletions
diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx
index 4ae044433f0f..df68fa2fb0a5 100644
--- a/sd/source/ui/view/drviewsf.cxx
+++ b/sd/source/ui/view/drviewsf.cxx
@@ -61,6 +61,7 @@
#include <editeng/escapementitem.hxx>
#include <editeng/numitem.hxx>
#include <editeng/adjustitem.hxx>
+#include <editeng/urlfieldhelper.hxx>
#include <svx/nbdtmgfact.hxx>
#include <svx/nbdtmg.hxx>
#include <memory>
@@ -89,7 +90,7 @@ void DrawViewShell::GetCtrlState(SfxItemSet &rSet)
if (pOLV)
{
- const SvxFieldData* pField = GetFieldAtCursor();
+ const SvxFieldData* pField = pOLV->GetFieldAtCursor();
if( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) )
{
aHLinkItem.SetName(pUrlField->GetRepresentation());
@@ -796,38 +797,6 @@ bool DrawViewShell::HasSelection(bool bText) const
return bReturn;
}
-const SvxFieldData* DrawViewShell::GetFieldAtCursor()
-{
- OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
- if (!pOLV)
- return nullptr;
-
- const SvxFieldItem* pFieldItem = pOLV->GetFieldAtSelection();
- if (pFieldItem)
- {
- // Make sure the whole field is selected
- ESelection aSel = pOLV->GetSelection();
- if (aSel.nStartPos == aSel.nEndPos)
- {
- aSel.nEndPos++;
- pOLV->SetSelection(aSel);
- }
- }
- if (!pFieldItem)
- {
- // Cursor probably behind the field - extend selection to select the field
- ESelection aSel = pOLV->GetSelection();
- if (aSel.nStartPos == aSel.nEndPos)
- {
- aSel.nStartPos--;
- pOLV->SetSelection(aSel);
- pFieldItem = pOLV->GetFieldAtSelection();
- }
- }
-
- return pFieldItem ? pFieldItem->GetField() : nullptr;
-}
-
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */