summaryrefslogtreecommitdiff
path: root/sd/source/ui/view
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 /sd/source/ui/view
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 'sd/source/ui/view')
-rw-r--r--sd/source/ui/view/sdview4.cxx105
1 files changed, 54 insertions, 51 deletions
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 4c5e2c575d89..6a6b4e4f61b9 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -93,67 +93,70 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
}
- if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
- {
- const bool bIsGraphic(0 != dynamic_cast< SdrGrafObj* >(pPickObj));
+ const bool bIsGraphic(0 != dynamic_cast< SdrGrafObj* >(pPickObj));
- if(bIsGraphic || (pPickObj && pPickObj->IsEmptyPresObj() && !bOnMaster)) // #i121603# Do not use pObj, it may be NULL
+ if(pPickObj && !bIsGraphic && pPickObj->IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(pPickObj))
+ {
+ // fill style change (fill object with graphic), independent of mnAction
+ // and thus of DND_ACTION_LINK or DND_ACTION_MOVE
+ if( IsUndoEnabled() )
{
- if( IsUndoEnabled() )
- BegUndo(SD_RESSTR(STR_INSERTGRAPHIC));
-
- SdPage* pPage = (SdPage*) pPickObj->GetPage();
-
- if( bIsGraphic )
- {
- // We fill the object with the Bitmap
- pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
- pNewGrafObj->SetGraphic(rGraphic);
- }
- else
- {
- pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetSnapRect() );
- pNewGrafObj->SetEmptyPresObj(true);
- }
-
- if ( pNewGrafObj->IsEmptyPresObj() )
- {
- Rectangle aRect( pNewGrafObj->GetLogicRect() );
- pNewGrafObj->AdjustToMaxRect( aRect, false );
- pNewGrafObj->SetOutlinerParaObject(NULL);
- pNewGrafObj->SetEmptyPresObj(false);
- }
+ BegUndo(OUString(SdResId(STR_UNDO_DRAGDROP)));
+ AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
+ EndUndo();
+ }
- if (pPage && pPage->IsPresObj(pPickObj))
- {
- // Insert new PresObj into the list
- pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
- pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
- }
+ SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
- if (pImageMap)
- pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
+ aSet.Put(XFillStyleItem(XFILL_BITMAP));
+ aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
+ pPickObj->SetMergedItemSetAndBroadcast(aSet);
+ }
+ else if(DND_ACTION_LINK == mnAction
+ && pPickObj
+ && pPV
+ && (bIsGraphic || (pPickObj->IsEmptyPresObj() && !bOnMaster))) // #121603# Do not use pObj, it may be NULL
+ {
+ // hit on SdrGrafObj with wanted new linked graphic (or PresObj placeholder hit)
+ if( IsUndoEnabled() )
+ BegUndo(OUString(SdResId(STR_INSERTGRAPHIC)));
- ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
+ SdPage* pPage = (SdPage*) pPickObj->GetPage();
- if( IsUndoEnabled() )
- EndUndo();
+ if( bIsGraphic )
+ {
+ // Das Objekt wird mit der Bitmap gefuellt
+ pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
+ pNewGrafObj->SetGraphic(rGraphic);
}
- else if(pPickObj->IsClosedObj())
+ else
{
- // fill object with graphic
- if( IsUndoEnabled() )
- {
- BegUndo(SD_RESSTR(STR_UNDO_DRAGDROP));
- AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
- EndUndo();
- }
+ pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
+ pNewGrafObj->SetEmptyPresObj(sal_True);
+ }
+
+ if ( pNewGrafObj->IsEmptyPresObj() )
+ {
+ Rectangle aRect( pNewGrafObj->GetLogicRect() );
+ pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
+ pNewGrafObj->SetOutlinerParaObject(NULL);
+ pNewGrafObj->SetEmptyPresObj(sal_False);
+ }
- SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
- aSet.Put(XFillStyleItem(XFILL_BITMAP));
- aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
- pPickObj->SetMergedItemSetAndBroadcast(aSet);
+ if (pPage && pPage->IsPresObj(pPickObj))
+ {
+ // Neues PresObj in die Liste eintragen
+ pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
+ pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
}
+
+ if (pImageMap)
+ pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
+
+ ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
+
+ if( IsUndoEnabled() )
+ EndUndo();
}
else if ( pPV )
{