LCOV - code coverage report
Current view: top level - sw/source/core/inc - layfrm.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 20 20 100.0 %
Date: 2014-11-03 Functions: 10 10 100.0 %
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_LAYFRM_HXX
      20             : #define INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
      21             : 
      22             : #include "frame.hxx"
      23             : 
      24             : class SwAnchoredObject;
      25             : class SwCntntFrm;
      26             : class SwFlowFrm;
      27             : class SwFmtCol;
      28             : struct SwCrsrMoveState;
      29             : class SwFrmFmt;
      30             : class SwBorderAttrs;
      31             : class SwFmtFrmSize;
      32             : class SwCellFrm;
      33             : 
      34             : class SwLayoutFrm: public SwFrm
      35             : {
      36             :     // The SwFrm in disguise
      37             :     friend class SwFlowFrm;
      38             :     friend class SwFrm;
      39             : 
      40             :     // Releases the Lower while restructuring columns
      41             :     friend SwFrm* SaveCntnt( SwLayoutFrm *, SwFrm * );
      42             :     friend void   RestoreCntnt( SwFrm *, SwLayoutFrm *, SwFrm *pSibling, bool bGrow );
      43             : 
      44             : #ifdef DBG_UTIL
      45             :     //removes empty SwSectionFrms from a chain
      46             :     friend SwFrm* SwClearDummies( SwFrm* pFrm );
      47             : #endif
      48             : 
      49             :     void CopySubtree( const SwLayoutFrm *pDest );
      50             : protected:
      51             :     void Destroy(); // for ~SwRootFrm
      52             : 
      53             :     virtual void Format( const SwBorderAttrs *pAttrs = 0 ) SAL_OVERRIDE;
      54             :     virtual void MakeAll() SAL_OVERRIDE;
      55             : 
      56             :     SwFrm           *pLower;
      57             :     std::vector<SwAnchoredObject*> aVertPosOrientFrmsFor;
      58             : 
      59             :     virtual SwTwips ShrinkFrm( SwTwips, bool bTst = false, bool bInfo = false ) SAL_OVERRIDE;
      60             :     virtual SwTwips GrowFrm  ( SwTwips, bool bTst = false, bool bInfo = false ) SAL_OVERRIDE;
      61             : 
      62             :     long CalcRel( const SwFmtFrmSize &rSz, bool bWidth ) const;
      63             : 
      64             : public:
      65             :     // --> #i28701#
      66             :     TYPEINFO_OVERRIDE();
      67             : 
      68             :     virtual void PaintSubsidiaryLines( const SwPageFrm*, const SwRect& ) const;
      69             :     void RefreshLaySubsidiary( const SwPageFrm*, const SwRect& ) const;
      70             :     void RefreshExtraData( const SwRect & ) const;
      71             : 
      72             :     /// Change size of lowers proportionally
      73             :     void ChgLowersProp( const Size& rOldSize );
      74             : 
      75             :     void AdjustColumns( const SwFmtCol *pCol, bool bAdjustAttributes );
      76             : 
      77             :     void ChgColumns( const SwFmtCol &rOld, const SwFmtCol &rNew,
      78             :         const bool bChgFtn = false );
      79             : 
      80             :     /// Paints the column separation line for the inner columns
      81             :     void PaintColLines( const SwRect &, const SwFmtCol &,
      82             :                         const SwPageFrm * ) const;
      83             : 
      84             :     virtual bool    FillSelection( SwSelectionList& rList, const SwRect& rRect ) const SAL_OVERRIDE;
      85             : 
      86             :     virtual bool GetCrsrOfst( SwPosition *, Point&,
      87             :                                SwCrsrMoveState* = 0, bool bTestBackground = false ) const SAL_OVERRIDE;
      88             : 
      89             :     virtual void Cut() SAL_OVERRIDE;
      90             :     virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) SAL_OVERRIDE;
      91             : 
      92             :     /**
      93             :      * Finds the closest Cntnt for the SPoint
      94             :      * Is used for Pages, Flys and Cells if GetCrsrOfst failed
      95             :      */
      96             :     const SwCntntFrm* GetCntntPos( Point &rPoint, const bool bDontLeave,
      97             :                                    const bool bBodyOnly = false,
      98             :                                    const bool bCalc = false,
      99             :                                    const SwCrsrMoveState *pCMS = 0,
     100             :                                    const bool bDefaultExpand = true ) const;
     101             : 
     102             :     SwLayoutFrm( SwFrmFmt*, SwFrm* );
     103             :     virtual ~SwLayoutFrm();
     104             : 
     105             :     virtual void Paint( SwRect const&,
     106             :                         SwPrintData const*const pPrintData = NULL ) const SAL_OVERRIDE;
     107     6538732 :     const SwFrm *Lower() const { return pLower; }
     108     4229641 :           SwFrm *Lower()       { return pLower; }
     109             :     const SwCntntFrm *ContainsCntnt() const;
     110             :     inline SwCntntFrm *ContainsCntnt();
     111             :     const SwCellFrm *FirstCell() const;
     112             :     inline SwCellFrm *FirstCell();
     113             : 
     114             :     /**
     115             :      * Method <ContainsAny()> doesn't investigate content of footnotes by default.
     116             :      * But under certain circumstances this investigation is intended.
     117             :      * Thus, introduce new optional parameter <_bInvestigateFtnForSections>.
     118             :      * It's default is <false>, still indicating that content of footnotes isn't
     119             :      * investigated for sections.
     120             :      */
     121             :     const SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false ) const;
     122             :     inline SwFrm *ContainsAny( const bool _bInvestigateFtnForSections = false );
     123             :     bool IsAnLower( const SwFrm * ) const;
     124             : 
     125             :     virtual const SwFrmFmt *GetFmt() const;
     126             :     virtual       SwFrmFmt *GetFmt();
     127             :     void        SetFrmFmt( SwFrmFmt* );
     128             : 
     129             :     /**
     130             :      * Moving the Ftns of all Lowers - starting from StartCntnt
     131             :      *
     132             :      * @returns true if at least one Ftn was moved
     133             :      * Calls the page number update if bFtnNums is set
     134             :      */
     135             :     bool MoveLowerFtns( SwCntntFrm *pStart, SwFtnBossFrm *pOldBoss,
     136             :                         SwFtnBossFrm *pNewBoss, const bool bFtnNums );
     137             : 
     138             :     // --> #i28701# - change purpose of method and its name
     139             :     // --> #i44016# - add parameter <_bUnlockPosOfObjs> to
     140             :     /// force an unlockposition call for the lower objects.
     141             :     void NotifyLowerObjs( const bool _bUnlockPosOfObjs = false );
     142             : 
     143             :     /**
     144             :      * Invalidates the inner Frames, whose width and/or height are
     145             :      * calculated using percentages.
     146             :      * Frames that are anchored to this or inner Frames, are also invalidated.
     147             :      */
     148             :     void InvaPercentLowers( SwTwips nDiff = 0 );
     149             : 
     150             :     /// Called by Format for Frames and Areas with columns
     151             :     void FormatWidthCols( const SwBorderAttrs &, const SwTwips nBorder,
     152             :                           const SwTwips nMinHeight );
     153             : 
     154             :     /**
     155             :      * InnerHeight returns the height of the content and may be bigger or
     156             :      * less than the PrtArea-Height of the layoutframe himself
     157             :      */
     158             :     SwTwips InnerHeight() const;
     159             : 
     160             :     /** method to check relative position of layout frame to
     161             :         a given layout frame.
     162             : 
     163             :         refactoring of pseudo-local method <lcl_Apres(..)> in
     164             :         <txtftn.cxx> for #104840#.
     165             : 
     166             :         @param _aCheckRefLayFrm
     167             :         constant reference of an instance of class <SwLayoutFrm> which
     168             :         is used as the reference for the relative position check.
     169             : 
     170             :         @return true, if <this> is positioned before the layout frame <p>
     171             :     */
     172             :     bool IsBefore( const SwLayoutFrm* _pCheckRefLayFrm ) const;
     173             : 
     174             :     const SwFrm* GetLastLower() const;
     175             :     inline SwFrm* GetLastLower();
     176             : 
     177             :     virtual void PaintBreak() const;
     178             : 
     179        8248 :     void SetVertPosOrientFrmFor(SwAnchoredObject *pObj)
     180             :     {
     181        8248 :         aVertPosOrientFrmsFor.push_back(pObj);
     182        8248 :     }
     183             : 
     184        8248 :     void ClearVertPosOrientFrmFor(SwAnchoredObject *pObj)
     185             :     {
     186             :         aVertPosOrientFrmsFor.erase(
     187             :             std::remove(aVertPosOrientFrmsFor.begin(),
     188        8248 :                 aVertPosOrientFrmsFor.end(), pObj), aVertPosOrientFrmsFor.end());
     189        8248 :     }
     190             : };
     191             : 
     192             : /**
     193             :  * In order to save us from duplicating implementations, we cast here
     194             :  * a little.
     195             :  */
     196      275033 : inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
     197             : {
     198      275033 :     return (SwCntntFrm*)(((const SwLayoutFrm*)this)->ContainsCntnt());
     199             : }
     200             : 
     201          56 : inline SwCellFrm* SwLayoutFrm::FirstCell()
     202             : {
     203          56 :     return (SwCellFrm*)(((const SwLayoutFrm*)this)->FirstCell());
     204             : }
     205             : 
     206       11800 : inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections )
     207             : {
     208       11800 :     return (SwFrm*)(((const SwLayoutFrm*)this)->ContainsAny( _bInvestigateFtnForSections ));
     209             : }
     210             : 
     211             : /**
     212             :  * These SwFrm inlines are here, so that frame.hxx does not need to include layfrm.hxx
     213             :  */
     214      129384 : inline bool SwFrm::IsColBodyFrm() const
     215             : {
     216      129384 :     return mnType == FRMC_BODY && GetUpper()->IsColumnFrm();
     217             : }
     218             : 
     219      252583 : inline bool SwFrm::IsPageBodyFrm() const
     220             : {
     221      252583 :     return mnType == FRMC_BODY && GetUpper()->IsPageFrm();
     222             : }
     223             : 
     224        8522 : inline SwFrm* SwLayoutFrm::GetLastLower()
     225             : {
     226        8522 :     return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->GetLastLower());
     227             : }
     228             : 
     229             : #endif // INCLUDED_SW_SOURCE_CORE_INC_LAYFRM_HXX
     230             : 
     231             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10