[Libreoffice-commits] core.git: 19 commits - chart2/source sc/source sd/qa sd/source sfx2/source svx/source sw/inc sw/sdi sw/source writerfilter/source

Armin Le Grand alg at apache.org
Fri Feb 7 04:25:19 PST 2014


 chart2/source/controller/dialogs/DataBrowserModel.cxx                  |    2 
 chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx |    3 
 sc/source/core/tool/dbdata.cxx                                         |    1 
 sc/source/ui/drawfunc/fuins1.cxx                                       |   35 ++
 sc/source/ui/inc/drawview.hxx                                          |   10 
 sc/source/ui/inc/viewfunc.hxx                                          |    8 
 sc/source/ui/view/drawview.cxx                                         |   38 ++
 sc/source/ui/view/gridwin.cxx                                          |    4 
 sc/source/ui/view/viewfun3.cxx                                         |   73 +++--
 sc/source/ui/view/viewfun7.cxx                                         |   79 ++---
 sd/qa/unit/import-tests.cxx                                            |    6 
 sd/source/ui/func/fuinsert.cxx                                         |   14 
 sd/source/ui/view/sdview4.cxx                                          |  105 +++----
 sfx2/source/view/viewprn.cxx                                           |    2 
 svx/source/table/accessibletableshape.cxx                              |    5 
 sw/inc/fesh.hxx                                                        |    2 
 sw/sdi/drawsh.sdi                                                      |    4 
 sw/source/core/doc/docdde.cxx                                          |    2 
 sw/source/core/edit/autofmt.cxx                                        |    5 
 sw/source/core/frmedt/fecopy.cxx                                       |   59 +++-
 sw/source/core/txtnode/atrfld.cxx                                      |    2 
 sw/source/core/unocore/unofield.cxx                                    |    2 
 sw/source/core/unocore/unoportenum.cxx                                 |    2 
 sw/source/ui/dochdl/swdtflvr.cxx                                       |   97 ++++--
 sw/source/ui/inc/drawsh.hxx                                            |    4 
 sw/source/ui/inc/view.hxx                                              |    5 
 sw/source/ui/shells/drawsh.cxx                                         |  142 ++++++++++
 sw/source/ui/shells/grfsh.cxx                                          |    7 
 sw/source/ui/uiview/view2.cxx                                          |   54 ++-
 sw/source/ui/wrtsh/wrtsh1.cxx                                          |   23 +
 writerfilter/source/dmapper/DomainMapper.cxx                           |    1 
 31 files changed, 591 insertions(+), 205 deletions(-)

New commits:
commit 5c75cd95178e3d57e53fee64a9d64023c6d18acf
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Feb 7 01:26:23 2014 +0000

    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

diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index eb184d0..a7c1357 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 )
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 2e22397..419749d 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -150,6 +150,16 @@ public:
     sal_Bool    GetObjectIsMarked(  SdrObject * pObject );
     sal_Bool    SelectCurrentViewObject( const OUString& rName );
 
+    // #i123922# helper which checks if a Graphic may be appied to an existing
+    // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
+    // fillable, non-OLE SdrObject, the FillStyle will be adapted
+    SdrObject* ApplyGraphicToObject(
+        SdrObject& rHitObject,
+        const Graphic& rGraphic,
+        const OUString& rBeginUndoText,
+        const OUString& rFile,
+        const OUString& rFilter);
+
     static void CheckOle( const SdrMarkList& rMarkList, sal_Bool& rAnyOle, sal_Bool& rOneOle );
     virtual void SyncForGrid( SdrObject* pObj );
 };
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 4736964..daad48e 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -118,9 +118,9 @@ public:
     void            PasteDraw( const Point& rLogicPos, SdrModel* pModel,
                                 sal_Bool bGroup = false, sal_Bool bSameDocClipboard = false );
 
-    sal_Bool            PasteOnDrawObject( const ::com::sun::star::uno::Reference<
-                                            ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
-                                        SdrObject* pHitObj, sal_Bool bLink );
+    sal_Bool PasteOnDrawObjectLinked(
+        const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rxTransferable,
+        SdrObject& rHitObj);
 
     sal_Bool            PasteDataFormat( sal_uLong nFormatId,
                                         const ::com::sun::star::uno::Reference<
@@ -141,8 +141,6 @@ public:
     bool            PasteLink( const ::com::sun::star::uno::Reference<
                                 ::com::sun::star::datatransfer::XTransferable >& rxTransferable );
 
-    sal_Bool            ApplyGraphicToObject( SdrObject* pObject, const Graphic& rGraphic );
-
     void            InsertBookmark( const OUString& rDescription, const OUString& rURL,
                                     SCCOL nPosX, SCROW nPosY, const OUString* pTarget = NULL,
                                     sal_Bool bTryReplace = false );
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index c4a4da2..fde4f9c 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -34,6 +34,7 @@
 #include <sfx2/bindings.hxx>
 #include <sfx2/viewfrm.hxx>
 #include <svx/sdrundomanager.hxx>
+#include <svx/xbtmpit.hxx>
 
 #include "drawview.hxx"
 #include "global.hxx"
@@ -951,4 +952,41 @@ SdrUndoManager* ScDrawView::getSdrUndoManagerForEnhancedTextEdit() const
     return pDoc ? dynamic_cast< SdrUndoManager* >(pDoc->GetUndoManager()) : 0;
 }
 
+// #i123922# helper to apply a Graphic to an existing SdrObject
+SdrObject* ScDrawView::ApplyGraphicToObject(
+    SdrObject& rHitObject,
+    const Graphic& rGraphic,
+    const OUString& rBeginUndoText,
+    const OUString& rFile,
+    const OUString& rFilter)
+{
+    if(dynamic_cast< SdrGrafObj* >(&rHitObject))
+    {
+        SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rHitObject.Clone();
+
+        pNewGrafObj->SetGraphic(rGraphic);
+        BegUndo(rBeginUndoText);
+        ReplaceObjectAtView(&rHitObject, *GetSdrPageView(), pNewGrafObj);
+
+        // set in all cases - the Clone() will have copied an existing link (!)
+        pNewGrafObj->SetGraphicLink( rFile, ""/*TODO?*/, rFilter );
+
+        EndUndo();
+        return pNewGrafObj;
+    }
+    else if(rHitObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rHitObject))
+    {
+        AddUndo(new SdrUndoAttrObj(rHitObject));
+
+        SfxItemSet aSet(GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+
+        aSet.Put(XFillStyleItem(XFILL_BITMAP));
+        aSet.Put(XFillBitmapItem(OUString(), rGraphic));
+        rHitObject.SetMergedItemSetAndBroadcast(aSet);
+        return &rHitObject;
+    }
+
+    return NULL;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 85498c2..30631c2 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4452,8 +4452,8 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt )
     if ( pHitObj && bIsLink )
     {
         //  dropped on drawing object
-        //  PasteOnDrawObject checks for valid formats
-        if ( pViewData->GetView()->PasteOnDrawObject( rEvt.maDropEvent.Transferable, pHitObj, sal_True ) )
+        //  PasteOnDrawObjectLinked checks for valid formats
+        if ( pViewData->GetView()->PasteOnDrawObjectLinked( rEvt.maDropEvent.Transferable, *pHitObj ) )
             return rEvt.mnAction;
     }
 
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index fd16a60..20f12c4 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -692,41 +692,66 @@ sal_Bool ScViewFunc::PasteFromSystem( sal_uLong nFormatId, sal_Bool bApi )
 //----------------------------------------------------------------------------
 //      P A S T E
 
-sal_Bool ScViewFunc::PasteOnDrawObject( const uno::Reference<datatransfer::XTransferable>& rxTransferable,
-                                    SdrObject* pHitObj, sal_Bool bLink )
+sal_Bool ScViewFunc::PasteOnDrawObjectLinked(
+    const uno::Reference<datatransfer::XTransferable>& rxTransferable,
+    SdrObject& rHitObj)
 {
-    sal_Bool bRet = false;
-    if ( bLink )
+    TransferableDataHelper aDataHelper( rxTransferable );
+
+    if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) )
     {
-        TransferableDataHelper aDataHelper( rxTransferable );
-        if ( aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ) )
+        SotStorageStreamRef xStm;
+        ScDrawView* pScDrawView = GetScDrawView();
+
+        if( pScDrawView && aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ) )
         {
-            SotStorageStreamRef xStm;
-            if( aDataHelper.GetSotStorageStream( SOT_FORMATSTR_ID_SVXB, xStm ) )
+            Graphic aGraphic;
+
+            ReadGraphic( *xStm, aGraphic );
+
+            const OUString aEmpty;
+            const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
+
+            if(pScDrawView->ApplyGraphicToObject( rHitObj, aGraphic, aBeginUndo, aEmpty, aEmpty ))
             {
-                Graphic aGraphic;
-                ReadGraphic( *xStm, aGraphic );
-                bRet = ApplyGraphicToObject( pHitObj, aGraphic );
+                return sal_True;
             }
         }
-        else if ( aDataHelper.HasFormat( SOT_FORMAT_GDIMETAFILE ) )
-        {
-            GDIMetaFile aMtf;
-            if( aDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMtf ) )
-                bRet = ApplyGraphicToObject( pHitObj, Graphic(aMtf) );
-        }
-        else if ( aDataHelper.HasFormat( SOT_FORMAT_BITMAP ) || aDataHelper.HasFormat( SOT_FORMATSTR_ID_PNG ) )
+    }
+    else if ( aDataHelper.HasFormat( SOT_FORMAT_GDIMETAFILE ) )
+    {
+        GDIMetaFile aMtf;
+        ScDrawView* pScDrawView = GetScDrawView();
+
+        if( pScDrawView && aDataHelper.GetGDIMetaFile( FORMAT_GDIMETAFILE, aMtf ) )
         {
-            BitmapEx aBmpEx;
-            if( aDataHelper.GetBitmapEx( FORMAT_BITMAP, aBmpEx ) )
-                bRet = ApplyGraphicToObject( pHitObj, Graphic(aBmpEx) );
+            const OUString aEmpty;
+            const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
+
+            if(pScDrawView->ApplyGraphicToObject( rHitObj, Graphic(aMtf), aBeginUndo, aEmpty, aEmpty ))
+            {
+                return sal_True;
+            }
         }
     }
-    else
+    else if ( aDataHelper.HasFormat( SOT_FORMAT_BITMAP ) || aDataHelper.HasFormat( SOT_FORMATSTR_ID_PNG ) )
     {
-        //  ham' wa noch nich
+        BitmapEx aBmpEx;
+        ScDrawView* pScDrawView = GetScDrawView();
+
+        if( pScDrawView && aDataHelper.GetBitmapEx( FORMAT_BITMAP, aBmpEx ) )
+        {
+            const OUString aEmpty;
+            const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
+
+            if(pScDrawView->ApplyGraphicToObject( rHitObj, Graphic(aBmpEx), aBeginUndo, aEmpty, aEmpty ))
+            {
+                return sal_True;
+            }
+        }
     }
