LCOV - code coverage report
Current view: top level - sw/source/core/inc - sectfrm.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 21 25 84.0 %
Date: 2014-11-03 Functions: 19 22 86.4 %
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 SwSectionFmt;
      29             : class SwAttrSetChg;
      30             : class SwFtnContFrm;
      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 bFtnAtEnd; // footnotes at the end of section
      41             :     bool bEndnAtEnd; // endnotes at the end of section
      42             :     bool bCntntLock; // content locked
      43             :     bool bOwnFtnNum; // special numbering of footnotes
      44             :     bool bFtnLock; // 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 FtnContainer?
      50             :     // An empty sectionfrm without FtnCont is superfluous
      51        1594 :     bool IsSuperfluous() const { return !ContainsAny() && !ContainsFtnCont(); }
      52             :     void CalcFtnAtEndFlag();
      53             :     void CalcEndAtEndFlag();
      54             :     const SwSectionFmt* _GetEndSectFmt() const;
      55             :     bool IsEndnoteAtMyEnd() const;
      56             : protected:
      57             :     virtual void MakeAll() SAL_OVERRIDE;
      58             :     virtual bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, bool bHead, bool &rReformat ) SAL_OVERRIDE;
      59             :     virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
      60             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* ) SAL_OVERRIDE;
      61             :     virtual void SwClientNotify( const SwModify&, const SfxHint& ) SAL_OVERRIDE;
      62             : 
      63             : public:
      64             :     SwSectionFrm( SwSection &, SwFrm* ); // Content is not created!
      65             :     SwSectionFrm( SwSectionFrm &, bool bMaster ); // _ONLY_ for creating Master/Follows!
      66             :     virtual ~SwSectionFrm();
      67             : 
      68             :     void Init();
      69             :     virtual void CheckDirection( bool bVert ) SAL_OVERRIDE;
      70             : 
      71             :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const SAL_OVERRIDE;
      72             : 
      73             :     virtual void Cut() SAL_OVERRIDE;
      74             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
      75             : 
      76             :     inline const SwSectionFrm *GetFollow() const;
      77             :     inline       SwSectionFrm *GetFollow();
      78             :     SwSectionFrm* FindMaster() const;
      79             : 
      80             :                  SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 );
      81             :     inline const SwCntntFrm *FindLastCntnt( sal_uInt8 nMode = 0 ) const;
      82       44116 :     inline SwSection* GetSection() { return pSection; }
      83        4200 :     inline const SwSection* GetSection() const { return pSection; }
      84        3674 :     inline void ColLock()       { mbColLocked = true; }
      85        2462 :     inline void ColUnlock()     { mbColLocked = false; }
      86             : 
      87             :     void CalcFtnCntnt();
      88             :     void SimpleFormat();
      89             :     bool IsDescendantFrom( const SwSectionFmt* pSect ) const;
      90             :     bool HasToBreak( const SwFrm* pFrm ) const;
      91             :     void MergeNext( SwSectionFrm* pNxt );
      92             : 
      93             :     /**
      94             :      * Splits the SectionFrm surrounding the pFrm up in two parts:
      95             :      * pFrm and the start of the 2nd part
      96             :      */
      97             :     bool SplitSect( SwFrm* pFrm, bool bApres );
      98             :     void DelEmpty( bool bRemove ); // Like Cut(), except for that Follow chaining is maintained
      99             :     bool IsToIgnore() const        // No size, no content; need to be ignored
     100             :     { return !Frm().Height() && !ContainsCntnt(); }
     101             :     SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const;
     102             :     bool Growable() const;
     103             :     SwTwips _Shrink( SwTwips, bool bTst );
     104             :     SwTwips _Grow  ( SwTwips, bool bTst );
     105             : 
     106             :     /**
     107             :      * A sectionfrm has to maximize, if he has a follow or a ftncontainer at
     108             :      * the end of the page. A superfluous follow will be ignored,
     109             :      * if bCheckFollow is set.
     110             :      */
     111             :     bool ToMaximize( bool bCheckFollow ) const;
     112          52 :     inline bool _ToMaximize() const
     113          52 :         { if( !pSection ) return false; return ToMaximize( false ); }
     114             :     bool MoveAllowed( const SwFrm* ) const;
     115             :     bool CalcMinDiff( SwTwips& rMinDiff ) const;
     116             : 
     117             :     /**
     118             :      * If we don't pass a @param bOverSize or false, the return value is > 0 for
     119             :      * undersized Frames, or 0
     120             :      *
     121             :      * If @param bOverSize == true, we can also get a negative return value,
     122             :      * if the SectionFrm is not completely filled, which happens often for
     123             :      * e.g. SectionFrms with Follows.
     124             :      * We need this in the FormatWidthCols to "deflate" columns there.
     125             :      */
     126             :     long Undersize( bool bOverSize = false );
     127             : 
     128             :     /// Adapt size to surroundings
     129             :     void _CheckClipping( bool bGrow, bool bMaximize );
     130             : 
     131             :     void InvalidateFtnPos();
     132             :     void CollectEndnotes( SwLayouter* pLayouter );
     133           0 :     const SwSectionFmt* GetEndSectFmt() const
     134           0 :         { if( IsEndnAtEnd() ) return _GetEndSectFmt(); return NULL; }
     135             : 
     136             :     static void MoveCntntAndDelete( SwSectionFrm* pDel, bool bSave );
     137             : 
     138             :     bool IsBalancedSection() const;
     139             : 
     140             :     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const SAL_OVERRIDE;
     141             : 
     142        4250 :     bool IsFtnAtEnd() const { return bFtnAtEnd; }
     143       14386 :     bool IsEndnAtEnd() const { return bEndnAtEnd;   }
     144        3174 :     bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
     145             :     bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
     146             : 
     147          68 :     void SetCntntLock( bool bNew ) { bCntntLock = bNew; }
     148          56 :     bool IsCntntLocked() const { return bCntntLock; }
     149             : 
     150           0 :     bool IsOwnFtnNum() const { return bOwnFtnNum; }
     151             : 
     152           0 :     void SetFtnLock( bool bNew ) { bFtnLock = bNew; }
     153          10 :     bool IsFtnLock() const { return bFtnLock; }
     154             : 
     155        2364 :     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
     156             : };
     157             : 
     158         196 : class SwDestroyList : public std::set<SwSectionFrm*> {};
     159             : 
     160         284 : inline const SwSectionFrm *SwSectionFrm::GetFollow() const
     161             : {
     162         284 :     return (const SwSectionFrm*)SwFlowFrm::GetFollow();
     163             : }
     164       14970 : inline SwSectionFrm *SwSectionFrm::GetFollow()
     165             : {
     166       14970 :     return (SwSectionFrm*)SwFlowFrm::GetFollow();
     167             : }
     168         986 : inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const
     169             : {
     170         986 :     return ((SwSectionFrm*)this)->FindLastCntnt( nMode );
     171             : }
     172             : 
     173             : #endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
     174             : 
     175             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10