summaryrefslogtreecommitdiff
path: root/sw/source/ui/dochdl
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-02-07 01:26:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-07 12:24:46 +0000
commit5c75cd95178e3d57e53fee64a9d64023c6d18acf (patch)
tree0b8608bbb949b1f07e62c82a188ba5d96da861e3 /sw/source/ui/dochdl
parent96ca3d2f563d1f057b251c49541827223e6712d0 (diff)
Resolves: #i123922# Refactored D&D and insert picture from file...
in all apps for all object types to work the same (cherry picked from commit 080a23dfb836bac49d9496fa1460b9dda9138f65) Conflicts: sc/source/ui/drawfunc/fuins1.cxx sc/source/ui/inc/drawview.hxx sc/source/ui/inc/viewfunc.hxx sc/source/ui/view/drawview.cxx sc/source/ui/view/viewfun3.cxx sc/source/ui/view/viewfun7.cxx sd/source/ui/func/fuinsert.cxx sd/source/ui/view/sdview4.cxx sw/source/core/frmedt/fecopy.cxx sw/source/ui/dochdl/swdtflvr.cxx sw/source/ui/inc/view.hxx sw/source/ui/inc/wrtsh.hxx sw/source/ui/shells/drawsh.cxx sw/source/ui/uiview/view2.cxx sw/source/ui/wrtsh/wrtsh1.cxx Change-Id: I7f77d8c0812278ad434fe1c503a03d9747ea0b00
Diffstat (limited to 'sw/source/ui/dochdl')
-rw-r--r--sw/source/ui/dochdl/swdtflvr.cxx97
1 files changed, 63 insertions, 34 deletions
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index ae1da814e4b4..f0d7f9da31ba 100644
--- a/sw/source/ui/dochdl/swdtflvr.cxx
+++ b/sw/source/ui/dochdl/swdtflvr.cxx
@@ -1950,7 +1950,7 @@ bool SwTransferable::_PasteTargetURL( TransferableDataHelper& rData,
case SW_PASTESDR_SETATTR:
if( rSh.IsObjSelected() )
- rSh.Paste( aGraphic );
+ rSh.Paste( aGraphic, OUString() );
else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
rSh.ReRead( sURL, aEmptyOUStr, &aGraphic );
else
@@ -2212,7 +2212,7 @@ bool SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData,
bool SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt,
- sal_uInt8 nActionFlags, sal_Int8 /* nDropAction */, bool bNeedToSelectBeforePaste)
+ sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste)
{
bool nRet = false;
@@ -2308,52 +2308,81 @@ bool SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh,
lclCheckAndPerformRotation(aGraphic);
OUString sURL;
- if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell) )
+ if( rSh.GetView().GetDocShell()->ISA(SwWebDocShell)
+ // #i123922# if link action is noted, also take URL
+ || DND_ACTION_LINK == nDropAction)
+ {
sURL = aBkmk.GetURL();
+ }
switch( nAction )
{
- case SW_PASTESDR_INSERT:
- SwTransferable::SetSelInShell( rSh, sal_False, pPt );
- rSh.Insert( sURL, aEmptyOUStr, aGraphic );
- break;
+ case SW_PASTESDR_INSERT:
+ {
+ SwTransferable::SetSelInShell( rSh, sal_False, pPt );
+ rSh.Insert( sURL, aEmptyOUStr, aGraphic );
+ break;
+ }
- case SW_PASTESDR_REPLACE:
- if( rSh.IsObjSelected() )
+ case SW_PASTESDR_REPLACE:
{
- rSh.ReplaceSdrObj( sURL, aEmptyOUStr, &aGraphic );
- Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
- SwTransferable::SetSelInShell( rSh, sal_True, &aPt );
+ if( rSh.IsObjSelected() )
+ {
+ // #i123922# for D&D on draw objects, do for now the same for
+ // SW_PASTESDR_REPLACE (D&D) as for SW_PASTESDR_SETATTR (D&D and
+ // CTRL+SHIFT). The code below replaces the draw object with
+ // a writer graphic; maybe this is an option later again if wanted
+ rSh.Paste( aGraphic, sURL );
+
+ // rSh.ReplaceSdrObj( sURL, aEmptyOUStr, &aGraphic );
+ // Point aPt( pPt ? *pPt : rSh.GetCrsrDocPos() );
+ // SwTransferable::SetSelInShell( rSh, sal_True, &aPt );
+ }
+ else
+ {
+ // set graphic at writer graphic without link
+ rSh.ReRead( sURL, aEmptyOUStr, &aGraphic );
+ }
+
+ break;
}
- else
- rSh.ReRead( sURL, aEmptyOUStr, &aGraphic );
- break;
- case SW_PASTESDR_SETATTR:
- if( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK == nFmt )
+ case SW_PASTESDR_SETATTR:
{
- if( rSh.IsFrmSelected() )
+ if( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK == nFmt )
{
- SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
- rSh.GetFlyFrmAttr( aSet );
- SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
- aURL.SetURL( aBkmk.GetURL(), false );
- aSet.Put( aURL );
- rSh.SetFlyFrmAttr( aSet );
+ if( rSh.IsFrmSelected() )
+ {
+ SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL );
+ rSh.GetFlyFrmAttr( aSet );
+ SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) );
+ aURL.SetURL( aBkmk.GetURL(), sal_False );
+ aSet.Put( aURL );
+ rSh.SetFlyFrmAttr( aSet );
+ }
}
+ else if( rSh.IsObjSelected() )
+ {
+ // set as attribute at DrawObject
+ rSh.Paste( aGraphic, sURL );
+ }
+ else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
+ {
+ // set as linked graphic at writer graphic frame
+ rSh.ReRead( sURL, aEmptyOUStr, &aGraphic );
+ }
+ else
+ {
+ SwTransferable::SetSelInShell( rSh, sal_False, pPt );
+ rSh.Insert( aBkmk.GetURL(), aEmptyOUStr, aGraphic );
+ }
+ break;
}
- else if( rSh.IsObjSelected() )
- rSh.Paste( aGraphic );
- else if( OBJCNT_GRF == rSh.GetObjCntTypeOfSelection() )
- rSh.ReRead( sURL, aEmptyOUStr, &aGraphic );
- else
+ default:
{
- SwTransferable::SetSelInShell( rSh, sal_False, pPt );
- rSh.Insert( aBkmk.GetURL(), aEmptyOUStr, aGraphic );
+ nRet = 0;
+ break;
}
- break;
- default:
- nRet = false;
}
}