diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2022-09-12 15:12:08 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2022-09-12 17:00:55 +0200 |
commit | 70dcd1135743eb4dae6f881201140b57c1daddd3 (patch) | |
tree | decd1bb1e645368d6306f882f1316b3b71d6d4d5 /sw/source/filter/xml/xmlimp.cxx | |
parent | b96c5ede4a4fd82cfdf574ed4ef5d42b82cc021f (diff) |
tdf#150753: always do the final steps, including unlocking draw model
Otherwise, it's impossible to select objects added to the document
created from a template without content.xml, until save-and-reload,
because they never recalculate their bounds.
Change-Id: Id97f0ff14be33196703b6f0ade713203ff10df74
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139796
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/source/filter/xml/xmlimp.cxx')
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 61bbf47aa11d..352d658a24d8 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -821,29 +821,31 @@ void SwXMLImport::endDocument() m_oSttNdIdx.reset(); + // tdf#150753: pDoc may be null e.g. when the package lacks content.xml; + // we should not forget to tidy up here, including unlocking draw model + if (!pDoc) + pDoc = SwImport::GetDocFromXMLImport(*this); + assert(pDoc); // SJ: #i49801# -> now permitting repaints - if ( pDoc ) + if (getImportFlags() == SvXMLImportFlags::ALL) { - if( getImportFlags() == SvXMLImportFlags::ALL ) - { - // Notify math objects. If we are in the package filter this will - // be done by the filter object itself - if( IsInsertMode() ) - pDoc->PrtOLENotify( false ); - else if ( pDoc->IsOLEPrtNotifyPending() ) - pDoc->PrtOLENotify( true ); - - assert(pDoc->IsInReading()); - assert(pDoc->IsInXMLImport()); - pDoc->SetInReading(false); - pDoc->SetInXMLImport(false); - } - - SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); - if ( pDrawModel ) - pDrawModel->setLock(false); + // Notify math objects. If we are in the package filter this will + // be done by the filter object itself + if (IsInsertMode()) + pDoc->PrtOLENotify(false); + else if (pDoc->IsOLEPrtNotifyPending()) + pDoc->PrtOLENotify(true); + + assert(pDoc->IsInReading()); + assert(pDoc->IsInXMLImport()); + pDoc->SetInReading(false); + pDoc->SetInXMLImport(false); } + SwDrawModel* pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel(); + if (pDrawModel) + pDrawModel->setLock(false); + // #i90243# if ( m_bInititedXForms ) { @@ -871,8 +873,6 @@ void SwXMLImport::endDocument() } } -#if 1 - if (!pDoc) { pDoc = SwImport::GetDocFromXMLImport(*this); } for (SwNodeOffset i(0); i < pDoc->GetNodes().Count(); ++i) { if (SwTableNode *const pTableNode = pDoc->GetNodes()[i]->GetTableNode()) @@ -885,7 +885,6 @@ void SwXMLImport::endDocument() } // don't skip to the end; nested tables could have subtables too... } -#endif // delegate to parent: takes care of error handling SvXMLImport::endDocument(); |