This is likely the correct object to use here
In commit5e6def1bd4
(Redesign for XTransferable, 2001-01-19), a code was introduced, that used two different pPickObj variables. Later, in commit507aced21a
(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 <mike.kaganski@collabora.com> Tested-by: Jenkins
This commit is contained in:
@@ -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 )
|
||||
|
Reference in New Issue
Block a user