LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/inc - sectfrm.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 15 25 60.0 %
Date: 2012-12-27 Functions: 13 22 59.1 %
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 _SECTFRM_HXX
      20             : #define _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( sal_Bool bRemove );
      49             :     // Is there a FtnContainer?
      50             :     // An empty sectionfrm without FtnCont is superfluous
      51           8 :     sal_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();
      58             :     virtual sal_Bool ShouldBwdMoved( SwLayoutFrm *pNewUpper, sal_Bool bHead, sal_Bool &rReformat );
      59             :     virtual void Format( const SwBorderAttrs *pAttrs = 0 );
      60             :     virtual void Modify( const SfxPoolItem*, const SfxPoolItem* );
      61             :     virtual void SwClientNotify( const SwModify&, const SfxHint& );
      62             : 
      63             : public:
      64             :     SwSectionFrm( SwSection &, SwFrm* );                 //Inhalt wird nicht erzeugt!
      65             :     SwSectionFrm( SwSectionFrm &, sal_Bool bMaster );//_Nur_ zum Erzeugen von Master/Follows
      66             :     virtual ~SwSectionFrm();
      67             : 
      68             :     void Init();
      69             :     virtual void  CheckDirection( sal_Bool bVert );
      70             : 
      71             :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
      72             : 
      73             :     virtual void Cut();
      74             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 );
      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         120 :     inline SwSection* GetSection() { return pSection; }
      83           1 :     inline const SwSection* GetSection() const { return pSection; }
      84          13 :     inline void ColLock()       { bColLocked = sal_True; }
      85          13 :     inline void ColUnlock()     { bColLocked = sal_False; }
      86             : 
      87             :     void CalcFtnCntnt();
      88             :     void SimpleFormat();
      89             :     sal_Bool IsDescendantFrom( const SwSectionFmt* pSect ) const;
      90             :     sal_Bool HasToBreak( const SwFrm* pFrm ) const;
      91             :     void MergeNext( SwSectionFrm* pNxt );
      92             :     //Zerlegt den pFrm umgebenden SectionFrm in zwei Teile,
      93             :     //pFrm an den Anfang des 2. Teils
      94             :     sal_Bool SplitSect( SwFrm* pFrm, sal_Bool bApres );
      95             :     void DelEmpty( sal_Bool bRemove );  // wie Cut(), Follow-Verkettung wird aber mitgepflegt
      96             :     sal_Bool IsToIgnore() const         // Keine Groesse, kein Inhalt, muss ignoriert werden
      97             :     { return !Frm().Height() && !ContainsCntnt(); }
      98             :     SwFtnContFrm* ContainsFtnCont( const SwFtnContFrm* pCont = NULL ) const;
      99             :     sal_Bool Growable() const;
     100             :     SwTwips _Shrink( SwTwips, sal_Bool bTst );
     101             :     SwTwips _Grow  ( SwTwips, sal_Bool bTst );
     102             : 
     103             :     // A sectionfrm has to maximize, if he has a follow or a ftncontainer at
     104             :     // the end of the page. A superfluous follow will be ignored,
     105             :     // if bCheckFollow is set.
     106             :     sal_Bool ToMaximize( sal_Bool bCheckFollow ) const;
     107           0 :     inline sal_Bool _ToMaximize() const
     108           0 :         { if( !pSection ) return sal_False; return ToMaximize( sal_False ); }
     109             :     sal_Bool MoveAllowed( const SwFrm* ) const;
     110             :     sal_Bool CalcMinDiff( SwTwips& rMinDiff ) const;
     111             :     // Uebergibt man kein bOverSize bzw. sal_False, so ist der Returnwert
     112             :     // >0 fuer Undersized-Frames, ==0 sonst.
     113             :     // Uebergibt man sal_True, so kann es auch einen negativen Returnwert geben,
     114             :     // wenn der SectionFrm nicht vollstaendig ausgefuellt ist, was z.B. bei
     115             :     // SectionFrm mit Follow meist vorkommt. Benoetigt wird dies im
     116             :     // FormatWidthCols, um "Luft" aus den Spalten zu lassen.
     117             :     long Undersize( sal_Bool bOverSize = sal_False );
     118             :     // Groesse an die Umgebung anpassen
     119             :     void _CheckClipping( sal_Bool bGrow, sal_Bool bMaximize );
     120             : 
     121             :     void InvalidateFtnPos();
     122             :     void CollectEndnotes( SwLayouter* pLayouter );
     123           0 :     const SwSectionFmt* GetEndSectFmt() const
     124           0 :         { if( IsEndnAtEnd() ) return _GetEndSectFmt(); return NULL; }
     125             : 
     126             :     static void MoveCntntAndDelete( SwSectionFrm* pDel, sal_Bool bSave );
     127             : 
     128             :     bool IsBalancedSection() const;
     129             : 
     130             :     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer);
     131             : 
     132          24 :     bool IsFtnAtEnd() const { return bFtnAtEnd; }
     133          24 :     bool IsEndnAtEnd() const { return bEndnAtEnd;   }
     134          18 :     bool IsAnyNoteAtEnd() const { return bFtnAtEnd || bEndnAtEnd; }
     135             :     bool AreNotesAtEnd() const { return bFtnAtEnd && bEndnAtEnd; }
     136             : 
     137           2 :     void SetCntntLock( bool bNew ) { bCntntLock = bNew; }
     138           2 :     bool IsCntntLocked() const { return bCntntLock; }
     139             : 
     140           0 :     bool IsOwnFtnNum() const { return bOwnFtnNum; }
     141             : 
     142           0 :     void SetFtnLock( bool bNew ) { bFtnLock = bNew; }
     143           0 :     bool IsFtnLock() const { return bFtnLock; }
     144             : 
     145          10 :     DECL_FIXEDMEMPOOL_NEWDEL(SwSectionFrm)
     146             : };
     147             : 
     148           0 : class SwDestroyList : public std::set<SwSectionFrm*> {};
     149             : 
     150           0 : inline const SwSectionFrm *SwSectionFrm::GetFollow() const
     151             : {
     152           0 :     return (const SwSectionFrm*)SwFlowFrm::GetFollow();
     153             : }
     154          18 : inline SwSectionFrm *SwSectionFrm::GetFollow()
     155             : {
     156          18 :     return (SwSectionFrm*)SwFlowFrm::GetFollow();
     157             : }
     158           1 : inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const
     159             : {
     160           1 :     return ((SwSectionFrm*)this)->FindLastCntnt( nMode );
     161             : }
     162             : 
     163             : 
     164             : #endif  //_SECTFRM_HXX
     165             : 
     166             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10