LCOV - code coverage report
Current view: top level - sw/source/core/layout - layouter.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 98 225 43.6 %
Date: 2012-08-25 Functions: 15 34 44.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 63 244 25.8 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "layouter.hxx"
      31                 :            : #include "doc.hxx"
      32                 :            : #include "sectfrm.hxx"
      33                 :            : #include "ftnboss.hxx"
      34                 :            : #include "cntfrm.hxx"
      35                 :            : #include "pagefrm.hxx"
      36                 :            : #include "ftnfrm.hxx"
      37                 :            : #include "txtfrm.hxx"
      38                 :            : 
      39                 :            : // #i28701#
      40                 :            : #include <movedfwdfrmsbyobjpos.hxx>
      41                 :            : // #i35911#
      42                 :            : #include <objstmpconsiderwrapinfl.hxx>
      43                 :            : 
      44                 :            : #define LOOP_DETECT 250
      45                 :            : 
      46                 :            : class SwLooping
      47                 :            : {
      48                 :            :     sal_uInt16 nMinPage;
      49                 :            :     sal_uInt16 nMaxPage;
      50                 :            :     sal_uInt16 nCount;
      51                 :            :     sal_uInt16 mnLoopControlStage;
      52                 :            : public:
      53                 :            :     SwLooping( SwPageFrm* pPage );
      54                 :            :     void Control( SwPageFrm* pPage );
      55                 :            :     void Drastic( SwFrm* pFrm );
      56                 :          0 :     bool IsLoopingLouieLight() const { return nCount > LOOP_DETECT - 30; };
      57                 :            : };
      58                 :            : 
      59                 :            : class SwEndnoter
      60                 :            : {
      61                 :            :     SwLayouter* pMaster;
      62                 :            :     SwSectionFrm* pSect;
      63                 :            :     SwFtnFrms*    pEndArr;
      64                 :            : public:
      65                 :          0 :     SwEndnoter( SwLayouter* pLay )
      66                 :          0 :         : pMaster( pLay ), pSect( NULL ), pEndArr( NULL ) {}
      67         [ #  # ]:          0 :     ~SwEndnoter() { delete pEndArr; }
      68                 :            :     void CollectEndnotes( SwSectionFrm* pSct );
      69                 :            :     void CollectEndnote( SwFtnFrm* pFtn );
      70                 :          0 :     const SwSectionFrm* GetSect() const { return pSect; }
      71                 :            :     void InsertEndnotes();
      72 [ #  # ][ #  # ]:          0 :     sal_Bool HasEndnotes() const { return pEndArr && !pEndArr->empty(); }
      73                 :            : };
      74                 :            : 
      75                 :          0 : void SwEndnoter::CollectEndnotes( SwSectionFrm* pSct )
      76                 :            : {
      77                 :            :     OSL_ENSURE( pSct, "CollectEndnotes: Which section?" );
      78         [ #  # ]:          0 :     if( !pSect )
      79                 :          0 :         pSect = pSct;
      80         [ #  # ]:          0 :     else if( pSct != pSect )
      81                 :          0 :         return;
      82                 :          0 :     pSect->CollectEndnotes( pMaster );
      83                 :            : }
      84                 :            : 
      85                 :          0 : void SwEndnoter::CollectEndnote( SwFtnFrm* pFtn )
      86                 :            : {
      87 [ #  # ][ #  # ]:          0 :     if( pEndArr && pEndArr->end() != std::find( pEndArr->begin(), pEndArr->end(), pFtn ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
      88                 :          0 :         return;
      89                 :            : 
      90         [ #  # ]:          0 :     if( pFtn->GetUpper() )
      91                 :            :     {
      92                 :            :         // pFtn is the master, he incorporates its follows
      93                 :          0 :         SwFtnFrm *pNxt = pFtn->GetFollow();
      94         [ #  # ]:          0 :         while ( pNxt )
      95                 :            :         {
      96                 :          0 :             SwFrm *pCnt = pNxt->ContainsAny();
      97         [ #  # ]:          0 :             if ( pCnt )
      98                 :            :             {
      99         [ #  # ]:          0 :                 do
     100                 :          0 :                 {   SwFrm *pNxtCnt = pCnt->GetNext();
     101                 :          0 :                     pCnt->Cut();
     102                 :          0 :                     pCnt->Paste( pFtn );
     103                 :          0 :                     pCnt = pNxtCnt;
     104                 :            :                 } while ( pCnt );
     105                 :            :             }
     106                 :            :             else
     107                 :            :             { OSL_ENSURE( pNxt->Lower() && pNxt->Lower()->IsSctFrm(),
     108                 :            :                         "Endnote without content?" );
     109                 :          0 :                 pNxt->Cut();
     110         [ #  # ]:          0 :                 delete pNxt;
     111                 :            :             }
     112                 :          0 :             pNxt = pFtn->GetFollow();
     113                 :            :         }
     114         [ #  # ]:          0 :         if( pFtn->GetMaster() )
     115                 :          0 :             return;
     116                 :          0 :         pFtn->Cut();
     117                 :            :     }
     118         [ #  # ]:          0 :     else if( pEndArr )
     119                 :            :     {
     120         [ #  # ]:          0 :         for ( sal_uInt16 i = 0; i < pEndArr->size(); ++i )
     121                 :            :         {
     122                 :          0 :             SwFtnFrm *pEndFtn = (*pEndArr)[i];
     123         [ #  # ]:          0 :             if( pEndFtn->GetAttr() == pFtn->GetAttr() )
     124                 :            :             {
     125         [ #  # ]:          0 :                 delete pFtn;
     126                 :          0 :                 return;
     127                 :            :             }
     128                 :            :         }
     129                 :            :     }
     130         [ #  # ]:          0 :     if( !pEndArr )
     131         [ #  # ]:          0 :         pEndArr = new SwFtnFrms;  // deleted from the SwLayouter
     132                 :          0 :     pEndArr->push_back( pFtn );
     133                 :            : }
     134                 :            : 
     135                 :          0 : void SwEndnoter::InsertEndnotes()
     136                 :            : {
     137         [ #  # ]:          0 :     if( !pSect )
     138                 :          0 :         return;
     139 [ #  # ][ #  # ]:          0 :     if( !pEndArr || pEndArr->empty() )
                 [ #  # ]
     140                 :            :     {
     141                 :          0 :         pSect = NULL;
     142                 :          0 :         return;
     143                 :            :     }
     144                 :            :     OSL_ENSURE( pSect->Lower() && pSect->Lower()->IsFtnBossFrm(),
     145                 :            :             "InsertEndnotes: Where's my column?" );
     146                 :          0 :     SwFrm* pRef = pSect->FindLastCntnt( FINDMODE_MYLAST );
     147                 :            :     SwFtnBossFrm *pBoss = pRef ? pRef->FindFtnBossFrm()
     148         [ #  # ]:          0 :                                : (SwFtnBossFrm*)pSect->Lower();
     149                 :          0 :     pBoss->_MoveFtns( *pEndArr );
     150         [ #  # ]:          0 :     delete pEndArr;
     151                 :          0 :     pEndArr = NULL;
     152                 :          0 :     pSect = NULL;
     153                 :            : }
     154                 :            : 
     155                 :       7224 : SwLooping::SwLooping( SwPageFrm* pPage )
     156                 :            : {
     157                 :            :     OSL_ENSURE( pPage, "Where's my page?" );
     158                 :       7224 :     nMinPage = pPage->GetPhyPageNum();
     159                 :       7224 :     nMaxPage = nMinPage;
     160                 :       7224 :     nCount = 0;
     161                 :       7224 :     mnLoopControlStage = 0;
     162                 :       7224 : }
     163                 :            : 
     164                 :          0 : void SwLooping::Drastic( SwFrm* pFrm )
     165                 :            : {
     166         [ #  # ]:          0 :     while( pFrm )
     167                 :            :     {
     168                 :          0 :         pFrm->ValidateThisAndAllLowers( mnLoopControlStage );
     169                 :          0 :         pFrm = pFrm->GetNext();
     170                 :            :     }
     171                 :          0 : }
     172                 :            : 
     173                 :       9061 : void SwLooping::Control( SwPageFrm* pPage )
     174                 :            : {
     175         [ +  + ]:       9061 :     if( !pPage )
     176                 :       9061 :         return;
     177                 :       5906 :     sal_uInt16 nNew = pPage->GetPhyPageNum();
     178         [ +  + ]:       5906 :     if( nNew > nMaxPage )
     179                 :        716 :         nMaxPage = nNew;
     180         [ +  + ]:       5906 :     if( nNew < nMinPage )
     181                 :            :     {
     182                 :          8 :         nMinPage = nNew;
     183                 :          8 :         nMaxPage = nNew;
     184                 :          8 :         nCount = 0;
     185                 :          8 :         mnLoopControlStage = 0;
     186                 :            :     }
     187         [ +  + ]:       5898 :     else if( nNew > nMinPage + 2 )
     188                 :            :     {
     189                 :         20 :         nMinPage = nNew - 2;
     190                 :         20 :         nMaxPage = nNew;
     191                 :         20 :         nCount = 0;
     192                 :         20 :         mnLoopControlStage = 0;
     193                 :            :     }
     194         [ -  + ]:       5878 :     else if( ++nCount > LOOP_DETECT )
     195                 :            :     {
     196                 :            : #if OSL_DEBUG_LEVEL > 1
     197                 :            :         static sal_Bool bNoLouie = sal_False;
     198                 :            :         if( bNoLouie )
     199                 :            :             return;
     200                 :            : 
     201                 :            :         // FME 2007-08-30 #i81146# new loop control
     202                 :            :         OSL_ENSURE( 0 != mnLoopControlStage, "Looping Louie: Stage 1!" );
     203                 :            :         OSL_ENSURE( 1 != mnLoopControlStage, "Looping Louie: Stage 2!!" );
     204                 :            :         OSL_ENSURE( 2 >  mnLoopControlStage, "Looping Louie: Stage 3!!!" );
     205                 :            : #endif
     206                 :            : 
     207                 :          0 :         Drastic( pPage->Lower() );
     208 [ #  # ][ #  # ]:          0 :         if( nNew > nMinPage && pPage->GetPrev() )
                 [ #  # ]
     209                 :          0 :             Drastic( ((SwPageFrm*)pPage->GetPrev())->Lower() );
     210 [ #  # ][ #  # ]:          0 :         if( nNew < nMaxPage && pPage->GetNext() )
                 [ #  # ]
     211                 :          0 :             Drastic( ((SwPageFrm*)pPage->GetNext())->Lower() );
     212                 :            : 
     213                 :          0 :         ++mnLoopControlStage;
     214                 :          0 :         nCount = 0;
     215                 :            :     }
     216                 :            : }
     217                 :            : 
     218                 :            : /*************************************************************************
     219                 :            : |*
     220                 :            : |*  SwLayouter::SwLayouter()
     221                 :            : |*
     222                 :            : |*************************************************************************/
     223                 :            : 
     224                 :       1318 : SwLayouter::SwLayouter()
     225                 :            :         : pEndnoter( NULL ),
     226                 :            :           pLooping( NULL ),
     227                 :            :           // #i28701#
     228                 :            :           mpMovedFwdFrms( 0L ),
     229                 :            :           // #i35911#
     230         [ +  - ]:       1318 :           mpObjsTmpConsiderWrapInfl( 0L )
     231                 :            : {
     232                 :       1318 : }
     233                 :            : 
     234                 :       1229 : SwLayouter::~SwLayouter()
     235                 :            : {
     236         [ -  + ]:       1229 :     delete pEndnoter;
     237                 :       1229 :     delete pLooping;
     238                 :            :     // #i28701#
     239 [ #  # ][ -  + ]:       1229 :     delete mpMovedFwdFrms;
     240                 :       1229 :     mpMovedFwdFrms = 0L;
     241                 :            :     // #i35911#
     242 [ +  + ][ +  - ]:       1229 :     delete mpObjsTmpConsiderWrapInfl;
     243                 :       1229 :     mpObjsTmpConsiderWrapInfl = 0L;
     244                 :       1229 : }
     245                 :            : 
     246                 :          0 : void SwLayouter::_CollectEndnotes( SwSectionFrm* pSect )
     247                 :            : {
     248         [ #  # ]:          0 :     if( !pEndnoter )
     249                 :          0 :         pEndnoter = new SwEndnoter( this );
     250                 :          0 :     pEndnoter->CollectEndnotes( pSect );
     251                 :          0 : }
     252                 :            : 
     253                 :          0 : sal_Bool SwLayouter::HasEndnotes() const
     254                 :            : {
     255                 :          0 :     return pEndnoter->HasEndnotes();
     256                 :            : }
     257                 :            : 
     258                 :          0 : void SwLayouter::CollectEndnote( SwFtnFrm* pFtn )
     259                 :            : {
     260                 :          0 :     pEndnoter->CollectEndnote( pFtn );
     261                 :          0 : }
     262                 :            : 
     263                 :          0 : void SwLayouter::InsertEndnotes( SwSectionFrm* pSect )
     264                 :            : {
     265 [ #  # ][ #  # ]:          0 :     if( !pEndnoter || pEndnoter->GetSect() != pSect )
                 [ #  # ]
     266                 :          0 :         return;
     267                 :          0 :     pEndnoter->InsertEndnotes();
     268                 :            : }
     269                 :            : 
     270                 :       9061 : void SwLayouter::LoopControl( SwPageFrm* pPage, sal_uInt8 )
     271                 :            : {
     272                 :            :     OSL_ENSURE( pLooping, "Looping: Lost control" );
     273                 :       9061 :     pLooping->Control( pPage );
     274                 :       9061 : }
     275                 :            : 
     276                 :          0 : void SwLayouter::LoopingLouieLight( const SwDoc& rDoc, const SwTxtFrm& rFrm )
     277                 :            : {
     278 [ #  # ][ #  # ]:          0 :     if ( pLooping && pLooping->IsLoopingLouieLight() )
                 [ #  # ]
     279                 :            :     {
     280                 :            : #if OSL_DEBUG_LEVEL > 1
     281                 :            :         OSL_FAIL( "Looping Louie (Light): Fixating fractious frame" );
     282                 :            : #endif
     283                 :          0 :         SwLayouter::InsertMovedFwdFrm( rDoc, rFrm, rFrm.FindPageFrm()->GetPhyPageNum() );
     284                 :            :     }
     285                 :          0 : }
     286                 :            : 
     287                 :       7224 : sal_Bool SwLayouter::StartLooping( SwPageFrm* pPage )
     288                 :            : {
     289         [ -  + ]:       7224 :     if( pLooping )
     290                 :          0 :         return sal_False;
     291                 :       7224 :     pLooping = new SwLooping( pPage );
     292                 :       7224 :     return sal_True;
     293                 :            : }
     294                 :            : 
     295                 :       7224 : void SwLayouter::EndLoopControl()
     296                 :            : {
     297                 :       7224 :     delete pLooping;
     298                 :       7224 :     pLooping = NULL;
     299                 :       7224 : }
     300                 :            : 
     301                 :          0 : void SwLayouter::CollectEndnotes( SwDoc* pDoc, SwSectionFrm* pSect )
     302                 :            : {
     303                 :            :     OSL_ENSURE( pDoc, "No doc, no fun" );
     304         [ #  # ]:          0 :     if( !pDoc->GetLayouter() )
     305         [ #  # ]:          0 :         pDoc->SetLayouter( new SwLayouter() );
     306                 :          0 :     pDoc->GetLayouter()->_CollectEndnotes( pSect );
     307                 :          0 : }
     308                 :            : 
     309                 :          0 : sal_Bool SwLayouter::Collecting( SwDoc* pDoc, SwSectionFrm* pSect, SwFtnFrm* pFtn )
     310                 :            : {
     311         [ #  # ]:          0 :     if( !pDoc->GetLayouter() )
     312                 :          0 :         return sal_False;
     313                 :          0 :     SwLayouter *pLayouter = pDoc->GetLayouter();
     314 [ #  # ][ #  #  :          0 :     if( pLayouter->pEndnoter && pLayouter->pEndnoter->GetSect() && pSect &&
             #  #  #  # ]
         [ #  # ][ #  # ]
     315         [ #  # ]:          0 :         ( pLayouter->pEndnoter->GetSect()->IsAnFollow( pSect ) ||
     316         [ #  # ]:          0 :           pSect->IsAnFollow( pLayouter->pEndnoter->GetSect() ) ) )
     317                 :            :     {
     318         [ #  # ]:          0 :         if( pFtn )
     319                 :          0 :             pLayouter->CollectEndnote( pFtn );
     320                 :          0 :         return sal_True;
     321                 :            :     }
     322                 :          0 :     return sal_False;
     323                 :            : }
     324                 :            : 
     325                 :       7224 : sal_Bool SwLayouter::StartLoopControl( SwDoc* pDoc, SwPageFrm *pPage )
     326                 :            : {
     327                 :            :     OSL_ENSURE( pDoc, "No doc, no fun" );
     328         [ +  + ]:       7224 :     if( !pDoc->GetLayouter() )
     329         [ +  - ]:       1318 :         pDoc->SetLayouter( new SwLayouter() );
     330                 :       7224 :     return !pDoc->GetLayouter()->pLooping &&
     331 [ +  - ][ +  - ]:       7224 :             pDoc->GetLayouter()->StartLooping( pPage );
     332                 :            : }
     333                 :            : 
     334                 :            : // #i28701#
     335                 :            : // -----------------------------------------------------------------------------
     336                 :            : // methods to manage text frames, which are moved forward by the positioning
     337                 :            : // of its anchored objects
     338                 :            : // -----------------------------------------------------------------------------
     339                 :     252639 : void SwLayouter::ClearMovedFwdFrms( const SwDoc& _rDoc )
     340                 :            : {
     341   [ +  +  -  + ]:     288241 :     if ( _rDoc.GetLayouter() &&
                 [ -  + ]
     342                 :      35602 :          _rDoc.GetLayouter()->mpMovedFwdFrms )
     343                 :            :     {
     344                 :          0 :         _rDoc.GetLayouter()->mpMovedFwdFrms->Clear();
     345                 :            :     }
     346                 :     252639 : }
     347                 :            : 
     348                 :          0 : void SwLayouter::InsertMovedFwdFrm( const SwDoc& _rDoc,
     349                 :            :                                     const SwTxtFrm& _rMovedFwdFrmByObjPos,
     350                 :            :                                     const sal_uInt32 _nToPageNum )
     351                 :            : {
     352         [ #  # ]:          0 :     if ( !_rDoc.GetLayouter() )
     353                 :            :     {
     354         [ #  # ]:          0 :         const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() );
     355                 :            :     }
     356                 :            : 
     357         [ #  # ]:          0 :     if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
     358                 :            :     {
     359                 :          0 :         const_cast<SwDoc&>(_rDoc).GetLayouter()->mpMovedFwdFrms =
     360         [ #  # ]:          0 :                                                 new SwMovedFwdFrmsByObjPos();
     361                 :            :     }
     362                 :            : 
     363                 :          0 :     _rDoc.GetLayouter()->mpMovedFwdFrms->Insert( _rMovedFwdFrmByObjPos,
     364                 :          0 :                                                  _nToPageNum );
     365                 :          0 : }
     366                 :            : 
     367                 :            : // #i40155#
     368                 :          0 : void SwLayouter::RemoveMovedFwdFrm( const SwDoc& _rDoc,
     369                 :            :                                     const SwTxtFrm& _rTxtFrm )
     370                 :            : {
     371                 :            :     sal_uInt32 nDummy;
     372 [ #  # ][ #  # ]:          0 :     if ( SwLayouter::FrmMovedFwdByObjPos( _rDoc, _rTxtFrm, nDummy ) )
     373                 :            :     {
     374 [ #  # ][ #  # ]:          0 :         _rDoc.GetLayouter()->mpMovedFwdFrms->Remove( _rTxtFrm );
     375                 :            :     }
     376                 :          0 : }
     377                 :            : 
     378                 :      20674 : bool SwLayouter::FrmMovedFwdByObjPos( const SwDoc& _rDoc,
     379                 :            :                                       const SwTxtFrm& _rTxtFrm,
     380                 :            :                                       sal_uInt32& _ornToPageNum )
     381                 :            : {
     382         [ +  + ]:      20674 :     if ( !_rDoc.GetLayouter() )
     383                 :            :     {
     384                 :        346 :         _ornToPageNum = 0;
     385                 :        346 :         return false;
     386                 :            :     }
     387         [ +  - ]:      20328 :     else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
     388                 :            :     {
     389                 :      20328 :         _ornToPageNum = 0;
     390                 :      20328 :         return false;
     391                 :            :     }
     392                 :            :     else
     393                 :            :     {
     394                 :          0 :         return _rDoc.GetLayouter()->mpMovedFwdFrms->
     395                 :      20674 :                                 FrmMovedFwdByObjPos( _rTxtFrm, _ornToPageNum );
     396                 :            :     }
     397                 :            : }
     398                 :            : // #i26945#
     399                 :          0 : bool SwLayouter::DoesRowContainMovedFwdFrm( const SwDoc& _rDoc,
     400                 :            :                                             const SwRowFrm& _rRowFrm )
     401                 :            : {
     402         [ #  # ]:          0 :     if ( !_rDoc.GetLayouter() )
     403                 :            :     {
     404                 :          0 :         return false;
     405                 :            :     }
     406         [ #  # ]:          0 :     else if ( !_rDoc.GetLayouter()->mpMovedFwdFrms )
     407                 :            :     {
     408                 :          0 :         return false;
     409                 :            :     }
     410                 :            :     else
     411                 :            :     {
     412                 :          0 :         return _rDoc.GetLayouter()->
     413                 :          0 :                         mpMovedFwdFrms->DoesRowContainMovedFwdFrm( _rRowFrm );
     414                 :            :     }
     415                 :            : }
     416                 :            : 
     417                 :            : // #i35911#
     418                 :     252639 : void SwLayouter::ClearObjsTmpConsiderWrapInfluence( const SwDoc& _rDoc )
     419                 :            : {
     420   [ +  +  +  + ]:     288241 :     if ( _rDoc.GetLayouter() &&
                 [ +  + ]
     421                 :      35602 :          _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl )
     422                 :            :     {
     423                 :          9 :         _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Clear();
     424                 :            :     }
     425                 :     252639 : }
     426                 :          9 : void SwLayouter::InsertObjForTmpConsiderWrapInfluence(
     427                 :            :                                             const SwDoc& _rDoc,
     428                 :            :                                             SwAnchoredObject& _rAnchoredObj )
     429                 :            : {
     430         [ -  + ]:          9 :     if ( !_rDoc.GetLayouter() )
     431                 :            :     {
     432         [ #  # ]:          0 :         const_cast<SwDoc&>(_rDoc).SetLayouter( new SwLayouter() );
     433                 :            :     }
     434                 :            : 
     435         [ +  + ]:          9 :     if ( !_rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl )
     436                 :            :     {
     437                 :          3 :         const_cast<SwDoc&>(_rDoc).GetLayouter()->mpObjsTmpConsiderWrapInfl =
     438         [ +  - ]:          6 :                                 new SwObjsMarkedAsTmpConsiderWrapInfluence();
     439                 :            :     }
     440                 :            : 
     441                 :          9 :     _rDoc.GetLayouter()->mpObjsTmpConsiderWrapInfl->Insert( _rAnchoredObj );
     442                 :          9 : }
     443                 :            : 
     444                 :      22553 : void LOOPING_LOUIE_LIGHT( bool bCondition, const SwTxtFrm& rTxtFrm )
     445                 :            : {
     446         [ -  + ]:      22553 :     if ( bCondition )
     447                 :            :     {
     448                 :          0 :         const SwDoc& rDoc = *rTxtFrm.GetAttrSet()->GetDoc();
     449         [ #  # ]:          0 :         if ( rDoc.GetLayouter() )
     450                 :            :         {
     451                 :          0 :             const_cast<SwDoc&>(rDoc).GetLayouter()->LoopingLouieLight( rDoc, rTxtFrm );
     452                 :            :         }
     453                 :            :     }
     454                 :      22553 : }
     455                 :            : 
     456                 :            : // #i65250#
     457                 :         74 : bool SwLayouter::MoveBwdSuppressed( const SwDoc& p_rDoc,
     458                 :            :                                     const SwFlowFrm& p_rFlowFrm,
     459                 :            :                                     const SwLayoutFrm& p_rNewUpperFrm )
     460                 :            : {
     461                 :         74 :     bool bMoveBwdSuppressed( false );
     462                 :            : 
     463 [ +  - ][ -  + ]:         74 :     if ( !p_rDoc.GetLayouter() )
     464                 :            :     {
     465 [ #  # ][ #  # ]:          0 :         const_cast<SwDoc&>(p_rDoc).SetLayouter( new SwLayouter() );
                 [ #  # ]
     466                 :            :     }
     467                 :            : 
     468                 :            :     // create hash map key
     469                 :            :     tMoveBwdLayoutInfoKey aMoveBwdLayoutInfo;
     470                 :         74 :     aMoveBwdLayoutInfo.mnFrmId = p_rFlowFrm.GetFrm()->GetFrmId();
     471                 :         74 :     aMoveBwdLayoutInfo.mnNewUpperPosX = p_rNewUpperFrm.Frm().Pos().X();
     472                 :         74 :     aMoveBwdLayoutInfo.mnNewUpperPosY = p_rNewUpperFrm.Frm().Pos().Y();
     473                 :         74 :     aMoveBwdLayoutInfo.mnNewUpperWidth = p_rNewUpperFrm.Frm().Width();
     474                 :         74 :     aMoveBwdLayoutInfo.mnNewUpperHeight =  p_rNewUpperFrm.Frm().Height();
     475 [ -  + ][ #  # ]:         74 :     SWRECTFN( (&p_rNewUpperFrm) )
         [ #  # ][ -  + ]
                 [ +  - ]
     476                 :         74 :     const SwFrm* pLastLower( p_rNewUpperFrm.Lower() );
     477 [ +  + ][ +  + ]:        410 :     while ( pLastLower && pLastLower->GetNext() )
                 [ +  + ]
     478                 :            :     {
     479                 :        336 :         pLastLower = pLastLower->GetNext();
     480                 :            :     }
     481                 :            :     aMoveBwdLayoutInfo.mnFreeSpaceInNewUpper =
     482                 :            :             pLastLower
     483 [ +  - ][ +  - ]:         32 :             ? (pLastLower->Frm().*fnRect->fnBottomDist)( (p_rNewUpperFrm.*fnRect->fnGetPrtBottom)() )
                 [ +  - ]
     484 [ +  + ][ +  - ]:        106 :             : (p_rNewUpperFrm.Frm().*fnRect->fnGetHeight)();
         [ +  - ][ +  - ]
     485                 :            : 
     486                 :            :     // check for moving backward suppress threshold
     487                 :         74 :     const sal_uInt16 cMoveBwdCountSuppressThreshold = 20;
     488 [ +  - ][ +  - ]:         74 :     if ( ++const_cast<SwDoc&>(p_rDoc).GetLayouter()->maMoveBwdLayoutInfo[ aMoveBwdLayoutInfo ] >
                 [ -  + ]
     489                 :            :                                                 cMoveBwdCountSuppressThreshold )
     490                 :            :     {
     491                 :          0 :         bMoveBwdSuppressed = true;
     492                 :            :     }
     493                 :            : 
     494                 :         74 :     return bMoveBwdSuppressed;
     495                 :            : }
     496                 :            : 
     497                 :     252639 : void SwLayouter::ClearMoveBwdLayoutInfo( const SwDoc& _rDoc )
     498                 :            : {
     499         [ +  + ]:     252639 :     if ( _rDoc.GetLayouter() )
     500                 :      35602 :         const_cast<SwDoc&>(_rDoc).GetLayouter()->maMoveBwdLayoutInfo.clear();
     501                 :     252639 : }
     502                 :            : 
     503                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10