[Libreoffice-commits] .: sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Thu Apr 7 03:27:04 PDT 2011


 sw/source/core/inc/cntfrm.hxx     |   10 ++++++++++
 sw/source/core/inc/flowfrm.hxx    |   13 ++++++++++++-
 sw/source/core/inc/sectfrm.hxx    |    2 ++
 sw/source/core/inc/tabfrm.hxx     |    2 ++
 sw/source/core/layout/flowfrm.cxx |   12 ++++--------
 sw/source/core/text/xmldump.cxx   |   25 +++++++++++++++++++++++++
 6 files changed, 55 insertions(+), 9 deletions(-)

New commits:
commit 9ecab7b8926be7c0d3c5d48c15925a9d5c0ae9b3
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Thu Apr 7 12:23:51 2011 +0200

    sw: fixed layout crasher when closing document from fdo#34489

diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index cca1d52..147f1de 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 da3e5ca..b134d05 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 f9f7a2e..feb8e85 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 a81b25b..2468b59 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 9ba8202..02ae407 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 4152901..2543362 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: */


More information about the Libreoffice-commits mailing list