-    return bRet;
+
+    return sal_False;
 }
 
 static sal_Bool lcl_SelHasAttrib( ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index 4a7d399..02ea05f 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -379,6 +379,38 @@ sal_Bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
     MakeDrawLayer();
     ScDrawView* pScDrawView = GetScDrawView();
 
+    // #i123922# check if the drop was over an existing object; if yes, evtl. replace
+    // the graphic for a SdrGraphObj (including link state updates) or adapt the fill
+    // style for other objects
+    if(pScDrawView)
+    {
+        SdrObject* pPickObj = 0;
+        SdrPageView* pPageView = pScDrawView->GetSdrPageView();
+
+        if(pPageView)
+        {
+            pScDrawView->PickObj(rPos, pScDrawView->getHitTolLog(), pPickObj, pPageView);
+        }
+
+        if(pPickObj)
+        {
+            const OUString aBeginUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
+            SdrObject* pResult = pScDrawView->ApplyGraphicToObject(
+                *pPickObj,
+                rGraphic,
+                aBeginUndo,
+                rFile,
+                rFilter);
+
+            if(pResult)
+            {
+                // we are done; mark the modified/new object
+                pScDrawView->MarkObj(pResult, pScDrawView->GetSdrPageView());
+                return sal_True;
+            }
+        }
+    }
+
     Point aPos( rPos );
     Window* pWin = GetActiveWin();
     MapMode aSourceMap = rGraphic.GetPrefMapMode();
@@ -399,7 +431,6 @@ sal_Bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
         aPos.X() -= aSize.Width();
 
     GetViewData()->GetViewShell()->SetDrawShell( sal_True );
-
     Rectangle aRect(aPos, aSize);
     SdrGrafObj* pGrafObj = new SdrGrafObj(rGraphic, aRect);
 
@@ -421,50 +452,4 @@ sal_Bool ScViewFunc::PasteGraphic( const Point& rPos, const Graphic& rGraphic,
     return sal_True;
 }
 
-sal_Bool ScViewFunc::ApplyGraphicToObject( SdrObject* pPickObj, const Graphic& rGraphic )
-{
-    sal_Bool bRet = false;
-
-    ScDrawView* pScDrawView = GetScDrawView();
-    if ( pScDrawView && pPickObj )
-    {
-        /**********************************************************************
-        * New attributes for object
-        **********************************************************************/
-        SdrPageView* pPV = pScDrawView->GetSdrPageView();
-        if (pPickObj->ISA(SdrGrafObj))
-        {
-            /******************************************************************
-            * Graphic object gets a new graphic
-            ******************************************************************/
-            SdrGrafObj* pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
-            pNewGrafObj->SetGraphic(rGraphic);
-
-            pScDrawView->BegUndo(ScGlobal::GetRscString(STR_UNDO_DRAGDROP));
-            pScDrawView->ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj);
-            pScDrawView->EndUndo();
-
-            bRet = sal_True;
-        }
-        else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj))
-        {
-            /******************************************************************
-            * Object gets filled with the graphic
-            ******************************************************************/
-            pScDrawView->AddUndo(new SdrUndoAttrObj(*pPickObj));
-
-            SfxItemSet aSet( pScDrawView->GetModel()->GetItemPool(),
-                                XATTR_FILLSTYLE, XATTR_FILLBITMAP );
-            aSet.Put(XFillStyleItem(XFILL_BITMAP));
-            aSet.Put(XFillBitmapItem(OUString(), rGraphic));
-
-            pPickObj->SetMergedItemSetAndBroadcast(aSet);
-
-            bRet = sal_True;
-        }
-    }
-    return bRet;
-}
-
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 2387627..0a7668f 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -122,9 +122,18 @@ void FuInsertGraphic::DoExecute( SfxRequest&  )
             {
                 sal_Int8    nAction = DND_ACTION_COPY;
                 SdrObject* pPickObj;
+                bool bSelectionReplaced(false);
 
                 if( ( pPickObj = mpView->GetSelectedSingleObject( mpView->GetPage() ) ) || ( pPickObj = mpView->GetEmptyPresentationObject( PRESOBJ_GRAPHIC ) ) )
+                {
                     nAction = DND_ACTION_LINK;
+                }
+                else if(1 == mpView->GetMarkedObjectCount())
+                {
+                    pPickObj = mpView->GetMarkedObjectByIndex(0);
+                    nAction = DND_ACTION_MOVE;
+                    bSelectionReplaced = true;
+                }
 
                 Point aPos;
                 Rectangle aRect(aPos, mpWindow->GetOutputSizePixel() );
@@ -151,6 +160,11 @@ void FuInsertGraphic::DoExecute( SfxRequest&  )
                     }
                     pGrafObj->SetGraphicLink(aPath, aReferer, aFltName);
                 }
+
+                if(bSelectionReplaced && pGrafObj)
+                {
+                    mpView->MarkObj(pGrafObj, mpView->GetSdrPageView());
+                }
             }
         }
         else
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 4c5e2c5..6a6b4e4 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 )
     {
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 6ca2008..7fd2dfd 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -512,7 +512,7 @@ public:
     sal_Bool GetDrawObjGraphic( sal_uLong nFmt, Graphic& rGrf ) const;
 
     void Paste( SvStream& rStm, sal_uInt16 nAction, const Point* pPt = 0 );
-    sal_Bool Paste( const Graphic &rGrf );
+    bool Paste( const Graphic &rGrf, const OUString& rURL );
     sal_Bool Paste( SotDataObject& rObj, const Point& rPt );
 
     sal_Bool IsAlignPossible() const;
diff --git a/sw/sdi/drawsh.sdi b/sw/sdi/drawsh.sdi
index 3bd4a4a..e4751ea 100644
--- a/sw/sdi/drawsh.sdi
+++ b/sw/sdi/drawsh.sdi
@@ -391,7 +391,9 @@ interface TextDraw : TextDrawBase
     ]
     SID_INSERT_GRAPHIC
     [
-        StateMethod = StateDisableItems ;
+        // #i123922# Add Exec and State methods for the case where Graphic DrawObjects are selected (SdrGrafObj)
+        ExecMethod = Execute ;
+        StateMethod = GetState ;
     ]
     SID_TWAIN_SELECT
     [
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 2bafe51..9868750 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -24,6 +24,7 @@
 #include <sot/storage.hxx>
 #include <unotools/pathoptions.hxx>
 #include <sfx2/dispatch.hxx>
+#include <sfx2/docfile.hxx>
 #include <sfx2/viewsh.hxx>
 #include <svx/xexch.hxx>
 #include <svx/xflasit.hxx>
@@ -71,7 +72,7 @@
 #include <pagedesc.hxx>
 #include <mvsave.hxx>
 #include <vcl/virdev.hxx>
-
+#include <svx/svdundo.hxx>
 
 using namespace ::com::sun::star;
 
@@ -1442,7 +1443,12 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
                     pFmt = GetDoc()->Insert( *GetCrsr(), *pNewObj, &aFrmSet, NULL );
                 }
                 else
