• Michael Stahl's avatar
    embeddedobj: do not automatically convert alien objects to own · 17662cd7
    Michael Stahl yazdı
    OleEmbeddedObject::changeState() calls TryToConvertToOOo() on non-WNT
    platforms, which appears highly questionable to me, added in commit
    0c3d5fb0.
    
    What this does effectively is load the embedded object, store it as ODF,
    and then load it again as ODF.
    
    For one, it doesn't work in all cases currently.  If changeState() is
    not called from the UI but from some filter code, then no m_xClient may
    be set on the OleEmbeddedObject, hence no m_xClient will be set on the
    new m_xWrappedObject.  Then loading the embedded object will raise
    errors due to missing BaseURL, and storing it will fail in
    SfxObjectShell::SaveTo_Impl().  (It would be possible to solve that by
    copying the "DefaultParentBaseURL" handling code from
    OCommonEmbeddedObject.)
    
    The only reason why the previous code in ShapeExport::WriteOLE2Shape()
    was able to export the object despite the error is that it does not call
    SfxBaseModel functions but directly invokes the export filter, so the
    sfx2 code does not get an opportunity to check its error status.
    
    For another, doing this only on non-WNT platforms is also hazardous.
    
    It's probably better to leave conversion to own formats to an explicit
    UI action, as the OleEmbeddedObject::doVerb(-9) magic currently does,
    where it can hopefully be assumed that the caller at least established
    the client connection first.
    
    Change-Id: Ice3d8f8ceabe81b6e9025957c3eb87de9dbfe61a
    17662cd7
oleembed.cxx 40.2 KB