sd/source/ui/view/sdview3.cxx |  113 ++++++++++++++++++++----------------------
 1 file changed, 56 insertions(+), 57 deletions(-)

New commits:
commit 7ccde3fecfc496f8a57d699880e51432f7660d88
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Nov 28 13:07:54 2024 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Nov 28 12:16:54 2024 +0100

    Simplify a bit
    
    The creation of own TransferableDataHelper was needed when the code
    was introduced initially, taking a reference to XTransferable; now,
    when it already takes a helper, it's no more needed.
    
    Change-Id: I4c42327ab9b964c61572be13a4a89b44efc8d343
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177466
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index f2edd0f7bd47..37455c28b1bb 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -80,7 +80,7 @@ using namespace ::com::sun::star::datatransfer;
 
 namespace sd {
 
-#define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || nFormat 
== SotClipboardFormatId::NONE ) && aDataHelper.HasFormat( _def_Type ) )
+#define CHECK_FORMAT_TRANS( _def_Type ) ( ( nFormat == (_def_Type) || nFormat 
== SotClipboardFormatId::NONE ) && rDataHelper.HasFormat( _def_Type ) )
 
 /*************************************************************************
 |*
@@ -259,10 +259,6 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     mnAction = rDnDAction;
     mbIsDropAllowed = false;
 
-    TransferableDataHelper  aDataHelper( rDataHelper );
-    SdPage*                 pPage = nullptr;
-    std::unique_ptr<ImageMap> pImageMap;
-    bool bReturn = false;
     bool                    bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 );
     bool                    bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) 
|| bLink );
     SdrInsertFlags          nPasteOptions = SdrInsertFlags::SETDEFLAYER;
@@ -283,11 +279,12 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         pPickObj = PickObj(rPos, getHitTolLog(), pPV);
     }
 
+    SdPage* pPage = nullptr;
     if( nPage != SDRPAGE_NOTFOUND )
         pPage = static_cast<SdPage*>( mrDoc.GetPage( nPage ) );
 
     SdTransferable* pOwnData = nullptr;
-    SdTransferable* pImplementation = SdTransferable::getImplementation( 
aDataHelper.GetTransferable() );
+    SdTransferable* pImplementation = SdTransferable::getImplementation( 
rDataHelper.GetTransferable() );
 
     if(pImplementation && (rDnDAction & DND_ACTION_LINK))
     {
@@ -320,9 +317,10 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     }
 
     // ImageMap?
-    if( !pOwnData && aDataHelper.HasFormat( SotClipboardFormatId::SVIM ) )
+    std::unique_ptr<ImageMap> pImageMap;
+    if (!pOwnData && rDataHelper.HasFormat(SotClipboardFormatId::SVIM))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::SVIM ) )
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::SVIM ) )
         {
             pImageMap.reset(new ImageMap);
             // mba: clipboard always must contain absolute URLs (could be from 
alien source)
@@ -335,12 +333,12 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     if( !bLink && (nFormat == SotClipboardFormatId::NONE || (nFormat == 
SotClipboardFormatId::RTF) || (nFormat == SotClipboardFormatId::RICHTEXT)) )
     {
         // if the object supports rtf and there is a table involved, default 
is to create a table
-        bool bIsRTF = aDataHelper.HasFormat( SotClipboardFormatId::RTF );
-        if( ( bIsRTF || aDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT 
) )
-            && ! aDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
+        bool bIsRTF = rDataHelper.HasFormat(SotClipboardFormatId::RTF);
+        if( ( bIsRTF || rDataHelper.HasFormat( SotClipboardFormatId::RICHTEXT 
) )
+            && ! rDataHelper.HasFormat( SotClipboardFormatId::DRAWING ) )
         {
             auto nFormatId = bIsRTF ? SotClipboardFormatId::RTF : 
SotClipboardFormatId::RICHTEXT;
-            if (std::unique_ptr<SvStream> xStm = 
aDataHelper.GetSotStorageStream( nFormatId ))
+            if (std::unique_ptr<SvStream> xStm = 
rDataHelper.GetSotStorageStream(nFormatId))
             {
                 xStm->Seek( 0 );
 
@@ -364,6 +362,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     // when a CHECK_FORMAT_TRANS(*format*) detected format does not work. This 
is
     // e.g. necessary for SotClipboardFormatId::BITMAP
 
+    bool bReturn = false;
     if (pOwnData)
     {
         // Paste only if SfxClassificationHelper recommends so.
@@ -683,7 +682,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::PDF ))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::PDF ))
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::PDF ))
         {
             Point aInsertPos(rPos);
             Graphic aGraphic;
@@ -702,7 +701,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && CHECK_FORMAT_TRANS( SotClipboardFormatId::DRAWING ))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::DRAWING ))
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::DRAWING ))
         {
             DrawDocShellRef xShell = new 
DrawDocShell(SfxObjectCreateMode::INTERNAL, false, DocumentType::Impress);
             xShell->DoInitNew();
@@ -858,7 +857,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     {
         OUString aOUString;
 
-        if( aDataHelper.GetString( 
SotClipboardFormatId::SBA_FIELDDATAEXCHANGE, aOUString ) )
+        if (rDataHelper.GetString(SotClipboardFormatId::SBA_FIELDDATAEXCHANGE, 
aOUString))
         {
             rtl::Reference<SdrObject> pObj = CreateFieldControl( aOUString );
 
@@ -881,18 +880,18 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     if(!bReturn &&
         !bLink &&
         (CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBED_SOURCE) || 
CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBEDDED_OBJ))  &&
-        aDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
+        rDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR))
     {
         //TODO/LATER: is it possible that this format is binary?! (from old 
versions of SO)
         uno::Reference < io::XInputStream > xStm;
         TransferableObjectDescriptor    aObjDesc;
 
-        if 
(aDataHelper.GetTransferableObjectDescriptor(SotClipboardFormatId::OBJECTDESCRIPTOR,
 aObjDesc))
+        if 
(rDataHelper.GetTransferableObjectDescriptor(SotClipboardFormatId::OBJECTDESCRIPTOR,
 aObjDesc))
         {
             OUString aDocShellID = 
SfxObjectShell::CreateShellID(mrDoc.GetDocSh());
-            xStm = aDataHelper.GetInputStream(nFormat != 
SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE, 
aDocShellID);
+            xStm = rDataHelper.GetInputStream(nFormat != 
SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE, 
aDocShellID);
             if (!xStm.is())
-                xStm = 
aDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ, aDocShellID);
+                xStm = 
rDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ, aDocShellID);
         }
 
         if (xStm.is())
@@ -1057,22 +1056,22 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     if(!bReturn &&
         !bLink &&
         (CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBEDDED_OBJ_OLE) || 
CHECK_FORMAT_TRANS(SotClipboardFormatId::EMBED_SOURCE_OLE)) &&
-        aDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR_OLE))
+        rDataHelper.HasFormat(SotClipboardFormatId::OBJECTDESCRIPTOR_OLE))
     {
         // online insert ole if format is forced or no gdi metafile is 
available
-        if( (nFormat != SotClipboardFormatId::NONE) || !aDataHelper.HasFormat( 
SotClipboardFormatId::GDIMETAFILE ) )
+        if( (nFormat != SotClipboardFormatId::NONE) || !rDataHelper.HasFormat( 
SotClipboardFormatId::GDIMETAFILE ) )
         {
             uno::Reference < io::XInputStream > xStm;
             TransferableObjectDescriptor    aObjDesc;
 
-            if ( aDataHelper.GetTransferableObjectDescriptor( 
SotClipboardFormatId::OBJECTDESCRIPTOR_OLE, aObjDesc ) )
+            if ( rDataHelper.GetTransferableObjectDescriptor( 
SotClipboardFormatId::OBJECTDESCRIPTOR_OLE, aObjDesc ) )
             {
                 uno::Reference < embed::XEmbeddedObject > xObj;
                 OUString aName;
 
-                xStm = aDataHelper.GetInputStream(nFormat != 
SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE_OLE, 
OUString());
+                xStm = rDataHelper.GetInputStream(nFormat != 
SotClipboardFormatId::NONE ? nFormat : SotClipboardFormatId::EMBED_SOURCE_OLE, 
OUString());
                 if (!xStm.is())
-                    xStm = 
aDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ_OLE, OUString());
+                    xStm = 
rDataHelper.GetInputStream(SotClipboardFormatId::EMBEDDED_OBJ_OLE, OUString());
 
                 if (xStm.is())
                 {
@@ -1111,11 +1110,11 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
 // (for Selection Manager in Trusted Solaris)
 #ifndef __sun
-                    if( aDataHelper.GetGraphic( SotClipboardFormatId::SVXB, 
aGraphic ) )
+                    if (rDataHelper.GetGraphic(SotClipboardFormatId::SVXB, 
aGraphic))
                         nGrFormat = SotClipboardFormatId::SVXB;
-                    else if( aDataHelper.GetGraphic( 
SotClipboardFormatId::GDIMETAFILE, aGraphic ) )
+                    else if 
(rDataHelper.GetGraphic(SotClipboardFormatId::GDIMETAFILE, aGraphic))
                         nGrFormat = SotClipboardFormatId::GDIMETAFILE;
-                    else if( aDataHelper.GetGraphic( 
SotClipboardFormatId::BITMAP, aGraphic ) )
+                    else if 
(rDataHelper.GetGraphic(SotClipboardFormatId::BITMAP, aGraphic))
                         nGrFormat = SotClipboardFormatId::BITMAP;
 #endif
 
@@ -1212,17 +1211,17 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
             }
         }
 
-        if( !bReturn && aDataHelper.HasFormat( 
SotClipboardFormatId::GDIMETAFILE ) )
+        if (!bReturn && 
rDataHelper.HasFormat(SotClipboardFormatId::GDIMETAFILE))
         {
             // if no object was inserted, insert a picture
-            InsertMetaFile( aDataHelper, rPos, pImageMap.get(), true );
+            InsertMetaFile(rDataHelper, rPos, pImageMap.get(), true);
             bReturn = true;
         }
     }
 
     if(!bReturn && (!bLink || pPickObj) && 
CHECK_FORMAT_TRANS(SotClipboardFormatId::SVXB))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::SVXB ))
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::SVXB ))
         {
             Point   aInsertPos( rPos );
             Graphic aGraphic;
@@ -1278,7 +1277,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
             aInsertPos.setY( pOwnData->GetStartPos().Y() + ( aSize.Height() >> 
1 ) );
         }
 
-        bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap.get(), 
nFormat == SotClipboardFormatId::NONE );
+        bReturn = InsertMetaFile( rDataHelper, aInsertPos, pImageMap.get(), 
nFormat == SotClipboardFormatId::NONE );
     }
 
     if(!bReturn && (!bLink || pPickObj) && 
CHECK_FORMAT_TRANS(SotClipboardFormatId::BITMAP))
@@ -1286,22 +1285,22 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         BitmapEx aBmpEx;
 
         // get basic Bitmap data
-        aDataHelper.GetBitmapEx(SotClipboardFormatId::BITMAP, aBmpEx);
+        rDataHelper.GetBitmapEx(SotClipboardFormatId::BITMAP, aBmpEx);
 
         if(aBmpEx.IsEmpty())
         {
             // if this did not work, try to get graphic formats and convert 
these to bitmap
             Graphic aGraphic;
 
-            if(aDataHelper.GetGraphic(SotClipboardFormatId::GDIMETAFILE, 
aGraphic))
+            if (rDataHelper.GetGraphic(SotClipboardFormatId::GDIMETAFILE, 
aGraphic))
             {
                 aBmpEx = aGraphic.GetBitmapEx();
             }
-            else if(aDataHelper.GetGraphic(SotClipboardFormatId::SVXB, 
aGraphic))
+            else if (rDataHelper.GetGraphic(SotClipboardFormatId::SVXB, 
aGraphic))
             {
                 aBmpEx = aGraphic.GetBitmapEx();
             }
-            else if(aDataHelper.GetGraphic(SotClipboardFormatId::BITMAP, 
aGraphic))
+            else if (rDataHelper.GetGraphic(SotClipboardFormatId::BITMAP, 
aGraphic))
             {
                 aBmpEx = aGraphic.GetBitmapEx();
             }
@@ -1338,7 +1337,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SotClipboardFormatId::XFA ) 
)
     {
-        uno::Any const data(aDataHelper.GetAny(SotClipboardFormatId::XFA, 
u""_ustr));
+        uno::Any const data(rDataHelper.GetAny(SotClipboardFormatId::XFA, 
u""_ustr));
         uno::Sequence<beans::NamedValue> props;
         if (data >>= props)
         {
@@ -1409,7 +1408,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::HTML ))
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::HTML ))
         {
             xStm->Seek( 0 );
 
@@ -1439,7 +1438,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
 
     if(!bReturn && !bLink && 
CHECK_FORMAT_TRANS(SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT))
     {
-        if (std::unique_ptr<SvStream> xStm = aDataHelper.GetSotStorageStream( 
SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ))
+        if (std::unique_ptr<SvStream> xStm = rDataHelper.GetSotStorageStream( 
SotClipboardFormatId::EDITENGINE_ODF_TEXT_FLAT ))
         {
             OutlinerView* pOLV = GetTextEditOutlinerView();
 
@@ -1469,7 +1468,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         bool bIsHtmlSimple = 
CHECK_FORMAT_TRANS(SotClipboardFormatId::HTML_SIMPLE);
         if (bIsHtmlSimple)
         {
-            if (std::unique_ptr<SvStream> xStm = 
aDataHelper.GetSotStorageStream(SotClipboardFormatId::HTML_SIMPLE))
+            if (std::unique_ptr<SvStream> xStm = 
rDataHelper.GetSotStorageStream(SotClipboardFormatId::HTML_SIMPLE))
             {
                 xStm->Seek(0);
 
@@ -1500,7 +1499,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
         if (!bReturn && (bIsRTF || 
CHECK_FORMAT_TRANS(SotClipboardFormatId::RICHTEXT)))
         {
             auto nFormatId = bIsRTF ? SotClipboardFormatId::RTF : 
SotClipboardFormatId::RICHTEXT;
-            if (std::unique_ptr<SvStream> xStm = 
aDataHelper.GetSotStorageStream( nFormatId ))
+            if (std::unique_ptr<SvStream> xStm = 
rDataHelper.GetSotStorageStream(nFormatId))
             {
                 xStm->Seek( 0 );
 
@@ -1538,7 +1537,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     {
         FileList aDropFileList;
 
-        if( aDataHelper.GetFileList( SotClipboardFormatId::FILE_LIST, 
aDropFileList ) )
+        if (rDataHelper.GetFileList(SotClipboardFormatId::FILE_LIST, 
aDropFileList))
         {
             maDropFileVector.clear();
 
@@ -1555,7 +1554,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     {
         OUString aDropFile;
 
-        if( aDataHelper.GetString( SotClipboardFormatId::SIMPLE_FILE, 
aDropFile ) )
+        if (rDataHelper.GetString(SotClipboardFormatId::SIMPLE_FILE, 
aDropFile))
         {
             maDropFileVector.clear();
             maDropFileVector.push_back( aDropFile );
@@ -1568,13 +1567,13 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SotClipboardFormatId::STRING))
     {
         if( ( SotClipboardFormatId::STRING == nFormat ) ||
-            ( !aDataHelper.HasFormat( SotClipboardFormatId::SOLK ) &&
-              !aDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK 
) &&
-              !aDataHelper.HasFormat( SotClipboardFormatId::FILENAME ) ) )
+            ( !rDataHelper.HasFormat( SotClipboardFormatId::SOLK ) &&
+              !rDataHelper.HasFormat( SotClipboardFormatId::NETSCAPE_BOOKMARK 
) &&
+              !rDataHelper.HasFormat( SotClipboardFormatId::FILENAME ) ) )
         {
             OUString aOUString;
 
-            if( aDataHelper.GetString( SotClipboardFormatId::STRING, aOUString 
) )
+            if (rDataHelper.GetString(SotClipboardFormatId::STRING, aOUString))
             {
                 OutlinerView* pOLV = GetTextEditOutlinerView();
 
commit c8fb04402878fcf1c62f68b8d4838e98553f72b5
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Nov 28 12:45:42 2024 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Thu Nov 28 12:16:47 2024 +0100

    This is likely the correct object to use here
    
    In commit 5e6def1bd4e36379e8dce78402820540bd6f02e2 (Redesign for 
XTransferable,
    2001-01-19), a code was introduced, that used two different pPickObj 
variables.
    Later, in commit 507aced21a19deba279029bbabeca24562381824 (INTEGRATION: CWS
    sdwarningsbegone (1.68.10); FILE MERGED, 2006-12-12), the name conflict was
    fixed; but that fix changed the object used here, from the nearest, that was
    just initialized in the current scope, to the one that was optionally 
assigned
    early in the function, depending on a variable not used in current scope. I
    assume that that was an overlook; so fix it now.
    
    I don't have a failure case, just found it by code reading, so this could be
    wrong, and need be reverted, hopefully with an explanation.
    
    Change-Id: Ib95bc450b78f64e1ac468e9676f32395ddaf0870
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177464
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index e32ba5e13ed9..f2edd0f7bd47 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -260,7 +260,6 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
     mbIsDropAllowed = false;
 
     TransferableDataHelper  aDataHelper( rDataHelper );
-    SdrObject*              pPickObj = nullptr;
     SdPage*                 pPage = nullptr;
     std::unique_ptr<ImageMap> pImageMap;
     bool bReturn = false;
@@ -277,6 +276,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
             nPasteOptions |= SdrInsertFlags::DONTMARK;
     }
 
+    SdrObject* pPickObj = nullptr;
     if( bDrag )
     {
         SdrPageView* pPV = nullptr;
@@ -724,7 +724,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
             {
                 bool bChanged = false;
 
-                if( bReturn )
+                if (bReturn && (mnAction & (DND_ACTION_MOVE | 
DND_ACTION_LINK)))
                 {
                     if( pModel->GetSdPage( 0, PageKind::Standard 
)->GetObjCount() == 1 )
                     {
@@ -772,9 +772,9 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
                             bChanged = true;
                             mnAction = DND_ACTION_COPY;
                         }
-                        else if( ( mnAction & DND_ACTION_LINK ) && pPickObj && 
pObj &&
-                            dynamic_cast< const SdrGrafObj *>( pPickObj ) ==  
nullptr &&
-                                dynamic_cast< const SdrOle2Obj *>( pPickObj ) 
==  nullptr )
+                        else if( ( mnAction & DND_ACTION_LINK ) && pPickObj2 
&& pObj &&
+                            dynamic_cast< const SdrGrafObj *>( pPickObj2 ) ==  
nullptr &&
+                                dynamic_cast< const SdrOle2Obj *>( pPickObj2 ) 
==  nullptr )
                         {
                             SfxItemSet aSet( mrDoc.GetPool() );
 
@@ -783,7 +783,7 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
                             if( bUndo )
                             {
                                 BegUndo( SdResId(STR_UNDO_DRAGDROP) );
-                                AddUndo( 
mrDoc.GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj ) );
+                                AddUndo( 
mrDoc.GetSdrUndoFactory().CreateUndoAttrObject( *pPickObj2 ) );
                             }
 
                             aSet.Put( pObj->GetMergedItemSet() );
@@ -804,24 +804,24 @@ bool View::InsertData( const TransferableDataHelper& 
rDataHelper,
                                 
aSet.Put(XFillBitmapItem(pSdrGrafObj->GetGraphic()));
                             }
 
-                            pPickObj->SetMergedItemSetAndBroadcast( aSet );
+                            pPickObj2->SetMergedItemSetAndBroadcast( aSet );
 
-                            if( DynCastE3dObject( pPickObj ) && 
DynCastE3dObject( pObj ) )
+                            if( DynCastE3dObject( pPickObj2 ) && 
DynCastE3dObject( pObj ) )
                             {
                                 // handle 3D attribute in addition
                                 SfxItemSetFixed<SID_ATTR_3D_START, 
SID_ATTR_3D_END> aNewSet( mrDoc.GetPool() );
                                 SfxItemSetFixed<SID_ATTR_3D_START, 
SID_ATTR_3D_END> aOldSet( mrDoc.GetPool() );
 
-                                aOldSet.Put(pPickObj->GetMergedItemSet());
+                                aOldSet.Put(pPickObj2->GetMergedItemSet());
                                 aNewSet.Put( pObj->GetMergedItemSet() );
 
                                 if( bUndo )
                                     AddUndo(
                                         
std::make_unique<E3dAttributesUndoAction>(
-                                            *static_cast< E3dObject* 
>(pPickObj),
+                                            *static_cast< E3dObject* 
>(pPickObj2),
                                             aNewSet,
                                             aOldSet));
-                                pPickObj->SetMergedItemSetAndBroadcast( 
aNewSet );
+                                pPickObj2->SetMergedItemSetAndBroadcast( 
aNewSet );
                             }
 
                             if( bUndo )

Reply via email to