sw/qa/core/data/ww6/fail/ofz45140-1.doc |binary sw/source/filter/ww8/ww8par2.cxx | 87 +++++++++++++++----------------- 2 files changed, 42 insertions(+), 45 deletions(-)
New commits: commit 66cf7677a2352c3796ef12597bbff9145a2efdec Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Mar 2 11:46:38 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Mar 2 16:35:13 2022 +0100 ofz#45140 just discard document where import has hopelessly failed Change-Id: Ic772402f99cd68abf24c79f2cf2270692f21aa53 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130844 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/core/data/ww6/fail/ofz45140-1.doc b/sw/qa/core/data/ww6/fail/ofz45140-1.doc new file mode 100644 index 000000000000..59538b13e450 Binary files /dev/null and b/sw/qa/core/data/ww6/fail/ofz45140-1.doc differ diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index df34892bc8a9..016ce7244634 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -2856,7 +2856,7 @@ void WW8TabDesc::FinishSwTable() m_pIo->m_aInsertedTables.InsertTable(*m_pTableNd, *m_pIo->m_pPaM); if (aListener.WasDeleted()) - return; + throw std::runtime_error("table unexpectedly destroyed by applying redlines"); MergeCells(); commit a625a9e6858fa1c8c62d6201040d7d36e71a4efa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Mar 2 12:04:32 2022 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Wed Mar 2 16:34:57 2022 +0100 move these two DeleteListeners beside each other Change-Id: I815223b88b09d19014bed7c4940873fc12b4854f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130845 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx index e47f11913548..df34892bc8a9 100644 --- a/sw/source/filter/ww8/ww8par2.cxx +++ b/sw/source/filter/ww8/ww8par2.cxx @@ -169,12 +169,12 @@ sal_uInt32 wwSectionManager::GetWWPageTopMargin() const namespace { - class DeleteListener final : public SvtListener + class SvtDeleteListener final : public SvtListener { private: bool bObjectDeleted; public: - explicit DeleteListener(SvtBroadcaster& rNotifier) + explicit SvtDeleteListener(SvtBroadcaster& rNotifier) : bObjectDeleted(false) { StartListening(rNotifier); @@ -191,6 +191,43 @@ namespace return bObjectDeleted; } }; + + class SwDeleteListener final : public SwClient + { + private: + SwModify* m_pModify; + + virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override + { + if (rHint.GetId() != SfxHintId::SwLegacyModify) + return; + auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); + if (pLegacy->GetWhich() == RES_OBJECTDYING) + { + m_pModify->Remove(this); + m_pModify = nullptr; + } + } + + public: + SwDeleteListener(SwModify* pModify) + : m_pModify(pModify) + { + m_pModify->Add(this); + } + + bool WasDeleted() const + { + return !m_pModify; + } + + virtual ~SwDeleteListener() override + { + if (!m_pModify) + return; + m_pModify->Remove(this); + } + }; } sal_uInt16 SwWW8ImplReader::End_Footnote() @@ -252,7 +289,7 @@ sal_uInt16 SwWW8ImplReader::End_Footnote() SwFormatFootnote& rFormatFootnote = static_cast<SwFormatFootnote&>(pFN->GetAttr()); - DeleteListener aDeleteListener(rFormatFootnote.GetNotifier()); + SvtDeleteListener aDeleteListener(rFormatFootnote.GetNotifier()); // read content of Ft-/End-Note Read_HdFtFootnoteText( pSttIdx, rDesc.mnStartCp, rDesc.mnLen, rDesc.meType); @@ -2789,46 +2826,6 @@ void WW8TabDesc::MoveOutsideTable() *m_pIo->m_pPaM->GetPoint() = *m_xTmpPos->GetPoint(); } -namespace -{ - class SwTableNodeListener final : public SwClient - { - private: - SwModify* m_pModify; - - virtual void SwClientNotify(const SwModify&, const SfxHint& rHint) override - { - if (rHint.GetId() != SfxHintId::SwLegacyModify) - return; - auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); - if (pLegacy->GetWhich() == RES_OBJECTDYING) - { - m_pModify->Remove(this); - m_pModify = nullptr; - } - } - - public: - SwTableNodeListener(SwModify* pModify) - : m_pModify(pModify) - { - m_pModify->Add(this); - } - - bool WasDeleted() const - { - return !m_pModify; - } - - virtual ~SwTableNodeListener() override - { - if (!m_pModify) - return; - m_pModify->Remove(this); - } - }; -} - void WW8TabDesc::FinishSwTable() { m_pIo->m_xRedlineStack->closeall(*m_pIo->m_pPaM->GetPoint()); @@ -2839,7 +2836,7 @@ void WW8TabDesc::FinishSwTable() m_pIo->m_pLastAnchorPos.reset(); SwTableNode* pTableNode = m_pTable->GetTableNode(); - SwTableNodeListener aListener(pTableNode); + SwDeleteListener aListener(pTableNode); m_pIo->m_xRedlineStack = std::move(mxOldRedlineStack); if (xLastAnchorCursor)