LCOV - code coverage report
Current view: top level - sw/source/core/inc - ftnboss.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 12 100.0 %
Date: 2015-06-13 12:38:46 Functions: 7 8 87.5 %
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             : 
      20             : #ifndef INCLUDED_SW_SOURCE_CORE_INC_FTNBOSS_HXX
      21             : #define INCLUDED_SW_SOURCE_CORE_INC_FTNBOSS_HXX
      22             : 
      23             : #include "layfrm.hxx"
      24             : 
      25             : class SwFootnoteBossFrm;
      26             : class SwFootnoteContFrm;
      27             : class SwFootnoteFrm;
      28             : class SwTextFootnote;
      29             : 
      30             : // Set max. footnote area.
      31             : // Restoration of the old value in DTor. Implementation in ftnfrm.cxx
      32             : class SwSaveFootnoteHeight
      33             : {
      34             :     SwFootnoteBossFrm *pBoss;
      35             :     const SwTwips nOldHeight;
      36             :     SwTwips nNewHeight;
      37             : public:
      38             :     SwSaveFootnoteHeight( SwFootnoteBossFrm *pBs, const SwTwips nDeadLine );
      39             :     ~SwSaveFootnoteHeight();
      40             : };
      41             : 
      42             : #define NA_ONLY_ADJUST 0
      43             : #define NA_GROW_SHRINK 1
      44             : #define NA_GROW_ADJUST 2
      45             : #define NA_ADJUST_GROW 3
      46             : 
      47             : typedef std::vector<SwFootnoteFrm*> SwFootnoteFrms;
      48             : 
      49        5152 : class SwFootnoteBossFrm: public SwLayoutFrm
      50             : {
      51             :     // for private footnote operations
      52             :     friend class SwFrm;
      53             :     friend class SwSaveFootnoteHeight;
      54             :     friend class SwPageFrm; // for setting of MaxFootnoteHeight
      55             : 
      56             :     // max. height of the footnote container on this page
      57             :     SwTwips nMaxFootnoteHeight;
      58             : 
      59             :     SwFootnoteContFrm *MakeFootnoteCont();
      60             :     SwFootnoteFrm     *FindFirstFootnote();
      61             :     sal_uInt8 _NeighbourhoodAdjustment( const SwFrm* pFrm ) const;
      62             : 
      63             : protected:
      64             :     void          InsertFootnote( SwFootnoteFrm * );
      65             :     static void   ResetFootnote( const SwFootnoteFrm *pAssumed );
      66             : 
      67             : public:
      68        5475 :     inline SwFootnoteBossFrm( SwFrameFormat* pFormat, SwFrm* pSib )
      69             :         : SwLayoutFrm( pFormat, pSib )
      70        5475 :         , nMaxFootnoteHeight(0)
      71        5475 :         {}
      72             : 
      73             :                  SwLayoutFrm *FindBodyCont();
      74             :     inline const SwLayoutFrm *FindBodyCont() const;
      75        6233 :     inline void SetMaxFootnoteHeight( const SwTwips nNewMax ) { nMaxFootnoteHeight = nNewMax; }
      76             : 
      77             :     // footnote interface
      78             :     void AppendFootnote( SwContentFrm *, SwTextFootnote * );
      79             :     void RemoveFootnote( const SwContentFrm *, const SwTextFootnote *, bool bPrep = true );
      80             :     static       SwFootnoteFrm     *FindFootnote( const SwContentFrm *, const SwTextFootnote * );
      81             :                  SwFootnoteContFrm *FindFootnoteCont();
      82             :     inline const SwFootnoteContFrm *FindFootnoteCont() const;
      83             :            const SwFootnoteFrm     *FindFirstFootnote( SwContentFrm* ) const;
      84             :                  SwFootnoteContFrm *FindNearestFootnoteCont( bool bDontLeave = false );
      85             : 
      86             :     static void ChangeFootnoteRef( const SwContentFrm *pOld, const SwTextFootnote *,
      87             :                        SwContentFrm *pNew );
      88             :     void RearrangeFootnotes( const SwTwips nDeadLine, const bool bLock = false,
      89             :                         const SwTextFootnote *pAttr = 0 );
      90             : 
      91             :     // Set DeadLine (in document coordinates) so that the text formatter can
      92             :     // temporarily limit footnote height.
      93             :     void    SetFootnoteDeadLine( const SwTwips nDeadLine );
      94       11906 :     SwTwips GetMaxFootnoteHeight() const { return nMaxFootnoteHeight; }
      95             : 
      96             :     // returns value for remaining space until the body reaches minimal height
      97             :     SwTwips GetVarSpace() const;
      98             : 
      99             :     // methods needed for layouting
     100             :     // The parameters <_bCollectOnlyPreviousFootnotes> and <_pRefFootnoteBossFrm> control
     101             :     // if only footnotes that are positioned before the given reference
     102             :     // footnote boss-frame have to be collected.
     103             :     // Note: if parameter <_bCollectOnlyPreviousFootnotes> is true, then parameter
     104             :     // <_pRefFootnoteBossFrm> has to be referenced by an object.
     105             :     static void _CollectFootnotes( const SwContentFrm*   _pRef,
     106             :                               SwFootnoteFrm*           _pFootnote,
     107             :                               SwFootnoteFrms&          _rFootnoteArr,
     108             :                               const bool      _bCollectOnlyPreviousFootnotes = false,
     109             :                               const SwFootnoteBossFrm* _pRefFootnoteBossFrm = NULL);
     110             :     // The parameter <_bCollectOnlyPreviousFootnotes> controls if only footnotes
     111             :     // that are positioned before the footnote boss-frame <this> have to be
     112             :     // collected.
     113             :     void    CollectFootnotes( const SwContentFrm* _pRef,
     114             :                          SwFootnoteBossFrm*     _pOld,
     115             :                          SwFootnoteFrms&        _rFootnoteArr,
     116             :                          const bool    _bCollectOnlyPreviousFootnotes = false );
     117             :     void    _MoveFootnotes( SwFootnoteFrms &rFootnoteArr, bool bCalc = false );
     118             :     void    MoveFootnotes( const SwContentFrm *pSrc, SwContentFrm *pDest,
     119             :                       SwTextFootnote *pAttr );
     120             : 
     121             :     // should AdjustNeighbourhood be called (or Grow/Shrink)?
     122       14805 :     sal_uInt8 NeighbourhoodAdjustment( const SwFrm* pFrm ) const
     123       14805 :         { return IsPageFrm() ? NA_ONLY_ADJUST : _NeighbourhoodAdjustment( pFrm ); }
     124             : };
     125             : 
     126       28028 : inline const SwLayoutFrm *SwFootnoteBossFrm::FindBodyCont() const
     127             : {
     128       28028 :     return const_cast<SwFootnoteBossFrm*>(this)->FindBodyCont();
     129             : }
     130             : 
     131          96 : inline const SwFootnoteContFrm *SwFootnoteBossFrm::FindFootnoteCont() const
     132             : {
     133          96 :     return const_cast<SwFootnoteBossFrm*>(this)->FindFootnoteCont();
     134             : }
     135             : 
     136             : #endif
     137             : 
     138             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11