LCOV - code coverage report
Current view: top level - sw/source/core/layout - wsfrm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1317 1862 70.7 %
Date: 2012-08-25 Functions: 53 62 85.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1496 2833 52.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 <hintids.hxx>
      31                 :            : #include <hints.hxx>
      32                 :            : #include <vcl/outdev.hxx>
      33                 :            : #include <svl/itemiter.hxx>
      34                 :            : #include <editeng/brshitem.hxx>
      35                 :            : #include <editeng/keepitem.hxx>
      36                 :            : #include <editeng/brkitem.hxx>
      37                 :            : #include <fmtornt.hxx>
      38                 :            : #include <pagefrm.hxx>
      39                 :            : #include <section.hxx>
      40                 :            : #include <rootfrm.hxx>
      41                 :            : #include <cntfrm.hxx>
      42                 :            : #include <dcontact.hxx>
      43                 :            : #include <anchoreddrawobject.hxx>
      44                 :            : #include <fmtanchr.hxx>
      45                 :            : #include <viewsh.hxx>
      46                 :            : #include <viewimp.hxx>
      47                 :            : #include "viewopt.hxx"
      48                 :            : #include <doc.hxx>
      49                 :            : #include <fesh.hxx>
      50                 :            : #include <docsh.hxx>
      51                 :            : #include <flyfrm.hxx>
      52                 :            : #include <frmtool.hxx>
      53                 :            : #include <ftninfo.hxx>
      54                 :            : #include <dflyobj.hxx>
      55                 :            : #include <fmtclbl.hxx>
      56                 :            : #include <fmtfordr.hxx>
      57                 :            : #include <fmtfsize.hxx>
      58                 :            : #include <fmtpdsc.hxx>
      59                 :            : #include <txtftn.hxx>
      60                 :            : #include <fmtftn.hxx>
      61                 :            : #include <fmtsrnd.hxx>
      62                 :            : #include <ftnfrm.hxx>
      63                 :            : #include <tabfrm.hxx>
      64                 :            : #include <htmltbl.hxx>
      65                 :            : #include <flyfrms.hxx>
      66                 :            : #include <sectfrm.hxx>
      67                 :            : #include <fmtclds.hxx>
      68                 :            : #include <txtfrm.hxx>
      69                 :            : #include <ndtxt.hxx>
      70                 :            : #include <bodyfrm.hxx>
      71                 :            : #include <cellfrm.hxx>
      72                 :            : #include <dbg_lay.hxx>
      73                 :            : #include <editeng/frmdiritem.hxx>
      74                 :            : // OD 2004-05-24 #i28701#
      75                 :            : #include <sortedobjs.hxx>
      76                 :            : #include <viewopt.hxx>
      77                 :            : 
      78                 :            : 
      79                 :            : using namespace ::com::sun::star;
      80                 :            : 
      81                 :            : 
      82                 :            : /*************************************************************************
      83                 :            : |*
      84                 :            : |*  SwFrm::SwFrm()
      85                 :            : |*
      86                 :            : |*************************************************************************/
      87                 :            : 
      88                 :      13819 : SwFrm::SwFrm( SwModify *pMod, SwFrm* pSib ) :
      89                 :            :     SwClient( pMod ),
      90                 :            :     // #i65250#
      91                 :            :     mnFrmId( SwFrm::mnLastFrmId++ ),
      92                 :            :     mpRoot( pSib ? pSib->getRootFrm() : 0 ),
      93                 :            :     pUpper( 0 ),
      94                 :            :     pNext( 0 ),
      95                 :            :     pPrev( 0 ),
      96                 :            :     pDrawObjs( 0 ),
      97                 :            :     nType(0),
      98                 :            :     bInfBody( sal_False ),
      99                 :            :     bInfTab ( sal_False ),
     100                 :            :     bInfFly ( sal_False ),
     101                 :            :     bInfFtn ( sal_False ),
     102 [ +  - ][ +  + ]:      13819 :     bInfSct ( sal_False )
     103                 :            : {
     104                 :            :     OSL_ENSURE( pMod, "No frame format passed." );
     105                 :      13819 :     bInvalidR2L = bInvalidVert = 1;
     106                 :            :     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
     107                 :      13819 :     bDerivedR2L = bDerivedVert = bRightToLeft = bVertical = bReverse = bVertLR = 0;
     108                 :            : 
     109                 :            :     bValidPos = bValidPrtArea = bValidSize = bValidLineNum = bRetouche =
     110                 :      13819 :     bFixSize = bColLocked = sal_False;
     111                 :      13819 :     bCompletePaint = bInfInvalid = sal_True;
     112                 :      13819 : }
     113                 :            : 
     114                 :        470 : const IDocumentDrawModelAccess* SwFrm::getIDocumentDrawModelAccess()
     115                 :            : {
     116                 :        470 :     return GetUpper()->GetFmt()->getIDocumentDrawModelAccess();
     117                 :            : }
     118                 :            : 
     119                 :          0 : bool SwFrm::KnowsFormat( const SwFmt& rFmt ) const
     120                 :            : {
     121                 :          0 :     return GetRegisteredIn() == &rFmt;
     122                 :            : }
     123                 :            : 
     124                 :         94 : void SwFrm::RegisterToFormat( SwFmt& rFmt )
     125                 :            : {
     126                 :         94 :     rFmt.Add( this );
     127                 :         94 : }
     128                 :            : 
     129                 :       7437 : void SwFrm::CheckDir( sal_uInt16 nDir, sal_Bool bVert, sal_Bool bOnlyBiDi, sal_Bool bBrowse )
     130                 :            : {
     131 [ +  + ][ +  + ]:       7437 :     if( FRMDIR_ENVIRONMENT == nDir || ( bVert && bOnlyBiDi ) )
                 [ +  + ]
     132                 :            :     {
     133                 :       5603 :         bDerivedVert = 1;
     134         [ +  + ]:       5603 :         if( FRMDIR_ENVIRONMENT == nDir )
     135                 :       4183 :             bDerivedR2L = 1;
     136                 :       5603 :         SetDirFlags( bVert );
     137                 :            :     }
     138         [ +  + ]:       1834 :     else if( bVert )
     139                 :            :     {
     140                 :        182 :         bInvalidVert = 0;
     141 [ -  + ][ #  # ]:        182 :         if( FRMDIR_HORI_LEFT_TOP == nDir || FRMDIR_HORI_RIGHT_TOP == nDir
                 [ #  # ]
     142                 :            :             || bBrowse )
     143                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
     144                 :            :         {
     145                 :        182 :             bVertical = 0;
     146                 :        182 :             bVertLR = 0;
     147                 :            :         }
     148                 :            :         else
     149                 :            :            {
     150                 :          0 :             bVertical = 1;
     151         [ #  # ]:          0 :             if(FRMDIR_VERT_TOP_RIGHT == nDir)
     152                 :          0 :                 bVertLR = 0;
     153         [ #  # ]:          0 :                else if(FRMDIR_VERT_TOP_LEFT==nDir)
     154                 :        182 :                        bVertLR = 1;
     155                 :            :         }
     156                 :            :     }
     157                 :            :     else
     158                 :            :     {
     159                 :       1652 :         bInvalidR2L = 0;
     160         [ -  + ]:       1652 :         if( FRMDIR_HORI_RIGHT_TOP == nDir )
     161                 :          0 :             bRightToLeft = 1;
     162                 :            :         else
     163                 :       1652 :             bRightToLeft = 0;
     164                 :            :     }
     165                 :       7437 : }
     166                 :            : 
     167                 :      33270 : void SwFrm::CheckDirection( sal_Bool bVert )
     168                 :            : {
     169         [ +  + ]:      33270 :     if( bVert )
     170                 :            :     {
     171 [ +  + ][ +  + ]:      29173 :         if( !IsHeaderFrm() && !IsFooterFrm() )
                 [ +  + ]
     172                 :            :         {
     173                 :       4489 :             bDerivedVert = 1;
     174                 :       4489 :             SetDirFlags( bVert );
     175                 :            :         }
     176                 :            :     }
     177                 :            :     else
     178                 :            :     {
     179                 :       4097 :         bDerivedR2L = 1;
     180                 :       4097 :         SetDirFlags( bVert );
     181                 :            :     }
     182                 :      33270 : }
     183                 :            : 
     184                 :        207 : void SwSectionFrm::CheckDirection( sal_Bool bVert )
     185                 :            : {
     186                 :        207 :     const SwFrmFmt* pFmt = GetFmt();
     187         [ +  - ]:        207 :     if( pFmt )
     188                 :            :     {
     189                 :        207 :         const ViewShell *pSh = getRootFrm()->GetCurrShell();
     190 [ -  + ][ +  - ]:        207 :         const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
     191                 :        207 :         CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
     192                 :        207 :                     bVert, sal_True, bBrowseMode );
     193                 :            :     }
     194                 :            :     else
     195                 :          0 :         SwFrm::CheckDirection( bVert );
     196                 :        207 : }
     197                 :            : 
     198                 :          4 : void SwFlyFrm::CheckDirection( sal_Bool bVert )
     199                 :            : {
     200                 :          4 :     const SwFrmFmt* pFmt = GetFmt();
     201         [ +  - ]:          4 :     if( pFmt )
     202                 :            :     {
     203                 :          4 :         const ViewShell *pSh = getRootFrm()->GetCurrShell();
     204 [ -  + ][ +  - ]:          4 :         const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
     205                 :          4 :         CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
     206                 :          4 :                     bVert, sal_False, bBrowseMode );
     207                 :            :     }
     208                 :            :     else
     209                 :          0 :         SwFrm::CheckDirection( bVert );
     210                 :          4 : }
     211                 :            : 
     212                 :        237 : void SwTabFrm::CheckDirection( sal_Bool bVert )
     213                 :            : {
     214                 :        237 :     const SwFrmFmt* pFmt = GetFmt();
     215         [ +  - ]:        237 :     if( pFmt )
     216                 :            :     {
     217                 :        237 :         const ViewShell *pSh = getRootFrm()->GetCurrShell();
     218 [ -  + ][ +  - ]:        237 :         const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
     219                 :        237 :         CheckDir(((SvxFrameDirectionItem&)pFmt->GetFmtAttr(RES_FRAMEDIR)).GetValue(),
     220                 :        237 :                     bVert, sal_True, bBrowseMode );
     221                 :            :     }
     222                 :            :     else
     223                 :          0 :         SwFrm::CheckDirection( bVert );
     224                 :        237 : }
     225                 :            : 
     226                 :       3914 : void SwCellFrm::CheckDirection( sal_Bool bVert )
     227                 :            : {
     228         [ +  - ]:       3914 :     const SwFrmFmt* pFmt = GetFmt();
     229                 :            :     const SfxPoolItem* pItem;
     230                 :            :     // Check if the item is set, before actually
     231                 :            :     // using it. Otherwise the dynamic pool default is used, which may be set
     232                 :            :     // to LTR in case of OOo 1.0 documents.
     233 [ +  - ][ +  - ]:       3914 :     if( pFmt && SFX_ITEM_SET == pFmt->GetItemState( RES_FRAMEDIR, sal_True, &pItem ) )
         [ +  + ][ +  + ]
     234                 :            :     {
     235                 :        360 :         const SvxFrameDirectionItem* pFrmDirItem = static_cast<const SvxFrameDirectionItem*>(pItem);
     236                 :        360 :         const ViewShell *pSh = getRootFrm()->GetCurrShell();
     237 [ -  + ][ +  - ]:        360 :         const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
     238         [ +  - ]:        360 :         CheckDir( pFrmDirItem->GetValue(), bVert, sal_False, bBrowseMode );
     239                 :            :     }
     240                 :            :     else
     241         [ +  - ]:       3554 :         SwFrm::CheckDirection( bVert );
     242                 :       3914 : }
     243                 :            : 
     244                 :       6629 : void SwTxtFrm::CheckDirection( sal_Bool bVert )
     245                 :            : {
     246                 :       6629 :     const ViewShell *pSh = getRootFrm()->GetCurrShell();
     247 [ +  + ][ +  - ]:       6629 :     const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
     248                 :       6629 :     CheckDir( GetTxtNode()->GetSwAttrSet().GetFrmDir().GetValue(), bVert,
     249                 :       6629 :               sal_True, bBrowseMode );
     250                 :       6629 : }
     251                 :            : 
     252                 :            : /*************************************************************************/
     253                 :       4138 : void SwFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
     254                 :            : {
     255                 :       4138 :     sal_uInt8 nInvFlags = 0;
     256                 :            : 
     257 [ +  - ][ +  + ]:       4138 :     if( pNew && RES_ATTRSET_CHG == pNew->Which() )
                 [ +  + ]
     258                 :            :     {
     259         [ +  - ]:       2586 :         SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
     260         [ +  - ]:       2586 :         SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
     261                 :        146 :         while( sal_True )
     262                 :            :         {
     263                 :            :             _UpdateAttrFrm( (SfxPoolItem*)aOIter.GetCurItem(),
     264         [ +  - ]:       2732 :                          (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags );
     265         [ +  + ]:       2732 :             if( aNIter.IsAtEnd() )
     266                 :       2586 :                 break;
     267         [ +  - ]:        146 :             aNIter.NextItem();
     268         [ +  - ]:        146 :             aOIter.NextItem();
     269 [ +  - ][ +  - ]:       2586 :         }
     270                 :            :     }
     271                 :            :     else
     272         [ +  - ]:       1552 :         _UpdateAttrFrm( pOld, pNew, nInvFlags );
     273                 :            : 
     274         [ +  + ]:       4138 :     if ( nInvFlags != 0 )
     275                 :            :     {
     276         [ +  - ]:       1720 :         SwPageFrm *pPage = FindPageFrm();
     277         [ +  - ]:       1720 :         InvalidatePage( pPage );
     278         [ +  + ]:       1720 :         if ( nInvFlags & 0x01 )
     279                 :            :         {
     280         [ +  - ]:       1634 :             _InvalidatePrt();
     281 [ +  + ][ +  + ]:       1634 :             if( !GetPrev() && IsTabFrm() && IsInSct() )
         [ +  - ][ -  + ]
                 [ -  + ]
     282 [ #  # ][ #  # ]:          0 :                 FindSctFrm()->_InvalidatePrt();
     283                 :            :         }
     284         [ +  + ]:       1720 :         if ( nInvFlags & 0x02 )
     285         [ +  - ]:       1634 :             _InvalidateSize();
     286         [ +  + ]:       1720 :         if ( nInvFlags & 0x04 )
     287         [ +  - ]:       1348 :             _InvalidatePos();
     288         [ +  + ]:       1720 :         if ( nInvFlags & 0x08 )
     289                 :       1694 :             SetCompletePaint();
     290                 :            :         SwFrm *pNxt;
     291 [ +  + ][ +  + ]:       1720 :         if ( nInvFlags & 0x30 && 0 != (pNxt = GetNext()) )
                 [ +  + ]
     292                 :            :         {
     293         [ +  - ]:         90 :             pNxt->InvalidatePage( pPage );
     294         [ +  + ]:         90 :             if ( nInvFlags & 0x10 )
     295         [ +  - ]:         20 :                 pNxt->_InvalidatePos();
     296         [ +  + ]:         90 :             if ( nInvFlags & 0x20 )
     297                 :         70 :                 pNxt->SetCompletePaint();
     298                 :            :         }
     299                 :            :     }
     300                 :       4138 : }
     301                 :            : 
     302                 :       4284 : void SwFrm::_UpdateAttrFrm( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
     303                 :            :                          sal_uInt8 &rInvFlags )
     304                 :            : {
     305 [ +  + ][ +  - ]:       4284 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
     306   [ +  +  -  +  :       4284 :     switch( nWhich )
          +  +  +  +  -  
                      + ]
     307                 :            :     {
     308                 :            :         case RES_BOX:
     309                 :            :         case RES_SHADOW:
     310                 :         50 :             Prepare( PREP_FIXSIZE_CHG );
     311                 :            :             // no break here!
     312                 :            :         case RES_LR_SPACE:
     313                 :            :         case RES_UL_SPACE:
     314                 :        266 :             rInvFlags |= 0x0B;
     315                 :        266 :             break;
     316                 :            : 
     317                 :            :         case RES_HEADER_FOOTER_EAT_SPACING:
     318                 :          0 :             rInvFlags |= 0x03;
     319                 :          0 :             break;
     320                 :            : 
     321                 :            :         case RES_BACKGROUND:
     322                 :         84 :             rInvFlags |= 0x28;
     323                 :         84 :             break;
     324                 :            : 
     325                 :            :         case RES_KEEP:
     326                 :          2 :             rInvFlags |= 0x04;
     327                 :          2 :             break;
     328                 :            : 
     329                 :            :         case RES_FRM_SIZE:
     330                 :         24 :             ReinitializeFrmSizeAttrFlags();
     331                 :         24 :             rInvFlags |= 0x13;
     332                 :         24 :             break;
     333                 :            : 
     334                 :            :         case RES_FMT_CHG:
     335                 :       1346 :             rInvFlags |= 0x0F;
     336                 :       1346 :             break;
     337                 :            : 
     338                 :            :         case RES_ROW_SPLIT:
     339                 :            :         {
     340         [ +  - ]:          2 :             if ( IsRowFrm() )
     341                 :            :             {
     342                 :          2 :                 sal_Bool bInFollowFlowRow = 0 != IsInFollowFlowRow();
     343 [ -  + ][ -  + ]:          2 :                 if ( bInFollowFlowRow || 0 != IsInSplitTableRow() )
                 [ +  - ]
     344                 :            :                 {
     345                 :          0 :                     SwTabFrm* pTab = FindTabFrm();
     346         [ #  # ]:          0 :                     if ( bInFollowFlowRow )
     347                 :          0 :                         pTab = pTab->FindMaster();
     348                 :          0 :                     pTab->SetRemoveFollowFlowLinePending( sal_True );
     349                 :            :                 }
     350                 :            :             }
     351                 :          2 :             break;
     352                 :            :         }
     353                 :            :         case RES_COL:
     354                 :            :             OSL_FAIL( "Columns for new FrmTyp?" );
     355                 :          0 :             break;
     356                 :            : 
     357                 :            :         default:
     358                 :            :             /* do Nothing */;
     359                 :            :     }
     360                 :       4284 : }
     361                 :            : 
     362                 :            : /*************************************************************************
     363                 :            : |*
     364                 :            : |*    SwFrm::Prepare()
     365                 :            : |*
     366                 :            : |*************************************************************************/
     367                 :        107 : void SwFrm::Prepare( const PrepareHint, const void *, sal_Bool )
     368                 :            : {
     369                 :            :     /* Do nothing */
     370                 :        107 : }
     371                 :            : 
     372                 :            : /*************************************************************************
     373                 :            : |*
     374                 :            : |*    SwFrm::InvalidatePage()
     375                 :            : |*    Description:      Invalidates the page in which the Frm is placed
     376                 :            : |*      currently. The page is invalidated depending on the type (Layout,
     377                 :            : |*      Cntnt, FlyFrm)
     378                 :            : |*
     379                 :            : |*************************************************************************/
     380                 :      60457 : void SwFrm::InvalidatePage( const SwPageFrm *pPage ) const
     381                 :            : {
     382         [ +  + ]:      60457 :     if ( !pPage )
     383                 :            :     {
     384                 :      49284 :         pPage = FindPageFrm();
     385                 :            :         // #i28701# - for at-character and as-character
     386                 :            :         // anchored Writer fly frames additionally invalidate also page frame
     387                 :            :         // its 'anchor character' is on.
     388 [ +  + ][ +  + ]:      49284 :         if ( pPage && pPage->GetUpper() && IsFlyFrm() )
         [ +  + ][ +  + ]
     389                 :            :         {
     390                 :       1707 :             const SwFlyFrm* pFlyFrm = static_cast<const SwFlyFrm*>(this);
     391 [ +  + ][ +  + ]:       1707 :             if ( pFlyFrm->IsAutoPos() || pFlyFrm->IsFlyInCntFrm() )
                 [ +  + ]
     392                 :            :             {
     393                 :            :                 // #i33751#, #i34060# - method <GetPageFrmOfAnchor()>
     394                 :            :                 // is replaced by method <FindPageFrmOfAnchor()>. It's return value
     395                 :            :                 // have to be checked.
     396                 :            :                 SwPageFrm* pPageFrmOfAnchor =
     397                 :       1451 :                         const_cast<SwFlyFrm*>(pFlyFrm)->FindPageFrmOfAnchor();
     398 [ -  + ][ +  - ]:       1451 :                 if ( pPageFrmOfAnchor && pPageFrmOfAnchor != pPage )
     399                 :            :                 {
     400                 :          0 :                     InvalidatePage( pPageFrmOfAnchor );
     401                 :            :                 }
     402                 :            :             }
     403                 :            :         }
     404                 :            :     }
     405                 :            : 
     406 [ +  + ][ +  + ]:      60457 :     if ( pPage && pPage->GetUpper() )
                 [ +  + ]
     407                 :            :     {
     408         [ -  + ]:      54088 :         if ( pPage->GetFmt()->GetDoc()->IsInDtor() )
     409                 :      60457 :             return;
     410                 :            : 
     411                 :      54088 :         SwRootFrm *pRoot = (SwRootFrm*)pPage->GetUpper();
     412                 :      54088 :         const SwFlyFrm *pFly = FindFlyFrm();
     413         [ +  + ]:      54088 :         if ( IsCntntFrm() )
     414                 :            :         {
     415         [ +  + ]:      40831 :             if ( pRoot->IsTurboAllowed() )
     416                 :            :             {
     417                 :            :                 // JP 21.09.95: it can still be a TurboAction if the
     418                 :            :                 // ContentFrame wants to register a second time.
     419                 :            :                 //  RIGHT????
     420 [ +  + ][ +  + ]:      12766 :                 if ( !pRoot->GetTurbo() || this == pRoot->GetTurbo() )
                 [ +  + ]
     421                 :      11471 :                     pRoot->SetTurbo( (const SwCntntFrm*)this );
     422                 :            :                 else
     423                 :            :                 {
     424                 :       1295 :                     pRoot->DisallowTurbo();
     425                 :            :                     //The page of the Turbo could be a different one then mine,
     426                 :            :                     //therefore we have to invalidate it.
     427                 :       1295 :                     const SwFrm *pTmp = pRoot->GetTurbo();
     428                 :       1295 :                     pRoot->ResetTurbo();
     429                 :       1295 :                     pTmp->InvalidatePage();
     430                 :            :                 }
     431                 :            :             }
     432         [ +  + ]:      40831 :             if ( !pRoot->GetTurbo() )
     433                 :            :             {
     434         [ +  + ]:      29329 :                 if ( pFly )
     435         [ +  - ]:       1810 :                 {   if( !pFly->IsLocked() )
     436                 :            :                     {
     437         [ +  + ]:       1810 :                         if ( pFly->IsFlyInCntFrm() )
     438                 :        987 :                         {   pPage->InvalidateFlyInCnt();
     439                 :        987 :                             ((SwFlyInCntFrm*)pFly)->InvalidateCntnt();
     440                 :        987 :                             pFly->GetAnchorFrm()->InvalidatePage();
     441                 :            :                         }
     442                 :            :                         else
     443                 :        823 :                             pPage->InvalidateFlyCntnt();
     444                 :            :                     }
     445                 :            :                 }
     446                 :            :                 else
     447                 :      27519 :                     pPage->InvalidateCntnt();
     448                 :            :             }
     449                 :            :         }
     450                 :            :         else
     451                 :            :         {
     452                 :      13257 :             pRoot->DisallowTurbo();
     453         [ +  + ]:      13257 :             if ( pFly )
     454                 :            :             {
     455         [ +  + ]:       2202 :                 if ( !pFly->IsLocked() )
     456                 :            :                 {
     457         [ +  + ]:       2165 :                     if ( pFly->IsFlyInCntFrm() )
     458                 :            :                     {
     459                 :       1277 :                         pPage->InvalidateFlyInCnt();
     460                 :       1277 :                         ((SwFlyInCntFrm*)pFly)->InvalidateLayout();
     461                 :       1277 :                         pFly->GetAnchorFrm()->InvalidatePage();
     462                 :            :                     }
     463                 :            :                     else
     464                 :        888 :                         pPage->InvalidateFlyLayout();
     465                 :            :                 }
     466                 :            :             }
     467                 :            :             else
     468                 :      11055 :                 pPage->InvalidateLayout();
     469                 :            : 
     470         [ +  + ]:      13257 :             if ( pRoot->GetTurbo() )
     471                 :        128 :             {   const SwFrm *pTmp = pRoot->GetTurbo();
     472                 :        128 :                 pRoot->ResetTurbo();
     473                 :        128 :                 pTmp->InvalidatePage();
     474                 :            :             }
     475                 :            :         }
     476                 :      54088 :         pRoot->SetIdleFlags();
     477                 :            : 
     478         [ -  + ]:      54088 :         const SwTxtFrm *pTxtFrm = dynamic_cast< const SwTxtFrm * >(this);
     479         [ +  + ]:      54088 :         if (pTxtFrm)
     480                 :            :         {
     481                 :      39865 :             const SwTxtNode *pTxtNode = pTxtFrm->GetTxtNode();
     482 [ +  + ][ +  + ]:      39865 :             if (pTxtNode && pTxtNode->IsGrammarCheckDirty())
                 [ +  - ]
     483                 :      29015 :                 pRoot->SetNeedGrammarCheck( sal_True );
     484                 :            :         }
     485                 :            :     }
     486                 :            : }
     487                 :            : 
     488                 :            : /*************************************************************************
     489                 :            : |*
     490                 :            : |*  SwFrm::ChgSize()
     491                 :            : |*
     492                 :            : |*************************************************************************/
     493                 :       1870 : Size SwFrm::ChgSize( const Size& aNewSize )
     494                 :            : {
     495                 :       1870 :     bFixSize = sal_True;
     496                 :       1870 :     const Size aOldSize( Frm().SSize() );
     497         [ +  + ]:       1870 :     if ( aNewSize == aOldSize )
     498                 :        296 :         return aOldSize;
     499                 :            : 
     500         [ +  + ]:       1574 :     if ( GetUpper() )
     501                 :            :     {
     502 [ +  - ][ +  + ]:        158 :         SWRECTFN2( this )
                 [ -  + ]
     503                 :        158 :         SwRect aNew( Point(0,0), aNewSize );
     504 [ +  - ][ +  - ]:        158 :         (aFrm.*fnRect->fnSetWidth)( (aNew.*fnRect->fnGetWidth)() );
         [ +  - ][ +  - ]
     505 [ +  - ][ +  - ]:        158 :         long nNew = (aNew.*fnRect->fnGetHeight)();
     506 [ +  - ][ +  - ]:        158 :         long nDiff = nNew - (aFrm.*fnRect->fnGetHeight)();
     507         [ +  + ]:        158 :         if( nDiff )
     508                 :            :         {
     509 [ +  + ][ +  - ]:        162 :             if ( GetUpper()->IsFtnBossFrm() && HasFixSize() &&
         [ +  - ][ +  + ]
     510                 :            :                  NA_GROW_SHRINK !=
     511         [ +  - ]:         16 :                  ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this ) )
     512                 :            :             {
     513 [ +  - ][ +  - ]:         16 :                 (aFrm.*fnRect->fnSetHeight)( nNew );
     514         [ +  - ]:         16 :                 SwTwips nReal = ((SwLayoutFrm*)this)->AdjustNeighbourhood(nDiff);
     515         [ +  + ]:         16 :                 if ( nReal != nDiff )
     516 [ +  - ][ +  - ]:         12 :                     (aFrm.*fnRect->fnSetHeight)( nNew - nDiff + nReal );
     517                 :            :             }
     518                 :            :             else
     519                 :            :             {
     520                 :            :                 // OD 24.10.2002 #97265# - grow/shrink not for neighbour frames
     521                 :            :                 // NOTE: neighbour frames are cell and column frames.
     522         [ +  + ]:        130 :                 if ( !bNeighb )
     523                 :            :                 {
     524         [ +  + ]:          6 :                     if ( nDiff > 0 )
     525         [ +  - ]:          2 :                         Grow( nDiff );
     526                 :            :                     else
     527         [ +  - ]:          4 :                         Shrink( -nDiff );
     528                 :            : 
     529 [ +  - ][ +  - ]:          6 :                     if ( GetUpper() && (aFrm.*fnRect->fnGetHeight)() != nNew )
         [ +  - ][ +  - ]
                 [ +  - ]
     530         [ +  - ]:          6 :                         GetUpper()->_InvalidateSize();
     531                 :            :                 }
     532                 :            : 
     533                 :            :                 // Even if grow/shrink did not yet set the desired width, for
     534                 :            :                 // example when called by ChgColumns to set the column width, we
     535                 :            :                 // set the right width now.
     536 [ +  - ][ +  - ]:        158 :                 (aFrm.*fnRect->fnSetHeight)( nNew );
     537                 :            :             }
     538                 :            :         }
     539                 :            :     }
     540                 :            :     else
     541                 :       1416 :         aFrm.SSize( aNewSize );
     542                 :            : 
     543         [ +  - ]:       1574 :     if ( Frm().SSize() != aOldSize )
     544                 :            :     {
     545         [ +  - ]:       1574 :         SwPageFrm *pPage = FindPageFrm();
     546         [ +  + ]:       1574 :         if ( GetNext() )
     547                 :            :         {
     548         [ +  - ]:         88 :             GetNext()->_InvalidatePos();
     549         [ +  - ]:         88 :             GetNext()->InvalidatePage( pPage );
     550                 :            :         }
     551         [ +  - ]:       1574 :         if( IsLayoutFrm() )
     552                 :            :         {
     553 [ +  - ][ -  + ]:       1574 :             if( IsRightToLeft() )
     554         [ #  # ]:          0 :                 _InvalidatePos();
     555         [ +  + ]:       1574 :             if( ((SwLayoutFrm*)this)->Lower() )
     556         [ +  - ]:        146 :                 ((SwLayoutFrm*)this)->Lower()->_InvalidateSize();
     557                 :            :         }
     558         [ +  - ]:       1574 :         _InvalidatePrt();
     559         [ +  - ]:       1574 :         _InvalidateSize();
     560         [ +  - ]:       1574 :         InvalidatePage( pPage );
     561                 :            :     }
     562                 :            : 
     563                 :       1870 :     return aFrm.SSize();
     564                 :            : }
     565                 :            : 
     566                 :            : /*************************************************************************
     567                 :            : |*
     568                 :            : |*  SwFrm::InsertBefore()
     569                 :            : |*
     570                 :            : |*  Description         SwFrm is inserted into an existing structure.
     571                 :            : |*                      Insertion is done below the parent and either before
     572                 :            : |*                      pBehind or at the end of the chain if pBehind is empty.
     573                 :            : |*
     574                 :            : |*************************************************************************/
     575                 :       3987 : void SwFrm::InsertBefore( SwLayoutFrm* pParent, SwFrm* pBehind )
     576                 :            : {
     577                 :            :     OSL_ENSURE( pParent, "No parent for insert." );
     578                 :            :     OSL_ENSURE( (!pBehind || (pBehind && pParent == pBehind->GetUpper())),
     579                 :            :             "Frame tree is inconsistent." );
     580                 :            : 
     581                 :       3987 :     pUpper = pParent;
     582                 :       3987 :     pNext = pBehind;
     583         [ +  + ]:       3987 :     if( pBehind )
     584                 :            :     {   //Insert before pBehind.
     585         [ +  + ]:        537 :         if( 0 != (pPrev = pBehind->pPrev) )
     586                 :        147 :             pPrev->pNext = this;
     587                 :            :         else
     588                 :        390 :             pUpper->pLower = this;
     589                 :        537 :         pBehind->pPrev = this;
     590                 :            :     }
     591                 :            :     else
     592                 :            :     {   //Insert at the end, or as first node in the sub tree
     593                 :       3450 :         pPrev = pUpper->Lower();
     594         [ +  + ]:       3450 :         if ( pPrev )
     595                 :            :         {
     596         [ +  + ]:       1899 :             while( pPrev->pNext )
     597                 :       1337 :                 pPrev = pPrev->pNext;
     598                 :        562 :             pPrev->pNext = this;
     599                 :            :         }
     600                 :            :         else
     601                 :       2888 :             pUpper->pLower = this;
     602                 :            :     }
     603                 :       3987 : }
     604                 :            : 
     605                 :            : /*************************************************************************
     606                 :            : |*
     607                 :            : |*  SwFrm::InsertBehind()
     608                 :            : |*
     609                 :            : |*  Description         SwFrm is inserted in an existing structure.
     610                 :            : |*                      Insertion is done below the parent and either behind
     611                 :            : |*                      pBefore or at the beginning of the chain if pBefore is
     612                 :            : |*                      empty.
     613                 :            : |*
     614                 :            : |*************************************************************************/
     615                 :       7987 : void SwFrm::InsertBehind( SwLayoutFrm *pParent, SwFrm *pBefore )
     616                 :            : {
     617                 :            :     OSL_ENSURE( pParent, "No Parent for Insert." );
     618                 :            :     OSL_ENSURE( (!pBefore || (pBefore && pParent == pBefore->GetUpper())),
     619                 :            :             "Frame tree is inconsistent." );
     620                 :            : 
     621                 :       7987 :     pUpper = pParent;
     622                 :       7987 :     pPrev = pBefore;
     623         [ +  + ]:       7987 :     if ( pBefore )
     624                 :            :     {
     625                 :            :         //Insert after pBefore
     626         [ +  + ]:       2986 :         if ( 0 != (pNext = pBefore->pNext) )
     627                 :         32 :             pNext->pPrev = this;
     628                 :       2986 :         pBefore->pNext = this;
     629                 :            :     }
     630                 :            :     else
     631                 :            :     {
     632                 :            :         //Insert at the beginning of the chain
     633                 :       5001 :         pNext = pParent->Lower();
     634         [ +  + ]:       5001 :         if ( pParent->Lower() )
     635                 :         26 :             pParent->Lower()->pPrev = this;
     636                 :       5001 :         pParent->pLower = this;
     637                 :            :     }
     638                 :       7987 : }
     639                 :            : 
     640                 :            : /*************************************************************************
     641                 :            : |*
     642                 :            : |*  SwFrm::InsertGroup()
     643                 :            : |*
     644                 :            : |*  Description         A chain of SwFrms gets inserted in an existing structure
     645                 :            : |*
     646                 :            : |*  Until now this is used to insert a SectionFrame (which may have some
     647                 :            : |*  siblings) into an existing structure.
     648                 :            : |*
     649                 :            : |*  If the third parameter is NULL, this method is (besides handling the
     650                 :            : |*  siblings) equal to SwFrm::InsertBefore(..)
     651                 :            : |*
     652                 :            : |*  If the third parameter is passed, the following happens:
     653                 :            : |*  - this becomes pNext of pParent
     654                 :            : |*  - pSct becomes pNext of the last one in the this-chain
     655                 :            : |*  - pBehind is reconnected from pParent to pSct
     656                 :            : |*  The purpose is: a SectionFrm (this) won't become a child of another
     657                 :            : |*  SectionFrm (pParent), but pParent gets split into two siblings
     658                 :            : |*  (pParent+pSect) and this is inserted between.
     659                 :            : |*
     660                 :            : |*************************************************************************/
     661                 :          0 : void SwFrm::InsertGroupBefore( SwFrm* pParent, SwFrm* pBehind, SwFrm* pSct )
     662                 :            : {
     663                 :            :     OSL_ENSURE( pParent, "No parent for insert." );
     664                 :            :     OSL_ENSURE( (!pBehind || ( (pBehind && (pParent == pBehind->GetUpper()))
     665                 :            :             || ((pParent->IsSctFrm() && pBehind->GetUpper()->IsColBodyFrm())) ) ),
     666                 :            :             "Frame tree inconsistent." );
     667         [ #  # ]:          0 :     if( pSct )
     668                 :            :     {
     669                 :          0 :         pUpper = pParent->GetUpper();
     670                 :          0 :         SwFrm *pLast = this;
     671         [ #  # ]:          0 :         while( pLast->GetNext() )
     672                 :            :         {
     673                 :          0 :             pLast = pLast->GetNext();
     674                 :          0 :             pLast->pUpper = GetUpper();
     675                 :            :         }
     676         [ #  # ]:          0 :         if( pBehind )
     677                 :            :         {
     678                 :          0 :             pLast->pNext = pSct;
     679                 :          0 :             pSct->pPrev = pLast;
     680                 :          0 :             pSct->pNext = pParent->GetNext();
     681                 :            :         }
     682                 :            :         else
     683                 :            :         {
     684                 :          0 :             pLast->pNext = pParent->GetNext();
     685         [ #  # ]:          0 :             if( pLast->GetNext() )
     686                 :          0 :                 pLast->GetNext()->pPrev = pLast;
     687                 :            :         }
     688                 :          0 :         pParent->pNext = this;
     689                 :          0 :         pPrev = pParent;
     690         [ #  # ]:          0 :         if( pSct->GetNext() )
     691                 :          0 :             pSct->GetNext()->pPrev = pSct;
     692         [ #  # ]:          0 :         while( pLast->GetNext() )
     693                 :            :         {
     694                 :          0 :             pLast = pLast->GetNext();
     695                 :          0 :             pLast->pUpper = GetUpper();
     696                 :            :         }
     697         [ #  # ]:          0 :         if( pBehind )
     698                 :            :         {   // Insert before pBehind.
     699         [ #  # ]:          0 :             if( pBehind->GetPrev() )
     700                 :          0 :                 pBehind->GetPrev()->pNext = NULL;
     701                 :            :             else
     702                 :          0 :                 pBehind->GetUpper()->pLower = NULL;
     703                 :          0 :             pBehind->pPrev = NULL;
     704                 :          0 :             SwLayoutFrm* pTmp = (SwLayoutFrm*)pSct;
     705         [ #  # ]:          0 :             if( pTmp->Lower() )
     706                 :            :             {
     707                 :            :                 OSL_ENSURE( pTmp->Lower()->IsColumnFrm(), "InsertGrp: Used SectionFrm" );
     708                 :          0 :                 pTmp = (SwLayoutFrm*)((SwLayoutFrm*)pTmp->Lower())->Lower();
     709                 :            :                 OSL_ENSURE( pTmp, "InsertGrp: Missing ColBody" );
     710                 :            :             }
     711                 :          0 :             pBehind->pUpper = pTmp;
     712                 :          0 :             pBehind->GetUpper()->pLower = pBehind;
     713                 :          0 :             pLast = pBehind->GetNext();
     714         [ #  # ]:          0 :             while ( pLast )
     715                 :            :             {
     716                 :          0 :                 pLast->pUpper = pBehind->GetUpper();
     717                 :          0 :                 pLast = pLast->GetNext();
     718                 :            :             };
     719                 :            :         }
     720                 :            :         else
     721                 :            :         {
     722                 :            :             OSL_ENSURE( pSct->IsSctFrm(), "InsertGroup: For SectionFrms only" );
     723         [ #  # ]:          0 :             delete ((SwSectionFrm*)pSct);
     724                 :            :         }
     725                 :            :     }
     726                 :            :     else
     727                 :            :     {
     728                 :          0 :         pUpper = (SwLayoutFrm*)pParent;
     729                 :          0 :         SwFrm *pLast = this;
     730         [ #  # ]:          0 :         while( pLast->GetNext() )
     731                 :            :         {
     732                 :          0 :             pLast = pLast->GetNext();
     733                 :          0 :             pLast->pUpper = GetUpper();
     734                 :            :         }
     735                 :          0 :         pLast->pNext = pBehind;
     736         [ #  # ]:          0 :         if( pBehind )
     737                 :            :         {   // Insert before pBehind.
     738         [ #  # ]:          0 :             if( 0 != (pPrev = pBehind->pPrev) )
     739                 :          0 :                 pPrev->pNext = this;
     740                 :            :             else
     741                 :          0 :                 pUpper->pLower = this;
     742                 :          0 :             pBehind->pPrev = pLast;
     743                 :            :         }
     744                 :            :         else
     745                 :            :         {
     746                 :            :             //Insert at the end, or ... the first node in the subtree
     747                 :          0 :             pPrev = pUpper->Lower();
     748         [ #  # ]:          0 :             if ( pPrev )
     749                 :            :             {
     750         [ #  # ]:          0 :                 while( pPrev->pNext )
     751                 :          0 :                     pPrev = pPrev->pNext;
     752                 :          0 :                 pPrev->pNext = this;
     753                 :            :             }
     754                 :            :             else
     755                 :          0 :                 pUpper->pLower = this;
     756                 :            :         }
     757                 :            :     }
     758                 :          0 : }
     759                 :            : 
     760                 :            : /*************************************************************************
     761                 :            : |*
     762                 :            : |*  SwFrm::Remove()
     763                 :            : |*
     764                 :            : |*************************************************************************/
     765                 :       7570 : void SwFrm::Remove()
     766                 :            : {
     767                 :            :     OSL_ENSURE( pUpper, "Remove without upper?" );
     768                 :            : 
     769         [ +  + ]:       7570 :     if( pPrev )
     770                 :            :         // one out of the middle is removed
     771                 :        301 :         pPrev->pNext = pNext;
     772                 :            :     else
     773                 :            :     {   // the first in a list is removed //TODO
     774                 :            :         OSL_ENSURE( pUpper->pLower == this, "Layout is inconsistent." );
     775                 :       7269 :         pUpper->pLower = pNext;
     776                 :            :     }
     777         [ +  + ]:       7570 :     if( pNext )
     778                 :       2345 :         pNext->pPrev = pPrev;
     779                 :            : 
     780                 :            :     // Remove link
     781                 :       7570 :     pNext  = pPrev  = 0;
     782                 :       7570 :     pUpper = 0;
     783                 :       7570 : }
     784                 :            : /*************************************************************************
     785                 :            : |*
     786                 :            : |*  SwCntntFrm::Paste()
     787                 :            : |*
     788                 :            : |*************************************************************************/
     789                 :        711 : void SwCntntFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
     790                 :            : {
     791                 :            :     OSL_ENSURE( pParent, "No parent for pasting." );
     792                 :            :     OSL_ENSURE( pParent->IsLayoutFrm(), "Parent is CntntFrm." );
     793                 :            :     OSL_ENSURE( pParent != this, "I'm the parent." );
     794                 :            :     OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
     795                 :            :     OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
     796                 :            :             "I'm still registered somewhere" );
     797                 :            :     OSL_ENSURE( !pSibling || pSibling->IsFlowFrm(),
     798                 :            :             "<SwCntntFrm::Paste(..)> - sibling not of expected type." );
     799                 :            : 
     800                 :            :     //Insert in the tree.
     801                 :        711 :     InsertBefore( (SwLayoutFrm*)pParent, pSibling );
     802                 :            : 
     803                 :        711 :     SwPageFrm *pPage = FindPageFrm();
     804                 :        711 :     _InvalidateAll();
     805                 :        711 :     InvalidatePage( pPage );
     806                 :            : 
     807         [ +  - ]:        711 :     if( pPage )
     808                 :            :     {
     809                 :        711 :         pPage->InvalidateSpelling();
     810                 :        711 :         pPage->InvalidateSmartTags();   // SMARTTAGS
     811                 :        711 :         pPage->InvalidateAutoCompleteWords();
     812                 :        711 :         pPage->InvalidateWordCount();
     813                 :            :     }
     814                 :            : 
     815         [ +  + ]:        711 :     if ( GetNext() )
     816                 :            :     {
     817                 :        392 :         SwFrm* pNxt = GetNext();
     818                 :        392 :         pNxt->_InvalidatePrt();
     819                 :        392 :         pNxt->_InvalidatePos();
     820                 :        392 :         pNxt->InvalidatePage( pPage );
     821         [ +  + ]:        392 :         if( pNxt->IsSctFrm() )
     822                 :          6 :             pNxt = ((SwSectionFrm*)pNxt)->ContainsCntnt();
     823 [ +  - ][ +  + ]:        392 :         if( pNxt && pNxt->IsTxtFrm() && pNxt->IsInFtn() )
         [ +  + ][ +  + ]
     824                 :         10 :             pNxt->Prepare( PREP_FTN, 0, sal_False );
     825                 :            :     }
     826                 :            : 
     827         [ +  + ]:        711 :     if ( Frm().Height() )
     828                 :         48 :         pParent->Grow( Frm().Height() );
     829                 :            : 
     830         [ +  + ]:        711 :     if ( Frm().Width() != pParent->Prt().Width() )
     831                 :        639 :         Prepare( PREP_FIXSIZE_CHG );
     832                 :            : 
     833         [ +  + ]:        711 :     if ( GetPrev() )
     834                 :            :     {
     835         [ +  + ]:        417 :         if ( IsFollow() )
     836                 :            :             //I'm a direct follower of my master now
     837                 :         63 :             ((SwCntntFrm*)GetPrev())->Prepare( PREP_FOLLOW_FOLLOWS );
     838                 :            :         else
     839                 :            :         {
     840         [ +  + ]:        708 :             if ( GetPrev()->Frm().Height() !=
     841                 :        354 :                  GetPrev()->Prt().Height() + GetPrev()->Prt().Top() )
     842                 :            :             {
     843                 :            :                 // Take the border into account?
     844                 :         10 :                 GetPrev()->_InvalidatePrt();
     845                 :            :             }
     846                 :            :             // OD 18.02.2003 #104989# - force complete paint of previous frame,
     847                 :            :             // if frame is inserted at the end of a section frame, in order to
     848                 :            :             // get subsidiary lines repainted for the section.
     849 [ +  + ][ -  + ]:        354 :             if ( pParent->IsSctFrm() && !GetNext() )
                 [ -  + ]
     850                 :            :             {
     851                 :            :                 // force complete paint of previous frame, if new inserted frame
     852                 :            :                 // in the section is the last one.
     853                 :          0 :                 GetPrev()->SetCompletePaint();
     854                 :            :             }
     855                 :        354 :             GetPrev()->InvalidatePage( pPage );
     856                 :            :         }
     857                 :            :     }
     858         [ +  + ]:        711 :     if ( IsInFtn() )
     859                 :            :     {
     860                 :         12 :         SwFrm* pFrm = GetIndPrev();
     861 [ +  + ][ +  + ]:         12 :         if( pFrm && pFrm->IsSctFrm() )
                 [ +  + ]
     862                 :          2 :             pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
     863         [ +  + ]:         12 :         if( pFrm )
     864                 :          4 :             pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
     865         [ +  + ]:         12 :         if( !GetNext() )
     866                 :            :         {
     867                 :          2 :             pFrm = FindFtnFrm()->GetNext();
     868 [ #  # ][ -  + ]:          2 :             if( pFrm && 0 != (pFrm=((SwLayoutFrm*)pFrm)->ContainsAny()) )
                 [ -  + ]
     869                 :          0 :                 pFrm->_InvalidatePrt();
     870                 :            :         }
     871                 :            :     }
     872                 :            : 
     873                 :        711 :     _InvalidateLineNum();
     874                 :        711 :     SwFrm *pNxt = FindNextCnt();
     875         [ +  + ]:        711 :     if ( pNxt  )
     876                 :            :     {
     877 [ +  - ][ +  + ]:        505 :         while ( pNxt && pNxt->IsInTab() )
                 [ +  + ]
     878                 :            :         {
     879         [ +  - ]:         16 :             if( 0 != (pNxt = pNxt->FindTabFrm()) )
     880                 :         16 :                 pNxt = pNxt->FindNextCnt();
     881                 :            :         }
     882         [ +  - ]:        489 :         if ( pNxt )
     883                 :            :         {
     884                 :        489 :             pNxt->_InvalidateLineNum();
     885         [ +  + ]:        489 :             if ( pNxt != GetNext() )
     886                 :        117 :                 pNxt->InvalidatePage();
     887                 :            :         }
     888                 :            :     }
     889                 :        711 : }
     890                 :            : 
     891                 :            : /*************************************************************************
     892                 :            : |*
     893                 :            : |*  SwCntntFrm::Cut()
     894                 :            : |*
     895                 :            : |*************************************************************************/
     896                 :        279 : void SwCntntFrm::Cut()
     897                 :            : {
     898                 :            :     OSL_ENSURE( GetUpper(), "Cut without Upper()." );
     899                 :            : 
     900                 :        279 :     SwPageFrm *pPage = FindPageFrm();
     901                 :        279 :     InvalidatePage( pPage );
     902                 :        279 :     SwFrm *pFrm = GetIndPrev();
     903         [ +  + ]:        279 :     if( pFrm )
     904                 :            :     {
     905         [ +  + ]:        167 :         if( pFrm->IsSctFrm() )
     906                 :         22 :             pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
     907 [ +  + ][ +  + ]:        167 :         if ( pFrm && pFrm->IsCntntFrm() )
                 [ +  + ]
     908                 :            :         {
     909                 :        147 :             pFrm->_InvalidatePrt();
     910         [ +  + ]:        147 :             if( IsInFtn() )
     911                 :          4 :                 pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
     912                 :            :         }
     913                 :            :         // #i26250# - invalidate printing area of previous
     914                 :            :         // table frame.
     915 [ +  + ][ +  - ]:         20 :         else if ( pFrm && pFrm->IsTabFrm() )
                 [ +  + ]
     916                 :            :         {
     917                 :          4 :             pFrm->InvalidatePrt();
     918                 :            :         }
     919                 :            :     }
     920                 :            : 
     921                 :        279 :     SwFrm *pNxt = FindNextCnt();
     922         [ +  + ]:        279 :     if ( pNxt )
     923                 :            :     {
     924 [ +  - ][ +  + ]:        223 :         while ( pNxt && pNxt->IsInTab() )
                 [ +  + ]
     925                 :            :         {
     926         [ +  - ]:          6 :             if( 0 != (pNxt = pNxt->FindTabFrm()) )
     927                 :          6 :                 pNxt = pNxt->FindNextCnt();
     928                 :            :         }
     929         [ +  - ]:        217 :         if ( pNxt )
     930                 :            :         {
     931                 :        217 :             pNxt->_InvalidateLineNum();
     932         [ +  + ]:        217 :             if ( pNxt != GetNext() )
     933                 :        110 :                 pNxt->InvalidatePage();
     934                 :            :         }
     935                 :            :     }
     936                 :            : 
     937         [ +  + ]:        279 :     if( 0 != (pFrm = GetIndNext()) )
     938                 :            :     {
     939                 :            :         // The old follow may have calculated a gap to the predecessor which
     940                 :            :         // now becomes obsolete or different as it becomes the first one itself
     941                 :        187 :         pFrm->_InvalidatePrt();
     942                 :        187 :         pFrm->_InvalidatePos();
     943                 :        187 :         pFrm->InvalidatePage( pPage );
     944         [ +  + ]:        187 :         if( pFrm->IsSctFrm() )
     945                 :            :         {
     946                 :         58 :             pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
     947         [ +  + ]:         58 :             if( pFrm )
     948                 :            :             {
     949                 :         18 :                 pFrm->_InvalidatePrt();
     950                 :         18 :                 pFrm->_InvalidatePos();
     951                 :         18 :                 pFrm->InvalidatePage( pPage );
     952                 :            :             }
     953                 :            :         }
     954 [ +  + ][ +  + ]:        187 :         if( pFrm && IsInFtn() )
                 [ +  + ]
     955                 :          4 :             pFrm->Prepare( PREP_ERGOSUM, 0, sal_False );
     956 [ +  + ][ +  + ]:        187 :         if( IsInSct() && !GetPrev() )
                 [ +  + ]
     957                 :            :         {
     958                 :         46 :             SwSectionFrm* pSct = FindSctFrm();
     959         [ +  + ]:         46 :             if( !pSct->IsFollow() )
     960                 :            :             {
     961                 :          4 :                 pSct->_InvalidatePrt();
     962                 :          4 :                 pSct->InvalidatePage( pPage );
     963                 :            :             }
     964                 :            :         }
     965                 :            :     }
     966                 :            :     else
     967                 :            :     {
     968                 :         92 :         InvalidateNextPos();
     969                 :            :         //Someone needs to do the retouching: predecessor or upper
     970         [ +  + ]:         92 :         if ( 0 != (pFrm = GetPrev()) )
     971                 :         76 :         {   pFrm->SetRetouche();
     972                 :         76 :             pFrm->Prepare( PREP_WIDOWS_ORPHANS );
     973                 :         76 :             pFrm->_InvalidatePos();
     974                 :         76 :             pFrm->InvalidatePage( pPage );
     975                 :            :         }
     976                 :            :         // If I'm (was) the only CntntFrm in my upper, it has to do the
     977                 :            :         // retouching. Also, perhaps a page became empty.
     978                 :            :         else
     979                 :         16 :         {   SwRootFrm *pRoot = getRootFrm();
     980         [ +  - ]:         16 :             if ( pRoot )
     981                 :            :             {
     982                 :         16 :                 pRoot->SetSuperfluous();
     983                 :         16 :                 GetUpper()->SetCompletePaint();
     984                 :         16 :                 GetUpper()->InvalidatePage( pPage );
     985                 :            :             }
     986         [ -  + ]:         16 :             if( IsInSct() )
     987                 :            :             {
     988                 :          0 :                 SwSectionFrm* pSct = FindSctFrm();
     989         [ #  # ]:          0 :                 if( !pSct->IsFollow() )
     990                 :            :                 {
     991                 :          0 :                     pSct->_InvalidatePrt();
     992                 :          0 :                     pSct->InvalidatePage( pPage );
     993                 :            :                 }
     994                 :            :             }
     995                 :            :             // #i52253# The master table should take care
     996                 :            :             // of removing the follow flow line.
     997         [ -  + ]:         16 :             if ( IsInTab() )
     998                 :            :             {
     999                 :          0 :                 SwTabFrm* pThisTab = FindTabFrm();
    1000 [ #  # ][ #  # ]:          0 :                 SwTabFrm* pMasterTab = pThisTab && pThisTab->IsFollow() ? pThisTab->FindMaster() : 0;
    1001         [ #  # ]:          0 :                 if ( pMasterTab )
    1002                 :            :                 {
    1003                 :          0 :                     pMasterTab->_InvalidatePos();
    1004                 :          0 :                     pMasterTab->SetRemoveFollowFlowLinePending( sal_True );
    1005                 :            :                 }
    1006                 :            :             }
    1007                 :            :         }
    1008                 :            :     }
    1009                 :            :     //Remove first, then shrink the upper.
    1010                 :        279 :     SwLayoutFrm *pUp = GetUpper();
    1011                 :        279 :     Remove();
    1012         [ +  - ]:        279 :     if ( pUp )
    1013                 :            :     {
    1014                 :        279 :         SwSectionFrm *pSct = 0;
    1015   [ +  +  -  +  :        541 :         if ( !pUp->Lower() &&
          #  #  +  +  +  
                      - ]
           [ +  -  +  - ]
                 [ +  + ]
    1016                 :         62 :              ( ( pUp->IsFtnFrm() && !pUp->IsColLocked() ) ||
    1017                 :         62 :                ( pUp->IsInSct() &&
    1018                 :            :                  // #i29438#
    1019                 :            :                  // We have to consider the case that the section may be "empty"
    1020                 :            :                  // except from a temporary empty table frame.
    1021                 :            :                  // This can happen due to the new cell split feature.
    1022                 :         46 :                  !pUp->IsCellFrm() &&
    1023                 :            :                  // #126020# - adjust check for empty section
    1024                 :            :                  // #130797# - correct fix #126020#
    1025                 :         46 :                  !(pSct = pUp->FindSctFrm())->ContainsCntnt() &&
    1026                 :         46 :                  !pSct->ContainsAny( true ) ) ) )
    1027                 :            :         {
    1028         [ +  - ]:         46 :             if ( pUp->GetUpper() )
    1029                 :            :             {
    1030                 :            :                 //
    1031                 :            :                 // prevent delete of <ColLocked> footnote frame
    1032 [ -  + ][ #  # ]:         46 :                 if ( pUp->IsFtnFrm() && !pUp->IsColLocked())
                 [ -  + ]
    1033                 :            :                 {
    1034 [ #  # ][ #  # ]:          0 :                     if( pUp->GetNext() && !pUp->GetPrev() )
                 [ #  # ]
    1035                 :            :                     {
    1036                 :          0 :                         SwFrm* pTmp = ((SwLayoutFrm*)pUp->GetNext())->ContainsAny();
    1037         [ #  # ]:          0 :                         if( pTmp )
    1038                 :          0 :                             pTmp->_InvalidatePrt();
    1039                 :            :                     }
    1040                 :          0 :                     pUp->Cut();
    1041         [ #  # ]:          0 :                     delete pUp;
    1042                 :            :                 }
    1043                 :            :                 else
    1044                 :            :                 {
    1045                 :            :                     //
    1046 [ +  + ][ -  +  :         46 :                     if ( pSct->IsColLocked() || !pSct->IsInFtn() ||
             #  #  #  # ]
                 [ +  - ]
    1047                 :          0 :                          ( pUp->IsFtnFrm() && pUp->IsColLocked() ) )
    1048                 :            :                     {
    1049                 :         46 :                         pSct->DelEmpty( sal_False );
    1050                 :            :                         // If a locked section may not be deleted then at least
    1051                 :            :                         // its size became invalid after removing its last
    1052                 :            :                         // content.
    1053                 :         46 :                         pSct->_InvalidateSize();
    1054                 :            :                     }
    1055                 :            :                     else
    1056                 :            :                     {
    1057                 :          0 :                         pSct->DelEmpty( sal_True );
    1058         [ #  # ]:          0 :                         delete pSct;
    1059                 :            :                     }
    1060                 :            :                 }
    1061                 :            :             }
    1062                 :            :         }
    1063                 :            :         else
    1064                 :            :         {
    1065 [ -  + ][ #  # ]:        233 :             SWRECTFN( this )
         [ #  # ][ -  + ]
    1066         [ +  - ]:        233 :             long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
    1067         [ +  + ]:        233 :             if( nFrmHeight )
    1068                 :        183 :                 pUp->Shrink( nFrmHeight );
    1069                 :            :         }
    1070                 :            :     }
    1071                 :        279 : }
    1072                 :            : 
    1073                 :            : /*************************************************************************
    1074                 :            : |*
    1075                 :            : |*  SwLayoutFrm::Paste()
    1076                 :            : |*
    1077                 :            : |*************************************************************************/
    1078                 :       1585 : void SwLayoutFrm::Paste( SwFrm* pParent, SwFrm* pSibling)
    1079                 :            : {
    1080                 :            :     OSL_ENSURE( pParent, "No parent for pasting." );
    1081                 :            :     OSL_ENSURE( pParent->IsLayoutFrm(), "Parent is CntntFrm." );
    1082                 :            :     OSL_ENSURE( pParent != this, "I'm the parent oneself." );
    1083                 :            :     OSL_ENSURE( pSibling != this, "I'm my own neighbour." );
    1084                 :            :     OSL_ENSURE( !GetPrev() && !GetNext() && !GetUpper(),
    1085                 :            :             "I'm still registered somewhere." );
    1086                 :            : 
    1087                 :            :     //Insert in the tree.
    1088                 :       1585 :     InsertBefore( (SwLayoutFrm*)pParent, pSibling );
    1089                 :            : 
    1090                 :            :     // OD 24.10.2002 #103517# - correct setting of variable <fnRect>
    1091                 :            :     // <fnRect> is used for the following:
    1092                 :            :     // (1) To invalidate the frame's size, if its size, which has to be the
    1093                 :            :     //      same as its upper/parent, differs from its upper's/parent's.
    1094                 :            :     // (2) To adjust/grow the frame's upper/parent, if it has a dimension in its
    1095                 :            :     //      size, which is not determined by its upper/parent.
    1096                 :            :     // Which size is which depends on the frame type and the layout direction
    1097                 :            :     // (vertical or horizontal).
    1098                 :            :     // There are the following cases:
    1099                 :            :     // (A) Header and footer frames both in vertical and in horizontal layout
    1100                 :            :     //      have to size the width to the upper/parent. A dimension in the height
    1101                 :            :     //      has to cause a adjustment/grow of the upper/parent.
    1102                 :            :     //      --> <fnRect> = fnRectHori
    1103                 :            :     // (B) Cell and column frames in vertical layout, the width has to be the
    1104                 :            :     //          same as upper/parent and a dimension in height causes adjustment/grow
    1105                 :            :     //          of the upper/parent.
    1106                 :            :     //          --> <fnRect> = fnRectHori
    1107                 :            :     //      in horizontal layout the other way around
    1108                 :            :     //          --> <fnRect> = fnRectVert
    1109                 :            :     // (C) Other frames in vertical layout, the height has to be the
    1110                 :            :     //          same as upper/parent and a dimension in width causes adjustment/grow
    1111                 :            :     //          of the upper/parent.
    1112                 :            :     //          --> <fnRect> = fnRectVert
    1113                 :            :     //      in horizontal layout the other way around
    1114                 :            :     //          --> <fnRect> = fnRectHori
    1115                 :            :     //SwRectFn fnRect = IsVertical() ? fnRectHori : fnRectVert;
    1116                 :            :     SwRectFn fnRect;
    1117 [ +  + ][ +  + ]:       1585 :     if ( IsHeaderFrm() || IsFooterFrm() )
                 [ +  + ]
    1118                 :         68 :         fnRect = fnRectHori;
    1119 [ +  - ][ +  + ]:       1517 :     else if ( IsCellFrm() || IsColumnFrm() )
                 [ +  + ]
    1120                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1121 [ +  - ][ -  + ]:         42 :         fnRect = GetUpper()->IsVertical() ? fnRectHori : ( GetUpper()->IsVertLR() ? fnRectVertL2R : fnRectVert );
    1122                 :            :     else
    1123                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1124 [ -  + ][ #  # ]:       1475 :         fnRect = GetUpper()->IsVertical() ? ( GetUpper()->IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
    1125                 :            : 
    1126                 :            : 
    1127 [ +  - ][ +  - ]:       1585 :     if( (Frm().*fnRect->fnGetWidth)() != (pParent->Prt().*fnRect->fnGetWidth)())
                 [ +  + ]
    1128                 :        143 :         _InvalidateSize();
    1129                 :       1585 :     _InvalidatePos();
    1130                 :       1585 :     const SwPageFrm *pPage = FindPageFrm();
    1131                 :       1585 :     InvalidatePage( pPage );
    1132                 :            :     SwFrm *pFrm;
    1133         [ +  + ]:       1585 :     if( !IsColumnFrm() )
    1134                 :            :     {
    1135         [ +  + ]:       1543 :         if( 0 != ( pFrm = GetIndNext() ) )
    1136                 :            :         {
    1137                 :         38 :             pFrm->_InvalidatePos();
    1138         [ -  + ]:         38 :             if( IsInFtn() )
    1139                 :            :             {
    1140         [ #  # ]:          0 :                 if( pFrm->IsSctFrm() )
    1141                 :          0 :                     pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
    1142         [ #  # ]:          0 :                 if( pFrm )
    1143                 :          0 :                     pFrm->Prepare( PREP_ERGOSUM, 0, sal_False );
    1144                 :            :             }
    1145                 :            :         }
    1146 [ +  + ][ +  - ]:       1543 :         if ( IsInFtn() && 0 != ( pFrm = GetIndPrev() ) )
                 [ +  + ]
    1147                 :            :         {
    1148         [ -  + ]:         45 :             if( pFrm->IsSctFrm() )
    1149                 :          0 :                 pFrm = ((SwSectionFrm*)pFrm)->ContainsAny();
    1150         [ +  - ]:         45 :             if( pFrm )
    1151                 :         45 :                 pFrm->Prepare( PREP_QUOVADIS, 0, sal_False );
    1152                 :            :         }
    1153                 :            :     }
    1154                 :            : 
    1155 [ +  - ][ +  + ]:       1585 :     if( (Frm().*fnRect->fnGetHeight)() )
    1156                 :            :     {
    1157                 :            :         // AdjustNeighbourhood is now also called in columns which are not
    1158                 :            :         // placed inside a frame
    1159                 :       1412 :         sal_uInt8 nAdjust = GetUpper()->IsFtnBossFrm() ?
    1160                 :       1412 :                 ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
    1161         [ +  - ]:       2824 :                 : NA_GROW_SHRINK;
    1162         [ +  - ]:       1412 :         SwTwips nGrow = (Frm().*fnRect->fnGetHeight)();
    1163         [ +  - ]:       1412 :         if( NA_ONLY_ADJUST == nAdjust )
    1164                 :       1412 :             AdjustNeighbourhood( nGrow );
    1165                 :            :         else
    1166                 :            :         {
    1167                 :          0 :             SwTwips nReal = 0;
    1168         [ #  # ]:          0 :             if( NA_ADJUST_GROW == nAdjust )
    1169                 :          0 :                 nReal = AdjustNeighbourhood( nGrow );
    1170         [ #  # ]:          0 :             if( nReal < nGrow )
    1171                 :          0 :                 nReal += pParent->Grow( nGrow - nReal );
    1172 [ #  # ][ #  # ]:          0 :             if( NA_GROW_ADJUST == nAdjust && nReal < nGrow )
    1173                 :          0 :                 AdjustNeighbourhood( nGrow - nReal );
    1174                 :            :         }
    1175                 :            :     }
    1176                 :       1585 : }
    1177                 :            : 
    1178                 :            : /*************************************************************************
    1179                 :            : |*
    1180                 :            : |*  SwLayoutFrm::Cut()
    1181                 :            : |*
    1182                 :            : |*************************************************************************/
    1183                 :         56 : void SwLayoutFrm::Cut()
    1184                 :            : {
    1185         [ +  + ]:         56 :     if ( GetNext() )
    1186                 :          6 :         GetNext()->_InvalidatePos();
    1187                 :            : 
    1188 [ -  + ][ #  # ]:         56 :     SWRECTFN( this )
         [ #  # ][ -  + ]
    1189         [ +  - ]:         56 :     SwTwips nShrink = (Frm().*fnRect->fnGetHeight)();
    1190                 :            : 
    1191                 :            :     //Remove first, then shrink upper.
    1192                 :         56 :     SwLayoutFrm *pUp = GetUpper();
    1193                 :            : 
    1194                 :            :     // AdjustNeighbourhood is now also called in columns which are not
    1195                 :            :     // placed inside a frame
    1196                 :            : 
    1197                 :            :     // Remove must not be called before a AdjustNeighbourhood, but it has to
    1198                 :            :     // be called before the upper-shrink-call, if the upper-shrink takes care
    1199                 :            :     // of his content
    1200 [ +  - ][ +  - ]:         56 :     if ( pUp && nShrink )
    1201                 :            :     {
    1202         [ +  + ]:         56 :         if( pUp->IsFtnBossFrm() )
    1203                 :            :         {
    1204                 :         42 :             sal_uInt8 nAdjust= ((SwFtnBossFrm*)pUp)->NeighbourhoodAdjustment( this );
    1205         [ +  - ]:         42 :             if( NA_ONLY_ADJUST == nAdjust )
    1206                 :         42 :                 AdjustNeighbourhood( -nShrink );
    1207                 :            :             else
    1208                 :            :             {
    1209                 :          0 :                 SwTwips nReal = 0;
    1210         [ #  # ]:          0 :                 if( NA_ADJUST_GROW == nAdjust )
    1211                 :          0 :                     nReal = -AdjustNeighbourhood( -nShrink );
    1212         [ #  # ]:          0 :                 if( nReal < nShrink )
    1213                 :            :                 {
    1214         [ #  # ]:          0 :                     SwTwips nOldHeight = (Frm().*fnRect->fnGetHeight)();
    1215         [ #  # ]:          0 :                     (Frm().*fnRect->fnSetHeight)( 0 );
    1216                 :          0 :                     nReal += pUp->Shrink( nShrink - nReal );
    1217         [ #  # ]:          0 :                     (Frm().*fnRect->fnSetHeight)( nOldHeight );
    1218                 :            :                 }
    1219 [ #  # ][ #  # ]:          0 :                 if( NA_GROW_ADJUST == nAdjust && nReal < nShrink )
    1220                 :          0 :                     AdjustNeighbourhood( nReal - nShrink );
    1221                 :            :             }
    1222                 :         42 :             Remove();
    1223                 :            :         }
    1224                 :            :         else
    1225                 :            :         {
    1226                 :         14 :             Remove();
    1227                 :         14 :             pUp->Shrink( nShrink );
    1228                 :         56 :         }
    1229                 :            :     }
    1230                 :            :     else
    1231                 :          0 :         Remove();
    1232                 :            : 
    1233 [ +  - ][ +  + ]:         56 :     if( pUp && !pUp->Lower() )
                 [ +  + ]
    1234                 :            :     {
    1235                 :          8 :         pUp->SetCompletePaint();
    1236                 :          8 :         pUp->InvalidatePage();
    1237                 :            :     }
    1238                 :         56 : }
    1239                 :            : 
    1240                 :            : /*************************************************************************
    1241                 :            : |*
    1242                 :            : |*  SwFrm::Grow()
    1243                 :            : |*
    1244                 :            : |*************************************************************************/
    1245                 :      15186 : SwTwips SwFrm::Grow( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    1246                 :            : {
    1247                 :            :     OSL_ENSURE( nDist >= 0, "Negative growth?" );
    1248                 :            : 
    1249                 :            :     PROTOCOL_ENTER( this, bTst ? PROT_GROW_TST : PROT_GROW, 0, &nDist )
    1250                 :            : 
    1251         [ +  - ]:      15186 :     if ( nDist )
    1252                 :            :     {
    1253 [ -  + ][ #  # ]:      15186 :         SWRECTFN( this )
         [ #  # ][ -  + ]
    1254                 :            : 
    1255         [ +  - ]:      15186 :         SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
    1256 [ +  + ][ +  + ]:      15186 :         if( nPrtHeight > 0 && nDist > (LONG_MAX - nPrtHeight) )
    1257                 :       2332 :             nDist = LONG_MAX - nPrtHeight;
    1258                 :            : 
    1259         [ +  + ]:      15186 :         if ( IsFlyFrm() )
    1260                 :        191 :             return ((SwFlyFrm*)this)->_Grow( nDist, bTst );
    1261         [ +  + ]:      14995 :         else if( IsSctFrm() )
    1262                 :        539 :             return ((SwSectionFrm*)this)->_Grow( nDist, bTst );
    1263                 :            :         else
    1264                 :            :         {
    1265         [ -  + ]:      14456 :             const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
    1266         [ +  + ]:      14456 :             if ( pThisCell )
    1267                 :            :             {
    1268                 :        605 :                 const SwTabFrm* pTab = FindTabFrm();
    1269                 :            : 
    1270                 :            :                 // NEW TABLES
    1271         [ -  + ]:       1210 :                 if ( ( 0 != pTab->IsVertical() ) != ( 0 != IsVertical() ) ||
           [ +  -  -  + ]
    1272                 :        605 :                      pThisCell->GetLayoutRowSpan() < 1 )
    1273                 :          0 :                     return 0;
    1274                 :            :             }
    1275                 :            : 
    1276                 :      14456 :             const SwTwips nReal = GrowFrm( nDist, bTst, bInfo );
    1277         [ +  + ]:      14456 :             if( !bTst )
    1278                 :            :             {
    1279         [ +  - ]:      11720 :                 nPrtHeight = (Prt().*fnRect->fnGetHeight)();
    1280                 :      11720 :                 (Prt().*fnRect->fnSetHeight)( nPrtHeight +
    1281 [ +  + ][ +  - ]:      11720 :                         ( IsCntntFrm() ? nDist : nReal ) );
    1282                 :            :             }
    1283                 :      14456 :             return nReal;
    1284                 :            :         }
    1285                 :            :     }
    1286                 :      15186 :     return 0L;
    1287                 :            : }
    1288                 :            : 
    1289                 :            : /*************************************************************************
    1290                 :            : |*
    1291                 :            : |*  SwFrm::Shrink()
    1292                 :            : |*
    1293                 :            : |*************************************************************************/
    1294                 :       3770 : SwTwips SwFrm::Shrink( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    1295                 :            : {
    1296                 :            :     OSL_ENSURE( nDist >= 0, "Negative reduction?" );
    1297                 :            : 
    1298                 :            :     PROTOCOL_ENTER( this, bTst ? PROT_SHRINK_TST : PROT_SHRINK, 0, &nDist )
    1299                 :            : 
    1300         [ +  - ]:       3770 :     if ( nDist )
    1301                 :            :     {
    1302         [ +  + ]:       3770 :         if ( IsFlyFrm() )
    1303                 :         18 :             return ((SwFlyFrm*)this)->_Shrink( nDist, bTst );
    1304         [ +  + ]:       3752 :         else if( IsSctFrm() )
    1305                 :         93 :             return ((SwSectionFrm*)this)->_Shrink( nDist, bTst );
    1306                 :            :         else
    1307                 :            :         {
    1308         [ -  + ]:       3659 :             const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
    1309         [ +  + ]:       3659 :             if ( pThisCell )
    1310                 :            :             {
    1311                 :        909 :                 const SwTabFrm* pTab = FindTabFrm();
    1312                 :            : 
    1313                 :            :                 // NEW TABLES
    1314         [ -  + ]:       1818 :                 if ( ( 0 != pTab->IsVertical() ) != ( 0 != IsVertical() ) ||
           [ +  -  -  + ]
    1315                 :        909 :                      pThisCell->GetLayoutRowSpan() < 1 )
    1316                 :          0 :                     return 0;
    1317                 :            :             }
    1318                 :            : 
    1319 [ +  + ][ +  - ]:       3659 :             SWRECTFN( this )
         [ -  + ][ -  + ]
    1320         [ +  - ]:       3659 :             SwTwips nReal = (Frm().*fnRect->fnGetHeight)();
    1321                 :       3659 :             ShrinkFrm( nDist, bTst, bInfo );
    1322         [ +  - ]:       3659 :             nReal -= (Frm().*fnRect->fnGetHeight)();
    1323         [ +  - ]:       3659 :             if( !bTst )
    1324                 :            :             {
    1325         [ +  - ]:       3659 :                 const SwTwips nPrtHeight = (Prt().*fnRect->fnGetHeight)();
    1326                 :       3659 :                 (Prt().*fnRect->fnSetHeight)( nPrtHeight -
    1327 [ +  + ][ +  - ]:       3659 :                         ( IsCntntFrm() ? nDist : nReal ) );
    1328                 :            :             }
    1329                 :       3659 :             return nReal;
    1330                 :            :         }
    1331                 :            :     }
    1332                 :       3770 :     return 0L;
    1333                 :            : }
    1334                 :            : 
    1335                 :            : /*************************************************************************
    1336                 :            : |*
    1337                 :            : |*  SwFrm::AdjustNeighbourhood()
    1338                 :            : |*
    1339                 :            : |*  Description         A Frm needs "normalization" if it is directly placed
    1340                 :            : |*       below a footnote boss (page/column) and its size changed.
    1341                 :            : |*       There's always a frame which takes the maximum possible space (the
    1342                 :            : |*       frame which contains the Body.Text) and zero or more frames which
    1343                 :            : |*       only take the space needed (header/footer area, footnote container).
    1344                 :            : |*       If one of these frames changes, the body-text-frame has to grow or
    1345                 :            : |*       shrink accordingly, even tough it's fixed.
    1346                 :            : |*       !! Is it possible to do this in a generic way and not restrict it to
    1347                 :            : |*       the page and a distinct frame which takes the maximum space (controlled
    1348                 :            : |*       using the FrmSize attribute)? Problems: What if multiple frames taking
    1349                 :            : |*       the maximum space are placed next to each other?
    1350                 :            : |*       How is the maximum space calculated?
    1351                 :            : |*       How small can those frames become?
    1352                 :            : |*
    1353                 :            : |*       In any case, only a certain amount of space is allowed, so we
    1354                 :            : |*       never go below a minimum value for the height of the body.
    1355                 :            : |*
    1356                 :            : |*  Parameter: nDiff is the value around which the space has to be allocated
    1357                 :            : |*
    1358                 :            : |*************************************************************************/
    1359                 :       2049 : SwTwips SwFrm::AdjustNeighbourhood( SwTwips nDiff, sal_Bool bTst )
    1360                 :            : {
    1361                 :            :     PROTOCOL_ENTER( this, PROT_ADJUSTN, 0, &nDiff );
    1362                 :            : 
    1363 [ +  - ][ -  + ]:       2049 :     if ( !nDiff || !GetUpper()->IsFtnBossFrm() ) // only inside pages/columns
                 [ -  + ]
    1364                 :          0 :         return 0L;
    1365                 :            : 
    1366                 :       2049 :     const ViewShell *pSh = getRootFrm()->GetCurrShell();
    1367 [ +  + ][ +  + ]:       2049 :     const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
    1368                 :            : 
    1369                 :            :     //The (Page-)Body only changes in BrowseMode, but only if it does not
    1370                 :            :     //contain columns.
    1371 [ +  + ][ +  +  :       2073 :     if ( IsPageBodyFrm() && (!bBrowse ||
             +  -  -  + ]
                 [ +  + ]
    1372                 :         12 :           (((SwLayoutFrm*)this)->Lower() &&
    1373                 :         12 :            ((SwLayoutFrm*)this)->Lower()->IsColumnFrm())) )
    1374                 :       1412 :         return 0L;
    1375                 :            : 
    1376                 :            :     //In BrowseView mode the PageFrm can handle some of the requests.
    1377                 :        637 :     long nBrowseAdd = 0;
    1378 [ +  + ][ +  - ]:        637 :     if ( bBrowse && GetUpper()->IsPageFrm() ) // only (Page-)BodyFrms
                 [ +  + ]
    1379                 :            :     {
    1380                 :         12 :         ViewShell *pViewShell = getRootFrm()->GetCurrShell();
    1381                 :         12 :         SwLayoutFrm *pUp = GetUpper();
    1382                 :            :         long nChg;
    1383                 :         12 :         const long nUpPrtBottom = pUp->Frm().Height() -
    1384                 :         12 :                                   pUp->Prt().Height() - pUp->Prt().Top();
    1385                 :         12 :         SwRect aInva( pUp->Frm() );
    1386         [ +  - ]:         12 :         if ( pViewShell )
    1387                 :            :         {
    1388                 :         12 :             aInva.Pos().X() = pViewShell->VisArea().Left();
    1389                 :         12 :             aInva.Width( pViewShell->VisArea().Width() );
    1390                 :            :         }
    1391         [ +  + ]:         12 :         if ( nDiff > 0 )
    1392                 :            :         {
    1393                 :          4 :             nChg = BROWSE_HEIGHT - pUp->Frm().Height();
    1394                 :          4 :             nChg = Min( nDiff, nChg );
    1395                 :            : 
    1396         [ -  + ]:          4 :             if ( !IsBodyFrm() )
    1397                 :            :             {
    1398                 :          0 :                 SetCompletePaint();
    1399 [ #  # ][ #  # ]:          0 :                 if ( !pViewShell || pViewShell->VisArea().Height() >= pUp->Frm().Height() )
                 [ #  # ]
    1400                 :            :                 {
    1401                 :            :                     //First minimize Body, it will grow again later.
    1402         [ #  # ]:          0 :                     SwFrm *pBody = ((SwFtnBossFrm*)pUp)->FindBodyCont();
    1403                 :          0 :                     const long nTmp = nChg - pBody->Prt().Height();
    1404         [ #  # ]:          0 :                     if ( !bTst )
    1405                 :            :                     {
    1406                 :          0 :                         pBody->Frm().Height(Max( 0L, pBody->Frm().Height() - nChg ));
    1407         [ #  # ]:          0 :                         pBody->_InvalidatePrt();
    1408         [ #  # ]:          0 :                         pBody->_InvalidateSize();
    1409         [ #  # ]:          0 :                         if ( pBody->GetNext() )
    1410         [ #  # ]:          0 :                             pBody->GetNext()->_InvalidatePos();
    1411         [ #  # ]:          0 :                         if ( !IsHeaderFrm() )
    1412                 :          0 :                             pBody->SetCompletePaint();
    1413                 :            :                     }
    1414                 :          0 :                     nChg = nTmp <= 0 ? 0 : nTmp;
    1415                 :            :                 }
    1416                 :            :             }
    1417                 :            : 
    1418                 :          4 :             const long nTmp = nUpPrtBottom + 20;
    1419                 :          4 :             aInva.Top( aInva.Bottom() - nTmp );
    1420                 :          4 :             aInva.Height( nChg + nTmp );
    1421                 :            :         }
    1422                 :            :         else
    1423                 :            :         {
    1424                 :            :             //The page can shrink to 0. The fist page keeps the same size like
    1425                 :            :             //VisArea.
    1426                 :          8 :             nChg = nDiff;
    1427                 :          8 :             long nInvaAdd = 0;
    1428         [ +  - ]:         16 :             if ( pViewShell && !pUp->GetPrev() &&
           [ +  -  +  - ]
                 [ +  - ]
    1429                 :          8 :                  pUp->Frm().Height() + nDiff < pViewShell->VisArea().Height() )
    1430                 :            :             {
    1431                 :            :                 // This means that we have to invalidate adequately.
    1432                 :          8 :                 nChg = pViewShell->VisArea().Height() - pUp->Frm().Height();
    1433                 :          8 :                 nInvaAdd = -(nDiff - nChg);
    1434                 :            :             }
    1435                 :            : 
    1436                 :            :             //Invalidate including bottom border.
    1437                 :          8 :             long nBorder = nUpPrtBottom + 20;
    1438                 :          8 :             nBorder -= nChg;
    1439                 :          8 :             aInva.Top( aInva.Bottom() - (nBorder+nInvaAdd) );
    1440         [ -  + ]:          8 :             if ( !IsBodyFrm() )
    1441                 :            :             {
    1442                 :          0 :                 SetCompletePaint();
    1443         [ #  # ]:          0 :                 if ( !IsHeaderFrm() )
    1444         [ #  # ]:          0 :                     ((SwFtnBossFrm*)pUp)->FindBodyCont()->SetCompletePaint();
    1445                 :            :             }
    1446                 :            :             //Invalidate the page because of the frames. Thereby the page becomes
    1447                 :            :             //the right size again if a frame didn't fit. This only works
    1448                 :            :             //randomly for paragraph bound frames otherwise (NotifyFlys).
    1449         [ +  - ]:          8 :             pUp->InvalidateSize();
    1450                 :            :         }
    1451         [ +  - ]:         12 :         if ( !bTst )
    1452                 :            :         {
    1453                 :            :             //Independent from nChg
    1454 [ +  - ][ +  - ]:         12 :             if ( pViewShell && aInva.HasArea() && pUp->GetUpper() )
         [ +  + ][ +  - ]
                 [ +  + ]
    1455         [ +  - ]:          8 :                 pViewShell->InvalidateWindows( aInva );
    1456                 :            :         }
    1457 [ +  - ][ +  + ]:         12 :         if ( !bTst && nChg )
    1458                 :            :         {
    1459                 :          4 :             const SwRect aOldRect( pUp->Frm() );
    1460                 :          4 :             pUp->Frm().SSize().Height() += nChg;
    1461                 :          4 :             pUp->Prt().SSize().Height() += nChg;
    1462         [ +  - ]:          4 :             if ( pViewShell )
    1463                 :          4 :                 pViewShell->Imp()->SetFirstVisPageInvalid();
    1464                 :            : 
    1465         [ -  + ]:          4 :             if ( GetNext() )
    1466         [ #  # ]:          0 :                 GetNext()->_InvalidatePos();
    1467                 :            : 
    1468                 :            :             //Trigger a repaint if necessary.
    1469 [ +  - ][ +  - ]:          4 :             const SvxGraphicPosition ePos = pUp->GetFmt()->GetBackground().GetGraphicPos();
    1470 [ #  # ][ -  + ]:          4 :             if ( ePos != GPOS_NONE && ePos != GPOS_TILED )
    1471         [ #  # ]:          0 :                 pViewShell->InvalidateWindows( pUp->Frm() );
    1472                 :            : 
    1473         [ +  - ]:          4 :             if ( pUp->GetUpper() )
    1474                 :            :             {
    1475         [ -  + ]:          4 :                 if ( pUp->GetNext() )
    1476         [ #  # ]:          0 :                     pUp->GetNext()->InvalidatePos();
    1477                 :            : 
    1478                 :            :                 //Sad but true: during notify on ViewImp a Calc on the page and
    1479                 :            :                 //its Lower may be called. The values should not be changed
    1480                 :            :                 //because the caller takes care of the adjustment of Frm and
    1481                 :            :                 //Prt.
    1482                 :          4 :                 const long nOldFrmHeight = Frm().Height();
    1483                 :          4 :                 const long nOldPrtHeight = Prt().Height();
    1484                 :          4 :                 const sal_Bool bOldComplete = IsCompletePaint();
    1485         [ +  - ]:          4 :                 if ( IsBodyFrm() )
    1486                 :          4 :                     Prt().SSize().Height() = nOldFrmHeight;
    1487                 :            : 
    1488                 :            :                 // PAGES01
    1489         [ +  - ]:          4 :                 if ( pUp->GetUpper() )
    1490         [ +  - ]:          4 :                     static_cast<SwRootFrm*>(pUp->GetUpper())->CheckViewLayout( 0, 0 );
    1491                 :            :                 //((SwPageFrm*)pUp)->AdjustRootSize( CHG_CHGPAGE, &aOldRect );
    1492                 :            : 
    1493                 :          4 :                 Frm().SSize().Height() = nOldFrmHeight;
    1494                 :          4 :                 Prt().SSize().Height() = nOldPrtHeight;
    1495                 :          4 :                 bCompletePaint = bOldComplete;
    1496                 :            :             }
    1497         [ -  + ]:          4 :             if ( !IsBodyFrm() )
    1498         [ #  # ]:          0 :                 pUp->_InvalidateSize();
    1499         [ +  - ]:          4 :             InvalidatePage( (SwPageFrm*)pUp );
    1500                 :            :         }
    1501                 :         12 :         nDiff -= nChg;
    1502         [ +  + ]:         12 :         if ( !nDiff )
    1503                 :          4 :             return nChg;
    1504                 :            :         else
    1505                 :          8 :             nBrowseAdd = nChg;
    1506                 :            :     }
    1507                 :            : 
    1508                 :        633 :     const SwFtnBossFrm *pBoss = (SwFtnBossFrm*)GetUpper();
    1509                 :            : 
    1510                 :        633 :     SwTwips nReal = 0,
    1511                 :        633 :             nAdd  = 0;
    1512                 :        633 :     SwFrm *pFrm = 0;
    1513 [ #  # ][ #  # ]:        633 :     SWRECTFN( this )
         [ -  + ][ -  + ]
    1514                 :            : 
    1515         [ +  + ]:        633 :     if( IsBodyFrm() )
    1516                 :            :     {
    1517         [ -  + ]:         20 :         if( IsInSct() )
    1518                 :            :         {
    1519                 :          0 :             SwSectionFrm *pSect = FindSctFrm();
    1520         [ #  # ]:          0 :             if( nDiff > 0 && pSect->IsEndnAtEnd() && GetNext() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1521                 :          0 :                 GetNext()->IsFtnContFrm() )
    1522                 :            :             {
    1523                 :          0 :                 SwFtnContFrm* pCont = (SwFtnContFrm*)GetNext();
    1524                 :          0 :                 SwTwips nMinH = 0;
    1525                 :          0 :                 SwFtnFrm* pFtn = (SwFtnFrm*)pCont->Lower();
    1526                 :          0 :                 sal_Bool bFtn = sal_False;
    1527         [ #  # ]:          0 :                 while( pFtn )
    1528                 :            :                 {
    1529         [ #  # ]:          0 :                     if( !pFtn->GetAttr()->GetFtn().IsEndNote() )
    1530                 :            :                     {
    1531         [ #  # ]:          0 :                         nMinH += (pFtn->Frm().*fnRect->fnGetHeight)();
    1532                 :          0 :                         bFtn = sal_True;
    1533                 :            :                     }
    1534                 :          0 :                     pFtn = (SwFtnFrm*)pFtn->GetNext();
    1535                 :            :                 }
    1536         [ #  # ]:          0 :                 if( bFtn )
    1537         [ #  # ]:          0 :                     nMinH += (pCont->Prt().*fnRect->fnGetTop)();
    1538         [ #  # ]:          0 :                 nReal = (pCont->Frm().*fnRect->fnGetHeight)() - nMinH;
    1539         [ #  # ]:          0 :                 if( nReal > nDiff )
    1540                 :          0 :                     nReal = nDiff;
    1541         [ #  # ]:          0 :                 if( nReal > 0 )
    1542                 :          0 :                     pFrm = GetNext();
    1543                 :            :                 else
    1544                 :          0 :                     nReal = 0;
    1545                 :            :             }
    1546 [ #  # ][ #  # ]:          0 :             if( !bTst && !pSect->IsColLocked() )
                 [ #  # ]
    1547                 :          0 :                 pSect->InvalidateSize();
    1548                 :            :         }
    1549         [ +  - ]:         20 :         if( !pFrm )
    1550                 :         20 :             return nBrowseAdd;
    1551                 :            :     }
    1552                 :            :     else
    1553                 :            :     {
    1554 [ +  - ][ +  + ]:        613 :         const sal_Bool bFtnPage = pBoss->IsPageFrm() && ((SwPageFrm*)pBoss)->IsFtnPage();
    1555 [ +  + ][ -  + ]:        613 :         if ( bFtnPage && !IsFtnContFrm() )
                 [ -  + ]
    1556                 :          0 :             pFrm = (SwFrm*)pBoss->FindFtnCont();
    1557         [ +  - ]:        613 :         if ( !pFrm )
    1558                 :        613 :             pFrm = (SwFrm*)pBoss->FindBodyCont();
    1559                 :            : 
    1560         [ -  + ]:        613 :         if ( !pFrm )
    1561                 :          0 :             return 0;
    1562                 :            : 
    1563                 :            :         //If not one is found, everything else is solved.
    1564         [ +  - ]:        613 :         nReal = (pFrm->Frm().*fnRect->fnGetHeight)();
    1565         [ +  + ]:        613 :         if( nReal > nDiff )
    1566                 :        603 :             nReal = nDiff;
    1567         [ +  + ]:        613 :         if( !bFtnPage )
    1568                 :            :         {
    1569                 :            :             //Respect the minimal boundary!
    1570         [ +  - ]:        593 :             if( nReal )
    1571                 :            :             {
    1572                 :        593 :                 const SwTwips nMax = pBoss->GetVarSpace();
    1573         [ -  + ]:        593 :                 if ( nReal > nMax )
    1574                 :          0 :                     nReal = nMax;
    1575                 :            :             }
    1576 [ +  + ][ -  +  :        593 :             if( !IsFtnContFrm() && nDiff > nReal &&
          #  #  #  #  #  
              # ][ -  + ]
    1577                 :          0 :                 pFrm->GetNext() && pFrm->GetNext()->IsFtnContFrm()
    1578                 :          0 :                 && ( pFrm->GetNext()->IsVertical() == IsVertical() )
    1579                 :            :                 )
    1580                 :            :             {
    1581                 :            :                 //If the Body doesn't return enough, we look for a footnote, if
    1582                 :            :                 //there is one, we steal there accordingly.
    1583                 :          0 :                 const SwTwips nAddMax = (pFrm->GetNext()->Frm().*fnRect->
    1584         [ #  # ]:          0 :                                         fnGetHeight)();
    1585                 :          0 :                 nAdd = nDiff - nReal;
    1586         [ #  # ]:          0 :                 if ( nAdd > nAddMax )
    1587                 :          0 :                     nAdd = nAddMax;
    1588         [ #  # ]:          0 :                 if ( !bTst )
    1589                 :            :                 {
    1590         [ #  # ]:          0 :                     (pFrm->GetNext()->Frm().*fnRect->fnSetHeight)(nAddMax-nAdd);
    1591                 :            :                     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1592 [ #  # ][ #  # ]:          0 :                     if( bVert && !bVertL2R && !bRev )
                 [ #  # ]
    1593                 :          0 :                         pFrm->GetNext()->Frm().Pos().X() += nAdd;
    1594                 :          0 :                     pFrm->GetNext()->InvalidatePrt();
    1595         [ #  # ]:          0 :                     if ( pFrm->GetNext()->GetNext() )
    1596                 :          0 :                         pFrm->GetNext()->GetNext()->_InvalidatePos();
    1597                 :            :                 }
    1598                 :            :             }
    1599                 :            :         }
    1600                 :            :     }
    1601                 :            : 
    1602 [ +  + ][ +  - ]:        613 :     if ( !bTst && nReal )
    1603                 :            :     {
    1604         [ +  - ]:        332 :         SwTwips nTmp = (pFrm->Frm().*fnRect->fnGetHeight)();
    1605         [ +  - ]:        332 :         (pFrm->Frm().*fnRect->fnSetHeight)( nTmp - nReal );
    1606                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1607 [ #  # ][ #  # ]:        332 :         if( bVert && !bVertL2R && !bRev )
                 [ -  + ]
    1608                 :          0 :             pFrm->Frm().Pos().X() += nReal;
    1609                 :        332 :         pFrm->InvalidatePrt();
    1610         [ +  + ]:        332 :         if ( pFrm->GetNext() )
    1611                 :        309 :             pFrm->GetNext()->_InvalidatePos();
    1612 [ +  + ][ -  + ]:        332 :         if( nReal < 0 && pFrm->IsInSct() )
                 [ -  + ]
    1613                 :            :         {
    1614                 :          0 :             SwLayoutFrm* pUp = pFrm->GetUpper();
    1615         [ #  # ]:          0 :             if( pUp && 0 != ( pUp = pUp->GetUpper() ) && pUp->IsSctFrm() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1616                 :          0 :                 !pUp->IsColLocked() )
    1617                 :          0 :                 pUp->InvalidateSize();
    1618                 :            :         }
    1619 [ +  + ][ +  + ]:        332 :         if( ( IsHeaderFrm() || IsFooterFrm() ) && pBoss->GetDrawObjs() )
         [ -  + ][ -  + ]
    1620                 :            :         {
    1621                 :          0 :             const SwSortedObjs &rObjs = *pBoss->GetDrawObjs();
    1622                 :            :             OSL_ENSURE( pBoss->IsPageFrm(), "Header/Footer out of page?" );
    1623         [ #  # ]:          0 :             for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
    1624                 :            :             {
    1625                 :          0 :                 SwAnchoredObject* pAnchoredObj = rObjs[i];
    1626         [ #  # ]:          0 :                 if ( pAnchoredObj->ISA(SwFlyFrm) )
    1627                 :            :                 {
    1628         [ #  # ]:          0 :                     SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
    1629                 :            :                     OSL_ENSURE( !pFly->IsFlyInCntFrm(), "FlyInCnt at Page?" );
    1630                 :            :                     const SwFmtVertOrient &rVert =
    1631                 :          0 :                                         pFly->GetFmt()->GetVertOrient();
    1632                 :            :                     // When do we have to invalidate?
    1633                 :            :                     // If a frame is aligned on a PageTextArea and the header
    1634                 :            :                     // changes a TOP, MIDDLE or NONE aligned frame needs to
    1635                 :            :                     // recalculate it's position; if the footer changes a BOTTOM
    1636                 :            :                     // or MIDDLE aligned frame needs to recalculate it's
    1637                 :            :                     // position.
    1638 [ #  # ][ #  #  :          0 :                     if( ( rVert.GetRelationOrient() == text::RelOrientation::PRINT_AREA ||
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
    1639                 :          0 :                           rVert.GetRelationOrient() == text::RelOrientation::PAGE_PRINT_AREA )    &&
    1640                 :          0 :                         ((IsHeaderFrm() && rVert.GetVertOrient()!=text::VertOrientation::BOTTOM) ||
    1641                 :          0 :                          (IsFooterFrm() && rVert.GetVertOrient()!=text::VertOrientation::NONE &&
    1642                 :          0 :                           rVert.GetVertOrient() != text::VertOrientation::TOP)) )
    1643                 :            :                     {
    1644                 :          0 :                         pFly->_InvalidatePos();
    1645                 :          0 :                         pFly->_Invalidate();
    1646                 :            :                     }
    1647                 :            :                 }
    1648                 :            :             }
    1649                 :            :         }
    1650                 :            :     }
    1651                 :       2049 :     return (nBrowseAdd + nReal + nAdd);
    1652                 :            : }
    1653                 :            : 
    1654                 :            : /*************************************************************************
    1655                 :            : |*
    1656                 :            : |*  SwFrm::ImplInvalidateSize(), ImplInvalidatePrt(), ImplInvalidatePos(),
    1657                 :            : |*         ImplInvalidateLineNum()
    1658                 :            : |*
    1659                 :            : |*************************************************************************/
    1660                 :            : /** method to perform additional actions on an invalidation
    1661                 :            : 
    1662                 :            :     OD 2004-05-19 #i28701#
    1663                 :            : 
    1664                 :            :     @author OD
    1665                 :            : */
    1666                 :      54645 : void SwFrm::_ActionOnInvalidation( const InvalidationType )
    1667                 :            : {
    1668                 :            :     // default behaviour is to perform no additional action
    1669                 :      54645 : }
    1670                 :            : 
    1671                 :            : /** method to determine, if an invalidation is allowed.
    1672                 :            : 
    1673                 :            :     OD 2004-05-19 #i28701#
    1674                 :            : 
    1675                 :            :     @author OD
    1676                 :            : */
    1677                 :      55198 : bool SwFrm::_InvalidationAllowed( const InvalidationType ) const
    1678                 :            : {
    1679                 :            :     // default behaviour is to allow invalidation
    1680                 :      55198 :     return true;
    1681                 :            : }
    1682                 :            : 
    1683                 :      14921 : void SwFrm::ImplInvalidateSize()
    1684                 :            : {
    1685         [ +  - ]:      14921 :     if ( _InvalidationAllowed( INVALID_SIZE ) )
    1686                 :            :     {
    1687                 :      14921 :         bValidSize = sal_False;
    1688         [ -  + ]:      14921 :         if ( IsFlyFrm() )
    1689                 :          0 :             ((SwFlyFrm*)this)->_Invalidate();
    1690                 :            :         else
    1691                 :      14921 :             InvalidatePage();
    1692                 :            : 
    1693                 :            :         // OD 2004-05-19 #i28701#
    1694                 :      14921 :         _ActionOnInvalidation( INVALID_SIZE );
    1695                 :            :     }
    1696                 :      14921 : }
    1697                 :            : 
    1698                 :       6322 : void SwFrm::ImplInvalidatePrt()
    1699                 :            : {
    1700         [ +  - ]:       6322 :     if ( _InvalidationAllowed( INVALID_PRTAREA ) )
    1701                 :            :     {
    1702                 :       6322 :         bValidPrtArea = sal_False;
    1703         [ -  + ]:       6322 :         if ( IsFlyFrm() )
    1704                 :          0 :             ((SwFlyFrm*)this)->_Invalidate();
    1705                 :            :         else
    1706                 :       6322 :             InvalidatePage();
    1707                 :            : 
    1708                 :            :         // OD 2004-05-19 #i28701#
    1709                 :       6322 :         _ActionOnInvalidation( INVALID_PRTAREA );
    1710                 :            :     }
    1711                 :       6322 : }
    1712                 :            : 
    1713                 :       8273 : void SwFrm::ImplInvalidatePos()
    1714                 :            : {
    1715         [ +  + ]:       8273 :     if ( _InvalidationAllowed( INVALID_POS ) )
    1716                 :            :     {
    1717                 :       8264 :         bValidPos = sal_False;
    1718         [ +  + ]:       8264 :         if ( IsFlyFrm() )
    1719                 :            :         {
    1720                 :        256 :             ((SwFlyFrm*)this)->_Invalidate();
    1721                 :            :         }
    1722                 :            :         else
    1723                 :            :         {
    1724                 :       8008 :             InvalidatePage();
    1725                 :            :         }
    1726                 :            : 
    1727                 :            :         // OD 2004-05-19 #i28701#
    1728                 :       8264 :         _ActionOnInvalidation( INVALID_POS );
    1729                 :            :     }
    1730                 :       8273 : }
    1731                 :            : 
    1732                 :       3765 : void SwFrm::ImplInvalidateLineNum()
    1733                 :            : {
    1734         [ +  - ]:       3765 :     if ( _InvalidationAllowed( INVALID_LINENUM ) )
    1735                 :            :     {
    1736                 :       3765 :         bValidLineNum = sal_False;
    1737                 :            :         OSL_ENSURE( IsTxtFrm(), "line numbers are implemented for text only" );
    1738                 :       3765 :         InvalidatePage();
    1739                 :            : 
    1740                 :            :         // OD 2004-05-19 #i28701#
    1741                 :       3765 :         _ActionOnInvalidation( INVALID_LINENUM );
    1742                 :            :     }
    1743                 :       3765 : }
    1744                 :            : 
    1745                 :            : /*************************************************************************
    1746                 :            : |*
    1747                 :            : |*  SwFrm::ReinitializeFrmSizeAttrFlags
    1748                 :            : |*
    1749                 :            : |*************************************************************************/
    1750                 :         24 : void SwFrm::ReinitializeFrmSizeAttrFlags()
    1751                 :            : {
    1752                 :         24 :     const SwFmtFrmSize &rFmtSize = GetAttrSet()->GetFrmSize();
    1753         [ +  + ]:         30 :     if ( ATT_VAR_SIZE == rFmtSize.GetHeightSizeType() ||
           [ +  +  -  + ]
    1754                 :          6 :          ATT_MIN_SIZE == rFmtSize.GetHeightSizeType())
    1755                 :            :     {
    1756                 :         18 :         bFixSize = sal_False;
    1757         [ +  + ]:         18 :         if ( GetType() & (FRM_HEADER | FRM_FOOTER | FRM_ROW) )
    1758                 :            :         {
    1759                 :         12 :             SwFrm *pFrm = ((SwLayoutFrm*)this)->Lower();
    1760         [ +  + ]:         72 :             while ( pFrm )
    1761                 :         60 :             {   pFrm->_InvalidateSize();
    1762                 :         60 :                 pFrm->_InvalidatePrt();
    1763                 :         60 :                 pFrm = pFrm->GetNext();
    1764                 :            :             }
    1765                 :         12 :             SwCntntFrm *pCnt = ((SwLayoutFrm*)this)->ContainsCntnt();
    1766                 :            :             // #i36991# - be save.
    1767                 :            :             // E.g., a row can contain *no* content.
    1768         [ +  - ]:         12 :             if ( pCnt )
    1769                 :            :             {
    1770                 :         12 :                 pCnt->InvalidatePage();
    1771         [ +  + ]:         60 :                 do
    1772                 :            :                 {
    1773                 :         60 :                     pCnt->Prepare( PREP_ADJUST_FRM );
    1774                 :         60 :                     pCnt->_InvalidateSize();
    1775                 :         60 :                     pCnt = pCnt->GetNextCntntFrm();
    1776                 :         60 :                 } while ( ((SwLayoutFrm*)this)->IsAnLower( pCnt ) );
    1777                 :            :             }
    1778                 :            :         }
    1779                 :            :     }
    1780         [ +  - ]:          6 :     else if ( rFmtSize.GetHeightSizeType() == ATT_FIX_SIZE )
    1781                 :            :     {
    1782         [ -  + ]:          6 :         if( IsVertical() )
    1783         [ #  # ]:          0 :             ChgSize( Size( rFmtSize.GetWidth(), Frm().Height()));
    1784                 :            :         else
    1785         [ +  - ]:          6 :             ChgSize( Size( Frm().Width(), rFmtSize.GetHeight()));
    1786                 :            :     }
    1787                 :         24 : }
    1788                 :            : 
    1789                 :            : /*************************************************************************
    1790                 :            : |*  SwFrm::ValidateThisAndAllLowers()
    1791                 :            :  *
    1792                 :            :  * FME 2007-08-30 #i81146# new loop control
    1793                 :            : |*************************************************************************/
    1794                 :          0 : void SwFrm::ValidateThisAndAllLowers( const sal_uInt16 nStage )
    1795                 :            : {
    1796                 :            :     // Stage 0: Only validate frames. Do not process any objects.
    1797                 :            :     // Stage 1: Only validate fly frames and all of their contents.
    1798                 :            :     // Stage 2: Validate all.
    1799                 :            : 
    1800                 :          0 :     const bool bOnlyObject = 1 == nStage;
    1801                 :          0 :     const bool bIncludeObjects = 1 <= nStage;
    1802                 :            : 
    1803 [ #  # ][ #  # ]:          0 :     if ( !bOnlyObject || ISA(SwFlyFrm) )
                 [ #  # ]
    1804                 :            :     {
    1805                 :          0 :         bValidSize = sal_True;
    1806                 :          0 :         bValidPrtArea = sal_True;
    1807                 :          0 :         bValidPos = sal_True;
    1808                 :            :     }
    1809                 :            : 
    1810         [ #  # ]:          0 :     if ( bIncludeObjects )
    1811                 :            :     {
    1812                 :          0 :         const SwSortedObjs* pObjs = GetDrawObjs();
    1813         [ #  # ]:          0 :         if ( pObjs )
    1814                 :            :         {
    1815                 :          0 :             const sal_uInt32 nCnt = pObjs->Count();
    1816         [ #  # ]:          0 :             for ( sal_uInt32 i = 0; i < nCnt; ++i )
    1817                 :            :             {
    1818                 :          0 :                 SwAnchoredObject* pAnchObj = (*pObjs)[i];
    1819         [ #  # ]:          0 :                 if ( pAnchObj->ISA(SwFlyFrm) )
    1820         [ #  # ]:          0 :                     static_cast<SwFlyFrm*>(pAnchObj)->ValidateThisAndAllLowers( 2 );
    1821         [ #  # ]:          0 :                 else if ( pAnchObj->ISA(SwAnchoredDrawObject) )
    1822                 :          0 :                     static_cast<SwAnchoredDrawObject*>(pAnchObj)->ValidateThis();
    1823                 :            :             }
    1824                 :            :         }
    1825                 :            :     }
    1826                 :            : 
    1827         [ #  # ]:          0 :     if ( IsLayoutFrm() )
    1828                 :            :     {
    1829                 :          0 :         SwFrm* pLower = static_cast<SwLayoutFrm*>(this)->Lower();
    1830         [ #  # ]:          0 :         while ( pLower )
    1831                 :            :         {
    1832                 :          0 :             pLower->ValidateThisAndAllLowers( nStage );
    1833                 :          0 :             pLower = pLower->GetNext();
    1834                 :            :         }
    1835                 :            :     }
    1836                 :          0 : }
    1837                 :            : 
    1838                 :            : /*************************************************************************
    1839                 :            : |*
    1840                 :            : |*  SwCntntFrm::GrowFrm()
    1841                 :            : |*
    1842                 :            : |*************************************************************************/
    1843                 :      10095 : SwTwips SwCntntFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    1844                 :            : {
    1845 [ -  + ][ #  # ]:      10095 :     SWRECTFN( this )
         [ #  # ][ -  + ]
    1846                 :            : 
    1847         [ +  - ]:      10095 :     SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
    1848 [ +  + ][ +  + ]:      10095 :     if( nFrmHeight > 0 &&
    1849                 :            :          nDist > (LONG_MAX - nFrmHeight ) )
    1850                 :          3 :         nDist = LONG_MAX - nFrmHeight;
    1851                 :            : 
    1852                 :      10095 :     const ViewShell *pSh = getRootFrm()->GetCurrShell();
    1853 [ +  + ][ +  - ]:      10095 :     const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
    1854         [ +  + ]:      10095 :     const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body
    1855 [ +  + ][ +  + ]:      10095 :     if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() )
                 [ +  + ]
    1856                 :            :     {
    1857         [ +  + ]:       7256 :         if ( !bTst )
    1858                 :            :         {
    1859         [ +  - ]:       5355 :             (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
    1860                 :            :             //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1861 [ #  # ][ #  # ]:       5355 :             if( IsVertical() && !IsVertLR() && !IsReverse() )
         [ -  + ][ -  + ]
    1862                 :          0 :                 Frm().Pos().X() -= nDist;
    1863         [ +  + ]:       5355 :             if ( GetNext() )
    1864                 :            :             {
    1865                 :       1977 :                 GetNext()->InvalidatePos();
    1866                 :            :             }
    1867                 :            :             // #i28701# - Due to the new object positioning the
    1868                 :            :             // frame on the next page/column can flow backward (e.g. it was moved forward
    1869                 :            :             // due to the positioning of its objects ). Thus, invalivate this next frame,
    1870                 :            :             // if document compatibility option 'Consider wrapping style influence on
    1871                 :            :             // object positioning' is ON.
    1872         [ +  + ]:       3378 :             else if ( GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
    1873                 :            :             {
    1874                 :         54 :                 InvalidateNextPos();
    1875                 :            :             }
    1876                 :            :         }
    1877                 :       7256 :         return 0;
    1878                 :            :     }
    1879                 :            : 
    1880         [ +  - ]:       2839 :     SwTwips nReal = (GetUpper()->Prt().*fnRect->fnGetHeight)();
    1881                 :       2839 :     SwFrm *pFrm = GetUpper()->Lower();
    1882 [ +  + ][ +  + ]:       5006 :     while( pFrm && nReal > 0 )
                 [ +  + ]
    1883         [ +  - ]:       2167 :     {   nReal -= (pFrm->Frm().*fnRect->fnGetHeight)();
    1884                 :       2167 :         pFrm = pFrm->GetNext();
    1885                 :            :     }
    1886                 :            : 
    1887         [ +  + ]:       2839 :     if ( !bTst )
    1888                 :            :     {
    1889                 :            :         //Cntnts are always resized to the wished value.
    1890         [ +  - ]:       2626 :         long nOld = (Frm().*fnRect->fnGetHeight)();
    1891         [ +  - ]:       2626 :         (Frm().*fnRect->fnSetHeight)( nOld + nDist );
    1892                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1893 [ #  # ][ #  # ]:       2626 :         if( IsVertical()&& !IsVertLR() && !IsReverse() )
         [ -  + ][ -  + ]
    1894                 :          0 :             Frm().Pos().X() -= nDist;
    1895 [ +  + ][ +  + ]:       2626 :         if ( nOld && IsInTab() )
                 [ +  + ]
    1896                 :            :         {
    1897                 :        144 :             SwTabFrm *pTab = FindTabFrm();
    1898 [ -  + ][ -  +  :        144 :             if ( pTab->GetTable()->GetHTMLTableLayout() &&
             #  #  #  # ]
    1899                 :          0 :                  !pTab->IsJoinLocked() &&
    1900                 :          0 :                  !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
    1901                 :            :             {
    1902                 :          0 :                 pTab->InvalidatePos();
    1903                 :          0 :                 pTab->SetResizeHTMLTable();
    1904                 :            :             }
    1905                 :            :         }
    1906                 :            :     }
    1907                 :            : 
    1908                 :            :     //Only grow Upper if necessary.
    1909         [ +  + ]:       2839 :     if ( nReal < nDist )
    1910                 :            :     {
    1911         [ +  - ]:       1192 :         if( GetUpper() )
    1912                 :            :         {
    1913 [ +  + ][ +  + ]:       1192 :             if( bTst || !GetUpper()->IsFooterFrm() )
                 [ +  + ]
    1914                 :       1171 :                 nReal = GetUpper()->Grow( nDist - (nReal > 0 ? nReal : 0),
    1915                 :       1171 :                                           bTst, bInfo );
    1916                 :            :             else
    1917                 :            :             {
    1918                 :         21 :                 nReal = 0;
    1919                 :         21 :                 GetUpper()->InvalidateSize();
    1920                 :            :             }
    1921                 :            :         }
    1922                 :            :         else
    1923                 :          0 :             nReal = 0;
    1924                 :            :     }
    1925                 :            :     else
    1926                 :       1647 :         nReal = nDist;
    1927                 :            : 
    1928                 :            :     // #i28701# - Due to the new object positioning the
    1929                 :            :     // frame on the next page/column can flow backward (e.g. it was moved forward
    1930                 :            :     // due to the positioning of its objects ). Thus, invalivate this next frame,
    1931                 :            :     // if document compatibility option 'Consider wrapping style influence on
    1932                 :            :     // object positioning' is ON.
    1933         [ +  + ]:       2839 :     if ( !bTst )
    1934                 :            :     {
    1935         [ +  + ]:       2626 :         if ( GetNext() )
    1936                 :            :         {
    1937                 :         66 :             GetNext()->InvalidatePos();
    1938                 :            :         }
    1939         [ +  + ]:       2560 :         else if ( GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::CONSIDER_WRAP_ON_OBJECT_POSITION) )
    1940                 :            :         {
    1941                 :        222 :             InvalidateNextPos();
    1942                 :            :         }
    1943                 :            :     }
    1944                 :            : 
    1945                 :      10095 :     return nReal;
    1946                 :            : }
    1947                 :            : 
    1948                 :            : /*************************************************************************
    1949                 :            : |*
    1950                 :            : |*  SwCntntFrm::ShrinkFrm()
    1951                 :            : |*
    1952                 :            : |*************************************************************************/
    1953                 :        800 : SwTwips SwCntntFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    1954                 :            : {
    1955 [ +  + ][ +  - ]:        800 :     SWRECTFN( this )
         [ -  + ][ -  + ]
    1956                 :            :     OSL_ENSURE( nDist >= 0, "nDist < 0" );
    1957                 :            :     OSL_ENSURE( nDist <= (Frm().*fnRect->fnGetHeight)(),
    1958                 :            :             "nDist > than current size." );
    1959                 :            : 
    1960         [ +  - ]:        800 :     if ( !bTst )
    1961                 :            :     {
    1962                 :            :         SwTwips nRstHeight;
    1963         [ +  - ]:        800 :         if( GetUpper() )
    1964                 :        800 :             nRstHeight = (Frm().*fnRect->fnBottomDist)
    1965 [ +  - ][ +  - ]:        800 :                          ( (GetUpper()->*fnRect->fnGetPrtBottom)() );
    1966                 :            :         else
    1967                 :          0 :             nRstHeight = 0;
    1968         [ +  + ]:        800 :         if( nRstHeight < 0 )
    1969                 :            :         {
    1970                 :        504 :             SwTwips nNextHeight = 0;
    1971 [ +  + ][ -  + ]:        504 :             if( GetUpper()->IsSctFrm() && nDist > LONG_MAX/2 )
                 [ -  + ]
    1972                 :            :             {
    1973                 :          0 :                 SwFrm *pNxt = GetNext();
    1974         [ #  # ]:          0 :                 while( pNxt )
    1975                 :            :                 {
    1976         [ #  # ]:          0 :                     nNextHeight += (pNxt->Frm().*fnRect->fnGetHeight)();
    1977                 :          0 :                     pNxt = pNxt->GetNext();
    1978                 :            :                 }
    1979                 :            :             }
    1980                 :        504 :             nRstHeight = nDist + nRstHeight - nNextHeight;
    1981                 :            :         }
    1982                 :            :         else
    1983                 :        296 :             nRstHeight = nDist;
    1984 [ +  - ][ +  - ]:        800 :         (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)() - nDist );
    1985                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    1986 [ +  - ][ +  + ]:        800 :         if( IsVertical() && !IsVertLR() )
                 [ +  + ]
    1987                 :          4 :             Frm().Pos().X() += nDist;
    1988                 :        800 :         nDist = nRstHeight;
    1989         [ +  + ]:        800 :         if ( IsInTab() )
    1990                 :            :         {
    1991                 :        115 :             SwTabFrm *pTab = FindTabFrm();
    1992 [ -  + ][ -  +  :        115 :             if ( pTab->GetTable()->GetHTMLTableLayout() &&
             #  #  #  # ]
    1993                 :          0 :                  !pTab->IsJoinLocked() &&
    1994                 :          0 :                  !pTab->GetFmt()->GetDoc()->GetDocShell()->IsReadOnly() )
    1995                 :            :             {
    1996                 :          0 :                 pTab->InvalidatePos();
    1997                 :          0 :                 pTab->SetResizeHTMLTable();
    1998                 :            :             }
    1999                 :            :         }
    2000                 :            :     }
    2001                 :            : 
    2002                 :            :     SwTwips nReal;
    2003 [ +  - ][ +  + ]:        800 :     if( GetUpper() && nDist > 0 )
                 [ +  + ]
    2004                 :            :     {
    2005 [ +  - ][ +  - ]:        604 :         if( bTst || !GetUpper()->IsFooterFrm() )
                 [ +  - ]
    2006                 :        604 :             nReal = GetUpper()->Shrink( nDist, bTst, bInfo );
    2007                 :            :         else
    2008                 :            :         {
    2009                 :          0 :             nReal = 0;
    2010                 :            : 
    2011                 :            :             // #108745# Sorry, dear old footer friend, I'm not gonna invalidate you,
    2012                 :            :             // if there are any objects anchored inside your content, which
    2013                 :            :             // overlap with the shrinking frame.
    2014                 :            :             // This may lead to a footer frame that is too big, but this is better
    2015                 :            :             // than looping.
    2016                 :            :             // #109722# : The fix for #108745# was too strict.
    2017                 :            : 
    2018                 :          0 :             bool bInvalidate = true;
    2019                 :          0 :             const SwRect aRect( Frm() );
    2020         [ #  # ]:          0 :             const SwPageFrm* pPage = FindPageFrm();
    2021         [ #  # ]:          0 :             const SwSortedObjs* pSorted = pPage ? pPage->GetSortedObjs() : 0;
    2022         [ #  # ]:          0 :             if( pSorted )
    2023                 :            :             {
    2024 [ #  # ][ #  # ]:          0 :                 for ( sal_uInt16 i = 0; i < pSorted->Count(); ++i )
    2025                 :            :                 {
    2026         [ #  # ]:          0 :                     const SwAnchoredObject* pAnchoredObj = (*pSorted)[i];
    2027         [ #  # ]:          0 :                     const SwRect aBound( pAnchoredObj->GetObjRectWithSpaces() );
    2028                 :            : 
    2029         [ #  # ]:          0 :                     if( aBound.Left() > aRect.Right() )
    2030                 :          0 :                         continue;
    2031                 :            : 
    2032 [ #  # ][ #  # ]:          0 :                     if( aBound.IsOver( aRect ) )
    2033                 :            :                     {
    2034         [ #  # ]:          0 :                         const SwFrmFmt& rFmt = pAnchoredObj->GetFrmFmt();
    2035 [ #  # ][ #  # ]:          0 :                         if( SURROUND_THROUGHT != rFmt.GetSurround().GetSurround() )
    2036                 :            :                         {
    2037         [ #  # ]:          0 :                             const SwFrm* pAnchor = pAnchoredObj->GetAnchorFrm();
    2038 [ #  # ][ #  # ]:          0 :                             if ( pAnchor && pAnchor->FindFooterOrHeader() == GetUpper() )
         [ #  # ][ #  # ]
    2039                 :            :                             {
    2040                 :          0 :                                 bInvalidate = false;
    2041                 :            :                                 break;
    2042                 :            :                             }
    2043                 :            :                         }
    2044                 :            :                     }
    2045                 :            :                 }
    2046                 :            :             }
    2047                 :            : 
    2048         [ #  # ]:          0 :             if ( bInvalidate )
    2049         [ #  # ]:          0 :                 GetUpper()->InvalidateSize();
    2050                 :            :         }
    2051                 :            :     }
    2052                 :            :     else
    2053                 :        196 :         nReal = 0;
    2054                 :            : 
    2055         [ +  - ]:        800 :     if ( !bTst )
    2056                 :            :     {
    2057                 :            :         //The position of the next Frm changes for sure.
    2058                 :        800 :         InvalidateNextPos();
    2059                 :            : 
    2060                 :            :         //If I don't have a successor I have to do the retouch by myself.
    2061         [ +  + ]:        800 :         if ( !GetNext() )
    2062                 :        689 :             SetRetouche();
    2063                 :            :     }
    2064                 :        800 :     return nReal;
    2065                 :            : }
    2066                 :            : 
    2067                 :            : /*************************************************************************
    2068                 :            : |*
    2069                 :            : |*    SwCntntFrm::Modify()
    2070                 :            : |*
    2071                 :            : |*************************************************************************/
    2072                 :       2995 : void SwCntntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
    2073                 :            : {
    2074                 :       2995 :     sal_uInt8 nInvFlags = 0;
    2075                 :            : 
    2076 [ +  - ][ +  + ]:       2995 :     if( pNew && RES_ATTRSET_CHG == pNew->Which() )
                 [ +  + ]
    2077                 :            :     {
    2078         [ +  - ]:       2884 :         SfxItemIter aNIter( *((SwAttrSetChg*)pNew)->GetChgSet() );
    2079         [ +  - ]:       2884 :         SfxItemIter aOIter( *((SwAttrSetChg*)pOld)->GetChgSet() );
    2080         [ +  - ]:       2884 :         SwAttrSetChg aOldSet( *(SwAttrSetChg*)pOld );
    2081         [ +  - ]:       2884 :         SwAttrSetChg aNewSet( *(SwAttrSetChg*)pNew );
    2082                 :          0 :         while( sal_True )
    2083                 :            :         {
    2084                 :            :             _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
    2085                 :            :                          (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
    2086         [ +  - ]:       2884 :                          &aOldSet, &aNewSet );
    2087         [ +  - ]:       2884 :             if( aNIter.IsAtEnd() )
    2088                 :       2884 :                 break;
    2089         [ #  # ]:          0 :             aNIter.NextItem();
    2090         [ #  # ]:          0 :             aOIter.NextItem();
    2091                 :            :         }
    2092 [ +  + ][ -  + ]:       2884 :         if ( aOldSet.Count() || aNewSet.Count() )
                 [ +  + ]
    2093 [ +  - ][ +  - ]:       2884 :             SwFrm::Modify( &aOldSet, &aNewSet );
         [ +  - ][ +  - ]
                 [ +  - ]
    2094                 :            :     }
    2095                 :            :     else
    2096         [ +  - ]:        111 :         _UpdateAttr( pOld, pNew, nInvFlags );
    2097                 :            : 
    2098         [ +  + ]:       2995 :     if ( nInvFlags != 0 )
    2099                 :            :     {
    2100         [ +  - ]:        817 :         SwPageFrm *pPage = FindPageFrm();
    2101         [ +  - ]:        817 :         InvalidatePage( pPage );
    2102         [ +  + ]:        817 :         if ( nInvFlags & 0x01 )
    2103                 :        738 :             SetCompletePaint();
    2104         [ +  + ]:        817 :         if ( nInvFlags & 0x02 )
    2105         [ +  - ]:         56 :             _InvalidatePos();
    2106         [ +  + ]:        817 :         if ( nInvFlags & 0x04 )
    2107         [ +  - ]:         50 :             _InvalidateSize();
    2108         [ +  + ]:        817 :         if ( nInvFlags & 0x88 )
    2109                 :            :         {
    2110 [ +  - ][ -  + ]:         60 :             if( IsInSct() && !GetPrev() )
         [ #  # ][ -  + ]
    2111                 :            :             {
    2112         [ #  # ]:          0 :                 SwSectionFrm *pSect = FindSctFrm();
    2113 [ #  # ][ #  # ]:          0 :                 if( pSect->ContainsAny() == this )
    2114                 :            :                 {
    2115         [ #  # ]:          0 :                     pSect->_InvalidatePrt();
    2116         [ #  # ]:          0 :                     pSect->InvalidatePage( pPage );
    2117                 :            :                 }
    2118                 :            :             }
    2119         [ +  - ]:         60 :             _InvalidatePrt();
    2120                 :            :         }
    2121         [ +  - ]:        817 :         SwFrm* pNextFrm = GetIndNext();
    2122 [ +  + ][ +  - ]:        817 :         if ( pNextFrm && nInvFlags & 0x10)
    2123                 :            :         {
    2124         [ +  - ]:         33 :             pNextFrm->_InvalidatePrt();
    2125         [ +  - ]:         33 :             pNextFrm->InvalidatePage( pPage );
    2126                 :            :         }
    2127 [ +  + ][ -  + ]:        817 :         if ( pNextFrm && nInvFlags & 0x80 )
    2128                 :            :         {
    2129                 :          0 :             pNextFrm->SetCompletePaint();
    2130                 :            :         }
    2131         [ +  + ]:        817 :         if ( nInvFlags & 0x20 )
    2132                 :            :         {
    2133                 :        123 :             SwFrm* pPrevFrm = GetPrev();
    2134         [ +  + ]:        123 :             if ( pPrevFrm )
    2135                 :            :             {
    2136         [ +  - ]:         39 :                 pPrevFrm->_InvalidatePrt();
    2137         [ +  - ]:         39 :                 pPrevFrm->InvalidatePage( pPage );
    2138                 :            :             }
    2139                 :            :         }
    2140         [ +  + ]:        817 :         if ( nInvFlags & 0x40 )
    2141         [ +  - ]:         50 :             InvalidateNextPos();
    2142                 :            :     }
    2143                 :       2995 : }
    2144                 :            : 
    2145                 :       2995 : void SwCntntFrm::_UpdateAttr( const SfxPoolItem* pOld, const SfxPoolItem* pNew,
    2146                 :            :                               sal_uInt8 &rInvFlags,
    2147                 :            :                             SwAttrSetChg *pOldSet, SwAttrSetChg *pNewSet )
    2148                 :            : {
    2149                 :       2995 :     sal_Bool bClear = sal_True;
    2150 [ +  + ][ +  - ]:       2995 :     sal_uInt16 nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
    2151   [ +  +  +  +  :       2995 :     switch ( nWhich )
             -  -  +  -  
                      + ]
    2152                 :            :     {
    2153                 :            :         case RES_FMT_CHG:
    2154                 :         50 :             rInvFlags = 0xFF;
    2155                 :            :             /* no break here */
    2156                 :            : 
    2157                 :            :         case RES_PAGEDESC:                      //attribute changes (on/off)
    2158 [ +  - ][ +  - ]:         56 :             if ( IsInDocBody() && !IsInTab() )
                 [ +  - ]
    2159                 :            :             {
    2160                 :         56 :                 rInvFlags |= 0x02;
    2161         [ +  - ]:         56 :                 SwPageFrm *pPage = FindPageFrm();
    2162         [ +  - ]:         56 :                 if ( !GetPrev() )
    2163         [ +  - ]:         56 :                     CheckPageDescs( pPage );
    2164 [ +  - ][ +  - ]:         56 :                 if ( pPage && GetAttrSet()->GetPageDesc().GetNumOffset() )
         [ +  - ][ -  + ]
                 [ -  + ]
    2165                 :          0 :                     ((SwRootFrm*)pPage->GetUpper())->SetVirtPageNum( sal_True );
    2166         [ +  - ]:         56 :                 SwDocPosUpdate aMsgHnt( pPage->Frm().Top() );
    2167 [ +  - ][ +  - ]:         56 :                 pPage->GetFmt()->GetDoc()->UpdatePageFlds( &aMsgHnt );
                 [ +  - ]
    2168                 :            :             }
    2169                 :         56 :             break;
    2170                 :            : 
    2171                 :            :         case RES_UL_SPACE:
    2172                 :            :             {
    2173                 :            :                 // OD 2004-02-18 #106629# - correction
    2174                 :            :                 // Invalidation of the printing area of next frame, not only
    2175                 :            :                 // for footnote content.
    2176         [ +  - ]:         10 :                 if ( !GetIndNext() )
    2177                 :            :                 {
    2178                 :         10 :                     SwFrm* pNxt = FindNext();
    2179         [ -  + ]:         10 :                     if ( pNxt )
    2180                 :            :                     {
    2181                 :          0 :                         SwPageFrm* pPg = pNxt->FindPageFrm();
    2182                 :          0 :                         pNxt->InvalidatePage( pPg );
    2183                 :          0 :                         pNxt->_InvalidatePrt();
    2184         [ #  # ]:          0 :                         if( pNxt->IsSctFrm() )
    2185                 :            :                         {
    2186                 :          0 :                             SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
    2187         [ #  # ]:          0 :                             if( pCnt )
    2188                 :            :                             {
    2189                 :          0 :                                 pCnt->_InvalidatePrt();
    2190                 :          0 :                                 pCnt->InvalidatePage( pPg );
    2191                 :            :                             }
    2192                 :            :                         }
    2193                 :          0 :                         pNxt->SetCompletePaint();
    2194                 :            :                     }
    2195                 :            :                 }
    2196                 :            :                 // OD 2004-03-17 #i11860#
    2197   [ -  +  #  # ]:         10 :                 if ( GetIndNext() &&
                 [ -  + ]
    2198                 :          0 :                      !GetUpper()->GetFmt()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::USE_FORMER_OBJECT_POS) )
    2199                 :            :                 {
    2200                 :            :                     // OD 2004-07-01 #i28701# - use new method <InvalidateObjs(..)>
    2201                 :          0 :                     GetIndNext()->InvalidateObjs( true );
    2202                 :            :                 }
    2203                 :         10 :                 Prepare( PREP_UL_SPACE );   //TxtFrm has to correct line spacing.
    2204                 :         10 :                 rInvFlags |= 0x80;
    2205                 :            :                 /* no break here */
    2206                 :            :             }
    2207                 :            :         case RES_LR_SPACE:
    2208                 :            :         case RES_BOX:
    2209                 :            :         case RES_SHADOW:
    2210                 :         73 :             Prepare( PREP_FIXSIZE_CHG );
    2211                 :         73 :             SwFrm::Modify( pOld, pNew );
    2212                 :         73 :             rInvFlags |= 0x30;
    2213                 :         73 :             break;
    2214                 :            : 
    2215                 :            :         case RES_BREAK:
    2216                 :            :             {
    2217                 :          0 :                 rInvFlags |= 0x42;
    2218                 :          0 :                 const IDocumentSettingAccess* pIDSA = GetUpper()->GetFmt()->getIDocumentSettingAccess();
    2219         [ #  # ]:          0 :                 if( pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX) ||
           [ #  #  #  # ]
    2220                 :          0 :                     pIDSA->get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES) )
    2221                 :            :                 {
    2222                 :          0 :                     rInvFlags |= 0x1;
    2223                 :          0 :                     SwFrm* pNxt = FindNext();
    2224         [ #  # ]:          0 :                     if( pNxt )
    2225                 :            :                     {
    2226                 :          0 :                         SwPageFrm* pPg = pNxt->FindPageFrm();
    2227                 :          0 :                         pNxt->InvalidatePage( pPg );
    2228                 :          0 :                         pNxt->_InvalidatePrt();
    2229         [ #  # ]:          0 :                         if( pNxt->IsSctFrm() )
    2230                 :            :                         {
    2231                 :          0 :                             SwFrm* pCnt = ((SwSectionFrm*)pNxt)->ContainsAny();
    2232         [ #  # ]:          0 :                             if( pCnt )
    2233                 :            :                             {
    2234                 :          0 :                                 pCnt->_InvalidatePrt();
    2235                 :          0 :                                 pCnt->InvalidatePage( pPg );
    2236                 :            :                             }
    2237                 :            :                         }
    2238                 :          0 :                         pNxt->SetCompletePaint();
    2239                 :            :                     }
    2240                 :            :                 }
    2241                 :            :             }
    2242                 :          0 :             break;
    2243                 :            : 
    2244                 :            :         // OD 2004-02-26 #i25029#
    2245                 :            :         case RES_PARATR_CONNECT_BORDER:
    2246                 :            :         {
    2247                 :          0 :             rInvFlags |= 0x01;
    2248         [ #  # ]:          0 :             if ( IsTxtFrm() )
    2249                 :            :             {
    2250                 :          0 :                 InvalidateNextPrtArea();
    2251                 :            :             }
    2252 [ #  # ][ #  # ]:          0 :             if ( !GetIndNext() && IsInTab() && IsInSplitTableRow() )
         [ #  # ][ #  # ]
    2253                 :            :             {
    2254                 :          0 :                 FindTabFrm()->InvalidateSize();
    2255                 :            :             }
    2256                 :            :         }
    2257                 :          0 :         break;
    2258                 :            : 
    2259                 :            :         case RES_PARATR_TABSTOP:
    2260                 :            :         case RES_CHRATR_PROPORTIONALFONTSIZE:
    2261                 :            :         case RES_CHRATR_SHADOWED:
    2262                 :            :         case RES_CHRATR_AUTOKERN:
    2263                 :            :         case RES_CHRATR_UNDERLINE:
    2264                 :            :         case RES_CHRATR_OVERLINE:
    2265                 :            :         case RES_CHRATR_KERNING:
    2266                 :            :         case RES_CHRATR_FONT:
    2267                 :            :         case RES_CHRATR_FONTSIZE:
    2268                 :            :         case RES_CHRATR_ESCAPEMENT:
    2269                 :            :         case RES_CHRATR_CONTOUR:
    2270                 :            :         case RES_PARATR_NUMRULE:
    2271                 :        688 :             rInvFlags |= 0x01;
    2272                 :        688 :             break;
    2273                 :            : 
    2274                 :            : 
    2275                 :            :         case RES_FRM_SIZE:
    2276                 :          0 :             rInvFlags |= 0x01;
    2277                 :            :             /* no break here */
    2278                 :            : 
    2279                 :            :         default:
    2280                 :       2178 :             bClear = sal_False;
    2281                 :            :     }
    2282         [ +  + ]:       2995 :     if ( bClear )
    2283                 :            :     {
    2284 [ +  + ][ -  + ]:        817 :         if ( pOldSet || pNewSet )
    2285                 :            :         {
    2286         [ +  - ]:        714 :             if ( pOldSet )
    2287                 :        714 :                 pOldSet->ClearItem( nWhich );
    2288         [ +  - ]:       1428 :             if ( pNewSet )
    2289                 :        714 :                 pNewSet->ClearItem( nWhich );
    2290                 :            :         }
    2291                 :            :         else
    2292                 :        817 :             SwFrm::Modify( pOld, pNew );
    2293                 :            :     }
    2294                 :       2995 : }
    2295                 :            : 
    2296                 :            : /*************************************************************************
    2297                 :            : |*
    2298                 :            : |*  SwLayoutFrm::SwLayoutFrm()
    2299                 :            : |*
    2300                 :            : |*************************************************************************/
    2301                 :       8033 : SwLayoutFrm::SwLayoutFrm( SwFrmFmt* pFmt, SwFrm* pSib ):
    2302                 :            :     SwFrm( pFmt, pSib ),
    2303                 :       8033 :     pLower( 0 )
    2304                 :            : {
    2305         [ +  - ]:       8033 :     const SwFmtFrmSize &rFmtSize = pFmt->GetFrmSize();
    2306         [ +  + ]:       8033 :     if ( rFmtSize.GetHeightSizeType() == ATT_FIX_SIZE )
    2307                 :       1670 :         bFixSize = sal_True;
    2308                 :       8033 : }
    2309                 :            : 
    2310                 :            : // #i28701#
    2311 [ +  + ][ +  + ]:      72303 : TYPEINIT1(SwLayoutFrm,SwFrm);
    2312                 :            : /*--------------------------------------------------
    2313                 :            :  * SwLayoutFrm::InnerHeight()
    2314                 :            :  * --------------------------------------------------*/
    2315                 :            : 
    2316                 :        548 : SwTwips SwLayoutFrm::InnerHeight() const
    2317                 :            : {
    2318         [ +  + ]:        548 :     if( !Lower() )
    2319                 :         26 :         return 0;
    2320                 :        522 :     SwTwips nRet = 0;
    2321                 :        522 :     const SwFrm* pCnt = Lower();
    2322 [ #  # ][ #  # ]:        522 :     SWRECTFN( this )
         [ -  + ][ -  + ]
    2323 [ +  + ][ -  + ]:        522 :     if( pCnt->IsColumnFrm() || pCnt->IsCellFrm() )
                 [ +  + ]
    2324                 :            :     {
    2325         [ +  + ]:         88 :         do
    2326                 :            :         {
    2327                 :         88 :             SwTwips nTmp = ((SwLayoutFrm*)pCnt)->InnerHeight();
    2328         [ +  - ]:         88 :             if( pCnt->GetValidPrtAreaFlag() )
    2329         [ +  - ]:         88 :                 nTmp += (pCnt->Frm().*fnRect->fnGetHeight)() -
    2330         [ +  - ]:         88 :                         (pCnt->Prt().*fnRect->fnGetHeight)();
    2331         [ +  + ]:         88 :             if( nRet < nTmp )
    2332                 :         72 :                 nRet = nTmp;
    2333                 :         88 :             pCnt = pCnt->GetNext();
    2334                 :            :         } while ( pCnt );
    2335                 :            :     }
    2336                 :            :     else
    2337                 :            :     {
    2338         [ +  + ]:        456 :         do
    2339                 :            :         {
    2340         [ +  - ]:        456 :             nRet += (pCnt->Frm().*fnRect->fnGetHeight)();
    2341 [ -  + ][ -  + ]:        456 :             if( pCnt->IsCntntFrm() && ((SwTxtFrm*)pCnt)->IsUndersized() )
                 [ +  + ]
    2342                 :          0 :                 nRet += ((SwTxtFrm*)pCnt)->GetParHeight() -
    2343         [ #  # ]:          0 :                         (pCnt->Prt().*fnRect->fnGetHeight)();
    2344 [ +  + ][ +  - ]:        456 :             if( pCnt->IsLayoutFrm() && !pCnt->IsTabFrm() )
                 [ +  + ]
    2345                 :         88 :                 nRet += ((SwLayoutFrm*)pCnt)->InnerHeight() -
    2346         [ +  - ]:         88 :                         (pCnt->Prt().*fnRect->fnGetHeight)();
    2347                 :        456 :             pCnt = pCnt->GetNext();
    2348                 :            :         } while( pCnt );
    2349                 :            : 
    2350                 :            :     }
    2351                 :        548 :     return nRet;
    2352                 :            : }
    2353                 :            : 
    2354                 :            : /*************************************************************************
    2355                 :            : |*
    2356                 :            : |*  SwLayoutFrm::GrowFrm()
    2357                 :            : |*
    2358                 :            : |*************************************************************************/
    2359                 :       2854 : SwTwips SwLayoutFrm::GrowFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    2360                 :            : {
    2361                 :       2854 :     const ViewShell *pSh = getRootFrm()->GetCurrShell();
    2362 [ +  + ][ +  - ]:       2854 :     const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
    2363         [ +  + ]:       2854 :     const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body
    2364 [ +  + ][ +  + ]:       2854 :     if( !(GetType() & nTmpType) && HasFixSize() )
                 [ +  + ]
    2365                 :        325 :         return 0;
    2366                 :            : 
    2367 [ +  - ][ -  + ]:       2529 :     SWRECTFN( this )
         [ #  # ][ #  # ]
                 [ -  + ]
    2368 [ +  - ][ +  - ]:       2529 :     const SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
    2369                 :       2529 :     const SwTwips nFrmPos = Frm().Pos().X();
    2370                 :            : 
    2371 [ -  + ][ +  + ]:       2529 :     if ( nFrmHeight > 0 && nDist > (LONG_MAX - nFrmHeight) )
    2372                 :          0 :         nDist = LONG_MAX - nFrmHeight;
    2373                 :            : 
    2374                 :       2529 :     SwTwips nMin = 0;
    2375 [ +  - ][ +  + ]:       2529 :     if ( GetUpper() && !IsCellFrm() )
                 [ +  + ]
    2376                 :            :     {
    2377                 :       1924 :         SwFrm *pFrm = GetUpper()->Lower();
    2378         [ +  + ]:      10488 :         while( pFrm )
    2379 [ +  - ][ +  - ]:       8564 :         {   nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
    2380                 :       8564 :             pFrm = pFrm->GetNext();
    2381                 :            :         }
    2382 [ +  - ][ +  - ]:       1924 :         nMin = (GetUpper()->Prt().*fnRect->fnGetHeight)() - nMin;
    2383         [ +  + ]:       1924 :         if ( nMin < 0 )
    2384                 :        128 :             nMin = 0;
    2385                 :            :     }
    2386                 :            : 
    2387                 :       2529 :     SwRect aOldFrm( Frm() );
    2388                 :       2529 :     sal_Bool bMoveAccFrm = sal_False;
    2389                 :            : 
    2390 [ -  + ][ #  # ]:       2529 :     sal_Bool bChgPos = IsVertical() && !IsReverse();
                 [ +  - ]
    2391         [ +  + ]:       2529 :     if ( !bTst )
    2392                 :            :     {
    2393 [ +  - ][ +  - ]:       2326 :         (Frm().*fnRect->fnSetHeight)( nFrmHeight + nDist );
    2394                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    2395 [ -  + ][ #  # ]:       2326 :         if( bChgPos && !IsVertLR() )
                 [ -  + ]
    2396                 :          0 :             Frm().Pos().X() -= nDist;
    2397                 :       2326 :         bMoveAccFrm = sal_True;
    2398                 :            :     }
    2399                 :            : 
    2400                 :       2529 :     SwTwips nReal = nDist - nMin;
    2401         [ +  + ]:       2529 :     if ( nReal > 0 )
    2402                 :            :     {
    2403         [ +  - ]:       2509 :         if ( GetUpper() )
    2404                 :            :         {   // AdjustNeighbourhood now only for the columns (but not in frames)
    2405                 :       2509 :             sal_uInt8 nAdjust = GetUpper()->IsFtnBossFrm() ?
    2406                 :        414 :                 ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
    2407   [ +  +  +  - ]:       2923 :                 : NA_GROW_SHRINK;
    2408         [ +  + ]:       2509 :             if( NA_ONLY_ADJUST == nAdjust )
    2409         [ +  - ]:        144 :                 nReal = AdjustNeighbourhood( nReal, bTst );
    2410                 :            :             else
    2411                 :            :             {
    2412         [ -  + ]:       2365 :                 if( NA_ADJUST_GROW == nAdjust )
    2413         [ #  # ]:          0 :                     nReal += AdjustNeighbourhood( nReal, bTst );
    2414                 :            : 
    2415                 :       2365 :                 SwTwips nGrow = 0;
    2416         [ +  - ]:       2365 :                 if( 0 < nReal )
    2417                 :            :                 {
    2418                 :       2365 :                     SwFrm* pToGrow = GetUpper();
    2419                 :            :                     // NEW TABLES
    2420                 :            :                     // A cell with a row span of > 1 is allowed to grow the
    2421                 :            :                     // line containing the end of the row span if it is
    2422                 :            :                     // located in the same table frame:
    2423         [ -  + ]:       2365 :                     const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
    2424 [ +  + ][ +  - ]:       2365 :                     if ( pThisCell && pThisCell->GetLayoutRowSpan() > 1 )
         [ -  + ][ -  + ]
    2425                 :            :                     {
    2426         [ #  # ]:          0 :                         SwCellFrm& rEndCell = const_cast<SwCellFrm&>(pThisCell->FindStartEndOfRowSpanCell( false, true ));
    2427 [ #  # ][ #  # ]:          0 :                         if ( -1 == rEndCell.GetTabBox()->getRowSpan() )
    2428                 :          0 :                             pToGrow = rEndCell.GetUpper();
    2429                 :            :                         else
    2430                 :          0 :                             pToGrow = 0;
    2431                 :            :                     }
    2432                 :            : 
    2433 [ +  - ][ +  - ]:       2365 :                     nGrow = pToGrow ? pToGrow->Grow( nReal, bTst, bInfo ) : 0;
    2434                 :            :                 }
    2435                 :            : 
    2436 [ +  + ][ -  + ]:       2365 :                 if( NA_GROW_ADJUST == nAdjust && nGrow < nReal )
    2437         [ #  # ]:          0 :                     nReal += AdjustNeighbourhood( nReal - nGrow, bTst );
    2438                 :            : 
    2439 [ +  + ][ +  + ]:       2365 :                 if ( IsFtnFrm() && (nGrow != nReal) && GetNext() )
         [ -  + ][ -  + ]
    2440                 :            :                 {
    2441                 :            :                     //Footnotes can replace their successor.
    2442         [ #  # ]:          0 :                     SwTwips nSpace = bTst ? 0 : -nDist;
    2443                 :          0 :                     const SwFrm *pFrm = GetUpper()->Lower();
    2444         [ #  # ]:          0 :                     do
    2445 [ #  # ][ #  # ]:          0 :                     {   nSpace += (pFrm->Frm().*fnRect->fnGetHeight)();
    2446                 :          0 :                         pFrm = pFrm->GetNext();
    2447                 :          0 :                     } while ( pFrm != GetNext() );
    2448 [ #  # ][ #  # ]:          0 :                     nSpace = (GetUpper()->Prt().*fnRect->fnGetHeight)() -nSpace;
    2449         [ #  # ]:          0 :                     if ( nSpace < 0 )
    2450                 :          0 :                         nSpace = 0;
    2451                 :          0 :                     nSpace += nGrow;
    2452         [ #  # ]:          0 :                     if ( nReal > nSpace )
    2453                 :          0 :                         nReal = nSpace;
    2454 [ #  # ][ #  # ]:          0 :                     if ( nReal && !bTst )
    2455 [ #  # ][ #  # ]:          0 :                         ((SwFtnFrm*)this)->InvalidateNxtFtnCnts( FindPageFrm() );
    2456                 :            :                 }
    2457                 :            :                 else
    2458                 :       2365 :                     nReal = nGrow;
    2459                 :            :             }
    2460                 :            :         }
    2461                 :            :         else
    2462                 :          0 :             nReal = 0;
    2463                 :            : 
    2464                 :       2509 :         nReal += nMin;
    2465                 :            :     }
    2466                 :            :     else
    2467                 :         20 :         nReal = nDist;
    2468                 :            : 
    2469         [ +  + ]:       2529 :     if ( !bTst )
    2470                 :            :     {
    2471   [ +  +  +  + ]:       2746 :         if( nReal != nDist &&
         [ -  + ][ +  + ]
    2472                 :            :             // NEW TABLES
    2473         [ +  - ]:        420 :             ( !IsCellFrm() || static_cast<SwCellFrm*>(this)->GetLayoutRowSpan() > 1 ) )
    2474                 :            :         {
    2475 [ +  - ][ +  - ]:        360 :             (Frm().*fnRect->fnSetHeight)( nFrmHeight + nReal );
    2476                 :            :             //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    2477 [ -  + ][ #  # ]:        360 :             if( bChgPos && !IsVertLR() )
                 [ -  + ]
    2478                 :          0 :                 Frm().Pos().X() = nFrmPos - nReal;
    2479                 :        360 :             bMoveAccFrm = sal_True;
    2480                 :            :         }
    2481                 :            : 
    2482         [ +  + ]:       2326 :         if ( nReal )
    2483                 :            :         {
    2484         [ +  - ]:       1936 :             SwPageFrm *pPage = FindPageFrm();
    2485         [ +  + ]:       1936 :             if ( GetNext() )
    2486                 :            :             {
    2487         [ +  - ]:       1386 :                 GetNext()->_InvalidatePos();
    2488         [ -  + ]:       1386 :                 if ( GetNext()->IsCntntFrm() )
    2489         [ #  # ]:          0 :                     GetNext()->InvalidatePage( pPage );
    2490                 :            :             }
    2491         [ +  + ]:       1936 :             if ( !IsPageBodyFrm() )
    2492                 :            :             {
    2493         [ +  - ]:       1932 :                 _InvalidateAll();
    2494         [ +  - ]:       1932 :                 InvalidatePage( pPage );
    2495                 :            :             }
    2496         [ +  + ]:       1936 :             if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
    2497         [ +  - ]:        876 :                 NotifyLowerObjs();
    2498                 :            : 
    2499         [ +  + ]:       1936 :             if( IsCellFrm() )
    2500         [ +  - ]:        575 :                 InvaPercentLowers( nReal );
    2501                 :            : 
    2502 [ +  - ][ +  - ]:       1936 :             const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
    2503 [ +  - ][ +  + ]:       1936 :             if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
    2504                 :          3 :                 SetCompletePaint();
    2505                 :            :         }
    2506                 :            :     }
    2507                 :            : 
    2508 [ +  + ][ +  + ]:       2529 :     if( bMoveAccFrm && IsAccessibleFrm() )
                 [ +  + ]
    2509                 :            :     {
    2510                 :        826 :         SwRootFrm *pRootFrm = getRootFrm();
    2511   [ -  +  #  # ]:        826 :         if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
         [ -  + ][ +  - ]
    2512                 :          0 :             pRootFrm->GetCurrShell() )
    2513                 :            :         {
    2514         [ #  # ]:          0 :             pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
    2515                 :            :         }
    2516                 :            :     }
    2517                 :       2854 :     return nReal;
    2518                 :            : }
    2519                 :            : 
    2520                 :            : /*************************************************************************
    2521                 :            : |*
    2522                 :            : |*  SwLayoutFrm::ShrinkFrm()
    2523                 :            : |*
    2524                 :            : |*************************************************************************/
    2525                 :       2046 : SwTwips SwLayoutFrm::ShrinkFrm( SwTwips nDist, sal_Bool bTst, sal_Bool bInfo )
    2526                 :            : {
    2527                 :       2046 :     const ViewShell *pSh = getRootFrm()->GetCurrShell();
    2528 [ +  + ][ +  + ]:       2046 :     const sal_Bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode();
    2529         [ +  + ]:       2046 :     const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse mit Body
    2530 [ +  + ][ +  + ]:       2046 :     if( !(GetType() & nTmpType) && HasFixSize() )
                 [ +  + ]
    2531                 :        849 :         return 0;
    2532                 :            : 
    2533                 :            :     OSL_ENSURE( nDist >= 0, "nDist < 0" );
    2534 [ +  - ][ -  + ]:       1197 :     SWRECTFN( this )
         [ #  # ][ #  # ]
                 [ -  + ]
    2535 [ +  - ][ +  - ]:       1197 :     SwTwips nFrmHeight = (Frm().*fnRect->fnGetHeight)();
    2536         [ +  + ]:       1197 :     if ( nDist > nFrmHeight )
    2537                 :         76 :         nDist = nFrmHeight;
    2538                 :            : 
    2539                 :       1197 :     SwTwips nMin = 0;
    2540 [ +  - ][ -  + ]:       1197 :     sal_Bool bChgPos = IsVertical() && !IsReverse();
                 [ #  # ]
    2541         [ +  + ]:       1197 :     if ( Lower() )
    2542                 :            :     {
    2543         [ +  - ]:       1113 :         if( !Lower()->IsNeighbourFrm() )
    2544                 :       1113 :         {   const SwFrm *pFrm = Lower();
    2545 [ +  - ][ +  - ]:       1113 :             const long nTmp = (Prt().*fnRect->fnGetHeight)();
    2546 [ +  + ][ +  - ]:       2374 :             while( pFrm && nMin < nTmp )
                 [ +  + ]
    2547 [ +  - ][ +  - ]:       1261 :             {   nMin += (pFrm->Frm().*fnRect->fnGetHeight)();
    2548                 :       1261 :                 pFrm = pFrm->GetNext();
    2549                 :            :             }
    2550                 :            :         }
    2551                 :            :     }
    2552                 :       1197 :     SwTwips nReal = nDist;
    2553 [ +  - ][ +  - ]:       1197 :     SwTwips nMinDiff = (Prt().*fnRect->fnGetHeight)() - nMin;
    2554         [ -  + ]:       1197 :     if( nReal > nMinDiff )
    2555                 :          0 :         nReal = nMinDiff;
    2556         [ -  + ]:       1197 :     if( nReal <= 0 )
    2557                 :          0 :         return nDist;
    2558                 :            : 
    2559                 :       1197 :     SwRect aOldFrm( Frm() );
    2560                 :       1197 :     sal_Bool bMoveAccFrm = sal_False;
    2561                 :            : 
    2562                 :       1197 :     SwTwips nRealDist = nReal;
    2563         [ +  - ]:       1197 :     if ( !bTst )
    2564                 :            :     {
    2565 [ +  - ][ +  - ]:       1197 :         (Frm().*fnRect->fnSetHeight)( nFrmHeight - nReal );
    2566                 :            :         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    2567 [ -  + ][ #  # ]:       1197 :         if( bChgPos && !IsVertLR() )
                 [ -  + ]
    2568                 :          0 :             Frm().Pos().X() += nReal;
    2569                 :       1197 :         bMoveAccFrm = sal_True;
    2570                 :            :     }
    2571                 :            : 
    2572                 :       2394 :     sal_uInt8 nAdjust = GetUpper() && GetUpper()->IsFtnBossFrm() ?
    2573                 :        128 :                    ((SwFtnBossFrm*)GetUpper())->NeighbourhoodAdjustment( this )
    2574   [ +  -  +  +  :       2522 :                    : NA_GROW_SHRINK;
                   +  - ]
    2575                 :            : 
    2576                 :            :     // AdjustNeighbourhood also in columns (but not in frames)
    2577         [ +  + ]:       1197 :     if( NA_ONLY_ADJUST == nAdjust )
    2578                 :            :     {
    2579 [ +  + ][ -  + ]:         38 :         if ( IsPageBodyFrm() && !bBrowse )
                 [ -  + ]
    2580                 :          0 :             nReal = nDist;
    2581                 :            :         else
    2582         [ +  - ]:         38 :         {   nReal = AdjustNeighbourhood( -nReal, bTst );
    2583                 :         38 :             nReal *= -1;
    2584 [ +  - ][ +  + ]:         38 :             if ( !bTst && IsBodyFrm() && nReal < nRealDist )
         [ +  - ][ +  + ]
    2585                 :            :             {
    2586 [ +  - ][ +  - ]:         16 :                 (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
    2587 [ +  - ][ +  - ]:         16 :                                             + nRealDist - nReal );
    2588                 :            :                 //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    2589 [ -  + ][ #  # ]:          8 :                 if( bChgPos && !IsVertLR() )
                 [ -  + ]
    2590                 :          0 :                     Frm().Pos().X() += nRealDist - nReal;
    2591                 :            :                 OSL_ENSURE( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
    2592                 :            :             }
    2593                 :            :         }
    2594                 :            :     }
    2595 [ +  + ][ +  + ]:       1159 :     else if( IsColumnFrm() || IsColBodyFrm() )
                 [ +  + ]
    2596                 :            :     {
    2597         [ +  - ]:        180 :         SwTwips nTmp = GetUpper()->Shrink( nReal, bTst, bInfo );
    2598         [ +  + ]:        180 :         if ( nTmp != nReal )
    2599                 :            :         {
    2600 [ +  - ][ +  - ]:        304 :             (Frm().*fnRect->fnSetHeight)( (Frm().*fnRect->fnGetHeight)()
    2601 [ +  - ][ +  - ]:        304 :                                           + nReal - nTmp );
    2602                 :            :             //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    2603 [ -  + ][ #  # ]:        152 :             if( bChgPos && !IsVertLR() )
                 [ -  + ]
    2604                 :          0 :                 Frm().Pos().X() += nTmp - nReal;
    2605                 :            :             OSL_ENSURE( !IsAccessibleFrm(), "bMoveAccFrm has to be set!" );
    2606                 :        152 :             nReal = nTmp;
    2607                 :            :         }
    2608                 :            :     }
    2609                 :            :     else
    2610                 :            :     {
    2611                 :        979 :         SwTwips nShrink = nReal;
    2612                 :        979 :         SwFrm* pToShrink = GetUpper();
    2613         [ -  + ]:        979 :         const SwCellFrm* pThisCell = dynamic_cast<const SwCellFrm*>(this);
    2614                 :            :         // NEW TABLES
    2615 [ +  + ][ +  - ]:        979 :         if ( pThisCell && pThisCell->GetLayoutRowSpan() > 1 )
         [ -  + ][ -  + ]
    2616                 :            :         {
    2617         [ #  # ]:          0 :             SwCellFrm& rEndCell = const_cast<SwCellFrm&>(pThisCell->FindStartEndOfRowSpanCell( false, true ));
    2618                 :          0 :             pToShrink = rEndCell.GetUpper();
    2619                 :            :         }
    2620                 :            : 
    2621 [ +  - ][ +  - ]:        979 :         nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0;
    2622 [ +  - ][ -  + ]:        979 :         if( ( NA_GROW_ADJUST == nAdjust || NA_ADJUST_GROW == nAdjust )
                 [ #  # ]
    2623                 :            :             && nReal < nShrink )
    2624         [ #  # ]:          0 :             AdjustNeighbourhood( nReal - nShrink );
    2625                 :            :     }
    2626                 :            : 
    2627 [ +  - ][ +  + ]:       1197 :     if( bMoveAccFrm && IsAccessibleFrm() )
                 [ +  + ]
    2628                 :            :     {
    2629                 :        983 :         SwRootFrm *pRootFrm = getRootFrm();
    2630   [ -  +  #  # ]:        983 :         if( pRootFrm && pRootFrm->IsAnyShellAccessible() &&
         [ -  + ][ +  - ]
    2631                 :          0 :             pRootFrm->GetCurrShell() )
    2632                 :            :         {
    2633         [ #  # ]:          0 :             pRootFrm->GetCurrShell()->Imp()->MoveAccessibleFrm( this, aOldFrm );
    2634                 :            :         }
    2635                 :            :     }
    2636 [ +  - ][ +  + ]:       1197 :     if ( !bTst && (IsCellFrm() || IsColumnFrm() ? nReal : nRealDist) )
         [ +  + ][ +  + ]
         [ +  - ][ +  + ]
    2637                 :            :     {
    2638         [ +  - ]:        246 :         SwPageFrm *pPage = FindPageFrm();
    2639         [ +  + ]:        246 :         if ( GetNext() )
    2640                 :            :         {
    2641         [ +  - ]:         96 :             GetNext()->_InvalidatePos();
    2642         [ +  + ]:         96 :             if ( GetNext()->IsCntntFrm() )
    2643         [ +  - ]:         64 :                 GetNext()->InvalidatePage( pPage );
    2644         [ +  + ]:         96 :             if ( IsTabFrm() )
    2645                 :         64 :                 ((SwTabFrm*)this)->SetComplete();
    2646                 :            :         }
    2647                 :            :         else
    2648         [ +  + ]:        150 :         {   if ( IsRetoucheFrm() )
    2649                 :          6 :                 SetRetouche();
    2650         [ -  + ]:        150 :             if ( IsTabFrm() )
    2651                 :            :             {
    2652         [ #  # ]:          0 :                 if( IsTabFrm() )
    2653                 :          0 :                     ((SwTabFrm*)this)->SetComplete();
    2654         [ #  # ]:          0 :                 if ( Lower() )  // Can also be in the Join and be empty!
    2655         [ #  # ]:          0 :                     InvalidateNextPos();
    2656                 :            :             }
    2657                 :            :         }
    2658         [ +  + ]:        246 :         if ( !IsBodyFrm() )
    2659                 :            :         {
    2660         [ +  - ]:        148 :             _InvalidateAll();
    2661         [ +  - ]:        148 :             InvalidatePage( pPage );
    2662 [ +  - ][ +  - ]:        148 :             const SvxGraphicPosition ePos = GetFmt()->GetBackground().GetGraphicPos();
    2663 [ #  # ][ -  + ]:        148 :             if ( GPOS_NONE != ePos && GPOS_TILED != ePos )
    2664                 :          0 :                 SetCompletePaint();
    2665                 :            :         }
    2666                 :            : 
    2667         [ +  + ]:        246 :         if ( !(GetType() & 0x1823) ) //Tab, Row, FtnCont, Root, Page
    2668         [ +  - ]:        156 :             NotifyLowerObjs();
    2669                 :            : 
    2670         [ +  + ]:        246 :         if( IsCellFrm() )
    2671         [ +  - ]:         34 :             InvaPercentLowers( nReal );
    2672                 :            : 
    2673                 :            :         SwCntntFrm *pCnt;
    2674         [ +  + ]:        252 :         if( IsFtnFrm() && !((SwFtnFrm*)this)->GetAttr()->GetFtn().IsEndNote() &&
           [ +  -  -  + ]
           [ #  #  #  # ]
         [ +  - ][ +  - ]
                 [ +  + ]
    2675         [ +  - ]:          6 :             ( GetFmt()->GetDoc()->GetFtnInfo().ePos != FTNPOS_CHAPTER ||
    2676 [ #  # ][ #  # ]:          0 :               ( IsInSct() && FindSctFrm()->IsFtnAtEnd() ) ) &&
    2677                 :            :               0 != (pCnt = ((SwFtnFrm*)this)->GetRefFromAttr() ) )
    2678                 :            :         {
    2679         [ -  + ]:          6 :             if ( pCnt->IsFollow() )
    2680                 :            :             {   // If we are in an other column/page than the frame with the
    2681                 :            :                 // reference, we don't need to invalidate its master.
    2682 [ #  # ][ #  # ]:          0 :                 SwFrm *pTmp = pCnt->FindFtnBossFrm(sal_True) == FindFtnBossFrm(sal_True)
    2683 [ #  # ][ #  # ]:          0 :                               ?  pCnt->FindMaster()->GetFrm() : pCnt;
    2684         [ #  # ]:          0 :                 pTmp->Prepare( PREP_ADJUST_FRM );
    2685         [ #  # ]:          0 :                 pTmp->InvalidateSize();
    2686                 :            :             }
    2687                 :            :             else
    2688         [ +  - ]:          6 :                 pCnt->InvalidatePos();
    2689                 :            :         }
    2690                 :            :     }
    2691                 :       2046 :     return nReal;
    2692                 :            : }
    2693                 :            : /*************************************************************************
    2694                 :            : |*
    2695                 :            : |*  SwLayoutFrm::ChgLowersProp()
    2696                 :            : |*
    2697                 :            : |*  Description          Changes the size of the directly subsidiary Frm's
    2698                 :            : |*      which have a fixed size, proportionally to the size change of the
    2699                 :            : |*      PrtArea of the Frm's.
    2700                 :            : |*      The variable Frms are also proportionally adapted; they will
    2701                 :            : |*      grow/shrink again by themselves.
    2702                 :            : |*
    2703                 :            : |*************************************************************************/
    2704                 :       8242 : void SwLayoutFrm::ChgLowersProp( const Size& rOldSize )
    2705                 :            : {
    2706                 :            :     // no change of lower properties for root frame or if no lower exists.
    2707 [ +  - ][ +  + ]:       8242 :     if ( IsRootFrm() || !Lower() )
                 [ +  + ]
    2708                 :       3172 :         return;
    2709                 :            : 
    2710                 :            :     // declare and init <SwFrm* pLowerFrm> with first lower
    2711                 :       5070 :     SwFrm *pLowerFrm = Lower();
    2712                 :            : 
    2713                 :            :     // declare and init const booleans <bHeightChgd> and <bWidthChg>
    2714                 :       5070 :     const bool bHeightChgd = rOldSize.Height() != Prt().Height();
    2715                 :       5070 :     const bool bWidthChgd  = rOldSize.Width()  != Prt().Width();
    2716                 :            : 
    2717                 :            :     // declare and init variables <bVert>, <bRev> and <fnRect>
    2718 [ +  - ][ -  + ]:       5070 :     SWRECTFN( this )
         [ -  + ][ +  + ]
    2719                 :            : 
    2720                 :            :     // This shortcut basically tries to handle only lower frames that
    2721                 :            :     // are affected by the size change. Otherwise much more lower frames
    2722                 :            :     // are invalidated.
    2723 [ +  + ][ +  +  :      10692 :     if ( !( bVert ? bHeightChgd : bWidthChgd ) &&
          +  +  +  +  +  
          -  +  +  +  -  
           +  + ][ +  + ]
    2724                 :       1799 :          ! Lower()->IsColumnFrm() &&
    2725                 :       2261 :            ( ( IsBodyFrm() && IsInDocBody() && ( !IsInSct() || !FindSctFrm()->IsColLocked() ) ) ||
    2726                 :            :                 // #i10826# Section frames without columns should not
    2727                 :            :                 // invalidate all lowers!
    2728                 :       1562 :                IsSctFrm() ) )
    2729                 :            :     {
    2730                 :            :         // Determine page frame the body frame resp. the section frame belongs to.
    2731                 :        152 :         SwPageFrm *pPage = FindPageFrm();
    2732                 :            :         // Determine last lower by traveling through them using <GetNext()>.
    2733                 :            :         // During travel check each section frame, if it will be sized to
    2734                 :            :         // maximum. If Yes, invalidate size of section frame and set
    2735                 :            :         // corresponding flags at the page.
    2736                 :         73 :         do
    2737                 :            :         {
    2738 [ -  + ][ #  # ]:        225 :             if( pLowerFrm->IsSctFrm() &&((SwSectionFrm*)pLowerFrm)->_ToMaximize() )
                 [ -  + ]
    2739                 :            :             {
    2740                 :          0 :                 pLowerFrm->_InvalidateSize();
    2741                 :          0 :                 pLowerFrm->InvalidatePage( pPage );
    2742                 :            :             }
    2743         [ +  + ]:        225 :             if( pLowerFrm->GetNext() )
    2744                 :         73 :                 pLowerFrm = pLowerFrm->GetNext();
    2745                 :            :             else
    2746                 :        152 :                 break;
    2747                 :            :         } while( sal_True );
    2748                 :            :         // If found last lower is a section frame containing no section
    2749                 :            :         // (section frame isn't valid and will be deleted in the future),
    2750                 :            :         // travel backwards.
    2751         [ -  + ]:        152 :         while( pLowerFrm->IsSctFrm() && !((SwSectionFrm*)pLowerFrm)->GetSection() &&
           [ #  #  #  # ]
                 [ -  + ]
    2752                 :          0 :                pLowerFrm->GetPrev() )
    2753                 :          0 :             pLowerFrm = pLowerFrm->GetPrev();
    2754                 :            :         // If found last lower is a section frame, set <pLowerFrm> to its last
    2755                 :            :         // content, if the section frame is valid and is not sized to maximum.
    2756                 :            :         // Otherwise set <pLowerFrm> to NULL - In this case body frame only
    2757                 :            :         //      contains invalid section frames.
    2758         [ -  + ]:        152 :         if( pLowerFrm->IsSctFrm() )
    2759                 :          0 :             pLowerFrm = ((SwSectionFrm*)pLowerFrm)->GetSection() &&
    2760                 :          0 :                    !((SwSectionFrm*)pLowerFrm)->ToMaximize( sal_False ) ?
    2761   [ #  #  #  # ]:          0 :                    ((SwSectionFrm*)pLowerFrm)->FindLastCntnt() : NULL;
    2762                 :            : 
    2763                 :            :         // continue with found last lower, probably the last content of a section
    2764         [ +  - ]:        152 :         if ( pLowerFrm )
    2765                 :            :         {
    2766                 :            :             // If <pLowerFrm> is in a table frame, set <pLowerFrm> to this table
    2767                 :            :             // frame and continue.
    2768         [ -  + ]:        152 :             if ( pLowerFrm->IsInTab() )
    2769                 :            :             {
    2770                 :            :                 // OD 28.10.2002 #97265# - safeguard for setting <pLowerFrm> to
    2771                 :            :                 // its table frame - check, if the table frame is also a lower
    2772                 :            :                 // of the body frame, in order to assure that <pLowerFrm> is not
    2773                 :            :                 // set to a frame, which is an *upper* of the body frame.
    2774                 :          0 :                 SwFrm* pTableFrm = pLowerFrm->FindTabFrm();
    2775         [ #  # ]:          0 :                 if ( IsAnLower( pTableFrm ) )
    2776                 :            :                 {
    2777                 :          0 :                     pLowerFrm = pTableFrm;
    2778                 :            :                 }
    2779                 :            :             }
    2780                 :            :             // Check, if variable size of body frame resp. section frame has grown
    2781                 :            :             // OD 28.10.2002 #97265# - correct check, if variable size has grown.
    2782         [ -  + ]:        152 :             SwTwips nOldHeight = bVert ? rOldSize.Width() : rOldSize.Height();
    2783 [ +  - ][ +  + ]:        152 :             if( nOldHeight < (Prt().*fnRect->fnGetHeight)() )
    2784                 :            :             {
    2785                 :            :                 // If variable size of body|section frame has grown, only found
    2786                 :            :                 // last lower and the position of the its next have to be invalidated.
    2787                 :         28 :                 pLowerFrm->_InvalidateAll();
    2788                 :         28 :                 pLowerFrm->InvalidatePage( pPage );
    2789         [ +  - ]:         56 :                 if( !pLowerFrm->IsFlowFrm() ||
           [ +  -  +  - ]
    2790                 :         28 :                     !SwFlowFrm::CastFlowFrm( pLowerFrm )->HasFollow() )
    2791                 :         28 :                     pLowerFrm->InvalidateNextPos( sal_True );
    2792         [ +  - ]:         28 :                 if ( pLowerFrm->IsTxtFrm() )
    2793                 :         28 :                     ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
    2794                 :            :             }
    2795                 :            :             else
    2796                 :            :             {
    2797                 :            :                 // variable size of body|section frame has shrinked. Thus,
    2798                 :            :                 // invalidate all lowers not matching the new body|section size
    2799                 :            :                 // and the dedicated new last lower.
    2800         [ -  + ]:        124 :                 if( bVert )
    2801                 :            :                 {
    2802                 :          0 :                     SwTwips nBot = Frm().Left() + Prt().Left();
    2803 [ #  # ][ #  # ]:          0 :                     while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Left() < nBot )
                 [ #  # ]
    2804                 :            :                     {
    2805                 :          0 :                         pLowerFrm->_InvalidateAll();
    2806                 :          0 :                         pLowerFrm->InvalidatePage( pPage );
    2807                 :          0 :                         pLowerFrm = pLowerFrm->GetPrev();
    2808                 :            :                     }
    2809                 :            :                 }
    2810                 :            :                 else
    2811                 :            :                 {
    2812                 :        124 :                     SwTwips nBot = Frm().Top() + Prt().Bottom();
    2813 [ +  + ][ -  + ]:        124 :                     while ( pLowerFrm->GetPrev() && pLowerFrm->Frm().Top() > nBot )
                 [ -  + ]
    2814                 :            :                     {
    2815                 :          0 :                         pLowerFrm->_InvalidateAll();
    2816                 :          0 :                         pLowerFrm->InvalidatePage( pPage );
    2817                 :          0 :                         pLowerFrm = pLowerFrm->GetPrev();
    2818                 :            :                     }
    2819                 :            :                 }
    2820         [ +  - ]:        124 :                 if ( pLowerFrm )
    2821                 :            :                 {
    2822                 :        124 :                     pLowerFrm->_InvalidateSize();
    2823                 :        124 :                     pLowerFrm->InvalidatePage( pPage );
    2824         [ +  - ]:        124 :                     if ( pLowerFrm->IsTxtFrm() )
    2825                 :        124 :                         ((SwCntntFrm*)pLowerFrm)->Prepare( PREP_ADJUST_FRM );
    2826                 :            :                 }
    2827                 :            :             }
    2828                 :            :             // #i41694# - improvement by removing duplicates
    2829         [ +  - ]:        152 :             if ( pLowerFrm )
    2830                 :            :             {
    2831         [ +  + ]:        152 :                 if ( pLowerFrm->IsInSct() )
    2832                 :            :                 {
    2833                 :            :                     // #i41694# - follow-up of issue #i10826#
    2834                 :            :                     // No invalidation of section frame, if it's the this.
    2835                 :          3 :                     SwFrm* pSectFrm = pLowerFrm->FindSctFrm();
    2836 [ #  # ][ -  + ]:          3 :                     if( pSectFrm != this && IsAnLower( pSectFrm ) )
                 [ -  + ]
    2837                 :            :                     {
    2838                 :          0 :                         pSectFrm->_InvalidateSize();
    2839                 :          0 :                         pSectFrm->InvalidatePage( pPage );
    2840                 :            :                     }
    2841                 :            :                 }
    2842                 :            :             }
    2843                 :            :         }
    2844                 :        152 :         return;
    2845                 :            :     } // end of { special case }
    2846                 :            : 
    2847                 :            : 
    2848                 :            :     // Invalidate page for content only once.
    2849                 :       4918 :     bool bInvaPageForCntnt = true;
    2850                 :            : 
    2851                 :            :     // Declare booleans <bFixChgd> and <bVarChgd>, indicating for text frame
    2852                 :            :     // adjustment, if fixed/variable size has changed.
    2853                 :            :     bool bFixChgd, bVarChgd;
    2854         [ +  + ]:       4918 :     if( bVert == pLowerFrm->IsNeighbourFrm() )
    2855                 :            :     {
    2856                 :       4826 :         bFixChgd = bWidthChgd;
    2857                 :       4826 :         bVarChgd = bHeightChgd;
    2858                 :            :     }
    2859                 :            :     else
    2860                 :            :     {
    2861                 :         92 :         bFixChgd = bHeightChgd;
    2862                 :         92 :         bVarChgd = bWidthChgd;
    2863                 :            :     }
    2864                 :            : 
    2865                 :            :     // Declare const unsigned short <nFixWidth> and init it this frame types
    2866                 :            :     // which has fixed width in vertical respectively horizontal layout.
    2867                 :            :     // In vertical layout these are neighbour frames (cell and column frames),
    2868                 :            :     //      header frames and footer frames.
    2869                 :            :     // In horizontal layout these are all frames, which aren't neighbour frames.
    2870                 :            :     const sal_uInt16 nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT)
    2871         [ +  + ]:       4918 :                                    : ~FRM_NEIGHBOUR;
    2872                 :            : 
    2873                 :            :     // Declare const unsigned short <nFixHeight> and init it this frame types
    2874                 :            :     // which has fixed height in vertical respectively horizontal layout.
    2875                 :            :     // In vertical layout these are all frames, which aren't neighbour frames,
    2876                 :            :     //      header frames, footer frames, body frames or foot note container frames.
    2877                 :            :     // In horizontal layout these are neighbour frames.
    2878                 :            :     const sal_uInt16 nFixHeight= bVert ? ~(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC)
    2879         [ +  + ]:       4918 :                                    : FRM_NEIGHBOUR;
    2880                 :            : 
    2881                 :            :     // Travel through all lowers using <GetNext()>
    2882         [ +  + ]:      10561 :     while ( pLowerFrm )
    2883                 :            :     {
    2884         [ +  + ]:       5643 :         if ( pLowerFrm->IsTxtFrm() )
    2885                 :            :         {
    2886                 :            :             // Text frames will only be invalidated - prepare invalidation
    2887         [ +  + ]:       3731 :             if ( bFixChgd )
    2888                 :       2470 :                 static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_FIXSIZE_CHG );
    2889         [ +  + ]:       3731 :             if ( bVarChgd )
    2890                 :       2416 :                 static_cast<SwCntntFrm*>(pLowerFrm)->Prepare( PREP_ADJUST_FRM );
    2891                 :            :         }
    2892                 :            :         else
    2893                 :            :         {
    2894                 :            :             // If lower isn't a table, row, cell or section frame, adjust its
    2895                 :            :             // frame size.
    2896                 :       1912 :             const sal_uInt16 nLowerType = pLowerFrm->GetType();
    2897         [ +  + ]:       1912 :             if ( !(nLowerType & (FRM_TAB|FRM_ROW|FRM_CELL|FRM_SECTION)) )
    2898                 :            :             {
    2899         [ +  + ]:       1268 :                 if ( bWidthChgd )
    2900                 :            :                 {
    2901         [ +  + ]:        698 :                     if( nLowerType & nFixWidth )
    2902                 :            :                     {
    2903                 :            :                         // Considering previous conditions:
    2904                 :            :                         // In vertical layout set width of column, header and
    2905                 :            :                         // footer frames to its upper width.
    2906                 :            :                         // In horizontal layout set width of header, footer,
    2907                 :            :                         // foot note container, foot note, body and no-text
    2908                 :            :                         // frames to its upper width.
    2909                 :        696 :                         pLowerFrm->Frm().Width( Prt().Width() );
    2910                 :            :                     }
    2911 [ +  - ][ +  - ]:          2 :                     else if( rOldSize.Width() && !pLowerFrm->IsFtnFrm() )
                 [ +  - ]
    2912                 :            :                     {
    2913                 :            :                         // Adjust frame width proportional, if lower isn't a
    2914                 :            :                         // foot note frame and condition <nLowerType & nFixWidth>
    2915                 :            :                         // isn't true.
    2916                 :            :                         // Considering previous conditions:
    2917                 :            :                         // In vertical layout these are foot note container,
    2918                 :            :                         // body and no-text frames.
    2919                 :            :                         // In horizontal layout these are column and no-text frames.
    2920                 :            :                         // OD 24.10.2002 #97265# - <double> calculation
    2921                 :            :                         // Perform <double> calculation of new width, if
    2922                 :            :                         // one of the coefficients is greater than 50000
    2923                 :            :                         SwTwips nNewWidth;
    2924   [ +  -  -  + ]:          4 :                         if ( (pLowerFrm->Frm().Width() > 50000) ||
                 [ -  + ]
    2925                 :          2 :                              (Prt().Width() > 50000) )
    2926                 :            :                         {
    2927                 :            :                             double nNewWidthTmp =
    2928                 :          0 :                                 ( double(pLowerFrm->Frm().Width())
    2929                 :          0 :                                   * double(Prt().Width()) )
    2930                 :          0 :                                 / double(rOldSize.Width());
    2931                 :          0 :                             nNewWidth = SwTwips(nNewWidthTmp);
    2932                 :            :                         }
    2933                 :            :                         else
    2934                 :            :                         {
    2935                 :            :                             nNewWidth =
    2936                 :          2 :                                 (pLowerFrm->Frm().Width() * Prt().Width()) / rOldSize.Width();
    2937                 :            :                         }
    2938                 :          2 :                         pLowerFrm->Frm().Width( nNewWidth );
    2939                 :            :                     }
    2940                 :            :                 }
    2941         [ +  + ]:       1268 :                 if ( bHeightChgd )
    2942                 :            :                 {
    2943         [ +  + ]:       1193 :                     if( nLowerType & nFixHeight )
    2944                 :            :                     {
    2945                 :            :                         // Considering previous conditions:
    2946                 :            :                         // In vertical layout set height of foot note and
    2947                 :            :                         // no-text frames to its upper height.
    2948                 :            :                         // In horizontal layout set height of column frames
    2949                 :            :                         // to its upper height.
    2950                 :        272 :                         pLowerFrm->Frm().Height( Prt().Height() );
    2951                 :            :                     }
    2952                 :            :                     // OD 01.10.2002 #102211#
    2953                 :            :                     // add conditions <!pLowerFrm->IsHeaderFrm()> and
    2954                 :            :                     // <!pLowerFrm->IsFooterFrm()> in order to avoid that
    2955                 :            :                     // the <Grow> of header or footer are overwritten.
    2956                 :            :                     // NOTE: Height of header/footer frame is determined by contents.
    2957   [ +  +  +  +  :       2091 :                     else if ( rOldSize.Height() &&
             +  +  +  - ]
                 [ +  + ]
    2958                 :        392 :                               !pLowerFrm->IsFtnFrm() &&
    2959                 :        390 :                               !pLowerFrm->IsHeaderFrm() &&
    2960                 :        388 :                               !pLowerFrm->IsFooterFrm()
    2961                 :            :                             )
    2962                 :            :                     {
    2963                 :            :                         // Adjust frame height proportional, if lower isn't a
    2964                 :            :                         // foot note, a header or a footer frame and
    2965                 :            :                         // condition <nLowerType & nFixHeight> isn't true.
    2966                 :            :                         // Considering previous conditions:
    2967                 :            :                         // In vertical layout these are column, foot note container,
    2968                 :            :                         // body and no-text frames.
    2969                 :            :                         // In horizontal layout these are column, foot note
    2970                 :            :                         // container, body and no-text frames.
    2971                 :            : 
    2972                 :            :                         // OD 29.10.2002 #97265# - special case for page lowers
    2973                 :            :                         // The page lowers that have to be adjusted on page height
    2974                 :            :                         // change are the body frame and the foot note container
    2975                 :            :                         // frame.
    2976                 :            :                         // In vertical layout the height of both is directly
    2977                 :            :                         // adjusted to the page height change.
    2978                 :            :                         // In horizontal layout the height of the body frame is
    2979                 :            :                         // directly adjsuted to the page height change and the
    2980                 :            :                         // foot note frame height isn't touched, because its
    2981                 :            :                         // determined by its content.
    2982                 :            :                         // OD 31.03.2003 #108446# - apply special case for page
    2983                 :            :                         // lowers - see description above - also for section columns.
    2984   [ +  +  +  +  :        996 :                         if ( IsPageFrm() ||
           +  - ][ +  + ]
    2985                 :        608 :                              ( IsColumnFrm() && IsInSct() )
    2986                 :            :                            )
    2987                 :            :                         {
    2988                 :            :                             OSL_ENSURE( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm(),
    2989                 :            :                                     "ChgLowersProp - only for body or foot note container" );
    2990 [ +  + ][ +  - ]:        380 :                             if ( pLowerFrm->IsBodyFrm() || pLowerFrm->IsFtnContFrm() )
                 [ +  - ]
    2991                 :            :                             {
    2992 [ +  + ][ +  + ]:        380 :                                 if ( IsVertical() || pLowerFrm->IsBodyFrm() )
                 [ +  + ]
    2993                 :            :                                 {
    2994                 :            :                                     SwTwips nNewHeight =
    2995                 :        372 :                                             pLowerFrm->Frm().Height() +
    2996                 :        372 :                                             ( Prt().Height() - rOldSize.Height() );
    2997         [ +  + ]:        372 :                                     if ( nNewHeight < 0)
    2998                 :            :                                     {
    2999                 :            :                                         // OD 01.04.2003 #108446# - adjust assertion condition and text
    3000                 :            :                                         OSL_ENSURE( !( IsPageFrm() &&
    3001                 :            :                                                    (pLowerFrm->Frm().Height()>0) &&
    3002                 :            :                                                    (pLowerFrm->IsValid()) ),
    3003                 :            :                                                     "ChgLowersProg - negative height for lower.");
    3004                 :          6 :                                         nNewHeight = 0;
    3005                 :            :                                     }
    3006                 :        372 :                                     pLowerFrm->Frm().Height( nNewHeight );
    3007                 :            :                                 }
    3008                 :            :                             }
    3009                 :            :                         }
    3010                 :            :                         else
    3011                 :            :                         {
    3012                 :            :                             SwTwips nNewHeight;
    3013                 :            :                             // OD 24.10.2002 #97265# - <double> calculation
    3014                 :            :                             // Perform <double> calculation of new height, if
    3015                 :            :                             // one of the coefficients is greater than 50000
    3016   [ +  -  -  + ]:         16 :                             if ( (pLowerFrm->Frm().Height() > 50000) ||
                 [ -  + ]
    3017                 :          8 :                                  (Prt().Height() > 50000) )
    3018                 :            :                             {
    3019                 :            :                                 double nNewHeightTmp =
    3020                 :          0 :                                     ( double(pLowerFrm->Frm().Height())
    3021                 :          0 :                                       * double(Prt().Height()) )
    3022                 :          0 :                                     / double(rOldSize.Height());
    3023                 :          0 :                                 nNewHeight = SwTwips(nNewHeightTmp);
    3024                 :            :                             }
    3025                 :            :                             else
    3026                 :            :                             {
    3027                 :          8 :                                 nNewHeight = ( pLowerFrm->Frm().Height()
    3028                 :          8 :                                              * Prt().Height() ) / rOldSize.Height();
    3029                 :            :                             }
    3030         [ +  - ]:          8 :                             if( !pLowerFrm->GetNext() )
    3031                 :            :                             {
    3032                 :          8 :                                 SwTwips nSum = Prt().Height();
    3033                 :          8 :                                 SwFrm* pTmp = Lower();
    3034         [ -  + ]:          8 :                                 while( pTmp->GetNext() )
    3035                 :            :                                 {
    3036 [ #  # ][ #  # ]:          0 :                                     if( !pTmp->IsFtnContFrm() || !pTmp->IsVertical() )
                 [ #  # ]
    3037                 :          0 :                                         nSum -= pTmp->Frm().Height();
    3038                 :          0 :                                     pTmp = pTmp->GetNext();
    3039                 :            :                                 }
    3040   [ -  +  #  # ]:          8 :                                 if( nSum - nNewHeight == 1 &&
                 [ -  + ]
    3041                 :          0 :                                     nSum == pLowerFrm->Frm().Height() )
    3042                 :          0 :                                     nNewHeight = nSum;
    3043                 :            :                             }
    3044                 :          8 :                             pLowerFrm->Frm().Height( nNewHeight );
    3045                 :            :                         }
    3046                 :            :                     }
    3047                 :            :                 }
    3048                 :            :             }
    3049                 :            :         } // end of else { NOT text frame }
    3050                 :            : 
    3051                 :       5643 :         pLowerFrm->_InvalidateAll();
    3052 [ +  + ][ +  + ]:       5643 :         if ( bInvaPageForCntnt && pLowerFrm->IsCntntFrm() )
                 [ +  + ]
    3053                 :            :         {
    3054                 :       4154 :             pLowerFrm->InvalidatePage();
    3055                 :       4154 :             bInvaPageForCntnt = false;
    3056                 :            :         }
    3057                 :            : 
    3058 [ +  + ][ +  + ]:       5643 :         if ( !pLowerFrm->GetNext() && pLowerFrm->IsRetoucheFrm() )
                 [ +  + ]
    3059                 :            :         {
    3060                 :            :             //If a growth took place and the subordinate elements can retouch
    3061                 :            :             //itself (currently Tabs, Sections and Cntnt) we trigger it.
    3062   [ +  +  +  + ]:       5778 :             if ( rOldSize.Height() < Prt().SSize().Height() ||
                 [ +  + ]
    3063                 :       1571 :                  rOldSize.Width() < Prt().SSize().Width() )
    3064                 :       3872 :                 pLowerFrm->SetRetouche();
    3065                 :            :         }
    3066                 :       5643 :         pLowerFrm = pLowerFrm->GetNext();
    3067                 :            :     }
    3068                 :            : 
    3069                 :            :     // Finally adjust the columns if width is set to auto
    3070                 :            :     // Possible optimisation: execute this code earlier in this function and
    3071                 :            :     // return???
    3072 [ +  + ][ -  + ]:       8189 :     if ( ( (bVert && bHeightChgd) || (! bVert && bWidthChgd) ) &&
                 [ +  - ]
           [ +  +  -  + ]
                 [ -  + ]
    3073                 :       3271 :            Lower()->IsColumnFrm() )
    3074                 :            :     {
    3075                 :            :         // get column attribute
    3076                 :          0 :         const SwFmtCol* pColAttr = NULL;
    3077         [ #  # ]:          0 :         if ( IsPageBodyFrm() )
    3078                 :            :         {
    3079                 :            :             OSL_ENSURE( GetUpper()->IsPageFrm(), "Upper is not page frame" );
    3080                 :          0 :             pColAttr = &GetUpper()->GetFmt()->GetCol();
    3081                 :            :         }
    3082                 :            :         else
    3083                 :            :         {
    3084                 :            :             OSL_ENSURE( IsFlyFrm() || IsSctFrm(), "Columns not in fly or section" );
    3085                 :          0 :             pColAttr = &GetFmt()->GetCol();
    3086                 :            :         }
    3087                 :            : 
    3088 [ #  # ][ #  # ]:          0 :         if ( pColAttr->IsOrtho() && pColAttr->GetNumCols() > 1 )
                 [ #  # ]
    3089                 :       8242 :             AdjustColumns( pColAttr, sal_False );
    3090                 :            :     }
    3091                 :            : }
    3092                 :            : 
    3093                 :            : /*************************************************************************
    3094                 :            : |*
    3095                 :            : |*  SwLayoutFrm::Format()
    3096                 :            : |*
    3097                 :            : |*  Description:        "Formats" the Frame; Frm and PrtArea.
    3098                 :            : |*                      The Fixsize is not set here.
    3099                 :            : |*
    3100                 :            : |*************************************************************************/
    3101                 :       3418 : void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs )
    3102                 :            : {
    3103                 :            :     OSL_ENSURE( pAttrs, "LayoutFrm::Format, pAttrs ist 0." );
    3104                 :            : 
    3105 [ +  + ][ -  + ]:       3418 :     if ( bValidPrtArea && bValidSize )
    3106                 :       3418 :         return;
    3107                 :            : 
    3108                 :       3418 :     const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this );
    3109                 :       3418 :     const sal_uInt16 nUpper = pAttrs->CalcTop();
    3110                 :            : 
    3111                 :       3418 :     const sal_uInt16 nRight = (sal_uInt16)((SwBorderAttrs*)pAttrs)->CalcRight( this );
    3112                 :       3418 :     const sal_uInt16 nLower = pAttrs->CalcBottom();
    3113 [ -  + ][ +  + ]:       3418 :     sal_Bool bVert = IsVertical() && !IsPageFrm();
    3114                 :            :     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
    3115 [ -  + ][ #  # ]:       3418 :     SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
    3116         [ +  + ]:       3418 :     if ( !bValidPrtArea )
    3117                 :            :     {
    3118                 :       2104 :         bValidPrtArea = sal_True;
    3119         [ +  - ]:       2104 :         (this->*fnRect->fnSetXMargins)( nLeft, nRight );
    3120         [ +  - ]:       2104 :         (this->*fnRect->fnSetYMargins)( nUpper, nLower );
    3121                 :            :     }
    3122                 :            : 
    3123         [ +  + ]:       3418 :     if ( !bValidSize )
    3124                 :            :     {
    3125         [ +  + ]:       3407 :         if ( !HasFixSize() )
    3126                 :            :         {
    3127                 :        229 :             const SwTwips nBorder = nUpper + nLower;
    3128                 :        229 :             const SwFmtFrmSize &rSz = GetFmt()->GetFrmSize();
    3129         [ +  + ]:        229 :             SwTwips nMinHeight = rSz.GetHeightSizeType() == ATT_MIN_SIZE ? rSz.GetHeight() : 0;
    3130         [ +  + ]:        238 :             do
    3131                 :        238 :             {   bValidSize = sal_True;
    3132                 :            : 
    3133                 :            :                 //The size in VarSize is calculated using the content plus the
    3134                 :            :                 // borders.
    3135                 :        238 :                 SwTwips nRemaining = 0;
    3136                 :        238 :                 SwFrm *pFrm = Lower();
    3137         [ +  + ]:        578 :                 while ( pFrm )
    3138         [ +  - ]:        340 :                 {   nRemaining += (pFrm->Frm().*fnRect->fnGetHeight)();
    3139 [ -  + ][ -  + ]:        340 :                     if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsUndersized() )
                 [ +  + ]
    3140                 :            :                     // This TxtFrm would like to be a bit bigger
    3141                 :          0 :                         nRemaining += ((SwTxtFrm*)pFrm)->GetParHeight()
    3142         [ #  # ]:          0 :                                       - (pFrm->Prt().*fnRect->fnGetHeight)();
    3143 [ +  + ][ -  + ]:        340 :                     else if( pFrm->IsSctFrm() && ((SwSectionFrm*)pFrm)->IsUndersized() )
                 [ -  + ]
    3144                 :          0 :                         nRemaining += ((SwSectionFrm*)pFrm)->Undersize();
    3145                 :        340 :                     pFrm = pFrm->GetNext();
    3146                 :            :                 }
    3147                 :        238 :                 nRemaining += nBorder;
    3148                 :        238 :                 nRemaining = Max( nRemaining, nMinHeight );
    3149         [ +  - ]:        238 :                 const SwTwips nDiff = nRemaining-(Frm().*fnRect->fnGetHeight)();
    3150         [ +  - ]:        238 :                 const long nOldLeft = (Frm().*fnRect->fnGetLeft)();
    3151         [ +  - ]:        238 :                 const long nOldTop = (Frm().*fnRect->fnGetTop)();
    3152         [ +  + ]:        238 :                 if ( nDiff )
    3153                 :            :                 {
    3154         [ +  - ]:          9 :                     if ( nDiff > 0 )
    3155                 :          9 :                         Grow( nDiff );
    3156                 :            :                     else
    3157                 :          0 :                         Shrink( -nDiff );
    3158                 :            :                     //Updates the positions using the fast channel.
    3159                 :          9 :                     MakePos();
    3160                 :            :                 }
    3161                 :            :                 //Don't exceed the bottom edge of the Upper.
    3162 [ +  - ][ +  - ]:        238 :                 if ( GetUpper() && (Frm().*fnRect->fnGetHeight)() )
         [ +  + ][ +  + ]
    3163                 :            :                 {
    3164         [ +  - ]:        173 :                     const SwTwips nLimit = (GetUpper()->*fnRect->fnGetPrtBottom)();
    3165   [ -  +  #  #  :        173 :                     if( (this->*fnRect->fnSetLimit)( nLimit ) &&
           #  # ][ -  + ]
                 [ +  - ]
    3166         [ #  # ]:          0 :                         nOldLeft == (Frm().*fnRect->fnGetLeft)() &&
    3167         [ #  # ]:          0 :                         nOldTop  == (Frm().*fnRect->fnGetTop)() )
    3168                 :          0 :                         bValidSize = bValidPrtArea = sal_True;
    3169                 :            :                 }
    3170                 :        238 :             } while ( !bValidSize );
    3171                 :            :         }
    3172         [ -  + ]:       3178 :         else if ( GetType() & 0x0018 )
    3173                 :            :         {
    3174         [ #  # ]:          0 :             do
    3175         [ #  # ]:          0 :             {   if ( Frm().Height() != pAttrs->GetSize().Height() )
    3176         [ #  # ]:          0 :                     ChgSize( Size( Frm().Width(), pAttrs->GetSize().Height()));
    3177                 :          0 :                 bValidSize = sal_True;
    3178                 :          0 :                 MakePos();
    3179                 :          0 :             } while ( !bValidSize );
    3180                 :            :         }
    3181                 :            :         else
    3182                 :       3178 :             bValidSize = sal_True;
    3183                 :            :     }
    3184                 :            : }
    3185                 :            : 
    3186                 :            : /*************************************************************************
    3187                 :            : |*
    3188                 :            : |*  SwLayoutFrm::InvalidatePercentLowers()
    3189                 :            : |*
    3190                 :            : |*************************************************************************/
    3191                 :         12 : static void InvaPercentFlys( SwFrm *pFrm, SwTwips nDiff )
    3192                 :            : {
    3193                 :            :     OSL_ENSURE( pFrm->GetDrawObjs(), "Can't find any Objects" );
    3194         [ +  + ]:         24 :     for ( sal_uInt16 i = 0; i < pFrm->GetDrawObjs()->Count(); ++i )
    3195                 :            :     {
    3196                 :         12 :         SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
    3197         [ +  + ]:         12 :         if ( pAnchoredObj->ISA(SwFlyFrm) )
    3198                 :            :         {
    3199         [ +  - ]:          9 :             SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
    3200                 :          9 :             const SwFmtFrmSize &rSz = pFly->GetFmt()->GetFrmSize();
    3201 [ -  + ][ -  + ]:          9 :             if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
                 [ +  - ]
    3202                 :            :             {
    3203                 :          0 :                 sal_Bool bNotify = sal_True;
    3204                 :            :                 // If we've a fly with more than 90% relative height...
    3205         [ #  # ]:          0 :                 if( rSz.GetHeightPercent() > 90 && pFly->GetAnchorFrm() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    3206                 :          0 :                     rSz.GetHeightPercent() != 0xFF && nDiff )
    3207                 :            :                 {
    3208                 :          0 :                     const SwFrm *pRel = pFly->IsFlyLayFrm() ? pFly->GetAnchorFrm():
    3209         [ #  # ]:          0 :                                         pFly->GetAnchorFrm()->GetUpper();
    3210                 :            :                     // ... and we have already more than 90% height and we
    3211                 :            :                     // not allow the text to go through...
    3212                 :            :                     // then a notifycation could cause an endless loop, e.g.
    3213                 :            :                     // 100% height and no text wrap inside a cell of a table.
    3214   [ #  #  #  # ]:          0 :                     if( pFly->Frm().Height()*10 >
                 [ #  # ]
    3215                 :          0 :                         ( nDiff + pRel->Prt().Height() )*9 &&
    3216                 :          0 :                         pFly->GetFmt()->GetSurround().GetSurround() !=
    3217                 :            :                         SURROUND_THROUGHT )
    3218                 :          0 :                        bNotify = sal_False;
    3219                 :            :                 }
    3220         [ #  # ]:          0 :                 if( bNotify )
    3221                 :          0 :                     pFly->InvalidateSize();
    3222                 :            :             }
    3223                 :            :         }
    3224                 :            :     }
    3225                 :         12 : }
    3226                 :            : 
    3227                 :       9343 : void SwLayoutFrm::InvaPercentLowers( SwTwips nDiff )
    3228                 :            : {
    3229         [ -  + ]:       9343 :     if ( GetDrawObjs() )
    3230                 :          0 :         ::InvaPercentFlys( this, nDiff );
    3231                 :            : 
    3232                 :       9343 :     SwFrm *pFrm = ContainsCntnt();
    3233         [ +  + ]:       9343 :     if ( pFrm )
    3234         [ +  + ]:      18064 :         do
           [ +  +  +  + ]
    3235                 :            :         {
    3236 [ +  + ][ +  + ]:       9705 :             if ( pFrm->IsInTab() && !IsTabFrm() )
                 [ +  + ]
    3237                 :            :             {
    3238                 :       5786 :                 SwFrm *pTmp = pFrm->FindTabFrm();
    3239                 :            :                 OSL_ENSURE( pTmp, "Where's my TabFrm?" );
    3240         [ +  + ]:       5786 :                 if( IsAnLower( pTmp ) )
    3241                 :         72 :                     pFrm = pTmp;
    3242                 :            :             }
    3243                 :            : 
    3244         [ +  + ]:       9705 :             if ( pFrm->IsTabFrm() )
    3245                 :            :             {
    3246                 :         72 :                 const SwFmtFrmSize &rSz = ((SwLayoutFrm*)pFrm)->GetFmt()->GetFrmSize();
    3247 [ -  + ][ +  + ]:         72 :                 if ( rSz.GetWidthPercent() || rSz.GetHeightPercent() )
                 [ +  + ]
    3248                 :          2 :                     pFrm->InvalidatePrt();
    3249                 :            :             }
    3250         [ +  + ]:       9633 :             else if ( pFrm->GetDrawObjs() )
    3251                 :         12 :                 ::InvaPercentFlys( pFrm, nDiff );
    3252                 :       9705 :             pFrm = pFrm->FindNextCnt();
    3253                 :       8359 :         } while ( pFrm && IsAnLower( pFrm ) ) ;
    3254                 :       9343 : }
    3255                 :            : 
    3256                 :            : /*************************************************************************
    3257                 :            : |*
    3258                 :            : |*  SwLayoutFrm::CalcRel()
    3259                 :            : |*
    3260                 :            : |*************************************************************************/
    3261                 :        749 : long SwLayoutFrm::CalcRel( const SwFmtFrmSize &rSz, sal_Bool ) const
    3262                 :            : {
    3263                 :        749 :     long nRet     = rSz.GetWidth(),
    3264                 :        749 :          nPercent = rSz.GetWidthPercent();
    3265                 :            : 
    3266         [ +  + ]:        749 :     if ( nPercent )
    3267                 :            :     {
    3268                 :          2 :         const SwFrm *pRel = GetUpper();
    3269                 :          2 :         long nRel = LONG_MAX;
    3270                 :          2 :         const ViewShell *pSh = getRootFrm()->GetCurrShell();
    3271 [ -  + ][ +  - ]:          2 :         const sal_Bool bBrowseMode = pSh && pSh->GetViewOptions()->getBrowseMode();
    3272 [ +  - ][ +  - ]:          2 :         if( pRel->IsPageBodyFrm() && pSh && bBrowseMode && pSh->VisArea().Width() )
         [ -  + ][ #  # ]
                 [ -  + ]
    3273                 :            :         {
    3274                 :          0 :             nRel = pSh->GetBrowseWidth();
    3275                 :          0 :             long nDiff = nRel - pRel->Prt().Width();
    3276         [ #  # ]:          0 :             if ( nDiff > 0 )
    3277                 :          0 :                 nRel -= nDiff;
    3278                 :            :         }
    3279                 :          2 :         nRel = Min( nRel, pRel->Prt().Width() );
    3280                 :          2 :         nRet = nRel * nPercent / 100;
    3281                 :            :     }
    3282                 :        749 :     return nRet;
    3283                 :            : }
    3284                 :            : 
    3285                 :            : /*************************************************************************
    3286                 :            : |*  Local helpers for SwLayoutFrm::FormatWidthCols()
    3287                 :            : |*************************************************************************/
    3288                 :         92 : long lcl_CalcMinColDiff( SwLayoutFrm *pLayFrm )
    3289                 :            : {
    3290                 :         92 :     long nDiff = 0, nFirstDiff = 0;
    3291                 :         92 :     SwLayoutFrm *pCol = (SwLayoutFrm*)pLayFrm->Lower();
    3292                 :            :     OSL_ENSURE( pCol, "Where's the columnframe?" );
    3293                 :         92 :     SwFrm *pFrm = pCol->Lower();
    3294 [ +  + ][ +  - ]:        284 :     do
                 [ +  + ]
    3295                 :            :     {
    3296 [ +  - ][ +  - ]:        284 :         if( pFrm && pFrm->IsBodyFrm() )
                 [ +  - ]
    3297                 :        284 :             pFrm = ((SwBodyFrm*)pFrm)->Lower();
    3298 [ +  + ][ +  - ]:        284 :         if ( pFrm && pFrm->IsTxtFrm() )
                 [ +  + ]
    3299                 :            :         {
    3300                 :         66 :             const long nTmp = ((SwTxtFrm*)pFrm)->FirstLineHeight();
    3301         [ +  - ]:         66 :             if ( nTmp != USHRT_MAX )
    3302                 :            :             {
    3303         [ +  - ]:         66 :                 if ( pCol == pLayFrm->Lower() )
    3304                 :         66 :                     nFirstDiff = nTmp;
    3305                 :            :                 else
    3306         [ #  # ]:          0 :                     nDiff = nDiff ? Min( nDiff, nTmp ) : nTmp;
    3307                 :            :             }
    3308                 :            :         }
    3309                 :            :         //Skip empty columns!
    3310                 :        284 :         pCol = (SwLayoutFrm*)pCol->GetNext();
    3311 [ +  + ][ -  + ]:        284 :         while ( pCol && 0 == (pFrm = pCol->Lower()) )
                 [ -  + ]
    3312                 :          0 :             pCol = (SwLayoutFrm*)pCol->GetNext();
    3313                 :            : 
    3314                 :            :     } while ( pFrm && pCol );
    3315                 :            : 
    3316 [ +  - ][ +  + ]:         92 :     return nDiff ? nDiff : nFirstDiff ? nFirstDiff : 240;
    3317                 :            : }
    3318                 :            : 
    3319                 :         92 : sal_Bool lcl_IsFlyHeightClipped( SwLayoutFrm *pLay )
    3320                 :            : {
    3321                 :         92 :     SwFrm *pFrm = pLay->ContainsCntnt();
    3322         [ +  + ]:       1186 :     while ( pFrm )
    3323                 :            :     {
    3324         [ -  + ]:       1094 :         if ( pFrm->IsInTab() )
    3325                 :          0 :             pFrm = pFrm->FindTabFrm();
    3326                 :            : 
    3327         [ -  + ]:       1094 :         if ( pFrm->GetDrawObjs() )
    3328                 :            :         {
    3329                 :          0 :             sal_uInt32 nCnt = pFrm->GetDrawObjs()->Count();
    3330         [ #  # ]:          0 :             for ( sal_uInt16 i = 0; i < nCnt; ++i )
    3331                 :            :             {
    3332                 :          0 :                 SwAnchoredObject* pAnchoredObj = (*pFrm->GetDrawObjs())[i];
    3333         [ #  # ]:          0 :                 if ( pAnchoredObj->ISA(SwFlyFrm) )
    3334                 :            :                 {
    3335         [ #  # ]:          0 :                     SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
    3336   [ #  #  #  #  :          0 :                     if ( pFly->IsHeightClipped() &&
           #  # ][ #  # ]
    3337                 :          0 :                          ( !pFly->IsFlyFreeFrm() || pFly->GetPageFrm() ) )
    3338                 :          0 :                         return sal_True;
    3339                 :            :                 }
    3340                 :            :             }
    3341                 :            :         }
    3342                 :       1094 :         pFrm = pFrm->FindNextCnt();
    3343                 :            :     }
    3344                 :         92 :     return sal_False;
    3345                 :            : }
    3346                 :            : 
    3347                 :            : /*************************************************************************
    3348                 :            : |*  SwLayoutFrm::FormatWidthCols()
    3349                 :            : |*************************************************************************/
    3350                 :          6 : void SwLayoutFrm::FormatWidthCols( const SwBorderAttrs &rAttrs,
    3351                 :            :                                    const SwTwips nBorder, const SwTwips nMinHeight )
    3352                 :            : {
    3353                 :            :     //If there are columns involved, the size is adjusted using the last column.
    3354                 :            :     //1. Format content.
    3355                 :            :     //2. Calculate height of the last column: if it's too big, the Fly has to
    3356                 :            :     //   grow. The amount by which the Fly grows is not the amount of the
    3357                 :            :     //   overhang because we have to act on the assumption that some text flows
    3358                 :            :     //   back which will generate some more space.
    3359                 :            :     //   The amount which we grow by equals the overhang
    3360                 :            :     //   divided by the amount of columns or the overhang itself if it's smaller
    3361                 :            :     //   than the amount of columns.
    3362                 :            :     //3. Go back to 1. until everything is stable.
    3363                 :            : 
    3364                 :          6 :     const SwFmtCol &rCol = rAttrs.GetAttrSet().GetCol();
    3365                 :          6 :     const sal_uInt16 nNumCols = rCol.GetNumCols();
    3366                 :            : 
    3367                 :          6 :     sal_Bool bEnd = sal_False;
    3368                 :          6 :     sal_Bool bBackLock = sal_False;
    3369                 :          6 :     ViewShell *pSh = getRootFrm()->GetCurrShell();
    3370         [ +  - ]:          6 :     SwViewImp *pImp = pSh ? pSh->Imp() : 0;
    3371                 :            :     {
    3372                 :            :         // Underlying algorithm
    3373                 :            :         // We try to find the optimal height for the column.
    3374                 :            :         // nMinimum starts with the passed minimum height and is then remembered
    3375                 :            :         // as the maximum height on which column content still juts out of a
    3376                 :            :         // column.
    3377                 :            :         // nMaximum starts with LONG_MAX and is then remembered as the minimum
    3378                 :            :         // width on which the content fitted.
    3379                 :            :         // In column based sections nMaximum starts at the maximum value which
    3380                 :            :         // the surrounding defines, this can certainly be a value on which
    3381                 :            :         // content still juts out.
    3382                 :            :         // The columns are formatted. If content still juts out, nMinimum is
    3383                 :            :         // adjusted accordingly, then we grow, at least by uMinDiff but not
    3384                 :            :         // over a certain nMaximum. If no content juts out but there is still
    3385                 :            :         // some space left in the column, shrinking is done accordingly, at
    3386                 :            :         // least by nMindIff but not below the nMinimum.
    3387                 :            :         // Cancel as soon as no content juts out and the difference from minimum
    3388                 :            :         // to maximum is less than MinDiff or the maximum which was defined by
    3389                 :            :         // the surrounding is reached even if some content still juts out.
    3390                 :            : 
    3391                 :            :         // Criticism of this implementation
    3392                 :            :         // 1. Theoretically situations are possible in which the content fits in
    3393                 :            :         // a lower height but not in a higher height. To ensure that the code
    3394                 :            :         // handles such situations the code contains a few checks concerning
    3395                 :            :         // minimum and maximum which probably are never triggered.
    3396                 :            :         // 2. We use the same nMinDiff for shrinking and growing, but nMinDiff
    3397                 :            :         // is more or less the smallest first line height and doesn't seem ideal
    3398                 :            :         // as minimum value.
    3399                 :            : 
    3400                 :          6 :         long nMinimum = nMinHeight;
    3401                 :            :         long nMaximum;
    3402                 :          6 :         sal_Bool bNoBalance = sal_False;
    3403 [ -  + ][ #  # ]:          6 :         SWRECTFN( this )
         [ #  # ][ -  + ]
    3404         [ +  - ]:          6 :         if( IsSctFrm() )
    3405                 :            :         {
    3406         [ +  - ]:          6 :             nMaximum = (Frm().*fnRect->fnGetHeight)() - nBorder +
    3407                 :          6 :                        (Frm().*fnRect->fnBottomDist)(
    3408 [ +  - ][ +  - ]:          6 :                                         (GetUpper()->*fnRect->fnGetPrtBottom)() );
    3409                 :          6 :             nMaximum += GetUpper()->Grow( LONG_MAX, sal_True );
    3410         [ -  + ]:          6 :             if( nMaximum < nMinimum )
    3411                 :            :             {
    3412         [ #  # ]:          0 :                 if( nMaximum < 0 )
    3413                 :          0 :                     nMinimum = nMaximum = 0;
    3414                 :            :                 else
    3415                 :          0 :                     nMinimum = nMaximum;
    3416                 :            :             }
    3417         [ -  + ]:          6 :             if( nMaximum > BROWSE_HEIGHT )
    3418                 :          0 :                 nMaximum = BROWSE_HEIGHT;
    3419                 :            : 
    3420                 :          6 :             bNoBalance = ((SwSectionFrm*)this)->GetSection()->GetFmt()->
    3421                 :          6 :                          GetBalancedColumns().GetValue();
    3422                 :          6 :             SwFrm* pAny = ContainsAny();
    3423 [ +  - ][ +  + ]:         12 :             if( bNoBalance ||
           [ +  -  +  + ]
    3424         [ +  - ]:          6 :                 ( !(Frm().*fnRect->fnGetHeight)() && pAny ) )
    3425                 :            :             {
    3426         [ +  - ]:          4 :                 long nTop = (this->*fnRect->fnGetTopMargin)();
    3427                 :            :                 // #i23129# - correction
    3428                 :            :                 // to the calculated maximum height.
    3429                 :          4 :                 (Frm().*fnRect->fnAddBottom)( nMaximum -
    3430 [ +  - ][ +  - ]:          4 :                                               (Frm().*fnRect->fnGetHeight)() );
    3431         [ -  + ]:          4 :                 if( nTop > nMaximum )
    3432                 :          0 :                     nTop = nMaximum;
    3433         [ +  - ]:          4 :                 (this->*fnRect->fnSetYMargins)( nTop, 0 );
    3434                 :            :             }
    3435 [ -  + ][ #  # ]:          6 :             if( !pAny && !((SwSectionFrm*)this)->IsFtnLock() )
                 [ -  + ]
    3436                 :            :             {
    3437                 :          0 :                 SwFtnContFrm* pFtnCont = ((SwSectionFrm*)this)->ContainsFtnCont();
    3438         [ #  # ]:          0 :                 if( pFtnCont )
    3439                 :            :                 {
    3440                 :          0 :                     SwFrm* pFtnAny = pFtnCont->ContainsAny();
    3441 [ #  # ][ #  # ]:          0 :                     if( pFtnAny && pFtnAny->IsValid() )
                 [ #  # ]
    3442                 :            :                     {
    3443                 :          0 :                         bBackLock = sal_True;
    3444                 :          0 :                         ((SwSectionFrm*)this)->SetFtnLock( sal_True );
    3445                 :            :                     }
    3446                 :            :                 }
    3447                 :            :             }
    3448                 :            :         }
    3449                 :            :         else
    3450                 :          0 :             nMaximum = LONG_MAX;
    3451                 :            : 
    3452                 :            :         // #i3317# - reset temporarly consideration
    3453                 :            :         // of wrapping style influence
    3454                 :          6 :         SwPageFrm* pPageFrm = FindPageFrm();
    3455         [ +  - ]:          6 :         SwSortedObjs* pObjs = pPageFrm ? pPageFrm->GetSortedObjs() : 0L;
    3456         [ -  + ]:          6 :         if ( pObjs )
    3457                 :            :         {
    3458                 :          0 :             sal_uInt32 i = 0;
    3459         [ #  # ]:          0 :             for ( i = 0; i < pObjs->Count(); ++i )
    3460                 :            :             {
    3461                 :          0 :                 SwAnchoredObject* pAnchoredObj = (*pObjs)[i];
    3462                 :            : 
    3463         [ #  # ]:          0 :                 if ( IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
    3464                 :            :                 {
    3465                 :          0 :                     pAnchoredObj->SetTmpConsiderWrapInfluence( false );
    3466                 :            :                 }
    3467                 :            :             }
    3468                 :            :         }
    3469 [ +  + ][ +  + ]:         96 :         do
                 [ +  + ]
    3470                 :            :         {
    3471                 :            :             //Could take a while therefore check for Waitcrsr here.
    3472         [ +  - ]:         96 :             if ( pImp )
    3473                 :         96 :                 pImp->CheckWaitCrsr();
    3474                 :            : 
    3475                 :         96 :             bValidSize = sal_True;
    3476                 :            :             //First format the column as this will relieve the stack a bit.
    3477                 :            :             //Also set width and height of the column (if they are wrong)
    3478                 :            :             //while we are at it.
    3479                 :         96 :             SwLayoutFrm *pCol = (SwLayoutFrm*)Lower();
    3480                 :            : 
    3481                 :            :             // #i27399#
    3482                 :            :             // Simply setting the column width based on the values returned by
    3483                 :            :             // CalcColWidth does not work for automatic column width.
    3484                 :         96 :             AdjustColumns( &rCol, sal_False );
    3485                 :            : 
    3486         [ +  + ]:        388 :             for ( sal_uInt16 i = 0; i < nNumCols; ++i )
    3487                 :            :             {
    3488                 :        292 :                 pCol->Calc();
    3489                 :            :                 // ColumnFrms have a BodyFrm now, which needs to be calculated
    3490                 :        292 :                 pCol->Lower()->Calc();
    3491         [ -  + ]:        292 :                 if( pCol->Lower()->GetNext() )
    3492                 :          0 :                     pCol->Lower()->GetNext()->Calc();  // SwFtnCont
    3493                 :        292 :                 pCol = (SwLayoutFrm*)pCol->GetNext();
    3494                 :            :             }
    3495                 :            : 
    3496                 :         96 :             ::CalcCntnt( this );
    3497                 :            : 
    3498                 :         96 :             pCol = (SwLayoutFrm*)Lower();
    3499                 :            :             OSL_ENSURE( pCol && pCol->GetNext(), ":-( column making holidays?");
    3500                 :            :             // set bMinDiff if no empty columns exist
    3501                 :         96 :             sal_Bool bMinDiff = sal_True;
    3502                 :            :             // OD 28.03.2003 #108446# - check for all column content and all columns
    3503 [ +  + ][ +  - ]:        258 :             while ( bMinDiff && pCol )
                 [ +  + ]
    3504                 :            :             {
    3505                 :        162 :                 bMinDiff = 0 != pCol->ContainsCntnt();
    3506                 :        162 :                 pCol = (SwLayoutFrm*)pCol->GetNext();
    3507                 :            :             }
    3508                 :         96 :             pCol = (SwLayoutFrm*)Lower();
    3509                 :            :             // OD 28.03.2003 #108446# - initialize local variable
    3510                 :         96 :             SwFrm *pLow = NULL;
    3511                 :         96 :             SwTwips nDiff = 0;
    3512                 :         96 :             SwTwips nMaxFree = 0;
    3513                 :         96 :             SwTwips nAllFree = LONG_MAX;
    3514                 :            :             // set bFoundLower if there is at least one non-empty column
    3515                 :         96 :             sal_Bool bFoundLower = sal_False;
    3516         [ +  + ]:        388 :             while( pCol )
    3517                 :            :             {
    3518                 :        292 :                 SwLayoutFrm* pLay = (SwLayoutFrm*)pCol->Lower();
    3519         [ +  - ]:        292 :                 SwTwips nInnerHeight = (pLay->Frm().*fnRect->fnGetHeight)() -
    3520         [ +  - ]:        292 :                                        (pLay->Prt().*fnRect->fnGetHeight)();
    3521         [ +  + ]:        292 :                 if( pLay->Lower() )
    3522                 :            :                 {
    3523                 :         66 :                     bFoundLower = sal_True;
    3524                 :         66 :                     nInnerHeight += pLay->InnerHeight();
    3525                 :            :                 }
    3526         [ -  + ]:        226 :                 else if( nInnerHeight < 0 )
    3527                 :          0 :                     nInnerHeight = 0;
    3528                 :            : 
    3529         [ -  + ]:        292 :                 if( pLay->GetNext() )
    3530                 :            :                 {
    3531                 :          0 :                     bFoundLower = sal_True;
    3532                 :          0 :                     pLay = (SwLayoutFrm*)pLay->GetNext();
    3533                 :            :                     OSL_ENSURE( pLay->IsFtnContFrm(),"FtnContainer exspected" );
    3534                 :          0 :                     nInnerHeight += pLay->InnerHeight();
    3535         [ #  # ]:          0 :                     nInnerHeight += (pLay->Frm().*fnRect->fnGetHeight)() -
    3536         [ #  # ]:          0 :                                     (pLay->Prt().*fnRect->fnGetHeight)();
    3537                 :            :                 }
    3538         [ +  - ]:        292 :                 nInnerHeight -= (pCol->Prt().*fnRect->fnGetHeight)();
    3539         [ -  + ]:        292 :                 if( nInnerHeight > nDiff )
    3540                 :            :                 {
    3541                 :          0 :                     nDiff = nInnerHeight;
    3542                 :          0 :                     nAllFree = 0;
    3543                 :            :                 }
    3544                 :            :                 else
    3545                 :            :                 {
    3546         [ +  + ]:        292 :                     if( nMaxFree < -nInnerHeight )
    3547                 :        136 :                         nMaxFree = -nInnerHeight;
    3548         [ +  + ]:        292 :                     if( nAllFree > -nInnerHeight )
    3549                 :         96 :                         nAllFree = -nInnerHeight;
    3550                 :            :                 }
    3551                 :        292 :                 pCol = (SwLayoutFrm*)pCol->GetNext();
    3552                 :            :             }
    3553                 :            : 
    3554 [ +  + ][ +  - ]:         96 :             if ( bFoundLower || ( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() ) )
         [ +  + ][ +  + ]
    3555                 :            :             {
    3556         [ +  - ]:         92 :                 SwTwips nMinDiff = ::lcl_CalcMinColDiff( this );
    3557                 :            :                 // Here we decide if growing is needed - this is the case, if
    3558                 :            :                 // column content (nDiff) or a Fly juts over.
    3559                 :            :                 // In sections with columns we take into account to set the size
    3560                 :            :                 // when having a non-empty Follow.
    3561 [ +  - ][ +  - ]:        276 :                 if ( nDiff || ::lcl_IsFlyHeightClipped( this ) ||
           [ +  -  +  - ]
         [ +  + ][ +  + ]
    3562         [ +  - ]:        184 :                      ( IsSctFrm() && ((SwSectionFrm*)this)->CalcMinDiff( nMinDiff ) ) )
    3563                 :            :                 {
    3564 [ +  - ][ +  - ]:         26 :                     long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
    3565                 :            :                     // The minimum must not be smaller than our PrtHeight as
    3566                 :            :                     // long as something juts over.
    3567         [ +  - ]:         26 :                     if( nMinimum < nPrtHeight )
    3568                 :         26 :                         nMinimum = nPrtHeight;
    3569                 :            :                     // The maximum must not be smaller than PrtHeight if
    3570                 :            :                     // something still juts over.
    3571         [ -  + ]:         26 :                     if( nMaximum < nPrtHeight )
    3572                 :          0 :                         nMaximum = nPrtHeight;  // Robust, but will this ever happen?
    3573         [ +  - ]:         26 :                     if( !nDiff ) // If only Flys jut over, we grow by nMinDiff
    3574                 :         26 :                         nDiff = nMinDiff;
    3575                 :            :                     // If we should grow more than by nMinDiff we split it over
    3576                 :            :                     // the columns
    3577 [ -  + ][ #  # ]:         26 :                     if ( Abs(nDiff - nMinDiff) > nNumCols && nDiff > (long)nNumCols )
                 [ -  + ]
    3578                 :          0 :                         nDiff /= nNumCols;
    3579                 :            : 
    3580         [ -  + ]:         26 :                     if ( bMinDiff )
    3581                 :            :                     {   // If no empty column exists, we want to grow at least
    3582                 :            :                         // by nMinDiff. Special case: If we are smaller than the
    3583                 :            :                         // minimal FrmHeight and PrtHeight is smaller than
    3584                 :            :                         // nMindiff we grow in a way that PrtHeight is exactly
    3585                 :            :                         // nMinDiff afterwards.
    3586 [ #  # ][ #  # ]:          0 :                         long nFrmHeight = (Frm().*fnRect->fnGetHeight)();
    3587 [ #  # ][ #  # ]:          0 :                         if ( nFrmHeight > nMinHeight || nPrtHeight >= nMinDiff )
    3588                 :          0 :                             nDiff = Max( nDiff, nMinDiff );
    3589         [ #  # ]:          0 :                         else if( nDiff < nMinDiff )
    3590                 :          0 :                             nDiff = nMinDiff - nPrtHeight + 1;
    3591                 :            :                     }
    3592                 :            :                     // nMaximum has a size which fits the content or the
    3593                 :            :                     // requested value from the surrounding therefore we don't
    3594                 :            :                     // need to exceed this value.
    3595         [ +  - ]:         26 :                     if( nDiff + nPrtHeight > nMaximum )
    3596                 :         26 :                         nDiff = nMaximum - nPrtHeight;
    3597                 :            :                 }
    3598         [ +  - ]:         66 :                 else if( nMaximum > nMinimum ) // We fit, do we still have some margin?
    3599                 :            :                 {
    3600 [ +  - ][ +  - ]:         66 :                     long nPrtHeight = (Prt().*fnRect->fnGetHeight)();
    3601         [ -  + ]:         66 :                     if ( nMaximum < nPrtHeight )
    3602                 :          0 :                         nDiff = nMaximum - nPrtHeight; // We grew over a working
    3603                 :            :                         // height and shrink back to it, but will this ever
    3604                 :            :                         // happen?
    3605                 :            :                     else
    3606                 :            :                     {   // We have a new maximum, a size which fits for the content.
    3607                 :         66 :                         nMaximum = nPrtHeight;
    3608                 :            :                         // If the margin in the column is bigger than nMinDiff
    3609                 :            :                         // and we therefore drop under the minimum, we deflate
    3610                 :            :                         // a bit.
    3611 [ +  - ][ +  - ]:         66 :                         if ( !bNoBalance &&
         [ +  + ][ +  + ]
    3612                 :            :                              // #i23129# - <nMinDiff> can be
    3613                 :            :                              // big, because of an object at the beginning of
    3614                 :            :                              // a column. Thus, decrease optimization here.
    3615                 :            :                              //nMaxFree >= nMinDiff &&
    3616                 :            :                              nMaxFree > 0 &&
    3617                 :            :                              ( !nAllFree ||
    3618                 :            :                                nMinimum < nPrtHeight - nMinDiff ) )
    3619                 :            :                         {
    3620                 :         62 :                             nMaxFree /= nNumCols; // disperse over the columns
    3621         [ +  + ]:         62 :                             nDiff = nMaxFree < nMinDiff ? -nMinDiff : -nMaxFree; // min nMinDiff
    3622         [ +  + ]:         88 :                             if( nPrtHeight + nDiff <= nMinimum ) // below the minimum?
    3623                 :         26 :                                 nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
    3624                 :            :                         }
    3625         [ +  - ]:          4 :                         else if( nAllFree )
    3626                 :            :                         {
    3627                 :          4 :                             nDiff = -nAllFree;
    3628         [ -  + ]:          4 :                             if( nPrtHeight + nDiff <= nMinimum ) // Less than minimum?
    3629                 :         66 :                                 nDiff = ( nMinimum - nMaximum ) / 2; // Take the center
    3630                 :            :                         }
    3631                 :            :                     }
    3632                 :            :                 }
    3633         [ +  + ]:         92 :                 if( nDiff ) // now we shrink or grow...
    3634                 :            :                 {
    3635                 :         88 :                     Size aOldSz( Prt().SSize() );
    3636 [ +  - ][ +  - ]:         88 :                     long nTop = (this->*fnRect->fnGetTopMargin)();
    3637 [ +  - ][ +  - ]:         88 :                     nDiff = (Prt().*fnRect->fnGetHeight)() + nDiff + nBorder -
    3638 [ +  - ][ +  - ]:         88 :                             (Frm().*fnRect->fnGetHeight)();
    3639 [ +  - ][ +  - ]:         88 :                     (Frm().*fnRect->fnAddBottom)( nDiff );
    3640                 :            :                     // #i68520#
    3641 [ +  - ][ -  + ]:         88 :                     if ( dynamic_cast<SwFlyFrm*>(this) )
    3642                 :            :                     {
    3643         [ #  # ]:          0 :                         dynamic_cast<SwFlyFrm*>(this)->InvalidateObjRectWithSpaces();
    3644                 :            :                     }
    3645 [ +  - ][ +  - ]:         88 :                     (this->*fnRect->fnSetYMargins)( nTop, nBorder - nTop );
    3646         [ +  - ]:         88 :                     ChgLowersProp( aOldSz );
    3647         [ +  - ]:         88 :                     NotifyLowerObjs();
    3648                 :            : 
    3649                 :            :                     // #i3317# - reset temporarly consideration
    3650                 :            :                     // of wrapping style influence
    3651         [ +  - ]:         88 :                     SwPageFrm* pTmpPageFrm = FindPageFrm();
    3652         [ +  - ]:         88 :                     SwSortedObjs* pTmpObjs = pTmpPageFrm ? pTmpPageFrm->GetSortedObjs() : 0L;
    3653         [ -  + ]:         88 :                     if ( pTmpObjs )
    3654                 :            :                     {
    3655                 :          0 :                         sal_uInt32 i = 0;
    3656 [ #  # ][ #  # ]:          0 :                         for ( i = 0; i < pTmpObjs->Count(); ++i )
    3657                 :            :                         {
    3658         [ #  # ]:          0 :                             SwAnchoredObject* pAnchoredObj = (*pTmpObjs)[i];
    3659                 :            : 
    3660 [ #  # ][ #  # ]:          0 :                             if ( IsAnLower( pAnchoredObj->GetAnchorFrm() ) )
                 [ #  # ]
    3661                 :            :                             {
    3662         [ #  # ]:          0 :                                 pAnchoredObj->SetTmpConsiderWrapInfluence( false );
    3663                 :            :                             }
    3664                 :            :                         }
    3665                 :            :                     }
    3666                 :            :                     //Invalidate suitable to nicely balance the Frms.
    3667                 :            :                     //- Every first one after the second column gets a
    3668                 :            :                     //  InvalidatePos();
    3669                 :         88 :                     pCol = (SwLayoutFrm*)Lower()->GetNext();
    3670         [ +  + ]:        272 :                     while ( pCol )
    3671                 :            :                     {
    3672                 :        184 :                         pLow = pCol->Lower();
    3673         [ +  - ]:        184 :                         if ( pLow )
    3674         [ +  - ]:        184 :                             pLow->_InvalidatePos();
    3675                 :        184 :                         pCol = (SwLayoutFrm*)pCol->GetNext();
    3676                 :            :                     }
    3677 [ +  - ][ +  + ]:         88 :                     if( IsSctFrm() && ((SwSectionFrm*)this)->HasFollow() )
                 [ +  + ]
    3678                 :            :                     {
    3679                 :            :                         // If we created a Follow, we need to give its content
    3680                 :            :                         // the opportunity to flow back inside the CalcCntnt
    3681                 :            :                         SwCntntFrm* pTmpCntnt =
    3682         [ +  - ]:         26 :                             ((SwSectionFrm*)this)->GetFollow()->ContainsCntnt();
    3683         [ +  - ]:         26 :                         if( pTmpCntnt )
    3684         [ +  - ]:         88 :                             pTmpCntnt->_InvalidatePos();
    3685                 :            :                     }
    3686                 :            :                 }
    3687                 :            :                 else
    3688                 :         92 :                     bEnd = sal_True;
    3689                 :            :             }
    3690                 :            :             else
    3691                 :          4 :                 bEnd = sal_True;
    3692                 :            : 
    3693                 :          8 :         } while ( !bEnd || !bValidSize );
    3694                 :            :     }
    3695                 :            :     // OD 01.04.2003 #108446# - Don't collect endnotes for sections. Thus, set
    3696                 :            :     // 2nd parameter to <true>.
    3697                 :          6 :     ::CalcCntnt( this, true );
    3698         [ +  - ]:          6 :     if( IsSctFrm() )
    3699                 :            :     {
    3700                 :            :         // OD 14.03.2003 #i11760# - adjust 2nd parameter - sal_True --> true
    3701                 :          6 :         ::CalcCntnt( this, true );
    3702         [ -  + ]:          6 :         if( bBackLock )
    3703                 :          0 :             ((SwSectionFrm*)this)->SetFtnLock( sal_False );
    3704                 :            :     }
    3705                 :          6 : }
    3706                 :            : 
    3707                 :            : 
    3708                 :            : /*************************************************************************
    3709                 :            : |*
    3710                 :            : |*  SwRootFrm::InvalidateAllCntnt()
    3711                 :            : |*
    3712                 :            : |*************************************************************************/
    3713                 :            : 
    3714                 :          0 : SwCntntFrm* lcl_InvalidateSection( SwFrm *pCnt, sal_uInt8 nInv )
    3715                 :            : {
    3716                 :          0 :     SwSectionFrm* pSect = pCnt->FindSctFrm();
    3717                 :            :     // If our CntntFrm is placed inside a table or a footnote, only sections
    3718                 :            :     // which are also placed inside are meant.
    3719                 :            :     // Exception: If a table is directly passed.
    3720   [ #  #  #  #  :          0 :     if( ( ( pCnt->IsInTab() && !pSect->IsInTab() ) ||
             #  #  #  # ]
         [ #  # ][ #  # ]
    3721                 :          0 :         ( pCnt->IsInFtn() && !pSect->IsInFtn() ) ) && !pCnt->IsTabFrm() )
    3722                 :          0 :         return NULL;
    3723         [ #  # ]:          0 :     if( nInv & INV_SIZE )
    3724                 :          0 :         pSect->_InvalidateSize();
    3725         [ #  # ]:          0 :     if( nInv & INV_POS )
    3726                 :          0 :         pSect->_InvalidatePos();
    3727         [ #  # ]:          0 :     if( nInv & INV_PRTAREA )
    3728                 :          0 :         pSect->_InvalidatePrt();
    3729         [ #  # ]:          0 :     SwFlowFrm *pFoll = pSect->GetFollow();
    3730                 :            :     // Temporary separation from follow
    3731                 :          0 :     pSect->SetFollow( NULL );
    3732                 :          0 :     SwCntntFrm* pRet = pSect->FindLastCntnt();
    3733                 :          0 :     pSect->SetFollow( pFoll );
    3734                 :          0 :     return pRet;
    3735                 :            : }
    3736                 :            : 
    3737                 :          0 : SwCntntFrm* lcl_InvalidateTable( SwTabFrm *pTable, sal_uInt8 nInv )
    3738                 :            : {
    3739 [ #  # ][ #  # ]:          0 :     if( ( nInv & INV_SECTION ) && pTable->IsInSct() )
                 [ #  # ]
    3740                 :          0 :         lcl_InvalidateSection( pTable, nInv );
    3741         [ #  # ]:          0 :     if( nInv & INV_SIZE )
    3742                 :          0 :         pTable->_InvalidateSize();
    3743         [ #  # ]:          0 :     if( nInv & INV_POS )
    3744                 :          0 :         pTable->_InvalidatePos();
    3745         [ #  # ]:          0 :     if( nInv & INV_PRTAREA )
    3746                 :          0 :         pTable->_InvalidatePrt();
    3747                 :          0 :     return pTable->FindLastCntnt();
    3748                 :            : }
    3749                 :            : 
    3750                 :            : void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv );
    3751                 :            : 
    3752                 :         56 : void lcl_InvalidateCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv )
    3753                 :            : {
    3754                 :         56 :     SwCntntFrm *pLastTabCnt = NULL;
    3755                 :         56 :     SwCntntFrm *pLastSctCnt = NULL;
    3756         [ +  + ]:        122 :     while ( pCnt )
    3757                 :            :     {
    3758         [ -  + ]:         66 :         if( nInv & INV_SECTION )
    3759                 :            :         {
    3760         [ #  # ]:          0 :             if( pCnt->IsInSct() )
    3761                 :            :             {
    3762                 :            :                 // See above at tables
    3763         [ #  # ]:          0 :                 if( !pLastSctCnt )
    3764                 :          0 :                     pLastSctCnt = lcl_InvalidateSection( pCnt, nInv );
    3765         [ #  # ]:          0 :                 if( pLastSctCnt == pCnt )
    3766                 :          0 :                     pLastSctCnt = NULL;
    3767                 :            :             }
    3768                 :            : #if OSL_DEBUG_LEVEL > 0
    3769                 :            :             else
    3770                 :            :                 OSL_ENSURE( !pLastSctCnt, "Where's the last SctCntnt?" );
    3771                 :            : #endif
    3772                 :            :         }
    3773         [ +  + ]:         66 :         if( nInv & INV_TABLE )
    3774                 :            :         {
    3775         [ -  + ]:         28 :             if( pCnt->IsInTab() )
    3776                 :            :             {
    3777                 :            :                 // To not call FindTabFrm() for each CntntFrm of a table and
    3778                 :            :                 // then invalidate the table, we remember the last CntntFrm of
    3779                 :            :                 // the table and ignore IsInTab() until we are past it.
    3780                 :            :                 // When entering the table, LastSctCnt is set to null, so
    3781                 :            :                 // sections inside the table are correctly invalidated.
    3782                 :            :                 // If the table itself is in a section the
    3783                 :            :                 // invalidation is done three times, which is acceptable.
    3784         [ #  # ]:          0 :                 if( !pLastTabCnt )
    3785                 :            :                 {
    3786                 :          0 :                     pLastTabCnt = lcl_InvalidateTable( pCnt->FindTabFrm(), nInv );
    3787                 :          0 :                     pLastSctCnt = NULL;
    3788                 :            :                 }
    3789         [ #  # ]:          0 :                 if( pLastTabCnt == pCnt )
    3790                 :            :                 {
    3791                 :          0 :                     pLastTabCnt = NULL;
    3792                 :          0 :                     pLastSctCnt = NULL;
    3793                 :            :                 }
    3794                 :            :             }
    3795                 :            : #if OSL_DEBUG_LEVEL > 0
    3796                 :            :             else
    3797                 :            :                 OSL_ENSURE( !pLastTabCnt, "Where's the last TabCntnt?" );
    3798                 :            : #endif
    3799                 :            :         }
    3800                 :            : 
    3801         [ +  + ]:         66 :         if( nInv & INV_SIZE )
    3802                 :         42 :             pCnt->Prepare( PREP_CLEAR, 0, sal_False );
    3803         [ +  + ]:         66 :         if( nInv & INV_POS )
    3804                 :         54 :             pCnt->_InvalidatePos();
    3805         [ +  + ]:         66 :         if( nInv & INV_PRTAREA )
    3806                 :         54 :             pCnt->_InvalidatePrt();
    3807         [ +  + ]:         66 :         if ( nInv & INV_LINENUM )
    3808                 :         12 :             pCnt->InvalidateLineNum();
    3809         [ -  + ]:         66 :         if ( pCnt->GetDrawObjs() )
    3810                 :          0 :             lcl_InvalidateAllCntnt( pCnt, nInv );
    3811                 :         66 :         pCnt = pCnt->GetNextCntntFrm();
    3812                 :            :     }
    3813                 :         56 : }
    3814                 :            : 
    3815                 :          0 : void lcl_InvalidateAllCntnt( SwCntntFrm *pCnt, sal_uInt8 nInv )
    3816                 :            : {
    3817                 :          0 :     SwSortedObjs &rObjs = *pCnt->GetDrawObjs();
    3818         [ #  # ]:          0 :     for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
    3819                 :            :     {
    3820                 :          0 :         SwAnchoredObject* pAnchoredObj = rObjs[i];
    3821         [ #  # ]:          0 :         if ( pAnchoredObj->ISA(SwFlyFrm) )
    3822                 :            :         {
    3823         [ #  # ]:          0 :             SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
    3824         [ #  # ]:          0 :             if ( pFly->IsFlyInCntFrm() )
    3825                 :            :             {
    3826                 :          0 :                 ::lcl_InvalidateCntnt( pFly->ContainsCntnt(), nInv );
    3827         [ #  # ]:          0 :                 if( nInv & INV_DIRECTION )
    3828                 :          0 :                     pFly->CheckDirChange();
    3829                 :            :             }
    3830                 :            :         }
    3831                 :            :     }
    3832                 :          0 : }
    3833                 :            : 
    3834                 :         56 : void SwRootFrm::InvalidateAllCntnt( sal_uInt8 nInv )
    3835                 :            : {
    3836                 :            :     // First process all page bound FlyFrms.
    3837                 :         56 :     SwPageFrm *pPage = (SwPageFrm*)Lower();
    3838         [ +  + ]:        112 :     while( pPage )
    3839                 :            :     {
    3840                 :         56 :         pPage->InvalidateFlyLayout();
    3841                 :         56 :         pPage->InvalidateFlyCntnt();
    3842                 :         56 :         pPage->InvalidateFlyInCnt();
    3843                 :         56 :         pPage->InvalidateLayout();
    3844                 :         56 :         pPage->InvalidateCntnt();
    3845                 :         56 :         pPage->InvalidatePage( pPage ); // So even the Turbo disappears if applicable
    3846                 :            : 
    3847         [ -  + ]:         56 :         if ( pPage->GetSortedObjs() )
    3848                 :            :         {
    3849                 :          0 :             const SwSortedObjs &rObjs = *pPage->GetSortedObjs();
    3850         [ #  # ]:          0 :             for ( sal_uInt16 i = 0; i < rObjs.Count(); ++i )
    3851                 :            :             {
    3852                 :          0 :                 SwAnchoredObject* pAnchoredObj = rObjs[i];
    3853         [ #  # ]:          0 :                 if ( pAnchoredObj->ISA(SwFlyFrm) )
    3854                 :            :                 {
    3855         [ #  # ]:          0 :                     SwFlyFrm* pFly = static_cast<SwFlyFrm*>(pAnchoredObj);
    3856                 :          0 :                     ::lcl_InvalidateCntnt( pFly->ContainsCntnt(), nInv );
    3857         [ #  # ]:          0 :                     if ( nInv & INV_DIRECTION )
    3858                 :          0 :                         pFly->CheckDirChange();
    3859                 :            :                 }
    3860                 :            :             }
    3861                 :            :         }
    3862         [ +  + ]:         56 :         if( nInv & INV_DIRECTION )
    3863                 :          4 :             pPage->CheckDirChange();
    3864                 :         56 :         pPage = (SwPageFrm*)(pPage->GetNext());
    3865                 :            :     }
    3866                 :            : 
    3867                 :            :     //Invalidate the whole document content and the character bound Flys here.
    3868                 :         56 :     ::lcl_InvalidateCntnt( ContainsCntnt(), nInv );
    3869                 :            : 
    3870         [ +  + ]:         56 :     if( nInv & INV_PRTAREA )
    3871                 :            :     {
    3872                 :         54 :         ViewShell *pSh  = getRootFrm()->GetCurrShell();
    3873         [ +  - ]:         54 :         if( pSh )
    3874                 :         54 :             pSh->InvalidateWindows( Frm() );
    3875                 :            :     }
    3876                 :         56 : }
    3877                 :            : 
    3878                 :            : /** method to invalidate/re-calculate the position of all floating
    3879                 :            :     screen objects (Writer fly frames and drawing objects), which are
    3880                 :            :     anchored to paragraph or to character.
    3881                 :            : 
    3882                 :            :     OD 2004-03-16 #i11860#
    3883                 :            : 
    3884                 :            :     @author OD
    3885                 :            : */
    3886                 :          0 : void SwRootFrm::InvalidateAllObjPos()
    3887                 :            : {
    3888                 :          0 :     const SwPageFrm* pPageFrm = static_cast<const SwPageFrm*>(Lower());
    3889         [ #  # ]:          0 :     while( pPageFrm )
    3890                 :            :     {
    3891                 :          0 :         pPageFrm->InvalidateFlyLayout();
    3892                 :            : 
    3893         [ #  # ]:          0 :         if ( pPageFrm->GetSortedObjs() )
    3894                 :            :         {
    3895                 :          0 :             const SwSortedObjs& rObjs = *(pPageFrm->GetSortedObjs());
    3896         [ #  # ]:          0 :             for ( sal_uInt8 i = 0; i < rObjs.Count(); ++i )
    3897                 :            :             {
    3898                 :          0 :                 SwAnchoredObject* pAnchoredObj = rObjs[i];
    3899                 :          0 :                 const SwFmtAnchor& rAnch = pAnchoredObj->GetFrmFmt().GetAnchor();
    3900         [ #  # ]:          0 :                 if ((rAnch.GetAnchorId() != FLY_AT_PARA) &&
           [ #  #  #  # ]
    3901                 :          0 :                     (rAnch.GetAnchorId() != FLY_AT_CHAR))
    3902                 :            :                 {
    3903                 :            :                     // only to paragraph and to character anchored objects are considered.
    3904                 :          0 :                     continue;
    3905                 :            :                 }
    3906                 :            :                 // #i28701# - special invalidation for anchored
    3907                 :            :                 // objects, whose wrapping style influence has to be considered.
    3908         [ #  # ]:          0 :                 if ( pAnchoredObj->ConsiderObjWrapInfluenceOnObjPos() )
    3909                 :          0 :                     pAnchoredObj->InvalidateObjPosForConsiderWrapInfluence( true );
    3910                 :            :                 else
    3911                 :          0 :                     pAnchoredObj->InvalidateObjPos();
    3912                 :            :             }
    3913                 :            :         }
    3914                 :            : 
    3915                 :          0 :         pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
    3916                 :            :     }
    3917                 :          0 : }
    3918                 :            : 
    3919                 :            : 
    3920                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10