-                    pView->ReplaceObjectAtView( pOldObj, *Imp()->GetPageView(), pNewObj, sal_True );
+                {
+                    // #i123922#  for handling MasterObject and virtual ones correctly, SW
+                    // wants us to call ReplaceObject at the page, but that also
+                    // triggers the same assertion (I tried it), so stay at the view method
+                    pView->ReplaceObjectAtView(pOldObj, *Imp()->GetPageView(), pNewObj);
+                }
             }
             break;
 
@@ -1545,24 +1551,59 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
     delete pModel;
 }
 
-sal_Bool SwFEShell::Paste( const Graphic &rGrf )
+bool SwFEShell::Paste(const Graphic &rGrf, const OUString& rURL)
 {
     SET_CURR_SHELL( this );
-    SdrObject* pObj;
+    SdrObject* pObj = 0;
     SdrView *pView = Imp()->GetDrawView();
 
     sal_Bool bRet = 1 == pView->GetMarkedObjectList().GetMarkCount() &&
         (pObj = pView->GetMarkedObjectList().GetMark( 0 )->GetMarkedSdrObj())->IsClosedObj() &&
         !pObj->ISA( SdrOle2Obj );
 
-    if( bRet )
+    if( bRet && pObj )
     {
-        SfxItemSet aSet(GetAttrPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+        // #i123922# added code to handle the two cases of SdrGrafObj and a fillable, non-
+        // OLE object in focus
+        SdrObject* pResult = pObj;
+
+        if(dynamic_cast< SdrGrafObj* >(pObj))
+        {
+            SdrGrafObj* pNewGrafObj = (SdrGrafObj*)pObj->Clone();
+
+            pNewGrafObj->SetGraphic(rGrf);
+
+            // #i123922#  for handling MasterObject and virtual ones correctly, SW
+            // wants us to call ReplaceObject at the page, but that also
+            // triggers the same assertion (I tried it), so stay at the view method
+            pView->ReplaceObjectAtView(pObj, *pView->GetSdrPageView(), pNewGrafObj);
+
+            OUString aReferer;
+            SwDocShell *pDocShell = GetDoc()->GetDocShell();
+            if (pDocShell->HasName()) {
+                aReferer = pDocShell->GetMedium()->GetName();
+            }
 
-        aSet.Put(XFillStyleItem(XFILL_BITMAP));
-        aSet.Put(XFillBitmapItem(aEmptyOUStr, rGrf));
-        pView->SetAttributes(aSet, false);
+            // set in all cases - the Clone() will have copied an existing link (!)
+            pNewGrafObj->SetGraphicLink(rURL, aReferer, OUString());
+
+            pResult = pNewGrafObj;
+        }
+        else
+        {
+            pView->AddUndo(new SdrUndoAttrObj(*pObj));
+
+            SfxItemSet aSet(pView->GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+
+            aSet.Put(XFillStyleItem(XFILL_BITMAP));
+            aSet.Put(XFillBitmapItem(OUString(), rGrf));
+            pObj->SetMergedItemSetAndBroadcast(aSet);
+        }
+
+        // we are done; mark the modified/new object
+        pView->MarkObj(pResult, pView->GetSdrPageView());
     }
+
     return bRet;
 }
 
diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx
index ae1da81..f0d7f9d 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;
         }
     }
 
diff --git a/sw/source/ui/inc/drawsh.hxx b/sw/source/ui/inc/drawsh.hxx
index 7e4e655..545faf7 100644
--- a/sw/source/ui/inc/drawsh.hxx
+++ b/sw/source/ui/inc/drawsh.hxx
@@ -39,6 +39,10 @@ public:
 
     void        ExecFormText(SfxRequest& rReq);
     void        GetFormTextState(SfxItemSet& rSet);
+
+    // #i123922# added helper methods to handle applying graphic data to draw objects
+    SdrObject* IsSingleFillableNonOLESelected();
+    void InsertPictureFromFile(SdrObject& rObject);
 };
 
 #endif
diff --git a/sw/source/ui/inc/view.hxx b/sw/source/ui/inc/view.hxx
index 2bcb9b5..6c8128c 100644
--- a/sw/source/ui/inc/view.hxx
+++ b/sw/source/ui/inc/view.hxx
@@ -360,10 +360,11 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
 
     SAL_DLLPRIVATE virtual void  Move();
 
-    SAL_DLLPRIVATE sal_Bool      InsertGraphicDlg( SfxRequest& );
-
     SAL_DLLPRIVATE void          DocumentStatsChanged();
 
+public: // #i123922# Needs to be called from a 2nd place now as a helper method
+    SAL_DLLPRIVATE sal_Bool          InsertGraphicDlg( SfxRequest& );
+
 protected:
 
     SwView_Impl*    GetViewImpl() {return m_pViewImpl;}
diff --git a/sw/source/ui/shells/drawsh.cxx b/sw/source/ui/shells/drawsh.cxx
index 16a1f98..84f394a 100644
--- a/sw/source/ui/shells/drawsh.cxx
+++ b/sw/source/ui/shells/drawsh.cxx
@@ -22,6 +22,7 @@
 #include <svx/svdotext.hxx>
 #include <svl/whiter.hxx>
 #include <svx/fontwork.hxx>
+#include <sfx2/docfile.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/bindings.hxx>
 #include <sfx2/objface.hxx>
@@ -34,6 +35,8 @@
 #include <wview.hxx>
 #include <swmodule.hxx>
 #include <swwait.hxx>
+#include <doc.hxx>
+#include <docsh.hxx>
 #include <docstat.hxx>
 #include <IDocumentStatistics.hxx>
 #include <tools/diagnose_ex.h>
@@ -44,6 +47,12 @@
 #include <svx/svdoashp.hxx>
 #include <svx/xtable.hxx>
 #include <sfx2/sidebar/EnumContext.hxx>
+#include <svx/svdoashp.hxx>
+#include <svx/svdoole2.hxx>
+#include <sfx2/opengrf.hxx>
+#include <svx/svdograf.hxx>
+#include <svx/svdundo.hxx>
+#include <svx/xbtmpit.hxx>
 
 #include "swundo.hxx"
 #include "wrtsh.hxx"
@@ -74,6 +83,112 @@ SFX_IMPL_INTERFACE(SwDrawShell, SwDrawBaseShell, SW_RES(STR_SHELLNAME_DRAW))
 
 TYPEINIT1(SwDrawShell,SwDrawBaseShell)
 
+// #i123922# check as the name implies
+SdrObject* SwDrawShell::IsSingleFillableNonOLESelected()
+{
+    SwWrtShell &rSh = GetShell();
+    SdrView* pSdrView = rSh.GetDrawView();
+
+    if(!pSdrView)
+    {
+        return 0;
+    }
+
+    if(1 != pSdrView->GetMarkedObjectCount())
+    {
+        return 0;
+    }
+
+    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+
+    if(!pPickObj)
+    {
+        return 0;
+    }
+
+    if(!pPickObj->IsClosedObj())
+    {
+        return 0;
+    }
+
+    if(dynamic_cast< SdrOle2Obj* >(pPickObj))
+    {
+        return 0;
+    }
+
+    return pPickObj;
+}
+
+// #i123922# insert given graphic data dependent of the object type in focus
+void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
+{
+    SwWrtShell &rSh = GetShell();
+    SdrView* pSdrView = rSh.GetDrawView();
+
+    if(pSdrView)
+    {
+        SvxOpenGraphicDialog aDlg(SW_RESSTR(STR_INSERT_GRAPHIC));
+
+        if(GRFILTER_OK == aDlg.Execute())
+        {
+            Graphic aGraphic;
+            int nError(aDlg.GetGraphic(aGraphic));
+
+            if(GRFILTER_OK == nError)
+            {
+                const bool bAsLink(aDlg.IsAsLink());
+                SdrObject* pResult = &rObject;
+
+                rSh.StartUndo(UNDO_PASTE_CLIPBOARD);
+
+                if(dynamic_cast< SdrGrafObj* >(&rObject))
+                {
+                    SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rObject.Clone();
+
+                    pNewGrafObj->SetGraphic(aGraphic);
+
+                    // #i123922#  for handling MasterObject and virtual ones correctly, SW
+                    // wants us to call ReplaceObject at the page, but that also
+                    // triggers the same assertion (I tried it), so stay at the view method
+                    pSdrView->ReplaceObjectAtView(&rObject, *pSdrView->GetSdrPageView(), pNewGrafObj);
+
+                    OUString aReferer;
+                    SwDocShell *pDocShell = rSh.GetDoc()->GetDocShell();
+                    if (pDocShell->HasName()) {
+                        aReferer = pDocShell->GetMedium()->GetName();
+                    }
+
+                    // set in all cases - the Clone() will have copied an existing link (!)
+                    pNewGrafObj->SetGraphicLink(
+                        bAsLink ? aDlg.GetPath() : OUString(),
+                        aReferer,
+                        bAsLink ? aDlg.GetCurrentFilter() : OUString());
+
+                    pResult = pNewGrafObj;
+                }
+                else // if(rObject.IsClosedObj() && !dynamic_cast< SdrOle2Obj* >(&rObject))
+                {
+                    pSdrView->AddUndo(new SdrUndoAttrObj(rObject));
+
+                    SfxItemSet aSet(pSdrView->GetModel()->GetItemPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
+
+                    aSet.Put(XFillStyleItem(XFILL_BITMAP));
+                    aSet.Put(XFillBitmapItem(OUString(), aGraphic));
+                    rObject.SetMergedItemSetAndBroadcast(aSet);
+                }
+
+                rSh.EndUndo( UNDO_END );
+
+                if(pResult)
+                {
+                    // we are done; mark the modified/new object
+                    pSdrView->MarkObj(pResult, pSdrView->GetSdrPageView());
+                }
+            }
+        }
+    }
+}
+
 void SwDrawShell::Execute(SfxRequest &rReq)
 {
     SwWrtShell          &rSh = GetShell();
@@ -265,6 +380,20 @@ void SwDrawShell::Execute(SfxRequest &rReq)
             rReq.Ignore ();
             break;
 
+        case SID_INSERT_GRAPHIC:
+        {
+            // #i123922# check if we can do something
+            SdrObject* pObj = IsSingleFillableNonOLESelected();
+
+            if(pObj)
+            {
+                // ...and if yes, do something
+                InsertPictureFromFile(*pObj);
+            }
+
+            break;
+        }
+
         default:
             OSL_ENSURE(!this, "wrong dispatcher");
             return;
@@ -357,6 +486,19 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
                 }
             }
             break;
+
+            case SID_INSERT_GRAPHIC:
+            {
+                // #i123922# check if we can do something
+                SdrObject* pObj = IsSingleFillableNonOLESelected();
+
+                if(!pObj)
+                {
+                    rSet.DisableItem(nWhich);
+                }
+
+                break;
+            }
         }
         nWhich = aIter.NextWhich();
     }
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 6e6c757..0ad2879 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -186,6 +186,13 @@ void SwGrfShell::Execute(SfxRequest &rReq)
         break;
 
         case SID_INSERT_GRAPHIC:
+        {
+            // #i123922# implement slot independent from the two below to
+            // bring up the insert graphic dialog and associated actions
+            SwView& rLclView = GetView();
+            rReq.SetReturnValue(SfxBoolItem(nSlot, rLclView.InsertGraphicDlg( rReq )));
+            break;
+        }
         case FN_FORMAT_GRAFIC_DLG:
         case FN_DRAW_WRAP_DLG:
         {
diff --git a/sw/source/ui/uiview/view2.cxx b/sw/source/ui/uiview/view2.cxx
index 4d66c6c..3a43507 100644
--- a/sw/source/ui/uiview/view2.cxx
+++ b/sw/source/ui/uiview/view2.cxx
@@ -238,28 +238,44 @@ int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter,
         }
 
         SwFlyFrmAttrMgr aFrameManager( sal_True, GetWrtShellPtr(), FRMMGR_TYPE_GRF );
-
         SwWrtShell& rShell = GetWrtShell();
