// TODO: this is probably a sub-optimal approach: ideally the media type // of the stream from [Content_Types].xml should be stored somewhere for this // purpose, but currently the media type of all OLE streams in the storage is // just "application/vnd.sun.star.oleobject" void SaveInteropProperties(uno::Reference<frame::XModel> const& xModel,
OUString const& rObjectName, OUString const*const pOldObjectName,
OUString const& rProgId)
{ static constexpr OUString sEmbeddingsPropName = u"EmbeddedObjects"_ustr;
// get interop grab bag from document
uno::Reference<beans::XPropertySet> const xDocProps(xModel, uno::UNO_QUERY);
comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue(u"InteropGrabBag"_ustr));
// get EmbeddedObjects property inside grab bag
comphelper::SequenceAsHashMap objectsList; auto grabIt = aGrabBag.find(sEmbeddingsPropName); if (grabIt != aGrabBag.end())
objectsList << grabIt->second;
// If we got an "old name", erase that first. if (pOldObjectName)
{
comphelper::SequenceAsHashMap::iterator it = objectsList.find(*pOldObjectName); if (it != objectsList.end())
objectsList.erase(it);
}
objectsList[rObjectName] <<= aGrabBagAttribute;
// put objects list back into the grab bag
aGrabBag[sEmbeddingsPropName] <<= objectsList.getAsConstPropertyValueList();
// put grab bag back into the document
xDocProps->setPropertyValue(u"InteropGrabBag"_ustr, uno::Any(aGrabBag.getAsConstPropertyValueList()));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.