[Libreoffice-commits] .: sw/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Thu Sep 8 02:11:33 PDT 2011


 sw/source/core/inc/flowfrm.hxx    |   15 -----------
 sw/source/core/inc/sectfrm.hxx    |   18 +++++++++++++
 sw/source/core/inc/txtfrm.hxx     |    2 -
 sw/source/core/layout/flowfrm.cxx |   11 ++++----
 sw/source/core/layout/sectfrm.cxx |   10 ++++---
 sw/source/core/layout/tabfrm.cxx  |    2 -
 sw/source/core/text/txtfrm.cxx    |   49 +++++++++++++++++---------------------
 7 files changed, 54 insertions(+), 53 deletions(-)

New commits:
commit b66db1c73f494e74a8bf6c94544eccc01095528e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Sep 8 11:07:51 2011 +0200

    Cleanup of SwFlowFrm flags.
    
    bUndersized was used uninitialized in derived SwFlowFrm, as valgrinding sw/qa/unoapi revealed.

diff --git a/sw/source/core/inc/flowfrm.hxx b/sw/source/core/inc/flowfrm.hxx
index 2eb36f5..e1c47c2 100644
--- a/sw/source/core/inc/flowfrm.hxx
+++ b/sw/source/core/inc/flowfrm.hxx
@@ -120,11 +120,6 @@ protected:
     sal_Bool bIsFollow  :1; //Ist's ein Follow
     sal_Bool bLockJoin  :1; //Join (und damit deleten) verboten wenn sal_True!
     sal_Bool bUndersized:1; // wir sind kleiner als gewuenscht
-    sal_Bool bFtnAtEnd  :1; // For sectionfrms only: footnotes at the end of section
-    sal_Bool bEndnAtEnd :1; //  "       "        " : endnotes at the end of section
-    sal_Bool bCntntLock :1; //  "       "        " : content locked
-    sal_Bool bOwnFtnNum :1; //  "       "        " : special numbering of footnotes
-    sal_Bool bFtnLock   :1; //  "       "        " : ftn, don't leave this section bwd
     sal_Bool bFlyLock   :1; //  Stop positioning of at-character flyframes
 
     //Prueft ob Vorwaertsfluss noch Sinn macht Endloswanderschaften (unterbinden)
@@ -180,10 +175,6 @@ public:
 
     sal_Bool IsJoinLocked() const { return bLockJoin; }
     sal_Bool IsAnyJoinLocked() const { return bLockJoin || HasLockedFollow(); }
-    sal_Bool IsFtnAtEnd() const { return bFtnAtEnd; }
-    sal_Bool IsEndnAtEnd() const { return bEndnAtEnd;   }
-    sal_Bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
-    sal_Bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
 
     sal_Bool IsPageBreak( sal_Bool bAct ) const;
     sal_Bool IsColBreak( sal_Bool bAct ) const;
@@ -234,14 +225,8 @@ public:
 
     void CheckKeep();
 
-    void SetFtnLock( sal_Bool bNew ){ bFtnLock = bNew; }
-    sal_Bool IsFtnLock() const {    return bFtnLock; }
     void SetFlyLock( sal_Bool bNew ){ bFlyLock = bNew; }
     sal_Bool IsFlyLock() const {    return bFlyLock; }
-    void SetOwnFtnNum( sal_Bool bNew ){ bOwnFtnNum = bNew; }
-    sal_Bool IsOwnFtnNum() const {  return bOwnFtnNum; }
-    void SetCntntLock( sal_Bool bNew ){ bCntntLock = bNew; }
-    sal_Bool IsCntntLocked() const {    return bCntntLock; }
 
     //casten einen Frm auf einen FlowFrm - wenns denn einer ist, sonst 0
     //Diese Methoden muessen fuer neue Ableitungen geaendert werden!
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index b821588..73a9e1f 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -45,6 +45,11 @@ class SwLayouter;
 class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm
 {
     SwSection* pSection;
+    bool bFtnAtEnd: 1; // footnotes at the end of section
+    bool bEndnAtEnd: 1; // endnotes at the end of section
+    bool bCntntLock: 1; // content locked
+    bool bOwnFtnNum: 1; // special numbering of footnotes
+    bool bFtnLock: 1; // ftn, don't leave this section bwd
 
     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
@@ -130,6 +135,19 @@ public:
 
     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
 
+    bool IsFtnAtEnd() const { return bFtnAtEnd; }
+    bool IsEndnAtEnd() const { return bEndnAtEnd;   }
+    bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
+    bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
+
+    void SetCntntLock( bool bNew ) { bCntntLock = bNew; }
+    bool IsCntntLocked() const { return bCntntLock; }
+
+    bool IsOwnFtnNum() const { return bOwnFtnNum; }
+
+    void SetFtnLock( bool bNew ) { bFtnLock = bNew; }
+    bool IsFtnLock() const { return bFtnLock; }
+
     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
 };
 
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 168d791..1d388e6 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -108,8 +108,6 @@ class SwTxtFrm: public SwCntntFrm
     //entsprechend dem Attribut ein.
     void CalcLineSpace();
 
