summaryrefslogtreecommitdiff
path: root/sw/source/uibase
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2023-07-16 22:22:18 -0800
committerJim Raykowski <raykowj@gmail.com>2023-07-23 06:48:13 +0200
commitc6b404c39569b6bc972b821a13f6bba0a68d8d9d (patch)
treeb6ee45cce9d56ade09b5b0b70db0b4445ac13e08 /sw/source/uibase
parent21013c4662a9ab32d293de263c54ebeceb66828c (diff)
tdf#156111 SwNavigator hyperlink dnd enhancement
Enhancement to use the selected document text dropped on as the hyperlink name for hyperlinks created by drag-and-drop from the Navigator. Change-Id: I6c458b24574cae28ab390644b8a3e1982675c4c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154508 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase')
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx9
-rw-r--r--sw/source/uibase/docvw/edtdd.cxx4
-rw-r--r--sw/source/uibase/inc/navicont.hxx2
-rw-r--r--sw/source/uibase/utlui/content.cxx4
4 files changed, 12 insertions, 7 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 201b7fa1b5d2..0974a424e921 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1724,7 +1724,12 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData,
if( pPt )
{
// external Drop
- if( bPasteSelection ? !pMod->m_pXSelection : !pMod->m_pDragDrop )
+ if ((bPasteSelection ? !pMod->m_pXSelection : !pMod->m_pDragDrop) &&
+ // The following condition is used for tdf#156111 to prevent a selection from being
+ // cleared by the default case of the nDestination switch.
+ !(rSh.GetCursorCnt() == 1 && rSh.TestCurrPam(*pPt) &&
+ nDestination == SotExchangeDest::SWDOC_FREE_AREA &&
+ nFormat == SotClipboardFormatId::SONLK))
{
switch( nDestination )
{
@@ -1929,7 +1934,7 @@ bool SwTransferable::PasteData( TransferableDataHelper& rData,
if( pPt )
{
NaviContentBookmark aBkmk;
- if( aBkmk.Paste( rData ) )
+ if (aBkmk.Paste(rData, rSh.GetSelText()))
{
if(bIsDefault)
{
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index bf23cc24391e..287d2969f632 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -260,9 +260,7 @@ SotExchangeDest SwEditWin::GetDropDestination( const Point& rPixPnt, SdrObject *
{
SwWrtShell &rSh = m_rView.GetWrtShell();
const Point aDocPt( PixelToLogic( rPixPnt ) );
- if( rSh.TestCurrPam( aDocPt )
- || rSh.IsOverReadOnlyPos( aDocPt )
- || rSh.DocPtInsideInputField( aDocPt ) )
+ if (rSh.IsOverReadOnlyPos(aDocPt) || rSh.DocPtInsideInputField(aDocPt))
return SotExchangeDest::NONE;
SdrObject *pObj = nullptr;
diff --git a/sw/source/uibase/inc/navicont.hxx b/sw/source/uibase/inc/navicont.hxx
index f8c81ae3dcef..604c1c982c76 100644
--- a/sw/source/uibase/inc/navicont.hxx
+++ b/sw/source/uibase/inc/navicont.hxx
@@ -48,7 +48,7 @@ public:
const OUString& GetDescription() const { return m_aDescription; }
RegionMode GetDefaultDragType() const { return m_nDefaultDrag; }
void Copy( TransferDataContainer& rData ) const;
- bool Paste( const TransferableDataHelper& rData );
+ bool Paste( const TransferableDataHelper& rData, const OUString& rsDesc );
};
#endif
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index c2af6a16304d..a57df3fd0630 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -5553,7 +5553,7 @@ void NaviContentBookmark::Copy( TransferDataContainer& rData ) const
rData.CopyByteString(SotClipboardFormatId::SONLK, sStrBuf);
}
-bool NaviContentBookmark::Paste( const TransferableDataHelper& rData )
+bool NaviContentBookmark::Paste( const TransferableDataHelper& rData, const OUString& rsDesc )
{
OUString sStr;
bool bRet = rData.GetString( SotClipboardFormatId::SONLK, sStr );
@@ -5564,6 +5564,8 @@ bool NaviContentBookmark::Paste( const TransferableDataHelper& rData )
m_aDescription = sStr.getToken(0, NAVI_BOOKMARK_DELIM, nPos );
m_nDefaultDrag= static_cast<RegionMode>( o3tl::toInt32(o3tl::getToken(sStr, 0, NAVI_BOOKMARK_DELIM, nPos )) );
m_nDocSh = o3tl::toInt32(o3tl::getToken(sStr, 0, NAVI_BOOKMARK_DELIM, nPos ));
+ if (!rsDesc.isEmpty())
+ m_aDescription = rsDesc;
}
return bRet;
}