tdf#148806 doc import: remove 2003 SetObjectShell(nullptr) hack
This was preventing doc event-macros from round-tripping.
Its original purpose was to "fix" doc->sxw export.
We no longer export to sxw, and the OOo bug doc exports fine to ODT.
Change-Id: I3a22db1b3bf9eaa2d64ac963f0c41892ba604e8d
--- https://bz.apache.org/ooo/show_bug.cgi?id=20540 ---
caolanm 2003-10-20 14:43:31 UTC
Setting a target for this bug, fixed for 2.0 in
portlaoisefilterteam16, and for 1.1.1 in droghedafilterteam15
MIB->CMC:
The document contains a Draw 4.0 OLE object, and the problem is the
import of that object in the Word filter.
During the import, the object's storage is copied into the document
storage (in SvxMSDffManager::CreateSdrOLEFromStorage, msdffimp.cxx,
5117). It now is contained in the document storage in the 3.o format,
but it is not in the child list of SvPersist.
Some time later, SvxMSDffManager::ImportGraphic calls a
SdrOLE2Obj::SetModel, that again calls SdrOLE2Obj::Connect. This
method notices that the object is not in the persist child list, and
for that reasdon call SvPersist::Move to add it to the list
(svdoole2.cxx, 374). Move converts the object into the OOo 1.0 format.
The destination storage is the object's storage, so the 1.0 format is
added to the existing 3.0 format, and the object storage remains an
OLE strorage and does not get a package. This situation is not
permitted and cannot be saved in the SXW format.
Change-Id: I24e55e5d47c3a7d10d6609ddbf9cc2374a47a37b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140950
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index e3482a2..d803e56 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2563,19 +2563,9 @@ SwFrameFormat* SwWW8ImplReader::Read_GrafLayer( tools::Long nGrafAnchorCp )
tools::Rectangle aRect(aFSFA.nXaLeft, aFSFA.nYaTop, aFSFA.nXaRight, aFSFA.nYaBottom);
SvxMSDffImportData aData( aRect );
/*
#i20540#
The SdrOle2Obj will try and manage any ole objects it finds, causing all
sorts of trouble later on
*/
SwDocShell* pPersist = m_rDoc.GetDocShell();
m_rDoc.SetDocShell(nullptr); // #i20540# Persist guard
rtl::Reference<SdrObject> pObject;
bool bOk = (m_xMSDffManager->GetShape(aFSFA.nSpId, pObject, aData) && pObject);
m_rDoc.SetDocShell(pPersist); // #i20540# Persist guard
if (!bOk)
{
OSL_ENSURE( false, "Where is the Shape ?" );