-        rShell.StartAction();
-        if( bLink )
-        {
-            SwDocShell* pDocSh = GetDocShell();
-            INetURLObject aTemp(
-                pDocSh->HasName() ?
-                    pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) :
-                    OUString());
 
-            OUString sURL = URIHelper::SmartRel2Abs( aTemp, rPath, URIHelper::GetMaybeFileHdl() );
+        // #i123922# determine if we really want to insert or replace the graphic at a selected object
+        const bool bReplaceMode(rShell.HasSelection() && nsSelectionType::SEL_FRM == rShell.GetSelectionType());
 
-            rShell.Insert( sURL, rFilter, aGraphic, &aFrameManager, bRule );
+        if(bReplaceMode)
+        {
+            // #i123922# Do same as in D&D, ReRead graphic and all is done
+            rShell.ReRead(
+                bLink ? rPath : OUString(),
+                bLink ? rFilter : OUString(),
+                &aGraphic);
         }
         else
         {
-            rShell.Insert( OUString(), OUString(), aGraphic, &aFrameManager );
-        }
+            rShell.StartAction();
+            if( bLink )
+            {
+                SwDocShell* pDocSh = GetDocShell();
+                INetURLObject aTemp(
+                    pDocSh->HasName() ?
+                        pDocSh->GetMedium()->GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) :
+                        OUString());
+
+                OUString sURL = URIHelper::SmartRel2Abs(
+                    aTemp, rPath, URIHelper::GetMaybeFileHdl() );
+
+                rShell.Insert( sURL,
+                            rFilter, aGraphic, &aFrameManager, bRule );
+            }
+            else
+            {
+                rShell.Insert( OUString(), OUString(), aGraphic, &aFrameManager );
+            }
 
-        // it is too late after "EndAction" because the Shell can already be destroyed.
-        rShell.EndAction();
+            // it is too late after "EndAction" because the Shell can already be destroyed.
+            rShell.EndAction();
+        }
     }
     return aResult;
 }
@@ -427,6 +443,9 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
         SwRewriter aRewriter;
         aRewriter.AddRule(UndoArg1, SW_RESSTR(STR_GRAPHIC_DEFNAME));
 
+        // #i123922# determine if we really want to insert or replace the graphic at a selected object
+        const bool bReplaceMode(rSh.HasSelection() && nsSelectionType::SEL_FRM == rSh.GetSelectionType());
+
         rSh.StartUndo(UNDO_INSERT, &aRewriter);
 
         int nError = InsertGraphic( aFileName, aFilterName, bAsLink, &GraphicFilter::GetGraphicFilter() );
@@ -434,7 +453,10 @@ sal_Bool SwView::InsertGraphicDlg( SfxRequest& rReq )
         // format not equal to current filter (with autodetection)
         if( nError == GRFILTER_FORMATERROR )
             nError = InsertGraphic( aFileName, OUString(), bAsLink, &GraphicFilter::GetGraphicFilter() );
-        if ( rSh.IsFrmSelected() )
+
+        // #i123922# no new FrameFormat for replace mode, only when new object was created,
+        // else this would reset the current setting for the frame holding the graphic
+        if ( !bReplaceMode && rSh.IsFrmSelected() )
         {
             SwFrmFmt* pFmt = pDoc->FindFrmFmtByName( sGraphicFormat );
             if(!pFmt)
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 4f03d0d..f1ccf38 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -166,7 +166,6 @@ sal_Bool SwWrtShell::IsEndWrd()
 }
 
 // Insert string
-
 void SwWrtShell::InsertByWord( const OUString & rStr)
 {
     if( !rStr.isEmpty() )
@@ -1644,7 +1643,27 @@ sal_Bool SwWrtShell::Pop( sal_Bool bOldCrsr )
 
 bool SwWrtShell::CanInsert()
 {
-    return (!(IsSelFrmMode() || IsObjSelected() || (GetView().GetDrawFuncPtr() != NULL) || (GetView().GetPostItMgr()->GetActiveSidebarWin()!= NULL)));
+    if(IsSelFrmMode())
+    {
+        return false;
+    }
+
+    if(IsObjSelected())
+    {
+        return false;
+    }
+
+    if(GetView().GetDrawFuncPtr())
+    {
+        return false;
+    }
+
+    if(GetView().GetPostItMgr()->GetActiveSidebarWin())
+    {
+        return false;
+    }
+
+    return true;
 }
 
 void SwWrtShell::ChgDBData(const SwDBData& aDBData)
commit 96ca3d2f563d1f057b251c49541827223e6712d0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:49:51 2014 +0000

    coverity#708818 Unused pointer value
    
    Change-Id: I9ffd3bd9fb4eeb7531dc489ce79c5b74e9ddc903

diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 7404ede..2a82e00 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -859,7 +859,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                     }
 
                     // take the changes made in the dialog
-                    pPrinter = SetPrinter_Impl( pDlgPrinter );
+                    SetPrinter_Impl( pDlgPrinter );
 
                     // forget new printer, it was taken over (as pPrinter) or deleted
                     pDlgPrinter = NULL;
commit ac01fd51822dc006abec578d61d66f7a169c19cb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:40:12 2014 +0000

    coverity#1158101 Unchecked dynamic_cast
    
    Change-Id: Ibbe35f67a92dd41d45d2e1b4a3bb240b6b7adc66

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 2698b83..ccc9781 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -223,6 +223,7 @@ void SdFiltersTest::testN828390()
         // Get the object
         SdrObject *pObj = pPage->GetObj(0);
         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+        CPPUNIT_ASSERT( pTxtObj );
         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
         aEdit.GetCharAttribs(0, rLst);
         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
commit c72f099d90353460a197e8308256e5aac2fa8383
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:39:41 2014 +0000

    coverity#1158102 Unchecked dynamic_cast
    
    Change-Id: I806e1c4cd768aec0bb5d56449a1692226f20895e

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index c6e4239..2698b83 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -408,6 +408,7 @@ void SdFiltersTest::testFdo72998()
     CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
     {
         SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>(pPage->GetObj(2));
+        CPPUNIT_ASSERT( pObj );
         const SdrCustomShapeGeometryItem& rGeometryItem = (const SdrCustomShapeGeometryItem&)pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY );
         CPPUNIT_ASSERT_MESSAGE( "not a custom shape", pObj );
         const ::com::sun::star::uno::Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( OUString( "ViewBox" ) );
