incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1373395 - /incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
Date Wed, 15 Aug 2012 13:28:07 GMT
Author: alg
Date: Wed Aug 15 13:28:07 2012
New Revision: 1373395

URL: http://svn.apache.org/viewvc?rev=1373395&view=rev
Log:
Corrected bad handling of loading draw objects in calc application

Modified:
    incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx

Modified: incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx?rev=1373395&r1=1373394&r2=1373395&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/filter/excel/xiescher.cxx Wed Aug 15 13:28:07 2012
@@ -319,53 +319,61 @@ XclImpDrawObjBase::~XclImpDrawObjBase()
     {
         sal_uInt16 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
-                case EXC_OBJTYPE_LINE:
-                case EXC_OBJTYPE_ARC:
-                    xDrawObj.reset( new XclImpTextObj( rRoot ) );
-                    // lines and arcs may be 2-dimensional
-                    xDrawObj->SetAreaObj( false );
-                break;
-
-                // in BIFF8, all simple objects support text
-                case EXC_OBJTYPE_RECTANGLE:
-                case EXC_OBJTYPE_OVAL:
-                case EXC_OBJTYPE_POLYGON:
-                case EXC_OBJTYPE_DRAWING:
-                case EXC_OBJTYPE_TEXT:
-                    xDrawObj.reset( new XclImpTextObj( 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_BUTTON:        xDrawObj.reset( new XclImpButtonObj( 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_OPTIONBUTTON:  xDrawObj.reset( new XclImpOptionButtonObj(
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_DIALOG:        xDrawObj.reset( new XclImpDialogObj( 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_LISTBOX:       xDrawObj.reset( new XclImpListBoxObj( 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_NOTE:          xDrawObj.reset( new XclImpNoteObj( rRoot
) );           break;
-
-                default:
-                    DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX",
nObjType );
-                    rRoot.GetTracer().TraceUnsupportedObjects();
-                    xDrawObj.reset( new XclImpPhObj( rRoot ) );
+                switch( nObjType )
+                {
+                    // in BIFF8, all simple objects support text
+                    case EXC_OBJTYPE_LINE:
+                    case EXC_OBJTYPE_ARC:
+                        xDrawObj.reset( new XclImpTextObj( rRoot ) );
+                        // lines and arcs may be 2-dimensional
+                        xDrawObj->SetAreaObj( false );
+                    break;
+
+                    // in BIFF8, all simple objects support text
+                    case EXC_OBJTYPE_RECTANGLE:
+                    case EXC_OBJTYPE_OVAL:
+                    case EXC_OBJTYPE_POLYGON:
+                    case EXC_OBJTYPE_DRAWING:
+                    case EXC_OBJTYPE_TEXT:
+                        xDrawObj.reset( new XclImpTextObj( 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_BUTTON:        xDrawObj.reset( new XclImpButtonObj(
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_OPTIONBUTTON:  xDrawObj.reset( new XclImpOptionButtonObj(
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_DIALOG:        xDrawObj.reset( new XclImpDialogObj(
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_LISTBOX:       xDrawObj.reset( new XclImpListBoxObj(
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_NOTE:          xDrawObj.reset( new XclImpNoteObj( rRoot
) );           break;
+
+                    default:
+                        DBG_ERROR1( "XclImpDrawObjBase::ReadObj8 - unknown object type 0x%04hX",
nObjType );
+                        rRoot.GetTracer().TraceUnsupportedObjects();
+                        xDrawObj.reset( new XclImpPhObj( rRoot ) );
+                }
             }
+
+            xDrawObj->ImplReadObj8( rStrm );
+        }
+        else
+        {
+            DBG_ASSERT(false, "XclImpDrawObjBase::ReadObj8 - OBJCMO subrecord expected" );
         }
     }
 
-    xDrawObj->ImplReadObj8( rStrm );
     return xDrawObj;
 }
 
@@ -3866,9 +3874,17 @@ void XclImpDrawing::ReadDffRecord( XclIm
 void XclImpDrawing::ReadObj8( XclImpStream& rStrm )
 {
     XclImpDrawObjRef xDrawObj = XclImpDrawObjBase::ReadObj8( GetRoot(), rStrm );
-    // store the new object in the internal containers
-    maObjMap[ maDffStrm.Tell() ] = xDrawObj;
-    maObjMapId[ xDrawObj->GetObjId() ] = xDrawObj;
+    
+    if(xDrawObj.is())
+    {
+        // 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 )



Mime
View raw message