LCOV - code coverage report
Current view: top level - sw/source/core/inc - sectfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 18 25 72.0 %
Date: 2012-08-25 Functions: 17 22 77.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 12 20 60.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #ifndef _SECTFRM_HXX
      29                 :            : #define _SECTFRM_HXX
      30                 :            : #include <tools/mempool.hxx>
      31                 :            : 
      32                 :            : #include "layfrm.hxx"
      33                 :            : #include "flowfrm.hxx"
      34                 :            : #include <set>
      35                 :            : 
      36                 :            : class SwSection;
      37                 :            : class SwSectionFmt;
      38                 :            : class SwAttrSetChg;
      39                 :            : class SwFtnContFrm;
      40                 :            : class SwLayouter;
      41                 :            : 
      42                 :            : #define FINDMODE_ENDNOTE 1
      43                 :            : #define FINDMODE_LASTCNT 2
      44                 :            : #define FINDMODE_MYLAST  4
      45                 :            : 
      46                 :            : class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm
      47                 :            : {
      48                 :            :     SwSection* pSection;
      49                 :            :     bool bFtnAtEnd; // footnotes at the end of section
      50                 :            :     bool bEndnAtEnd; // endnotes at the end of section
      51                 :            :     bool bCntntLock; // content locked
      52                 :            :     bool bOwnFtnNum; // special numbering of footnotes
      53                 :            :     bool bFtnLock; // ftn, don't leave this section bwd
      54                 :            : 
      55                 :            :     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
      56                 :            :                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
      57                 :            :     void _Cut( sal_Bool bRemove );
      58                 :            :     // Is there a FtnContainer?
      59                 :            :     // An empty sectionfrm without FtnCont is superfluous
      60 [ +  + ][ +  - ]:        270 :     sal_Bool IsSuperfluous() const { return !ContainsAny() && !ContainsFtnCont(); }
      61                 :            :     void CalcFtnAtEndFlag();
      62                 :            :     void CalcEndAtEndFlag();
      63                 :            :     const SwSectionFmt* _GetEndSectFmt() const;
      64                 :            :     bool IsEndnoteAtMyEnd() const;
      65                 :            : protected:
      66                 :            :     virtual void MakeAll();
      67                 :            :     virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat );
      68                 :            :     virtual void Format( const SwBorderAttrs *pAttrs = 0 );
      69                 :            :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
      70                 :            :     virtual void SwClientNotify( const SwModify&, const SfxHint& );
      71                 :            : 
      72                 :            : public:
      73                 :            :     SwSectionFrm( SwSection &, SwFrm* );                 //Inhalt wird nicht erzeugt!
      74                 :            :     SwSectionFrm( SwSectionFrm &, sal_Bool bMaster );//_Nur_ zum Erzeugen von Master/Follows
      75                 :            :     virtual ~SwSectionFrm();
      76                 :            : 
      77                 :            :     void Init();
      78                 :            :     virtual void  CheckDirection( sal_Bool bVert );
      79                 :            : 
      80                 :            :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
      81                 :            : 
      82                 :            :     virtual void Cut();
      83                 :            :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
      84                 :            : 
      85                 :            :     inline const SwSectionFrm *GetFollow() const;
      86                 :            :     inline       SwSectionFrm *GetFollow();
      87                 :            :     SwSectionFrm* FindMaster() const;
      88                 :            : 
      89                 :            :                  SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 );
      90                 :            :     inline const SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 ) const;
      91                 :       4236 :     inline SwSection* GetSection() { return pSection; }
      92                 :        282 :     inline const SwSection* GetSection() const { return pSection; }
      93                 :        265 :     inline void ColLock()       { bColLocked = sal_True; }
      94                 :        239 :     inline void ColUnlock()     { bColLocked = sal_False; }
      95                 :            : 
      96                 :            :     void CalcFtnCntnt();
      97                 :            :     void SimpleFormat();
      98                 :            :     sal_Bool IsDescendantFrom( const SwSectionFmt* pSect ) const;
      99                 :            :     sal_Bool HasToBreak( const SwFrm* pFrm ) const;
     100                 :            :     void MergeNext( SwSectionFrm* pNxt );
     101                 :            :     //Zerlegt den pFrm umgebenden SectionFrm in zwei Teile,
     102                 :            :     //pFrm an den Anfang des 2. Teils
     103                 :            :     sal_Bool SplitSect( SwFrm* pFrm, sal_Bool bApres );
     104                 :            :     void DelEmpty( sal_Bool bRemove );  // wie Cut(), Follow-Verkettung wird aber mitgepflegt
     105                 :            :     sal_Bool IsToIgnore() const         // Keine Groesse, kein Inhalt, muss ignoriert werden
     106                 :            :     { return !Frm().Height() && !ContainsCntnt(); }
     107                 :            :     SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const;
     108                 :            :     sal_Bool Growable() const;
     109                 :            :     SwTwips _Shrink( SwTwips, sal_Bool bTst );
     110                 :            :     SwTwips _Grow  ( SwTwips, sal_Bool bTst );
     111                 :            : 
     112                 :            :     // A sectionfrm has to maximize, if he has a follow or a ftncontainer at
     113                 :            :     // the end of the page. A superfluous follow will be ignored,
     114                 :            :     // if bCheckFollow is set.
     115                 :            :     sal_Bool ToMaximize( sal_Bool bCheckFollow ) const;
     116                 :          0 :     inline sal_Bool _ToMaximize() const
     117         [ #  # ]:          0 :         { if( !pSection ) return sal_False; return ToMaximize( sal_False ); }
     118                 :            :     sal_Bool MoveAllowed( const SwFrm* ) const;
     119                 :            :     sal_Bool CalcMinDiff( SwTwips& rMinDiff ) const;
     120                 :            :     // Uebergibt man kein bOverSize bzw. sal_False, so ist der Returnwert
     121                 :            :     // >0 fuer Undersized-Frames, ==0 sonst.
     122                 :            :     // Uebergibt man sal_True, so kann es auch einen negativen Returnwert geben,
     123                 :            :     // wenn der SectionFrm nicht vollstaendig ausgefuellt ist, was z.B. bei
     124                 :            :     // SectionFrm mit Follow meist vorkommt. Benoetigt wird dies im
     125                 :            :     // FormatWidthCols, um "Luft" aus den Spalten zu lassen.
     126                 :            :     long Undersize( sal_Bool bOverSize = sal_False );
     127                 :            :     // Groesse an die Umgebung anpassen
     128                 :            :     void _CheckClipping( sal_Bool bGrow, sal_Bool bMaximize );
     129                 :            : 
     130                 :            :     void InvalidateFtnPos();
     131                 :            :     void CollectEndnotes( SwLayouter* pLayouter );
     132                 :          0 :     const SwSectionFmt* GetEndSectFmt() const
     133         [ #  # ]:          0 :         { if( IsEndnAtEnd() ) return _GetEndSectFmt(); return NULL; }
     134                 :            : 
     135                 :            :     static void MoveCntntAndDelete( SwSectionFrm* pDel, sal_Bool bSave );
     136                 :            : 
     137                 :            :     bool IsBalancedSection() const;
     138                 :            : 
     139                 :            :     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
     140                 :            : 
     141                 :        719 :     bool IsFtnAtEnd() const { return bFtnAtEnd; }
     142                 :       1003 :     bool IsEndnAtEnd() const { return bEndnAtEnd;   }
     143 [ +  + ][ +  + ]:        509 :     bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
     144                 :            :     bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
     145                 :            : 
     146                 :          6 :     void SetCntntLock( bool bNew ) { bCntntLock = bNew; }
     147                 :          6 :     bool IsCntntLocked() const { return bCntntLock; }
     148                 :            : 
     149                 :          0 :     bool IsOwnFtnNum() const { return bOwnFtnNum; }
     150                 :            : 
     151                 :          0 :     void SetFtnLock( bool bNew ) { bFtnLock = bNew; }
     152                 :          0 :     bool IsFtnLock() const { return bFtnLock; }
     153                 :            : 
     154 [ +  - ][ +  - ]:        414 :     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
     155                 :            : };
     156                 :            : 
     157                 :          8 : class SwDestroyList : public std::set<SwSectionFrm*> {};
     158                 :            : 
     159                 :         26 : inline const SwSectionFrm *SwSectionFrm::GetFollow() const
     160                 :            : {
     161         [ +  - ]:         26 :     return (const SwSectionFrm*)SwFlowFrm::GetFollow();
     162                 :            : }
     163                 :        960 : inline SwSectionFrm *SwSectionFrm::GetFollow()
     164                 :            : {
     165         [ +  + ]:        960 :     return (SwSectionFrm*)SwFlowFrm::GetFollow();
     166                 :            : }
     167                 :        226 : inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const
     168                 :            : {
     169                 :        226 :     return ((SwSectionFrm*)this)->FindLastCntnt( nMode );
     170                 :            : }
     171                 :            : 
     172                 :            : 
     173                 :            : #endif  //_SECTFRM_HXX
     174                 :            : 
     175                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10