summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/filter/basflt/fltshell.cxx27
-rw-r--r--sw/source/filter/html/htmltab.cxx35
-rw-r--r--sw/source/filter/inc/fltshell.hxx22
-rw-r--r--sw/source/filter/ww8/ww8par.cxx3
-rw-r--r--sw/source/filter/ww8/ww8par.hxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx12
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx2
7 files changed, 59 insertions, 44 deletions
diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx
index e6e0517a0489..5daa1310d810 100644
--- a/sw/source/filter/basflt/fltshell.cxx
+++ b/sw/source/filter/basflt/fltshell.cxx
@@ -1126,4 +1126,31 @@ void UpdatePageDescs(SwDoc &rDoc, size_t nInPageDescOffset)
rDoc.ChgPageDesc(i, rDoc.GetPageDesc(i));
}
+FrameDeleteWatch::FrameDeleteWatch(SwFrameFormat* pFormat)
+ : m_pFormat(pFormat)
+{
+ if(m_pFormat)
+ StartListening(pFormat->GetNotifier());
+}
+
+void FrameDeleteWatch::Notify(const SfxHint& rHint)
+{
+ bool bDying = false;
+ if (rHint.GetId() == SfxHintId::Dying)
+ bDying = true;
+ else if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
+ bDying = pDrawFrameFormatHint->m_eId == sw::DrawFrameFormatHintId::DYING;
+ if (bDying)
+ {
+ m_pFormat = nullptr;
+ EndListeningAll();
+ }
+}
+
+FrameDeleteWatch::~FrameDeleteWatch()
+{
+ m_pFormat = nullptr;
+ EndListeningAll();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 0d659d7dfd65..ce689df01b9d 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4860,41 +4860,6 @@ HTMLTableOptions::HTMLTableOptions( const HTMLOptions& rOptions,
namespace
{
- class FrameDeleteWatch final: public SvtListener
- {
- SwFrameFormat* m_pFormat;
- public:
- FrameDeleteWatch(SwFrameFormat* pFormat)
- : m_pFormat(pFormat)
- {
- if(m_pFormat)
- StartListening(pFormat->GetNotifier());
- }
-
- virtual void Notify(const SfxHint& rHint) override
- {
- if (auto pDrawFrameFormatHint = dynamic_cast<const sw::DrawFrameFormatHint*>(&rHint))
- {
- if (pDrawFrameFormatHint->m_eId == sw::DrawFrameFormatHintId::DYING)
- {
- m_pFormat = nullptr;
- EndListeningAll();
- }
- }
- }
-
- bool WasDeleted() const
- {
- return !m_pFormat;
- }
-
- virtual ~FrameDeleteWatch() override
- {
- m_pFormat = nullptr;
- EndListeningAll();
- }
- };
-
class IndexInRange
{
private:
diff --git a/sw/source/filter/inc/fltshell.hxx b/sw/source/filter/inc/fltshell.hxx
index 2f8450556d39..1e6bf6c8a735 100644
--- a/sw/source/filter/inc/fltshell.hxx
+++ b/sw/source/filter/inc/fltshell.hxx
@@ -330,6 +330,28 @@ public:
}
};
+// detect if the SwFrameFormat it is watching was deleted
+class SW_DLLPUBLIC FrameDeleteWatch final: public SvtListener
+{
+ SwFrameFormat* m_pFormat;
+public:
+ FrameDeleteWatch(SwFrameFormat* pFormat);
+
+ virtual void Notify(const SfxHint& rHint) override;
+
+ SwFrameFormat* GetFormat()
+ {
+ return m_pFormat;
+ }
+
+ bool WasDeleted() const
+ {
+ return !m_pFormat;
+ }
+
+ virtual ~FrameDeleteWatch() override;
+};
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 44812a67ad1f..f5bdacffe32d 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -2170,7 +2170,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes)
std::unique_ptr<OutlinerParaObject> pOutliner = ImportAsOutliner( sText, pRes->nCp2OrIdx,
pRes->nCp2OrIdx + pRes->nMemLen, MAN_AND );
- m_pFormatOfJustInsertedApo = nullptr;
+ m_xFormatOfJustInsertedApo.reset();
SwPostItField aPostIt(
static_cast<SwPostItFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit)), sAuthor,
sText, sInitials, OUString(), aDate );
@@ -4260,7 +4260,6 @@ SwWW8ImplReader::SwWW8ImplReader(sal_uInt8 nVersionPara, SotStorage* pStorage,
, m_aParaStyleMapper(rD)
, m_aCharStyleMapper(rD)
, m_pFlyFormatOfJustInsertedGraphic(nullptr)
- , m_pFormatOfJustInsertedApo(nullptr)
, m_pPreviousNumPaM(nullptr)
, m_pPrevNumRule(nullptr)
, m_aTextNodesHavingFirstLineOfstSet()
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 61e30e6618ed..74953aa2016c 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -1196,7 +1196,7 @@ private:
std::unique_ptr<SwMSConvertControls> m_xFormImpl; // implementation of control
SwFlyFrameFormat* m_pFlyFormatOfJustInsertedGraphic;
- SwFrameFormat* m_pFormatOfJustInsertedApo;
+ std::unique_ptr<FrameDeleteWatch> m_xFormatOfJustInsertedApo;
SwPaM* m_pPreviousNumPaM;
const SwNumRule* m_pPrevNumRule;
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index f0a12ad3005e..6edc842e48ee 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2399,18 +2399,20 @@ void WW8TabDesc::CreateSwTable()
Set fly anchor to its anchor pos, so that if a table starts immediately
at this position a new node will be inserted before inserting the table.
*/
- if (!bInsNode && m_pIo->m_pFormatOfJustInsertedApo)
+ SwFrameFormat* pFormat = (!bInsNode && m_pIo->m_xFormatOfJustInsertedApo)
+ ? m_pIo->m_xFormatOfJustInsertedApo->GetFormat() : nullptr;
+ if (pFormat)
{
const SwPosition* pAPos =
- m_pIo->m_pFormatOfJustInsertedApo->GetAnchor().GetContentAnchor();
+ pFormat->GetAnchor().GetContentAnchor();
if (pAPos && &pAPos->nNode.GetNode() == &pPoint->nNode.GetNode())
{
bInsNode = true;
bSetMinHeight = true;
- SwFormatSurround aSur(m_pIo->m_pFormatOfJustInsertedApo->GetSurround());
+ SwFormatSurround aSur(pFormat->GetSurround());
aSur.SetAnchorOnly(true);
- m_pIo->m_pFormatOfJustInsertedApo->SetFormatAttr(aSur);
+ pFormat->SetFormatAttr(aSur);
}
}
@@ -2797,7 +2799,7 @@ void WW8TabDesc::FinishSwTable()
}
}
}
- m_pIo->m_pFormatOfJustInsertedApo = nullptr;
+ m_pIo->m_xFormatOfJustInsertedApo.reset();
m_MergeGroups.clear();
}
}
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 499fdc8e223e..1e68d7a592b4 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -2716,7 +2716,7 @@ void SwWW8ImplReader::StopApo()
//#i8062#
if (m_xSFlyPara && m_xSFlyPara->pFlyFormat)
- m_pFormatOfJustInsertedApo = m_xSFlyPara->pFlyFormat;
+ m_xFormatOfJustInsertedApo.reset(new FrameDeleteWatch(m_xSFlyPara->pFlyFormat));
m_xSFlyPara.reset();
m_xWFlyPara.reset();