Apache OpenOffice (AOO) Bugzilla – Issue 100710
OLE object created via API crashes when selected
Last modified: 2009-05-20 08:47:10 UTC
Load attached document, click button, the executed macro creates a linked OLE object without replacement graphic. Select the new object -> office crashes immediately.
Regression, does not crash in OOo 3.0
Created attachment 61315 [details] test
SdrOle2Obj::getFullDragClone() crashes because GetGraphic() returns null
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.
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; if(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { pOLEGraphic = getEmbeddedObjectRef().GetHCGraphic(); } if(pOLEGraphic) { 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()); } else { // #i100710# pOLEGraphic may be zero (no visualisation available), // so we need to use the OLE replacement graphic pClone = new SdrRectObj(GetSnapRect()); // gray outline pClone->SetMergedItem(XLineStyleItem(XLINE_SOLID)); const svtools::ColorConfig aColorConfig; const svtools::ColorConfigValue aColor(aColorConfig.GetColorValue(svtools::OBJECTBOUNDARIES)); pClone->SetMergedItem(XLineColorItem(String(), aColor.nColor)); // bitmap fill pClone->SetMergedItem(XFillStyleItem(XFILL_BITMAP)); pClone->SetMergedItem(XFillBitmapItem(String(), GetEmtyOLEReplacementBitmap())); pClone->SetMergedItem(XFillBmpTileItem(false)); pClone->SetMergedItem(XFillBmpStretchItem(false)); } 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...
AW: COmmited change, added task, building install sets.
AW->WG: Please verify. You will get a draggable object now in full drag with the empty OLE preview bitmap.
Verified in CWS.
Tested in m48. Closed.