summaryrefslogtreecommitdiff
path: root/sd
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
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')
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx3
-rw-r--r--sd/source/ui/view/drviews2.cxx14
-rw-r--r--sd/source/ui/view/drviewsf.cxx35
3 files changed, 5 insertions, 47 deletions
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 7d4ea407175a..373e543eda01 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -487,9 +487,6 @@ private:
void ConfigureAppBackgroundColor( svtools::ColorConfig* pColorConfig = nullptr );
- // Select and return the field at the current cursor position
- const SvxFieldData* GetFieldAtCursor();
-
// The colour of the area behind the slide (used to be called "Wiese")
Color mnAppBackgroundColor;
};
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 0cc9fef0a426..a812d3be34f4 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -45,6 +45,7 @@
#include <editeng/section.hxx>
#include <editeng/editobj.hxx>
#include <editeng/CustomPropertyField.hxx>
+#include <editeng/urlfieldhelper.hxx>
#include <sal/log.hxx>
@@ -1150,17 +1151,8 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
{
if (mpDrawView->IsTextEdit())
{
- Outliner* pOutl = mpDrawView->GetTextEditOutliner();
- OutlinerView* pOLV = mpDrawView->GetTextEditOutlinerView();
- if (pOutl && pOLV)
- {
- const SvxFieldData* pField = GetFieldAtCursor();
- if( auto pUrlField = dynamic_cast< const SvxURLField *>( pField ) )
- {
- ESelection aSel = pOLV->GetSelection();
- pOutl->QuickInsertText(pUrlField->GetRepresentation(), aSel);
- }
- }
+ URLFieldHelper::RemoveURLField(mpDrawView->GetTextEditOutliner(),
+ mpDrawView->GetTextEditOutlinerView());
}
}
Cancel();
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: */