diff options
author | Armin Le Grand <alg@apache.org> | 2014-02-07 01:26:23 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-07 12:24:46 +0000 |
commit | 5c75cd95178e3d57e53fee64a9d64023c6d18acf (patch) | |
tree | 0b8608bbb949b1f07e62c82a188ba5d96da861e3 /sc/source/ui/drawfunc/fuins1.cxx | |
parent | 96ca3d2f563d1f057b251c49541827223e6712d0 (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 'sc/source/ui/drawfunc/fuins1.cxx')
-rw-r--r-- | sc/source/ui/drawfunc/fuins1.cxx | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index eb184d0d5d33..a7c135789dea 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -40,6 +40,7 @@ #include "scresid.hxx" #include "progress.hxx" #include "sc.hrc" +#include "globstr.hrc" using namespace ::com::sun::star; @@ -97,11 +98,41 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, const OUString& rFileName, const OUString& rFilterName, sal_Bool bAsLink, sal_Bool bApi, ScTabViewShell* pViewSh, Window* pWindow, SdrView* pView ) { + ScDrawView* pDrawView = pViewSh->GetScDrawView(); + + // #i123922# check if an existing object is selected; if yes, evtl. replace + // the graphic for a SdrGraphObj (including link state updates) or adapt the fill + // style for other objects + if(pDrawView && 1 == pDrawView->GetMarkedObjectCount()) + { + SdrObject* pPickObj = pDrawView->GetMarkedObjectByIndex(0); + + if(pPickObj) + { + //sal_Int8 nAction(DND_ACTION_MOVE); + //Point aPos; + const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP)); + const OUString aEmpty; + + SdrObject* pResult = pDrawView->ApplyGraphicToObject( + *pPickObj, + rGraphic, + aBeginUndo, + bAsLink ? rFileName : aEmpty, + bAsLink ? rFilterName : aEmpty); + + if(pResult) + { + // we are done; mark the modified/new object + pDrawView->MarkObj(pResult, pDrawView->GetSdrPageView()); + return; + } + } + } + // set the size so the graphic has its original pixel size // at 100% view scale (as in SetMarkedOriginalSize), // instead of respecting the current view scale - - ScDrawView* pDrawView = pViewSh->GetScDrawView(); MapMode aSourceMap = rGraphic.GetPrefMapMode(); MapMode aDestMap( MAP_100TH_MM ); if ( aSourceMap.GetMapUnit() == MAP_PIXEL && pDrawView ) |