-    void InitCtor();        // Wird in beiden Ctoren gerufen
-
     // Wird nur in Format gerufen:
     void AdjustFrm( const SwTwips nChgHeight, sal_Bool bHasToFit = sal_False );
 
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index af62c78..3ca2604 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -82,11 +82,12 @@ sal_Bool SwFlowFrm::bMoveBwdJump = sal_False;
 SwFlowFrm::SwFlowFrm( SwFrm &rFrm ) :
     rThis( rFrm ),
     pFollow( 0 ),
-    pPrecede( 0 )
-{
-    bLockJoin = bIsFollow = bCntntLock = bOwnFtnNum =
-        bFtnLock = bFlyLock = sal_False;
-}
+    pPrecede( 0 ),
+    bIsFollow( false ),
+    bLockJoin( false ),
+    bUndersized( false ),
+    bFlyLock( false )
+{}
 
 
 /*************************************************************************
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 7347f06..6879add 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -87,11 +87,13 @@ SwSectionFrm::SwSectionFrm( SwSection &rSect, SwFrm* pSib ) :
 SwSectionFrm::SwSectionFrm( SwSectionFrm &rSect, sal_Bool bMaster ) :
     SwLayoutFrm( rSect.GetFmt(), rSect.getRootFrm() ),
     SwFlowFrm( (SwFrm&)*this ),
-    pSection( rSect.GetSection() )
+    pSection( rSect.GetSection() ),
+    bFtnAtEnd( rSect.IsFtnAtEnd() ),
+    bEndnAtEnd( rSect.IsEndnAtEnd() ),
+    bCntntLock( false ),
+    bOwnFtnNum( false ),
+    bFtnLock( false )
 {
-    bFtnAtEnd = rSect.IsFtnAtEnd();
-    bEndnAtEnd = rSect.IsEndnAtEnd();
-    bLockJoin = sal_False;
     nType = FRMC_SECTION;
 
     PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect )
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index db24310..b139c59 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -124,7 +124,7 @@ SwTabFrm::SwTabFrm( SwTabFrm &rTab ) :
     pTable( rTab.GetTable() )
 {
     bIsFollow = sal_True;
-    bLockJoin = bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove =
+    bComplete = bONECalcLowers = bCalcLowers = bLowersFormatted = bLockBackMove =
     bResizeHTMLTable = bHasFollowFlowLine = bIsRebuildLastLine =
     bRestrictTableGrowth = bRemoveFollowFlowLinePending = sal_False;
     // #i26945#
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 9e4a237..e29fbe7 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -365,37 +365,34 @@ void SwTxtFrm::Init()
 }
 
 /*************************************************************************
-|*  SwTxtFrm::CTORen/DTOR
-|*************************************************************************/
-
-void SwTxtFrm::InitCtor()
-{
-    nCacheIdx = MSHRT_MAX;
-    nOfst = 0;
-    nAllLines = 0;
-    nThisLines = 0;
-    mnFlyAnchorOfst = 0;
-    mnFlyAnchorOfstNoWrap = 0;
-    mnFtnLine = 0;
-    // OD 2004-03-17 #i11860#
-    mnHeightOfLastLine = 0;
-    mnAdditionalFirstLineOffset = 0;
-
-    nType = FRMC_TXT;
-    bLocked = bFormatted = bWidow = bUndersized = bJustWidow =
-        bEmpty = bInFtnConnect = bFtn = bRepaint = bBlinkPor =
-        bFieldFollow = bHasAnimation = bIsSwapped = sal_False;
-    // OD 14.03.2003 #i11760#
-    mbFollowFormatAllowed = sal_True;
-}
-
-/*************************************************************************
  *                      SwTxtFrm::SwTxtFrm()
  *************************************************************************/
 SwTxtFrm::SwTxtFrm(SwTxtNode * const pNode, SwFrm* pSib )
     : SwCntntFrm( pNode, pSib )
+    , nAllLines( 0 )
+    , nThisLines( 0 )
+    , mnFlyAnchorOfst( 0 )
+    , mnFlyAnchorOfstNoWrap( 0 )
+    , mnFtnLine( 0 )
+    , mnHeightOfLastLine( 0 ) // OD 2004-03-17 #i11860#
+    , mnAdditionalFirstLineOffset( 0 )
+    , nOfst( 0 )
+    , nCacheIdx( MSHRT_MAX )
+    , bLocked( false )
+    , bFormatted( false )
+    , bWidow( false )
+    , bJustWidow( false )
+    , bEmpty( false )
+    , bInFtnConnect( false )
+    , bFtn( false )
+    , bRepaint( false )
+    , bBlinkPor( false )
+    , bFieldFollow( false )
+    , bHasAnimation( false )
+    , bIsSwapped( false )
+    , mbFollowFormatAllowed( true ) // OD 14.03.2003 #i11760#
 {
-    InitCtor();
+    nType = FRMC_TXT;
 }
 
 /*************************************************************************


More information about the Libreoffice-commits mailing list