commit 0d1d6aa26e7987af99ca3dff9dde18a78879849c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:38:36 2014 +0000

    coverity#1158103 Unchecked dynamic_cast
    
    Change-Id: Id08897c1dcb9df59458a29d5d20d57cd6a9039f8

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 8f40354..c6e4239 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -255,6 +255,7 @@ void SdFiltersTest::testN828390_2()
 
     SdrObject *pObj = pPage->GetObj(0);
     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+    CPPUNIT_ASSERT( pTxtObj );
     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     CPPUNIT_ASSERT(aEdit.GetText(0) == OUString("Linux  "));
     CPPUNIT_ASSERT(aEdit.GetText(1) == OUString("Standard Platform"));
commit 38e7e67248f0b477b4b1a6614e10dfca60a8a5cd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:38:05 2014 +0000

    coverity#1158104 Unchecked dynamic_cast
    
    Change-Id: I725d1adc028597123dec10c2de6c609211c8e7a4

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index f7d3b4f..8f40354 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -275,6 +275,7 @@ void SdFiltersTest::testN828390_3()
 
     SdrObject *pObj = pPage->GetObj(0);
     SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+    CPPUNIT_ASSERT( pTxtObj );
     const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
     std::vector<EECharAttrib> rLst;
     aEdit.GetCharAttribs(1, rLst);
commit ade3a42423085bdeda921c175f5cd0b6aa876c43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:37:37 2014 +0000

    coverity#1158105 Unchecked dynamic_cast
    
    Change-Id: Ia908b5cc3f7d18e376496eacd71a2e55f75bf8b3

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index a906583..f7d3b4f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -311,6 +311,7 @@ void SdFiltersTest::testN828390_4()
         std::vector<EECharAttrib> rLst;
         SdrObject *pObj = pPage->GetObj(0);
         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+        CPPUNIT_ASSERT( pTxtObj );
         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
         aEdit.GetCharAttribs(1, rLst);
         for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it)
commit e04eee9a5954a381eecfbcb86584c61f7adcff62
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:37:04 2014 +0000

    coverity#1158106 Unchecked dynamic_cast
    
    Change-Id: I52af351a470bec9acb7a1981faf0ae6943ceba43

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 015b6e1..a906583 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -348,6 +348,7 @@ void SdFiltersTest::testN828390_5()
     {
         SdrObject *pObj = pPage->GetObj(0);
         SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pObj );
+        CPPUNIT_ASSERT( pTxtObj );
         const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
         const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetPool()->GetItem2(EE_PARA_NUMBULLET, 5));
         CPPUNIT_ASSERT( pNumFmt );
commit 16738ab4d85e0c81e49045a1948d2404e2e25bb3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:35:37 2014 +0000

    coverity#1158121 Unchecked dynamic_cast
    
    Change-Id: I961c3da368c1f2bffb4c116c325a82cf7619cf15

diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index 8bfa963..ce6defc 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -793,6 +793,8 @@ void DataBrowserModel::updateFromModel()
     {
         Reference< frame::XModel > xChartModel( m_xChartDocument, uno::UNO_QUERY );
         ChartModel* pModel = dynamic_cast<ChartModel*>(xChartModel.get());
+        if (!pModel)
+            return;
         ExplicitCategoriesProvider aExplicitCategoriesProvider( ChartModelHelper::getFirstCoordinateSystem(xChartModel), *pModel );
 
         const Sequence< Reference< chart2::data::XLabeledDataSequence> >& rSplitCategoriesList( aExplicitCategoriesProvider.getSplitCategoriesList() );
commit 33dc343268ee9d1d319b55a205ffb9b2768f97c8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:34:12 2014 +0000

    coverity#1158125 Unchecked dynamic_cast
    
    Change-Id: Id560c9d5941ba679b92aaa2b2db0fb34a23d7a5f

diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
index 5763764..e0efdc3 100644
--- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx
@@ -350,7 +350,8 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf
                 if (bIncludeHiddenCells != m_bIncludeHiddenCells)
                 {
                     ChartModel* pModel = dynamic_cast<ChartModel*>(m_xChartModel.get());
-                    bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *pModel );
+                    if (pModel)
+                        bChanged = ChartModelHelper::setIncludeHiddenCells( bIncludeHiddenCells, *pModel );
                 }
             }
         }
commit 6c45566ece90790e4baf7ba5ae8a45beb31eb078
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:29:50 2014 +0000

    coverity#1158077 Unchecked dynamic_cast
    
    Change-Id: I4aae47d34dc3ab25cdd20816d411d5e09375b49d

diff --git a/sw/source/core/doc/docdde.cxx b/sw/source/core/doc/docdde.cxx
index 488c70c..a2fef4e 100644
--- a/sw/source/core/doc/docdde.cxx
+++ b/sw/source/core/doc/docdde.cxx
@@ -57,6 +57,8 @@ namespace
             if ( IDocumentMarkAccess::GetType( *(ppMark->get()) ) == IDocumentMarkAccess::DDE_BOOKMARK)
             {
                 ::sw::mark::DdeBookmark* const pBkmk = dynamic_cast< ::sw::mark::DdeBookmark*>(ppMark->get());
+                if (!pBkmk)
+                    return NULL;
                 if (
                     (bCaseSensitive && (pBkmk->GetName() == sNameLc)) ||
                     (!bCaseSensitive && GetAppCharClass().lowercase(pBkmk->GetName()) == sNameLc)
commit 78213dfeadf5980b8ab4677bfdabb5bf6694c523
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:27:58 2014 +0000

    coverity#1158075 Dereference after null check
    
    Change-Id: I0143ec3dd07d4a56f9ce71ab877593c0b23a05c3

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 4ca35f4..60f3d7a 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1980,7 +1980,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos )
             case '/':
                 if ( aFlags.bAddNonBrkSpace )
                 {
-                    LanguageType eLang = (bGetLanguage && pAktTxtNd)
+                    LanguageType eLang = bGetLanguage
                                            ? pAktTxtNd->GetLang( nSttPos )
                                            : LANGUAGE_SYSTEM;
 
@@ -2037,7 +2037,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos )
                 continue;       // do not check further
             }
 
