diff options
Diffstat (limited to 'sc/source/filter/xcl97/xcl97rec.cxx')
-rw-r--r-- | sc/source/filter/xcl97/xcl97rec.cxx | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 3cc27e9e0bad..d4524b22e07b 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -223,13 +223,34 @@ bool IsValidObject( const XclObj& rObj ) void SaveDrawingMLObjects( XclExpObjList& rList, XclExpXmlStream& rStrm ) { std::vector<XclObj*> aList; - aList.reserve(rList.size()); + // do not add objects to the list that are in the group, + // because the group already contains them. For this, count + // the next skipped objects, i.e. objects of a group, + // including objects of its subgroups + size_t nSkipObj = 0; for (const auto& rxObj : rList) { + // FIXME: Can DrawingML objects be grouped with VML or not valid objects? if (IsVmlObject(rxObj.get()) || !IsValidObject(*rxObj)) continue; - aList.push_back(rxObj.get()); + if (nSkipObj == 0) + aList.push_back(rxObj.get()); + else + --nSkipObj; + + XclObjAny* pObj = nullptr; + if (rxObj->GetObjType() == 0) // group (it can be a subgroup) + pObj = dynamic_cast<XclObjAny*>(rxObj.get()); + if (pObj) + { + css::uno::Reference<css::drawing::XShapes> xShapes(pObj->GetShape(), UNO_QUERY); + if (xShapes) + { + // skip (also) the objects of this group + nSkipObj += xShapes->getCount(); + } + } } if (aList.empty()) @@ -1282,11 +1303,6 @@ bool ScURLTransformer::isExternalURL(const OUString& rURL) const void XclObjAny::SaveXml( XclExpXmlStream& rStrm ) { - // ignore group shapes at the moment, we don't process them correctly - // leading to ms2010 rejecting the content - if( !mxShape.is() || mxShape->getShapeType() == "com.sun.star.drawing.GroupShape" ) - return; - // Do not output any of the detective shapes and validation circles. SdrObject* pObject = SdrObject::getSdrObjectFromXShape(mxShape); if (pObject) |