Issue 100710 - OLE object created via API crashes when selected
Summary: OLE object created via API crashes when selected
Alias: None
Product: Draw
Classification: Application
Component: programming (show other issues)
Version: OOO310m7
Hardware: All All
: P2 Trivial (vote)
Target Milestone: OOo 3.2
Assignee: wolframgarten
QA Contact: issues@graphics
Depends on:
Reported: 2009-03-31 14:21 UTC by daniel.rentz
Modified: 2009-05-20 08:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

test (8.81 KB, application/vnd.oasis.opendocument.spreadsheet)
2009-03-31 14:29 UTC, daniel.rentz
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description daniel.rentz 2009-03-31 14:21:30 UTC
Load attached document, click button, the executed macro creates a linked OLE
object without replacement graphic. Select the new object -> office crashes
Comment 1 daniel.rentz 2009-03-31 14:22:07 UTC
Regression, does not crash in OOo 3.0
Comment 2 daniel.rentz 2009-03-31 14:29:52 UTC
Created attachment 61315 [details]
Comment 3 clippka 2009-03-31 15:01:59 UTC
SdrOle2Obj::getFullDragClone() crashes because GetGraphic() returns null
Comment 4 Armin Le Grand 2009-03-31 16:14:31 UTC
AW: Indeed. SdrOle2Obj::getFullDragClone() is not prepared for OLEs which have
no graphic representation. In that case (if that case is legal at all) the
default OLE representation should be used to create a DragClone. It will not
even be necessary to create a SdrGrafObj clone, but a simple SdrRectObj with
bitmap filling and a gray hairline will do it.
Comment 5 Armin Le Grand 2009-03-31 16:18:59 UTC
AW: Solution is to replace the current implementation with the following:

SdrObject* SdrOle2Obj::getFullDragClone() const
    // special handling for OLE. The default handling works, but is too
    // slow when the whole OLE needs to be cloned. Get the Metafile and
    // create a graphic object with it
    Graphic* pOLEGraphic = GetGraphic();
    SdrObject* pClone = 0;
        pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic();

        pClone = new SdrGrafObj(*pOLEGraphic, GetSnapRect());
        // this would be the place where to copy all attributes
        // when OLE will support fill and line style
        // pClone->SetMergedItem(pOleObject->GetMergedItemSet());
        // #i100710# pOLEGraphic may be zero (no visualisation available),
        // so we need to use the OLE replacement graphic
        pClone = new SdrRectObj(GetSnapRect());

        // gray outline
        const svtools::ColorConfig aColorConfig;
        const svtools::ColorConfigValue
        pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor));

        // bitmap fill

	return pClone;

Also decided by UL: Not a 3.1 task, but to be planned for 3.2. Changing target.
Also wanted: To place in an own 3.2 CWS. Opening one...
Comment 6 Armin Le Grand 2009-04-01 15:26:13 UTC
AW: COmmited change, added task, building install sets.
Comment 7 Armin Le Grand 2009-04-01 16:37:57 UTC
AW->WG: Please verify. You will get a draggable object now in full drag with the
empty OLE preview bitmap.
Comment 8 wolframgarten 2009-04-03 09:42:50 UTC
Verified in CWS.
Comment 9 wolframgarten 2009-05-20 08:47:10 UTC
Tested in m48. Closed.