Kaydet (Commit) f0bc9c2e authored tarafından Armin Le Grand's avatar Armin Le Grand

Corrected bad handling of loading draw objects in calc application

üst aa4649b8
...@@ -319,53 +319,61 @@ XclImpDrawObjBase::~XclImpDrawObjBase() ...@@ -319,53 +319,61 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
{ {
sal_uInt16 nSubRecId, nSubRecSize, nObjType; sal_uInt16 nSubRecId, nSubRecSize, nObjType;
rStrm >> nSubRecId >> nSubRecSize >> nObjType; rStrm >> nSubRecId >> nSubRecSize >> nObjType;
DBG_ASSERT( nSubRecId == EXC_ID_OBJCMO, "XclImpDrawObjBase::ReadObj8 - OBJCMO subrecord expected" );
if( (nSubRecId == EXC_ID_OBJCMO) && (nSubRecSize >= 6) ) if(EXC_ID_OBJCMO == nSubRecId)
{ {
switch( nObjType ) if( (nSubRecSize >= 6) )
{ {
// in BIFF8, all simple objects support text switch( nObjType )
case EXC_OBJTYPE_LINE: {
case EXC_OBJTYPE_ARC: // in BIFF8, all simple objects support text
xDrawObj.reset( new XclImpTextObj( rRoot ) ); case EXC_OBJTYPE_LINE:
// lines and arcs may be 2-dimensional case EXC_OBJTYPE_ARC:
xDrawObj->SetAreaObj( false ); xDrawObj.reset( new XclImpTextObj( rRoot ) );
break; // lines and arcs may be 2-dimensional
xDrawObj->SetAreaObj( false );
break;
// in BIFF8, all simple objects support text // in BIFF8, all simple objects support text
case EXC_OBJTYPE_RECTANGLE: case EXC_OBJTYPE_RECTANGLE:
case EXC_OBJTYPE_OVAL: case EXC_OBJTYPE_OVAL:
case EXC_OBJTYPE_POLYGON: case EXC_OBJTYPE_POLYGON:
case EXC_OBJTYPE_DRAWING: case EXC_OBJTYPE_DRAWING:
case EXC_OBJTYPE_TEXT: case EXC_OBJTYPE_TEXT:
xDrawObj.reset( new XclImpTextObj( rRoot ) ); xDrawObj.reset( new XclImpTextObj( rRoot ) );
break; break;
case EXC_OBJTYPE_GROUP: xDrawObj.reset( new XclImpGroupObj( rRoot ) ); break; case EXC_OBJTYPE_GROUP: xDrawObj.reset( new XclImpGroupObj( rRoot ) ); break;
case EXC_OBJTYPE_CHART: xDrawObj.reset( new XclImpChartObj( rRoot ) ); break; case EXC_OBJTYPE_CHART: xDrawObj.reset( new XclImpChartObj( rRoot ) ); break;
case EXC_OBJTYPE_BUTTON: xDrawObj.reset( new XclImpButtonObj( rRoot ) ); break; case EXC_OBJTYPE_BUTTON: xDrawObj.reset( new XclImpButtonObj( rRoot ) ); break;
case EXC_OBJTYPE_PICTURE: xDrawObj.reset( new XclImpPictureObj( rRoot ) ); break; case EXC_OBJTYPE_PICTURE: xDrawObj.reset( new XclImpPictureObj( rRoot ) ); break;
case EXC_OBJTYPE_CHECKBOX: xDrawObj.reset( new XclImpCheckBoxObj( rRoot ) ); break; case EXC_OBJTYPE_CHECKBOX: xDrawObj.reset( new XclImpCheckBoxObj( rRoot ) ); break;
case EXC_OBJTYPE_OPTIONBUTTON: xDrawObj.reset( new XclImpOptionButtonObj( rRoot ) ); break; case EXC_OBJTYPE_OPTIONBUTTON: xDrawObj.reset( new XclImpOptionButtonObj( rRoot ) ); break;
case EXC_OBJTYPE_EDIT: xDrawObj.reset( new XclImpEditObj( rRoot ) ); break; case EXC_OBJTYPE_EDIT: xDrawObj.reset( new XclImpEditObj( rRoot ) ); break;
case EXC_OBJTYPE_LABEL: xDrawObj.reset( new XclImpLabelObj( rRoot ) ); break; case EXC_OBJTYPE_LABEL: xDrawObj.reset( new XclImpLabelObj( rRoot ) ); break;
case EXC_OBJTYPE_DIALOG: xDrawObj.reset( new XclImpDialogObj( rRoot ) ); break; case EXC_OBJTYPE_DIALOG: xDrawObj.reset( new XclImpDialogObj( rRoot ) ); break;
case EXC_OBJTYPE_SPIN: xDrawObj.reset( new XclImpSpinButtonObj( rRoot ) ); break; case EXC_OBJTYPE_SPIN: xDrawObj.reset( new XclImpSpinButtonObj( rRoot ) ); break;
case EXC_OBJTYPE_SCROLLBAR: xDrawObj.reset( new XclImpScrollBarObj( rRoot ) ); break; case EXC_OBJTYPE_SCROLLBAR: xDrawObj.reset( new XclImpScrollBarObj( rRoot ) ); break;
case EXC_OBJTYPE_LISTBOX: xDrawObj.reset( new XclImpListBoxObj( rRoot ) ); break; case EXC_OBJTYPE_LISTBOX: xDrawObj.reset( new XclImpListBoxObj( rRoot ) ); break;
case EXC_OBJTYPE_GROUPBOX: xDrawObj.reset( new XclImpGroupBoxObj( rRoot ) ); break; case EXC_OBJTYPE_GROUPBOX: xDrawObj.reset( new XclImpGroupBoxObj( rRoot ) ); break;
case EXC_OBJTYPE_DROPDOWN: xDrawObj.reset( new XclImpDropDownObj( rRoot ) ); break; case EXC_OBJTYPE_DROPDOWN: xDrawObj.reset( new XclImpDropDownObj( rRoot ) ); break;
case EXC_OBJTYPE_NOTE: xDrawObj.reset( new XclImpNoteObj( rRoot ) ); break; case EXC_OBJTYPE_NOTE: xDrawObj.reset( new XclImpNoteObj( rRoot ) ); break;
default: default:
DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX", nObjType ); DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX", nObjType );
rRoot.GetTracer().TraceUnsupportedObjects(); rRoot.GetTracer().TraceUnsupportedObjects();
xDrawObj.reset( new XclImpPhObj( rRoot ) ); xDrawObj.reset( new XclImpPhObj( rRoot ) );
}
} }
xDrawObj->ImplReadObj8( rStrm );
}
else
{
DBG_ASSERT(false, "XclImpDrawObjBase::ReadObj8 - OBJCMO subrecord expected" );
} }
} }
xDrawObj->ImplReadObj8( rStrm );
return xDrawObj; return xDrawObj;
} }
...@@ -3866,9 +3874,17 @@ void XclImpDrawing::ReadDffRecord( XclImpStream& rStrm ) ...@@ -3866,9 +3874,17 @@ void XclImpDrawing::ReadDffRecord( XclImpStream& rStrm )
void XclImpDrawing::ReadObj8( XclImpStream& rStrm ) void XclImpDrawing::ReadObj8( XclImpStream& rStrm )
{ {
XclImpDrawObjRef xDrawObj = XclImpDrawObjBase::ReadObj8( GetRoot(), rStrm ); XclImpDrawObjRef xDrawObj = XclImpDrawObjBase::ReadObj8( GetRoot(), rStrm );
// store the new object in the internal containers
maObjMap[ maDffStrm.Tell() ] = xDrawObj; if(xDrawObj.is())
maObjMapId[ xDrawObj->GetObjId() ] = xDrawObj; {
// store the new object in the internal containers
maObjMap[ maDffStrm.Tell() ] = xDrawObj;
maObjMapId[ xDrawObj->GetObjId() ] = xDrawObj;
}
else
{
OSL_ENSURE(false, "DrawObj could not be loaded (!)");
}
} }
void XclImpDrawing::ReadTxo( XclImpStream& rStrm ) void XclImpDrawing::ReadTxo( XclImpStream& rStrm )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment