diff options
author | Armin Le Grand <alg@apache.org> | 2013-01-29 12:32:36 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-16 20:01:56 +0100 |
commit | 5aee0c13cc62a81a38d4132db7972dc301c21b3d (patch) | |
tree | 00c7837aa82296623f38305ce0f47bc6e6f5586a /sw | |
parent | 9618c7627061b9eb82ad6107de78a12c764744cf (diff) |
Resolves: #i121532# enhanced visualisation of text edit&selection
D&D overhauled
(cherry picked from commit c6e63b6bbb6b4a63fe1302de57fc32cd28432378)
Conflicts:
drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx
drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx
drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx
svx/Package_inc.mk
svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx
svx/inc/svx/sdr/overlay/overlayobject.hxx
svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx
svx/inc/svx/sdr/overlay/overlayrectangle.hxx
svx/inc/svx/sdr/overlay/overlaytools.hxx
svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx
svx/inc/svx/svdview.hxx
svx/source/engine3d/view3d.cxx
svx/source/sdr/overlay/overlayanimatedbitmapex.cxx
svx/source/sdr/overlay/overlayhatchrect.cxx
svx/source/sdr/overlay/overlaypolypolygon.cxx
svx/source/sdr/overlay/overlaytools.cxx
svx/source/svdraw/svdcrtv.cxx
svx/source/svdraw/svdedxv.cxx
svx/source/svdraw/svdhdl.cxx
svx/source/svdraw/svdobj.cxx
svx/source/svdraw/svdview.cxx
sw/source/ui/dochdl/swdtflvr.cxx
Unname unused arguments to prevent WaE issues.
(cherry picked from commit 0735a61e631b8d4bb3d4e889bee436fb9e7c5734)
Change-Id: I3b1cf4754063985dc1b4adac44b33e52e200607f
e4288936cadd1f6e06bdf79611536d7114236b56
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/frmedt/fecopy.cxx | 38 | ||||
-rw-r--r-- | sw/source/ui/dochdl/swdtflvr.cxx | 90 | ||||
-rw-r--r-- | sw/source/ui/inc/swdtflvr.hxx | 4 |
3 files changed, 113 insertions, 19 deletions
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 3fa4a73870ee..a38e0cd2d901 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -1452,7 +1452,43 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt ) case SW_PASTESDR_SETATTR: { SfxItemSet aSet( GetAttrPool() ); - aSet.Put(pClpObj->GetMergedItemSet()); + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pClpObj); + + if(pSdrGrafObj) + { + SdrObject* pTarget = 0; + + if(0 != pView->GetMarkedObjectList().GetMarkCount()) + { + // try to get target (if it's at least one, take first) + SdrMark* pMark = pView->GetMarkedObjectList().GetMark(0); + + if(pMark) + { + pTarget = pMark->GetMarkedSdrObj(); + } + } + + if(pTarget) + { + // copy ItemSet from target + aSet.Set(pTarget->GetMergedItemSet()); + } + + // for SdrGrafObj, use the graphic as fill style argument + const Graphic& rGraphic = pSdrGrafObj->GetGraphic(); + + if(GRAPHIC_NONE != rGraphic.GetType() && GRAPHIC_DEFAULT != rGraphic.GetType()) + { + aSet.Put(XFillBitmapItem(String(), rGraphic)); + aSet.Put(XFillStyleItem(XFILL_BITMAP)); + } + } + else + { + aSet.Put(pClpObj->GetMergedItemSet()); + } + pView->SetAttributes( aSet, sal_False ); } break; diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index 03efaa1bc0bb..80485bd41b8d 100644 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -407,8 +407,13 @@ sal_Bool SwTransferable::GetData( const DataFlavor& rFlavor ) { SelectionType nSelectionType = pWrtShell->GetSelectionType(); -// SEL_GRF comes from ContentType of editsh - if( (nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType ) + // when pending we will not get the correct type, but nsSelectionType::SEL_TXT + // as fallback. This *happens* durning D&D, so we need to check if we are in + // the fallback and just try to get a graphic + const bool bPending(pWrtShell->BasicActionPend()); + + // SEL_GRF kommt vom ContentType der editsh + if(bPending || ((nsSelectionType::SEL_GRF | nsSelectionType::SEL_DRW_FORM) & nSelectionType)) { pClpGraphic = new Graphic; if( !pWrtShell->GetDrawObjGraphic( FORMAT_GDIMETAFILE, *pClpGraphic )) @@ -1215,8 +1220,31 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, SwTransferable *pTrans=0, *pTunneledTrans=GetSwTransferable( rData ); - if( pPt && ( bPasteSelection ? 0 != ( pTrans = pMod->pXSelection ) - : 0 != ( pTrans = pMod->pDragDrop) )) + // check for private drop + bool bPrivateDrop(pPt && (bPasteSelection ? 0 != (pTrans = pMod->pXSelection) : 0 != (pTrans = pMod->pDragDrop))); + bool bNeedToSelectBeforePaste(false); + + if(bPrivateDrop && DND_ACTION_LINK == nDropAction) + { + // internal drop on object, suppress bPrivateDrop to change internal fill + bPrivateDrop = false; + bNeedToSelectBeforePaste = true; + } + + if(bPrivateDrop && pPt && DND_ACTION_MOVE == nDropAction) + { + // check if dragged over a useful target. If yes, use as content exchange + // drop as if from external + const SwFrmFmt* pSwFrmFmt = rSh.GetFmtFromObj(*pPt); + + if(pSwFrmFmt && 0 != dynamic_cast< const SwDrawFrmFmt* >(pSwFrmFmt)) + { + bPrivateDrop = false; + bNeedToSelectBeforePaste = true; + } + } + + if(bPrivateDrop) { // then internal Drag & Drop or XSelection nRet = pTrans->PrivateDrop( rSh, *pPt, DND_ACTION_MOVE == nDropAction, @@ -1267,7 +1295,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_DRAWING: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_INSERT, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_HTML: @@ -1305,7 +1333,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMAT_GDIMETAFILE: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_INSERT,pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_XFORMS: @@ -1425,7 +1453,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_DRAWING: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_SETATTR, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case SOT_FORMATSTR_ID_SVXB: case SOT_FORMAT_GDIMETAFILE: @@ -1436,7 +1464,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_SETATTR, pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; default: OSL_FAIL( "unknown format" ); @@ -1447,7 +1475,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_INSERT_DRAWOBJ: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_INSERT, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_INSERT_SVXB: case EXCHG_OUT_ACTION_INSERT_GDIMETAFILE: @@ -1455,13 +1483,13 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_INSERT_GRAPH: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_INSERT, pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_REPLACE_DRAWOBJ: nRet = SwTransferable::_PasteSdrFormat( rData, rSh, SW_PASTESDR_REPLACE, pPt, - nActionFlags ); + nActionFlags, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_REPLACE_SVXB: @@ -1470,7 +1498,7 @@ int SwTransferable::PasteData( TransferableDataHelper& rData, case EXCHG_OUT_ACTION_REPLACE_GRAPH: nRet = SwTransferable::_PasteGrf( rData, rSh, nFormat, SW_PASTESDR_REPLACE,pPt, - nActionFlags, bMsg ); + nActionFlags, nDropAction, bNeedToSelectBeforePaste); break; case EXCHG_OUT_ACTION_INSERT_INTERACTIVE: @@ -2151,13 +2179,21 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, - const Point* pPt, sal_uInt8 nActionFlags ) + const Point* pPt, sal_uInt8 nActionFlags, bool bNeedToSelectBeforePaste) { int nRet = 0; SotStorageStreamRef xStrm; if( rData.GetSotStorageStream( SOT_FORMATSTR_ID_DRAWING, xStrm )) { xStrm->SetVersion( SOFFICE_FILEFORMAT_50 ); + + if(bNeedToSelectBeforePaste && pPt) + { + // if this is an internal drag, need to set the target right (select it), else + // still the source will be selected + SwTransferable::SetSelInShell( rSh, sal_True, pPt ); + } + rSh.Paste( *xStrm, nAction, pPt ); nRet = 1; @@ -2170,7 +2206,7 @@ int SwTransferable::_PasteSdrFormat( TransferableDataHelper& rData, int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool /*bMsg*/ ) + sal_uInt8 nActionFlags, sal_Int8 /* nDropAction */, bool bNeedToSelectBeforePaste) { int nRet = 0; @@ -2185,6 +2221,19 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, nRet = rData.GetGraphic( nFmt, aGraphic ); break; + case SOT_FORMATSTR_ID_SVXB: + { + SotStorageStreamRef xStm; + + if(rData.GetSotStorageStream(SOT_FORMATSTR_ID_SVXB, xStm)) + { + *xStm >> aGraphic; + nRet = (GRAPHIC_NONE != aGraphic.GetType() && GRAPHIC_DEFAULT != aGraphic.GetType()); + } + + break; + } + case SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK: case SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR: case SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR: @@ -2237,6 +2286,15 @@ int SwTransferable::_PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, } } + if(pPt && bNeedToSelectBeforePaste) + { + // when using internal D&Ds, still the source object is selected and + // this is necessary to get the correct source data which is also + // dependent from selection. After receiving the drag data it is + // now tiime to select the correct target object + SwTransferable::SetSelInShell( rSh, sal_True, pPt ); + } + if( nRet ) { //Check and Perform rotation if needed @@ -2402,10 +2460,10 @@ int SwTransferable::_PasteAsHyperlink( TransferableDataHelper& rData, int SwTransferable::_PasteFileName( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool bMsg ) + sal_uInt8 nActionFlags, sal_Bool /* bMsg */) { int nRet = SwTransferable::_PasteGrf( rData, rSh, nFmt, nAction, - pPt, nActionFlags, bMsg ); + pPt, nActionFlags, 0, false); if( nRet ) nRet |= SWTRANSFER_GRAPHIC_INSERTED; if( !nRet ) diff --git a/sw/source/ui/inc/swdtflvr.hxx b/sw/source/ui/inc/swdtflvr.hxx index e790297a7b1d..ad9d369d5128 100644 --- a/sw/source/ui/inc/swdtflvr.hxx +++ b/sw/source/ui/inc/swdtflvr.hxx @@ -101,11 +101,11 @@ class SwTransferable : public TransferableHelper static int _PasteSdrFormat( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uInt16 nAction, - const Point* pPt, sal_uInt8 nActionFlags ); + const Point* pPt, sal_uInt8 nActionFlags, bool bNeedToSelectBeforePaste); static int _PasteGrf( TransferableDataHelper& rData, SwWrtShell& rSh, sal_uLong nFmt, sal_uInt16 nAction, const Point* pPt, - sal_uInt8 nActionFlags, sal_Bool bMsg ); + sal_uInt8 nActionFlags, sal_Int8 nDropAction, bool bNeedToSelectBeforePaste); static int _PasteImageMap( TransferableDataHelper& rData, SwWrtShell& rSh ); |