summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMuhammet Kara <muhammet.kara@collabora.com>2019-12-19 08:32:57 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2020-02-29 17:22:07 +0100
commit7ce29004934ae7b75dce492bde5602358eb3dc5f (patch)
tree15dd9c16176e5520ec21be1b1461c12dbf08b0cd /editeng
parentb9644a230cbaa1cf0478506c9a766c2a93276133 (diff)
lok: Resolves: Calc - selecting a hyperlink doesn't show link in dialog
Change-Id: Ic4264fad8035029ba6593c91fa57efa772d394ca Reviewed-on: https://gerrit.libreoffice.org/85468 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89705 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit.cxx41
1 files changed, 35 insertions, 6 deletions
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 842119a5b4ae..53900c16aa76 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -869,6 +869,23 @@ void ImpEditView::CalcAnchorPoint()
}
}
+namespace
+{
+
+// Build JSON message to be sent to Online
+OString buildHyperlinkJSON(const OUString& sText, const OUString& sLink)
+{
+ boost::property_tree::ptree aTree;
+ aTree.put("text", sText);
+ aTree.put("link", sLink);
+ std::stringstream aStream;
+ boost::property_tree::write_json(aStream, aTree, false);
+
+ return OString(aStream.str().c_str()).trim();
+}
+
+} // End of anon namespace
+
void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
{
// No ShowCursor in an empty View ...
@@ -1111,12 +1128,24 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor )
{
if (auto pUrlField = dynamic_cast<const SvxURLField*>(pFld->GetField()))
{
- boost::property_tree::ptree aTree;
- aTree.put("text", pUrlField->GetRepresentation());
- aTree.put("link", pUrlField->GetURL());
- std::stringstream aStream;
- boost::property_tree::write_json(aStream, aTree, false);
- sHyperlink = OString(aStream.str().c_str()).trim();
+ sHyperlink = buildHyperlinkJSON(pUrlField->GetRepresentation(), pUrlField->GetURL());
+ }
+ }
+ else if (GetEditSelection().HasRange())
+ {
+ EditView* pActiveView = GetEditViewPtr();
+
+ if (pActiveView)
+ {
+ const SvxFieldItem* pFieldItem = pActiveView->GetFieldAtSelection();
+ if (pFieldItem)
+ {
+ const SvxFieldData* pField = pFieldItem->GetField();
+ if ( auto pUrlField = dynamic_cast<const SvxURLField*>( pField) )
+ {
+ sHyperlink = buildHyperlinkJSON(pUrlField->GetRepresentation(), pUrlField->GetURL());
+ }
+ }
}
}