LCOV - code coverage report
Current view: top level - sw/source/core/inc - sectfrm.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 23 25 92.0 %
Date: 2015-06-13 12:38:46 Functions: 20 22 90.9 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
      21             : #include <tools/mempool.hxx>
      22             : 
      23             : #include "layfrm.hxx"
      24             : #include "flowfrm.hxx"
      25             : #include <set>
      26             : 
      27             : class SwSection;
      28             : class SwSectionFormat;
      29             : class SwAttrSetChg;
      30             : class SwFootnoteContFrm;
      31             : class SwLayouter;
      32             : 
      33             : #define FINDMODE_ENDNOTE 1
      34             : #define FINDMODE_LASTCNT 2
      35             : #define FINDMODE_MYLAST  4
      36             : 
      37             : class SwSectionFrm: public SwLayoutFrm, public SwFlowFrm
      38             : {
      39             :     SwSection* pSection;
      40             :     bool bFootnoteAtEnd; // footnotes at the end of section
      41             :     bool bEndnAtEnd; // endnotes at the end of section
      42             :     bool bContentLock; // content locked
      43             :     bool bOwnFootnoteNum; // special numbering of footnotes
      44             :     bool bFootnoteLock; // ftn, don't leave this section bwd
      45             : 
      46             :     void _UpdateAttr( const SfxPoolItem*, const SfxPoolItem*, sal_uInt8 &,
      47             :                       SwAttrSetChg *pa = 0, SwAttrSetChg *pb = 0 );
      48             :     void _Cut( bool bRemove );
      49             :     // Is there a FootnoteContainer?
      50             :     // An empty sectionfrm without FootnoteCont is superfluous
      51        1129 :     bool IsSuperfluous() const { return !ContainsAny() && !ContainsFootnoteCont(); }
      52             :     void CalcFootnoteAtEndFlag();
      53             :     void CalcEndAtEndFlag();
      54             :     const SwSectionFormat* _GetEndSectFormat() const;
      55             :     bool IsEndnoteAtMyEnd() const;
      56             : 
      57             :     virtual void DestroyImpl() SAL_OVERRIDE;
      58             :     virtual ~SwSectionFrm();
      59             : 
      60             : protected:
      61             :     virtual void MakeAll() SAL_OVERRIDE;
      62             :     virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
      63             :     virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
      64             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
      65             :     virtual void SwClientNotify( const SwModify&, const SfxHint& ) SAL_OVERRIDE;
      66             : 
      67             : public:
      68             :     SwSectionFrm( SwSection &, SwFrm* ); // Content is not created!
      69             :     SwSectionFrm( SwSectionFrm &, bool bMaster ); // _ONLY_ for creating Master/Follows!
      70             : 
      71             :     void Init();
      72             :     virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
      73             : 
      74             :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const SAL_OVERRIDE;
      75             : 
      76             :     virtual void Cut() SAL_OVERRIDE;
      77             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
      78             : 
      79             :     inline const SwSectionFrm *GetFollow() const;
      80             :     inline       SwSectionFrm *GetFollow();
      81             :     SwSectionFrm* FindMaster() const;
      82             : 
      83             :                  SwContentFrm *FindLastContent( sal_uInt8 nMode = 0 );
      84             :     inline const SwContentFrm *FindLastContent( sal_uInt8 nMode = 0 ) const;
      85       25928 :     inline SwSection* GetSection() { return pSection; }
      86        5393 :     inline const SwSection* GetSection() const { return pSection; }
      87        2514 :     inline void ColLock()       { mbColLocked = true; }
      88        1897 :     inline void ColUnlock()     { mbColLocked = false; }
      89             : 
      90             :     void CalcFootnoteContent();
      91             :     void SimpleFormat();
      92             :     bool IsDescendantFrom( const SwSectionFormat* pSect ) const;
      93             :     bool HasToBreak( const SwFrm* pFrm ) const;
      94             :     void MergeNext( SwSectionFrm* pNxt );
      95             : 
      96             :     /**
      97             :      * Splits the SectionFrm surrounding the pFrm up in two parts:
      98             :      * pFrm and the start of the 2nd part
      99             :      */
     100             :     bool SplitSect( SwFrm* pFrm, bool bApres );
     101             :     void DelEmpty( bool bRemove ); // Like Cut(), except for that Follow chaining is maintained
     102             :     bool IsToIgnore() const        // No size, no content; need to be ignored
     103             :     { return !Frm().Height() && !ContainsContent(); }
     104             :     SwFootnoteContFrm* ContainsFootnoteCont( const SwFootnoteContFrm* pCont = NULL ) const;
     105             :     bool Growable() const;
     106             :     SwTwips _Shrink( SwTwips, bool bTst );
     107             :     SwTwips _Grow  ( SwTwips, bool bTst );
     108             : 
     109             :     /**
     110             :      * A sectionfrm has to maximize, if he has a follow or a ftncontainer at
     111             :      * the end of the page. A superfluous follow will be ignored,
     112             :      * if bCheckFollow is set.
     113             :      */
     114             :     bool ToMaximize( bool bCheckFollow ) const;
     115          27 :     inline bool _ToMaximize() const
     116          27 :         { if( !pSection ) return false; return ToMaximize( false ); }
     117             :     bool MoveAllowed( const SwFrm* ) const;
     118             :     bool CalcMinDiff( SwTwips& rMinDiff ) const;
     119             : 
     120             :     /**
     121             :      * If we don't pass a @param bOverSize or false, the return value is > 0 for
     122             :      * undersized Frames, or 0
     123             :      *
     124             :      * If @param bOverSize == true, we can also get a negative return value,
     125             :      * if the SectionFrm is not completely filled, which happens often for
     126             :      * e.g. SectionFrms with Follows.
     127             :      * We need this in the FormatWidthCols to "deflate" columns there.
     128             :      */
     129             :     long Undersize( bool bOverSize = false );
     130             : 
     131             :     /// Adapt size to surroundings
     132             :     void _CheckClipping( bool bGrow, bool bMaximize );
     133             : 
     134             :     void InvalidateFootnotePos();
     135             :     void CollectEndnotes( SwLayouter* pLayouter );
     136          59 :     const SwSectionFormat* GetEndSectFormat() const
     137          59 :         { if( IsEndnAtEnd() ) return _GetEndSectFormat(); return NULL; }
     138             : 
     139             :     static void MoveContentAndDelete( SwSectionFrm* pDel, bool bSave );
     140             : 
     141             :     bool IsBalancedSection() const;
     142             : 
     143             :     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const SAL_OVERRIDE;
     144             : 
     145        2563 :     bool IsFootnoteAtEnd() const { return bFootnoteAtEnd; }
     146        9040 :     bool IsEndnAtEnd() const { return bEndnAtEnd;   }
     147        1932 :     bool IsAnyNoteAtEnd() const { return bFootnoteAtEnd || bEndnAtEnd; }
     148             :     bool AreNotesAtEnd() const { return bFootnoteAtEnd && bEndnAtEnd; }
     149             : 
     150          88 :     void SetContentLock( bool bNew ) { bContentLock = bNew; }
     151          60 :     bool IsContentLocked() const { return bContentLock; }
     152             : 
     153           0 :     bool IsOwnFootnoteNum() const { return bOwnFootnoteNum; }
     154             : 
     155           0 :     void SetFootnoteLock( bool bNew ) { bFootnoteLock = bNew; }
     156           5 :     bool IsFootnoteLock() const { return bFootnoteLock; }
     157             : 
     158        1354 :     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
     159             : };
     160             : 
     161         102 : class SwDestroyList : public std::set<SwSectionFrm*> {};
     162             : 
     163         167 : inline const SwSectionFrm *SwSectionFrm::GetFollow() const
     164             : {
     165         167 :     return static_cast<const SwSectionFrm*>(SwFlowFrm::GetFollow());
     166             : }
     167        9883 : inline SwSectionFrm *SwSectionFrm::GetFollow()
     168             : {
     169        9883 :     return static_cast<SwSectionFrm*>(SwFlowFrm::GetFollow());
     170             : }
     171         607 : inline const SwContentFrm *SwSectionFrm::FindLastContent( sal_uInt8 nMode ) const
     172             : {
     173         607 :     return const_cast<SwSectionFrm*>(this)->FindLastContent( nMode );
     174             : }
     175             : 
     176             : #endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
     177             : 
     178             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11