-            LanguageType eLang = (bGetLanguage && pAktTxtNd)
+            LanguageType eLang = bGetLanguage
                                            ? pAktTxtNd->GetLang( nSttPos )
                                            : LANGUAGE_SYSTEM;
 
commit 710a7dd475df5a68641ef1d4966178e739474a3e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:14:27 2014 +0000

    coverity#1158167 Missing break in switch
    
    Change-Id: I33f19229ebaa96aa7dffb3348dbe382fb813561f

diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index 96df66d..4ca35f4 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -1995,6 +1995,7 @@ void SwAutoFormat::AutoCorrect( sal_Int32 nPos )
             case '?':
                 if( aFlags.bCptlSttSntnc )
                     bFirstSent = sal_True;
+                /* fallthrough */
             default:
                 if( !( rAppCC.isLetterNumeric( *pTxt, nPos )
                         || '/' == cChar )) //  '/' should not be a word separator (e.g. '1/2' needs to be handled as one word for replacement)
commit 50838ed959c309cbaf04b9e7f7032337f8461f80
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 11:13:25 2014 +0000

    coverity#1158165 Missing break in switch
    
    Change-Id: I34fc275f6e55b3e70a0f010d9e342fa8ce34332e

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 61c5a8b..6ffd65b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2410,6 +2410,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     break;
     case NS_ooxml::LN_paratrackchange:
         m_pImpl->StartParaMarkerChange( );
+        /* fallthrough */
     case NS_ooxml::LN_CT_PPr_pPrChange:
     case NS_ooxml::LN_trackchange:
     case NS_ooxml::LN_EG_RPrContent_rPrChange:
commit 7ca55ef5cf75e9944fd9edc980d23462e83fa1fb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 10:24:18 2014 +0000

    coverity#1158074 Unchecked dynamic_cast
    
    Change-Id: I29e9a98a862b2d6b5263606111c7be75e2160261

diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 15c7a38..7481b4a 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -68,7 +68,7 @@ SwFmtFld::SwFmtFld( const SwField &rFld )
     {
         // input field in-place editing
         SetWhich( RES_TXTATR_INPUTFIELD );
-        dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
+        static_cast<SwInputField*>(GetField())->SetFmtFld( *this );
     }
     else if ( GetField()->GetTyp()->Which() == RES_POSTITFLD )
     {
commit 190737392868f9b47ac77fb7a01532c04856ae82
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 10:23:13 2014 +0000

    coverity#1158062 Unchecked dynamic_cast
    
    Change-Id: Ife7eae1cbf17c4fae4b147be2b93c1b02bdcab1e

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index b78f725..b304197 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1966,7 +1966,7 @@ throw (lang::IllegalArgumentException, uno::RuntimeException)
             {
                 UnoActionContext aCont( m_pImpl->m_pDoc );
                 // insert copy of annotation at new text range
-                SwPostItField* pPostItField = dynamic_cast< SwPostItField* >(m_pImpl->m_pFmtFld->GetField()->CopyField());
+                SwPostItField* pPostItField = static_cast< SwPostItField* >(m_pImpl->m_pFmtFld->GetField()->CopyField());
                 SwFmtFld aFmtFld( *pPostItField );
                 delete pPostItField;
                 SwPaM aEnd( *aIntPam.End(), *aIntPam.End() );
commit cee79013092ef593ff5ae8cce0d4174f7ac3512c
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 10:10:05 2014 +0000

    coverity#1158059 Unchecked dynamic_cast
    
    Change-Id: Ia7b3ed28c1120d542c1d1dbe4fd05b2663b688d1

diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 76059b4..9677f7d 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -816,7 +816,7 @@ lcl_ExportHints(
                             break;
 
                         const SwTxtAnnotationFld* pTxtAnnotationFld = dynamic_cast<const SwTxtAnnotationFld*>( pAttr );
-                        ::sw::mark::IMark* pAnnotationMark = pTxtAnnotationFld->GetAnnotationMark();
+                        ::sw::mark::IMark* pAnnotationMark = pTxtAnnotationFld ? pTxtAnnotationFld->GetAnnotationMark() : NULL;
                         if ( pAnnotationMark != NULL )
                         {
                             SwXTextPortion* pPortion = new SwXTextPortion( pUnoCrsr, xParent, PORTION_ANNOTATION_END );
commit 624eb1cc6a42ed37a351c14bdee4e0007959c2d0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 09:56:48 2014 +0000

    coverity#1132667 Unchecked dynamic_cast
    
    Change-Id: Ia1e8a041d1eb1770757731554ab4fe007a62c111

diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index fa6d20a..1aef642 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -291,9 +291,10 @@ void SAL_CALL AccessibleTableShapeImpl::modified( const EventObject& /*aEvent*/
         }
         //notify bridge to update the acc cache.
         AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
-        pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
+        if (pAccTable)
+            pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
     }
-    catch( Exception& )
+    catch( const Exception& )
     {
         OSL_FAIL("svx::AccessibleTableShape::modified(), exception caught!");
     }
commit f70d03436b7b501e0ed1d745935a204b9b97b855
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Feb 7 09:51:19 2014 +0000

    coverity#1158232 have a stab at silencing warning with function markup
    
    and coverity#983117 Resource leak
    
    Change-Id: I9dd71c64894191ff767e711f685d48f27308f445

diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e8f171f..62e3a36 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -683,6 +683,7 @@ ScDBData* ScDBCollection::NamedDBs::findByUpperName(const OUString& rName)
     return itr == maDBs.end() ? NULL : &(*itr);
 }
 
+// coverity[+free : arg-0]
 bool ScDBCollection::NamedDBs::insert(ScDBData* p)
 {
     SAL_WNODEPRECATED_DECLARATIONS_PUSH


More information about the Libreoffice-commits mailing list