[Libreoffice-commits] core.git: Branch 'aoo/trunk' - filter/inc filter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 17 22:10:05 UTC 2018
filter/inc/filter/msfilter/msdffimp.hxx | 2 +-
filter/source/msfilter/msdffimp.cxx | 23 +++++++++++++----------
2 files changed, 14 insertions(+), 11 deletions(-)
New commits:
commit e76d30177a1ff5fd8b08b8f5bb21441004a21141
Author: Don Lewis <truckman at apache.org>
AuthorDate: Fri Aug 17 22:04:50 2018 +0000
Commit: Don Lewis <truckman at apache.org>
CommitDate: Fri Aug 17 22:04:50 2018 +0000
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.
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index 02b58f0fdbf5..6ee04092c1a7 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -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,
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 3377b645d7fc..1665df6192f1 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4174,7 +4174,7 @@ SdrObject* SvxMSDffManager::ImportObj( SvStream& rSt, void* pClientData,
}
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( const DffRecordHeader& rHd, SvStream& r
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( const DffRecordHeader& rHd, SvStream& r
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( const DffRecordHeader& rHd, SvStream& r
{
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( const DffRecordHeader& rHd, SvStream& r
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( const DffRecordHeader& rHd, SvStream& r
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( const DffRecordHeader& rHd, SvStream& r
pRet->SetName( aObjName );
}
- pRet =
- ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
+ if (!bShapeGroup)
+ pRet = ProcessObj( rSt, aObjData, pClientData, aTextRect, pRet);
if ( pRet )
{
More information about the Libreoffice-commits
mailing list