LCOV - code coverage report
Current view: top level - sw/source/core/docnode - node2lay.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 145 219 66.2 %
Date: 2012-08-25 Functions: 13 16 81.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 126 284 44.4 %

           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 <switerator.hxx>
      31                 :            : #include <calbck.hxx>
      32                 :            : #include <node.hxx>
      33                 :            : #include <ndindex.hxx>
      34                 :            : #include <swtable.hxx>
      35                 :            : #include <ftnfrm.hxx>
      36                 :            : #include <sectfrm.hxx>
      37                 :            : #include "frmfmt.hxx"
      38                 :            : #include "cntfrm.hxx"
      39                 :            : #include "tabfrm.hxx"
      40                 :            : #include "frmtool.hxx"
      41                 :            : #include "section.hxx"
      42                 :            : #include "node2lay.hxx"
      43                 :            : 
      44                 :            : /* --------------------------------------------------
      45                 :            :  * Die SwNode2LayImpl-Klasse erledigt die eigentliche Arbeit,
      46                 :            :  * die SwNode2Layout-Klasse ist nur die der Oefffentlichkeit bekannte Schnittstelle
      47                 :            :  * --------------------------------------------------*/
      48                 :            : class SwNode2LayImpl
      49                 :            : {
      50                 :            :     SwIterator<SwFrm,SwModify>* pIter;
      51                 :            :     SwModify* pMod;
      52                 :            :     std::vector<SwFrm*>* pUpperFrms;// Zum Einsammeln der Upper
      53                 :            :     sal_uLong nIndex;        // Der Index des einzufuegenden Nodes
      54                 :            :     sal_Bool bMaster    : 1; // sal_True => nur Master , sal_False => nur Frames ohne Follow
      55                 :            :     sal_Bool bInit      : 1; // Ist am SwClient bereits ein First()-Aufruf erfolgt?
      56                 :            : public:
      57                 :            :     SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch );
      58 [ +  + ][ +  + ]:        820 :     ~SwNode2LayImpl() { delete pIter; delete pUpperFrms; }
      59                 :            :     SwFrm* NextFrm(); // liefert den naechsten "sinnvollen" Frame
      60                 :            :     SwLayoutFrm* UpperFrm( SwFrm* &rpFrm, const SwNode &rNode );
      61                 :            :     void SaveUpperFrms(); // Speichert (und lockt ggf.) die pUpper
      62                 :            :     // Fuegt unter jeden pUpper des Arrays einen Frame ein.
      63                 :            :     void RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd );
      64                 :            : 
      65                 :            :     SwFrm* GetFrm( const Point* pDocPos = 0,
      66                 :            :                     const SwPosition *pPos = 0,
      67                 :            :                     const sal_Bool bCalcFrm = sal_True ) const;
      68                 :            : };
      69                 :            : 
      70                 :            : /* --------------------------------------------------
      71                 :            :  * Hauptaufgabe des Ctor: Das richtige SwModify zu ermitteln,
      72                 :            :  * ueber das iteriert wird.
      73                 :            :  * Uebergibt man bSearch == sal_True, so wird der naechste Cntnt- oder TableNode
      74                 :            :  * gesucht, der Frames besitzt ( zum Einsammeln der pUpper ), ansonsten wird
      75                 :            :  * erwartet, das rNode bereits auf einem solchen Cntnt- oder TableNode sitzt,
      76                 :            :  * vor oder hinter den eingefuegt werden soll.
      77                 :            :  * --------------------------------------------------*/
      78                 :            : 
      79                 :         86 : SwNode* GoNextWithFrm(const SwNodes& rNodes, SwNodeIndex *pIdx)
      80                 :            : {
      81         [ -  + ]:         86 :     if( pIdx->GetIndex() >= rNodes.Count() - 1 )
      82                 :          0 :         return 0;
      83                 :            : 
      84         [ +  - ]:         86 :     SwNodeIndex aTmp(*pIdx, +1);
      85                 :         86 :     SwNode* pNd = 0;
      86         [ +  + ]:        666 :     while( aTmp < rNodes.Count()-1 )
      87                 :            :     {
      88                 :        597 :         pNd = &aTmp.GetNode();
      89                 :        597 :         bool bFound = false;
      90         [ +  + ]:        597 :         if ( pNd->IsCntntNode() )
      91 [ +  - ][ +  - ]:        580 :             bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0);
      92         [ +  + ]:         17 :         else if ( pNd->IsTableNode() )
      93         [ +  - ]:          8 :             bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 );
      94 [ +  + ][ +  - ]:          9 :         else if( pNd->IsEndNode() && !pNd->StartOfSectionNode()->IsSectionNode() )
                 [ +  + ]
      95                 :            :         {
      96                 :          3 :             pNd = 0;
      97                 :          3 :             break;
      98                 :            :         }
      99         [ +  + ]:        594 :         if ( bFound )
     100                 :         14 :                 break;
     101         [ +  - ]:        580 :         aTmp++;
     102                 :            :     }
     103                 :            : 
     104         [ +  + ]:         86 :     if( aTmp == rNodes.Count()-1 )
     105                 :         69 :         pNd = 0;
     106         [ +  + ]:         17 :     else if( pNd )
     107         [ +  - ]:         14 :         (*pIdx) = aTmp;
     108         [ +  - ]:         86 :     return pNd;
     109                 :            : }
     110                 :            : 
     111                 :          0 : SwNode* GoPreviousWithFrm(SwNodeIndex *pIdx)
     112                 :            : {
     113         [ #  # ]:          0 :     if( !pIdx->GetIndex() )
     114                 :          0 :         return 0;
     115                 :            : 
     116         [ #  # ]:          0 :     SwNodeIndex aTmp( *pIdx, -1 );
     117                 :          0 :     SwNode* pNd(0);
     118         [ #  # ]:          0 :     while( aTmp.GetIndex() )
     119                 :            :     {
     120                 :          0 :         pNd = &aTmp.GetNode();
     121                 :          0 :         bool bFound = false;
     122         [ #  # ]:          0 :         if ( pNd->IsCntntNode() )
     123 [ #  # ][ #  # ]:          0 :             bFound = ( SwIterator<SwFrm,SwCntntNode>::FirstElement(*(SwCntntNode*)pNd) != 0);
     124         [ #  # ]:          0 :         else if ( pNd->IsTableNode() )
     125         [ #  # ]:          0 :             bFound = ( SwIterator<SwFrm,SwFmt>::FirstElement(*((SwTableNode*)pNd)->GetTable().GetFrmFmt()) != 0 );
     126 [ #  # ][ #  # ]:          0 :         else if( pNd->IsStartNode() && !pNd->IsSectionNode() )
                 [ #  # ]
     127                 :            :         {
     128                 :          0 :             pNd = 0;
     129                 :          0 :             break;
     130                 :            :         }
     131         [ #  # ]:          0 :         if ( bFound )
     132                 :          0 :                 break;
     133         [ #  # ]:          0 :         aTmp--;
     134                 :            :     }
     135                 :            : 
     136         [ #  # ]:          0 :     if( !aTmp.GetIndex() )
     137                 :          0 :         pNd = 0;
     138         [ #  # ]:          0 :     else if( pNd )
     139         [ #  # ]:          0 :         (*pIdx) = aTmp;
     140         [ #  # ]:          0 :     return pNd;
     141                 :            : }
     142                 :            : 
     143                 :            : 
     144                 :        820 : SwNode2LayImpl::SwNode2LayImpl( const SwNode& rNode, sal_uLong nIdx, sal_Bool bSearch )
     145                 :        820 :     : pUpperFrms( NULL ), nIndex( nIdx ), bInit( sal_False )
     146                 :            : {
     147                 :            :     const SwNode* pNd;
     148 [ +  + ][ +  + ]:        820 :     if( bSearch || rNode.IsSectionNode() )
                 [ +  + ]
     149                 :            :     {
     150                 :            :         // Suche den naechsten Cntnt/TblNode, der einen Frame besitzt,
     151                 :            :         // damit wir uns vor/hinter ihn haengen koennen
     152 [ +  + ][ -  + ]:         86 :         if( !bSearch && rNode.GetIndex() < nIndex )
                 [ -  + ]
     153                 :            :         {
     154         [ #  # ]:          0 :             SwNodeIndex aTmp( *rNode.EndOfSectionNode(), +1 );
     155         [ #  # ]:          0 :             pNd = GoPreviousWithFrm( &aTmp );
     156 [ #  # ][ #  # ]:          0 :             if( !bSearch && pNd && rNode.GetIndex() > pNd->GetIndex() )
         [ #  # ][ #  # ]
     157                 :          0 :                 pNd = NULL; // Nicht ueber den Bereich hinausschiessen
     158         [ #  # ]:          0 :             bMaster = sal_False;
     159                 :            :         }
     160                 :            :         else
     161                 :            :         {
     162         [ +  - ]:         86 :             SwNodeIndex aTmp( rNode, -1 );
     163         [ +  - ]:         86 :             pNd = GoNextWithFrm( rNode.GetNodes(), &aTmp );
     164                 :         86 :             bMaster = sal_True;
     165 [ +  + ][ +  - ]:         86 :             if( !bSearch && pNd && rNode.EndOfSectionIndex() < pNd->GetIndex() )
         [ -  + ][ -  + ]
     166         [ +  - ]:         86 :                 pNd = NULL; // Nicht ueber den Bereich hinausschiessen
     167                 :            :         }
     168                 :            :     }
     169                 :            :     else
     170                 :            :     {
     171                 :        734 :         pNd = &rNode;
     172                 :        734 :         bMaster = nIndex < rNode.GetIndex();
     173                 :            :     }
     174         [ +  + ]:        820 :     if( pNd )
     175                 :            :     {
     176         [ +  + ]:        748 :         if( pNd->IsCntntNode() )
     177                 :        734 :             pMod = (SwModify*)pNd->GetCntntNode();
     178                 :            :         else
     179                 :            :         {
     180                 :            :             OSL_ENSURE( pNd->IsTableNode(), "For Tablenodes only" );
     181                 :         14 :             pMod = pNd->GetTableNode()->GetTable().GetFrmFmt();
     182                 :            :         }
     183         [ +  - ]:        748 :         pIter = new SwIterator<SwFrm,SwModify>( *pMod );
     184                 :            :     }
     185                 :            :     else
     186                 :            :     {
     187                 :         72 :         pIter = NULL;
     188                 :         72 :         pMod = 0;
     189                 :            :     }
     190                 :        820 : }
     191                 :            : 
     192                 :            : /* --------------------------------------------------
     193                 :            :  * SwNode2LayImpl::NextFrm() liefert den naechsten "sinnvollen" Frame,
     194                 :            :  * beim ersten Aufruf wird am eigentlichen Iterator ein First gerufen,
     195                 :            :  * danach die Next-Methode. Das Ergebnis wird auf Brauchbarkeit untersucht,
     196                 :            :  * so werden keine Follows akzeptiert, ein Master wird beim Einsammeln der
     197                 :            :  * pUpper und beim Einfuegen vor ihm akzeptiert. Beim Einfuegen dahinter
     198                 :            :  * wird vom Master ausgehend der letzte Follow gesucht und zurueckgegeben.
     199                 :            :  * Wenn der Frame innerhalb eines SectionFrms liegt, wird noch festgestellt,
     200                 :            :  * ob statt des Frames der SectionFrm der geeignete Rueckgabewert ist, dies
     201                 :            :  * ist der Fall, wenn der neu einzufuegende Node ausserhalb des Bereichs liegt.
     202                 :            :  * --------------------------------------------------*/
     203                 :       1514 : SwFrm* SwNode2LayImpl::NextFrm()
     204                 :            : {
     205                 :            :     SwFrm* pRet;
     206         [ +  + ]:       1514 :     if( !pIter )
     207                 :         72 :         return sal_False;
     208         [ +  + ]:       1442 :     if( !bInit )
     209                 :            :     {
     210                 :        748 :          pRet = pIter->First();
     211                 :        748 :          bInit = sal_True;
     212                 :            :     }
     213                 :            :     else
     214                 :        694 :         pRet = pIter->Next();
     215         [ +  + ]:       1484 :     while( pRet )
     216                 :            :     {
     217                 :        736 :         SwFlowFrm* pFlow = SwFlowFrm::CastFlowFrm( pRet );
     218                 :            :         OSL_ENSURE( pFlow, "Cntnt or Table expected?!" );
     219                 :            :         // Follows sind fluechtige Gestalten, deshalb werden sie ignoriert.
     220                 :            :         // Auch wenn wir hinter dem Frame eingefuegt werden sollen, nehmen wir
     221                 :            :         // zunaechst den Master, hangeln uns dann aber zum letzten Follow durch.
     222         [ +  + ]:        736 :         if( !pFlow->IsFollow() )
     223                 :            :         {
     224         [ +  + ]:        694 :             if( !bMaster )
     225                 :            :             {
     226         [ +  + ]:        260 :                 while( pFlow->HasFollow() )
     227                 :          6 :                     pFlow = pFlow->GetFollow();
     228                 :        254 :                 pRet = pFlow->GetFrm();
     229                 :            :             }
     230         [ +  + ]:        694 :             if( pRet->IsInSct() )
     231                 :            :             {
     232                 :         44 :                 SwSectionFrm* pSct = pRet->FindSctFrm();
     233                 :            :                 // Vorsicht: Wenn wir in einer Fussnote sind, so kann diese
     234                 :            :                 // Layoutmaessig in einem spaltigen Bereich liegen, obwohl
     235                 :            :                 // sie nodemaessig ausserhalb liegt. Deshalb muss bei Fussnoten
     236                 :            :                 // ueberprueft werden, ob auch der SectionFrm in der Fussnote
     237                 :            :                 // und nicht ausserhalb liegt.
     238 [ +  - ][ +  - ]:         44 :                 if( !pRet->IsInFtn() || pSct->IsInFtn() )
                 [ +  + ]
     239                 :            :                 {
     240                 :            :                     OSL_ENSURE( pSct && pSct->GetSection(), "Where's my section?" );
     241                 :         44 :                     SwSectionNode* pNd = pSct->GetSection()->GetFmt()->GetSectionNode();
     242                 :            :                     OSL_ENSURE( pNd, "Lost SectionNode" );
     243                 :            :                     // Wenn der erhaltene Frame in einem Bereichsframe steht,
     244                 :            :                     // dessen Bereich den Ausgangsnode nicht umfasst, so kehren
     245                 :            :                     // wir mit dem SectionFrm zurueck, sonst mit dem Cntnt/TabFrm
     246         [ +  + ]:         44 :                     if( bMaster )
     247                 :            :                     {
     248         [ +  + ]:         36 :                         if( pNd->GetIndex() >= nIndex )
     249                 :         10 :                             pRet = pSct;
     250                 :            :                     }
     251         [ +  + ]:          8 :                     else if( pNd->EndOfSectionIndex() < nIndex )
     252                 :          2 :                         pRet = pSct;
     253                 :            :                 }
     254                 :            :             }
     255                 :        694 :             return pRet;
     256                 :            :         }
     257                 :         42 :         pRet = pIter->Next();
     258                 :            :     }
     259                 :       1514 :     return NULL;
     260                 :            : }
     261                 :            : 
     262                 :         82 : void SwNode2LayImpl::SaveUpperFrms()
     263                 :            : {
     264 [ +  - ][ +  - ]:         82 :     pUpperFrms = new std::vector<SwFrm*>;
     265                 :            :     SwFrm* pFrm;
     266 [ +  - ][ +  + ]:         92 :     while( 0 != (pFrm = NextFrm()) )
     267                 :            :     {
     268                 :         10 :         SwFrm* pPrv = pFrm->GetPrev();
     269                 :         10 :         pFrm = pFrm->GetUpper();
     270         [ +  - ]:         10 :         if( pFrm )
     271                 :            :         {
     272         [ -  + ]:         10 :             if( pFrm->IsFtnFrm() )
     273                 :          0 :                 ((SwFtnFrm*)pFrm)->ColLock();
     274 [ +  - ][ -  + ]:         10 :             else if( pFrm->IsInSct() )
     275         [ #  # ]:          0 :                 pFrm->FindSctFrm()->ColLock();
     276 [ -  + ][ #  # ]:         10 :             if( pPrv && pPrv->IsSctFrm() )
                 [ -  + ]
     277                 :          0 :                 ((SwSectionFrm*)pPrv)->LockJoin();
     278         [ +  - ]:         10 :             pUpperFrms->push_back( pPrv );
     279         [ +  - ]:         10 :             pUpperFrms->push_back( pFrm );
     280                 :            :         }
     281                 :            :     }
     282 [ +  + ][ +  - ]:         82 :     delete pIter;
     283                 :         82 :     pIter = NULL;
     284                 :         82 :     pMod = 0;
     285                 :         82 : }
     286                 :            : 
     287                 :       1310 : SwLayoutFrm* SwNode2LayImpl::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
     288                 :            : {
     289                 :       1310 :     rpFrm = NextFrm();
     290         [ +  + ]:       1310 :     if( !rpFrm )
     291                 :        682 :         return NULL;
     292                 :        628 :     SwLayoutFrm* pUpper = rpFrm->GetUpper();
     293         [ +  + ]:        628 :     if( rpFrm->IsSctFrm() )
     294                 :            :     {
     295                 :          2 :         const SwNode* pNode = rNode.StartOfSectionNode();
     296         [ +  - ]:          2 :         if( pNode->IsSectionNode() )
     297                 :            :         {
     298         [ +  - ]:          2 :             SwFrm* pFrm = bMaster ? rpFrm->FindPrev() : rpFrm->FindNext();
     299 [ -  + ][ #  # ]:          2 :             if( pFrm && pFrm->IsSctFrm() )
                 [ -  + ]
     300                 :            :             {
     301                 :            :                 // pFrm could be a "dummy"-section
     302   [ #  #  #  # ]:          0 :                 if( ((SwSectionFrm*)pFrm)->GetSection() &&
                 [ #  # ]
     303                 :          0 :                     (&((SwSectionNode*)pNode)->GetSection() ==
     304                 :          0 :                      ((SwSectionFrm*)pFrm)->GetSection()) )
     305                 :            :                 {
     306                 :            :                     // #i22922# - consider columned sections
     307                 :            :                     // 'Go down' the section frame as long as the layout frame
     308                 :            :                     // is found, which would contain content.
     309   [ #  #  #  #  :          0 :                     while ( pFrm->IsLayoutFrm() &&
             #  #  #  # ]
                 [ #  # ]
     310                 :          0 :                             static_cast<SwLayoutFrm*>(pFrm)->Lower() &&
     311                 :          0 :                             !static_cast<SwLayoutFrm*>(pFrm)->Lower()->IsFlowFrm() &&
     312                 :          0 :                             static_cast<SwLayoutFrm*>(pFrm)->Lower()->IsLayoutFrm() )
     313                 :            :                     {
     314                 :          0 :                         pFrm = static_cast<SwLayoutFrm*>(pFrm)->Lower();
     315                 :            :                     }
     316                 :            :                     OSL_ENSURE( pFrm->IsLayoutFrm(),
     317                 :            :                             "<SwNode2LayImpl::UpperFrm(..)> - expected upper frame isn't a layout frame." );
     318                 :            :                     rpFrm = bMaster ? NULL
     319         [ #  # ]:          0 :                                     : static_cast<SwLayoutFrm*>(pFrm)->Lower();
     320                 :            :                     OSL_ENSURE( !rpFrm || rpFrm->IsFlowFrm(),
     321                 :            :                             "<SwNode2LayImpl::UpperFrm(..)> - expected sibling isn't a flow frame." );
     322                 :          0 :                     return static_cast<SwLayoutFrm*>(pFrm);
     323                 :            :                 }
     324                 :            : 
     325         [ #  # ]:          0 :                 pUpper = new SwSectionFrm(((SwSectionNode*)pNode)->GetSection(), rpFrm);
     326                 :          0 :                 pUpper->Paste( rpFrm->GetUpper(),
     327         [ #  # ]:          0 :                                bMaster ? rpFrm : rpFrm->GetNext() );
     328                 :          0 :                 static_cast<SwSectionFrm*>(pUpper)->Init();
     329                 :          0 :                 rpFrm = NULL;
     330                 :            :                 // 'Go down' the section frame as long as the layout frame
     331                 :            :                 // is found, which would contain content.
     332   [ #  #  #  #  :          0 :                 while ( pUpper->Lower() &&
           #  # ][ #  # ]
     333                 :          0 :                         !pUpper->Lower()->IsFlowFrm() &&
     334                 :          0 :                         pUpper->Lower()->IsLayoutFrm() )
     335                 :            :                 {
     336                 :          0 :                     pUpper = static_cast<SwLayoutFrm*>(pUpper->Lower());
     337                 :            :                 }
     338                 :          0 :                 return pUpper;
     339                 :            :             }
     340                 :            :         }
     341                 :            :     };
     342         [ +  + ]:        628 :     if( !bMaster )
     343                 :        236 :         rpFrm = rpFrm->GetNext();
     344                 :       1310 :     return pUpper;
     345                 :            : }
     346                 :            : 
     347                 :         82 : void SwNode2LayImpl::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd )
     348                 :            : {
     349                 :            :     OSL_ENSURE( pUpperFrms, "RestoreUpper without SaveUpper?" );
     350                 :            :     SwNode* pNd;
     351                 :         82 :     SwDoc *pDoc = rNds.GetDoc();
     352                 :         82 :     sal_Bool bFirst = sal_True;
     353         [ +  + ]:        164 :     for( ; nStt < nEnd; ++nStt )
     354                 :            :     {
     355                 :         82 :         SwFrm* pNew = 0;
     356                 :            :         SwFrm* pNxt;
     357                 :            :         SwLayoutFrm* pUp;
     358         [ -  + ]:         82 :         if( (pNd = rNds[nStt])->IsCntntNode() )
     359         [ #  # ]:          0 :             for( sal_uInt16 n = 0; n < pUpperFrms->size(); )
     360                 :            :             {
     361                 :          0 :                 pNxt = (*pUpperFrms)[n++];
     362 [ #  # ][ #  # ]:          0 :                 if( bFirst && pNxt && pNxt->IsSctFrm() )
         [ #  # ][ #  # ]
     363                 :          0 :                     ((SwSectionFrm*)pNxt)->UnlockJoin();
     364                 :          0 :                 pUp = (SwLayoutFrm*)(*pUpperFrms)[n++];
     365         [ #  # ]:          0 :                 if( pNxt )
     366                 :          0 :                     pNxt = pNxt->GetNext();
     367                 :            :                 else
     368                 :          0 :                     pNxt = pUp->Lower();
     369 [ #  # ][ #  # ]:          0 :                 pNew = ((SwCntntNode*)pNd)->MakeFrm( pUp );
                 [ #  # ]
     370                 :          0 :                 pNew->Paste( pUp, pNxt );
     371                 :          0 :                 (*pUpperFrms)[n-2] = pNew;
     372                 :            :             }
     373         [ +  + ]:         82 :         else if( pNd->IsTableNode() )
     374         [ +  + ]:         88 :             for( sal_uInt16 x = 0; x < pUpperFrms->size(); )
     375                 :            :             {
     376                 :          8 :                 pNxt = (*pUpperFrms)[x++];
     377 [ -  + ][ #  # ]:          8 :                 if( bFirst && pNxt && pNxt->IsSctFrm() )
         [ -  + ][ +  - ]
     378                 :          0 :                     ((SwSectionFrm*)pNxt)->UnlockJoin();
     379                 :          8 :                 pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
     380         [ -  + ]:          8 :                 if( pNxt )
     381                 :          0 :                     pNxt = pNxt->GetNext();
     382                 :            :                 else
     383                 :          8 :                     pNxt = pUp->Lower();
     384                 :          8 :                 pNew = ((SwTableNode*)pNd)->MakeFrm( pUp );
     385                 :            :                 OSL_ENSURE( pNew->IsTabFrm(), "Table exspected" );
     386                 :          8 :                 pNew->Paste( pUp, pNxt );
     387                 :          8 :                 ((SwTabFrm*)pNew)->RegistFlys();
     388                 :          8 :                 (*pUpperFrms)[x-2] = pNew;
     389                 :            :             }
     390         [ +  - ]:          2 :         else if( pNd->IsSectionNode() )
     391                 :            :         {
     392                 :          2 :             nStt = pNd->EndOfSectionIndex();
     393         [ +  + ]:          4 :             for( sal_uInt16 x = 0; x < pUpperFrms->size(); )
     394                 :            :             {
     395                 :          2 :                 pNxt = (*pUpperFrms)[x++];
     396 [ -  + ][ #  # ]:          2 :                 if( bFirst && pNxt && pNxt->IsSctFrm() )
         [ -  + ][ +  - ]
     397                 :          0 :                     ((SwSectionFrm*)pNxt)->UnlockJoin();
     398                 :          2 :                 pUp = (SwLayoutFrm*)(*pUpperFrms)[x++];
     399                 :            :                 OSL_ENSURE( pUp->GetUpper() || pUp->IsFlyFrm(), "Lost Upper" );
     400                 :          2 :                 ::_InsertCnt( pUp, pDoc, pNd->GetIndex(), sal_False, nStt+1, pNxt );
     401                 :          2 :                 pNxt = pUp->GetLastLower();
     402                 :          2 :                 (*pUpperFrms)[x-2] = pNxt;
     403                 :            :             }
     404                 :            :         }
     405                 :         82 :         bFirst = sal_False;
     406                 :            :     }
     407         [ +  + ]:         92 :     for( sal_uInt16 x = 0; x < pUpperFrms->size(); ++x )
     408                 :            :     {
     409                 :         10 :         SwFrm* pTmp = (*pUpperFrms)[++x];
     410         [ -  + ]:         10 :         if( pTmp->IsFtnFrm() )
     411                 :          0 :             ((SwFtnFrm*)pTmp)->ColUnlock();
     412         [ -  + ]:         10 :         else if ( pTmp->IsInSct() )
     413                 :            :         {
     414                 :          0 :             SwSectionFrm* pSctFrm = pTmp->FindSctFrm();
     415                 :          0 :             pSctFrm->ColUnlock();
     416                 :            :             // #i18103# - invalidate size of section in order to
     417                 :            :             // assure, that the section is formatted, unless it was 'Collocked'
     418                 :            :             // from its 'collection' until its 'restoration'.
     419                 :          0 :             pSctFrm->_InvalidateSize();
     420                 :            :         }
     421                 :            :     }
     422                 :         82 : }
     423                 :            : 
     424                 :          0 : SwFrm* SwNode2LayImpl::GetFrm( const Point* pDocPos,
     425                 :            :                                 const SwPosition *pPos,
     426                 :            :                                 const sal_Bool bCalcFrm ) const
     427                 :            : {
     428                 :            :     // mba: test if change of member pIter -> pMod broke anything
     429         [ #  # ]:          0 :     return pMod ? ::GetFrmOfModify( 0, *pMod, USHRT_MAX, pDocPos, pPos, bCalcFrm ) : 0;
     430                 :            : }
     431                 :            : 
     432                 :        738 : SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx )
     433                 :            : {
     434         [ +  - ]:        738 :     pImpl = new SwNode2LayImpl( rNd, nIdx, sal_False );
     435                 :        738 : }
     436                 :            : 
     437                 :         82 : SwNode2Layout::SwNode2Layout( const SwNode& rNd )
     438                 :            : {
     439         [ +  - ]:         82 :     pImpl = new SwNode2LayImpl( rNd, rNd.GetIndex(), sal_True );
     440                 :         82 :     pImpl->SaveUpperFrms();
     441                 :         82 : }
     442                 :            : 
     443                 :         82 : void SwNode2Layout::RestoreUpperFrms( SwNodes& rNds, sal_uLong nStt, sal_uLong nEnd )
     444                 :            : {
     445                 :            :     OSL_ENSURE( pImpl, "RestoreUpperFrms without SaveUpperFrms" );
     446                 :         82 :     pImpl->RestoreUpperFrms( rNds, nStt, nEnd );
     447                 :         82 : }
     448                 :            : 
     449                 :        112 : SwFrm* SwNode2Layout::NextFrm()
     450                 :            : {
     451                 :        112 :     return pImpl->NextFrm();
     452                 :            : }
     453                 :            : 
     454                 :       1310 : SwLayoutFrm* SwNode2Layout::UpperFrm( SwFrm* &rpFrm, const SwNode &rNode )
     455                 :            : {
     456                 :       1310 :     return pImpl->UpperFrm( rpFrm, rNode );
     457                 :            : }
     458                 :            : 
     459                 :        820 : SwNode2Layout::~SwNode2Layout()
     460                 :            : {
     461         [ +  - ]:        820 :     delete pImpl;
     462                 :        820 : }
     463                 :            : 
     464                 :          0 : SwFrm* SwNode2Layout::GetFrm( const Point* pDocPos,
     465                 :            :                                 const SwPosition *pPos,
     466                 :            :                                 const sal_Bool bCalcFrm ) const
     467                 :            : {
     468                 :          0 :     return pImpl->GetFrm( pDocPos, pPos, bCalcFrm );
     469                 :            : }
     470                 :            : 
     471                 :            : 
     472                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10