summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2011-04-07 12:23:51 +0200
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2011-04-07 12:26:49 +0200
commitcc3d0d182cafef9649e45f4657233ac2221fdd0a (patch)
tree05ed0cf14f1303d66a40e97cf16289bbceb4ad0a
parenteb1feda7ee6f3ccce9a056ee3740ea571d4422c5 (diff)
sw: fixed layout crasher when closing document from fdo#34489
-rw-r--r--sw/source/core/inc/cntfrm.hxx10
-rw-r--r--sw/source/core/inc/flowfrm.hxx13
-rw-r--r--sw/source/core/inc/sectfrm.hxx2
-rw-r--r--sw/source/core/inc/tabfrm.hxx2
-rw-r--r--sw/source/core/layout/flowfrm.cxx12
-rw-r--r--sw/source/core/text/xmldump.cxx25
6 files changed, 55 insertions, 9 deletions
diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 9ccf826631fc..848ac82efa09 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -83,6 +83,8 @@ public:
inline const SwCntntFrm *GetFollow() const;
inline SwCntntFrm *GetFollow();
+ inline const SwCntntFrm *GetPrecede() const;
+ inline SwCntntFrm *GetPrecede();
SwTxtFrm* FindMaster() const;
//Layoutabhaengiges Cursortravelling
@@ -146,6 +148,14 @@ inline SwCntntFrm *SwCntntFrm::GetFollow()
{
return (SwCntntFrm*)SwFlowFrm::GetFollow();
}
+inline const SwCntntFrm *SwCntntFrm::GetPrecede() const
+{
+ return (const SwCntntFrm*)SwFlowFrm::GetPrecede();
+}
+inline SwCntntFrm *SwCntntFrm::GetPrecede()
+{
+ return (SwCntntFrm*)SwFlowFrm::GetPrecede();
+}
#endif
diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index 1403718101d8..2eb36f59b5f1 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -115,6 +115,7 @@ class SwFlowFrm
protected:
SwFlowFrm *pFollow;
+ SwFlowFrm *pPrecede;
sal_Bool bIsFollow :1; //Ist's ein Follow
sal_Bool bLockJoin :1; //Join (und damit deleten) verboten wenn sal_True!
@@ -171,7 +172,11 @@ public:
const SwFlowFrm *GetFollow() const { return pFollow; }
SwFlowFrm *GetFollow() { return pFollow; }
sal_Bool IsAnFollow( const SwFlowFrm *pFlow ) const;
- inline void SetFollow( SwFlowFrm *pNew ) { pFollow = pNew; }
+ inline void SetFollow( SwFlowFrm *pNew );
+
+ const SwFlowFrm *GetPrecede() const { return pPrecede; }
+ SwFlowFrm *GetPrecede() { return pPrecede; }
+
sal_Bool IsJoinLocked() const { return bLockJoin; }
sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
@@ -249,6 +254,12 @@ inline sal_Bool SwFlowFrm::IsFwdMoveAllowed()
return rThis.GetIndPrev() != 0;
}
+inline void SwFlowFrm::SetFollow( SwFlowFrm *pNew )
+{
+ pFollow = pNew;
+ if ( pFollow != NULL )
+ pFollow->pPrecede = this;
+}
#endif
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 8c1b84bbd5b8..b8215887a19a 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -128,6 +128,8 @@ public:
bool IsBalancedSection() const;
+ virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
+
DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
};
diff --git a/sw/source/core/inc/tabfrm.hxx b/sw/source/core/inc/tabfrm.hxx
index 3527e2f6deff..40e0df831408 100644
--- a/sw/source/core/inc/tabfrm.hxx
+++ b/sw/source/core/inc/tabfrm.hxx
@@ -216,6 +216,8 @@ public:
sal_uInt16 GetBottomLineSize() const;
// <-- collapsing
+ virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
+
DECL_FIXEDMEMPOOL_NEWDEL(SwTabFrm)
};
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 59fac2138f1d..6b06f21d51b6 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -691,16 +691,12 @@ SwTxtFrm* SwCntntFrm::FindMaster() const
{
OSL_ENSURE( IsFollow(), "SwCntntFrm::FindMaster(): !IsFollow" );
- const SwCntntFrm* pCnt = GetPrevCntntFrm();
+ const SwCntntFrm* pPrec = GetPrecede();
- while ( pCnt )
+ if ( pPrec && pPrec->HasFollow() && pPrec->GetFollow() == this )
{
- if ( pCnt->HasFollow() && pCnt->GetFollow() == this )
- {
- OSL_ENSURE( pCnt->IsTxtFrm(), "NoTxtFrm with follow found" );
- return (SwTxtFrm*)pCnt;
- }
- pCnt = pCnt->GetPrevCntntFrm();
+ OSL_ENSURE( pPrec->IsTxtFrm(), "NoTxtFrm with follow found" );
+ return ( SwTxtFrm* )pPrec;
}
OSL_FAIL( "Follow ist lost in Space." );
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 4152901c6dd6..2543362782dc 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -29,6 +29,8 @@
#include "precompiled_sw.hxx"
#include "frame.hxx"
+#include "sectfrm.hxx"
+#include "tabfrm.hxx"
#include "txtfrm.hxx"
#include "porlin.hxx"
#include "porlay.hxx"
@@ -260,6 +262,29 @@ void SwTxtFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
SwFrm::dumpAsXmlAttributes( writer );
if ( HasFollow() )
xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+ if ( pPrecede != NULL )
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTxtFrm*)pPrecede );
+}
+
+void SwSectionFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
+{
+ SwFrm::dumpAsXmlAttributes( writer );
+ if ( HasFollow() )
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+ if ( pPrecede != NULL )
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwSectionFrm*)pPrecede );
+}
+
+void SwTabFrm::dumpAsXmlAttributes( xmlTextWriterPtr writer )
+{
+ SwFrm::dumpAsXmlAttributes( writer );
+ if ( HasFollow() )
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%p", GetFollow() );
+
+ if ( pPrecede != NULL )
+ xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%p", (SwTabFrm*)pPrecede );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */