You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by tr...@apache.org on 2018/08/17 22:04:50 UTC
svn commit: r1838291 - in /openoffice/trunk/main/filter:
inc/filter/msfilter/msdffimp.hxx source/msfilter/msdffimp.cxx
Author: truckman
Date: Fri Aug 17 22:04:50 2018
New Revision: 1838291
URL: http://svn.apache.org/viewvc?rev=1838291&view=rev
Log:
Ignore the SP_FGROUP flag on shape records. Instead assume that the
first shape in a shape group is the group shape. Add a new flag
parameter to SvxMSDffManager::ImportShape() to indicate the whether
or not this is a group shape based on the calling context. Call
SvxMSDffManager::ImportShape() directly from SvxMSDffManager::ImportGroup()
instead of indirectly via SvxMSDffManager::ImportObj() to facilitate
passing the context information.
Don't call SvxMSDffManager::ProcessObj() from SvxMSDffManager::ImportShape()
when processing a group shape. SvxMSDffManager::ImportObj() expects
SvxMSDffManager::ImportShape() to return a pointer to an SdrObjGroup
object in this case, and SvxMSDffManager::ProcessObj() may replace
the SdrObjGroup object with some other type of shape object.
Change some C-style SdrObjGroup* casts to dynamic_cast so that incorrect
casts will create a NULL pointer and fail quickly rather than executing
methods on an object of the wrong type and doing something possibly
undefined.
Modified:
openoffice/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx
openoffice/trunk/main/filter/source/msfilter/msdffimp.cxx
Modified: openoffice/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx?rev=1838291&r1=1838290&r2=1838291&view=diff
==============================================================================
--- openoffice/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx (original)
+++ openoffice/trunk/main/filter/inc/filter/msfilter/msdffimp.hxx Fri Aug 17 22:04:50 2018
@@ -658,7 +658,7 @@ public:
Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL );
SdrObject* ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pData,
- Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL);
+ Rectangle& rClientRect, const Rectangle& rGlobalChildRect, int nCalledByGroup = 0, sal_Int32* pShapeId = NULL, sal_Bool bShapeGroup = sal_False);
Rectangle GetGlobalChildAnchor( const DffRecordHeader& rHd, SvStream& rSt, Rectangle& aClientRect );
void GetGroupAnchors( const DffRecordHeader& rHd, SvStream& rSt,
Modified: openoffice/trunk/main/filter/source/msfilter/msdffimp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/filter/source/msfilter/msdffimp.cxx?rev=1838291&r1=1838290&r2=1838291&view=diff
==============================================================================
--- openoffice/trunk/main/filter/source/msfilter/msdffimp.cxx (original)
+++ openoffice/trunk/main/filter/source/msfilter/msdffimp.cxx Fri Aug 17 22:04:50 2018
@@ -4174,7 +4174,7 @@ SdrObject* SvxMSDffManager::ImportObj( S
}
else if ( aObjHd.nRecType == DFF_msofbtSpContainer )
{
- pRet = ImportShape( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId );
+ pRet = ImportShape( aObjHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup, pShapeId, sal_False );
}
aObjHd.SeekToBegOfRecord( rSt ); // FilePos restaurieren
return pRet;
@@ -4197,8 +4197,7 @@ SdrObject* SvxMSDffManager::ImportGroup(
sal_Int32 nGroupRotateAngle = 0;
sal_Int32 nSpFlags = 0;
mnFix16Angle = 0;
- aRecHd.SeekToBegOfRecord( rSt );
- pRet = ImportObj( rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId );
+ pRet = ImportShape( aRecHd, rSt, pClientData, rClientRect, rGlobalChildRect, nCalledByGroup + 1, pShapeId, sal_True );
if ( pRet )
{
nSpFlags = nGroupShapeFlags;
@@ -4239,7 +4238,7 @@ SdrObject* SvxMSDffManager::ImportGroup(
SdrObject* pTmp = ImportGroup( aRecHd2, rSt, pClientData, aGroupClientAnchor, aGroupChildAnchor, nCalledByGroup + 1, &nShapeId );
if ( pTmp )
{
- ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp );
+ (dynamic_cast<SdrObjGroup*>(pRet))->GetSubList()->NbcInsertObject( pTmp );
if( nShapeId )
insertShapeId( nShapeId, pTmp );
}
@@ -4248,10 +4247,10 @@ SdrObject* SvxMSDffManager::ImportGroup(
{
aRecHd2.SeekToBegOfRecord( rSt );
sal_Int32 nShapeId;
- SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId );
+ SdrObject* pTmp = ImportShape( aRecHd2, rSt, pClientData, aClientRect, aGlobalChildRect, nCalledByGroup + 1, &nShapeId, sal_False );
if ( pTmp )
{
- ((SdrObjGroup*)pRet)->GetSubList()->NbcInsertObject( pTmp );
+ (dynamic_cast<SdrObjGroup*>(pRet))->GetSubList()->NbcInsertObject( pTmp );
if( nShapeId )
insertShapeId( nShapeId, pTmp );
}
@@ -4284,7 +4283,7 @@ SdrObject* SvxMSDffManager::ImportGroup(
SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& rSt, void* pClientData,
Rectangle& rClientRect, const Rectangle& rGlobalChildRect,
- int nCalledByGroup, sal_Int32* pShapeId )
+ int nCalledByGroup, sal_Int32* pShapeId, sal_Bool bShapeGroup )
{
SdrObject* pRet = NULL;
@@ -4324,11 +4323,15 @@ SdrObject* SvxMSDffManager::ImportShape(
rSt >> aObjData.nShapeId
>> aObjData.nSpFlags;
aObjData.eShapeType = (MSO_SPT)maShapeRecords.Current()->nRecInstance;
+ if (bShapeGroup)
+ aObjData.nSpFlags |= SP_FGROUP;
+ else
+ aObjData.nSpFlags &= ~SP_FGROUP;
}
else
{
aObjData.nShapeId = 0;
- aObjData.nSpFlags = 0;
+ aObjData.nSpFlags = bShapeGroup ? SP_FGROUP : 0;
aObjData.eShapeType = mso_sptNil;
}
@@ -4935,8 +4938,8 @@ SdrObject* SvxMSDffManager::ImportShape(
pRet->SetName( aObjName );
}
- pRet =
- ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
+ if (!bShapeGroup)
+ pRet = ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
if ( pRet )
{