LCOV - code coverage report
Current view: top level - sw/source/filter/rtf - rtffly.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 737 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1395 0.0 %

           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                 :            : #include <hintids.hxx>
      30                 :            : #include <tools/cachestr.hxx>
      31                 :            : #include <svtools/rtftoken.h>
      32                 :            : #include <svl/itemiter.hxx>
      33                 :            : #include <editeng/prntitem.hxx>
      34                 :            : #include <editeng/opaqitem.hxx>
      35                 :            : #include <editeng/protitem.hxx>
      36                 :            : #include <editeng/ulspitem.hxx>
      37                 :            : #include <editeng/lrspitem.hxx>
      38                 :            : #include <editeng/boxitem.hxx>
      39                 :            : #include <editeng/frmdiritem.hxx>
      40                 :            : #include <fmtfsize.hxx>
      41                 :            : #include <fmtanchr.hxx>
      42                 :            : #include <fmtpdsc.hxx>
      43                 :            : #include <fmtsrnd.hxx>
      44                 :            : #include <fmtclds.hxx>
      45                 :            : #include <fmtcntnt.hxx>
      46                 :            : #include <frmatr.hxx>
      47                 :            : #include <doc.hxx>
      48                 :            : #include <pam.hxx>
      49                 :            : #include <ndtxt.hxx>
      50                 :            : #include <shellio.hxx>
      51                 :            : #include <swparrtf.hxx>
      52                 :            : #include <grfatr.hxx>
      53                 :            : #include <paratr.hxx>
      54                 :            : #include <rtf.hxx>
      55                 :            : #include <ndgrf.hxx>
      56                 :            : #include <pagedesc.hxx>
      57                 :            : #include <swtable.hxx>
      58                 :            : #include <txtflcnt.hxx>
      59                 :            : #include <fmtflcnt.hxx>
      60                 :            : #include <fltini.hxx>
      61                 :            : #include <unoframe.hxx>
      62                 :            : #include <deque>
      63                 :            : #include <map>
      64                 :            : #include <utility>
      65                 :            : // #i27767#
      66                 :            : #include <fmtwrapinfluenceonobjpos.hxx>
      67                 :            : #include <editeng/brshitem.hxx>
      68                 :            : #include <fmtfollowtextflow.hxx>
      69                 :            : #include "dcontact.hxx"
      70                 :            : 
      71                 :            : using namespace ::com::sun::star;
      72                 :            : 
      73                 :            : #define ANCHOR(p)   ((SwFmtAnchor*)p)
      74                 :            : 
      75                 :            : // steht in shellio.hxx
      76                 :            : extern SwCntntNode* GoNextNds( SwNodeIndex * pIdx, sal_Bool bChk );
      77                 :            : 
      78                 :          0 : inline const SwFmtFrmSize GetFrmSize(const SfxItemSet& rSet, sal_Bool bInP=sal_True)
      79                 :            : {
      80                 :          0 :     return (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE,bInP);
      81                 :            : }
      82                 :            : 
      83                 :          0 : SwFlySave::SwFlySave(const SwPaM& rPam, SfxItemSet& rSet)
      84                 :          0 :     : aFlySet(rSet), nSttNd(rPam.GetPoint()->nNode), nEndNd(nSttNd), nEndCnt(0),
      85 [ #  # ][ #  # ]:          0 :      nPageWidth(ATT_MIN_SIZE), nDropLines(0), nDropAnchor(0)
      86                 :            : {
      87                 :          0 : }
      88                 :            : 
      89                 :          0 : int SwFlySave::IsEqualFly( const SwPaM& rPos, SfxItemSet& rSet )
      90                 :            : {
      91 [ #  # ][ #  # ]:          0 :     if( rSet.Count() != aFlySet.Count() || nDropAnchor )
                 [ #  # ]
      92                 :          0 :         return sal_False;
      93                 :            : 
      94                 :            :     // nur TextNodes zusammenfassen
      95 [ #  # ][ #  # ]:          0 :     if( nSttNd == nEndNd && nEndNd.GetNode().IsNoTxtNode() )
                 [ #  # ]
      96                 :          0 :         return sal_False;
      97                 :            : 
      98                 :            :     // teste auf gleiche / naechste Position
      99         [ #  # ]:          0 :     if( rPos.GetPoint()->nNode.GetIndex() == nEndNd.GetIndex() )
     100                 :            :     {
     101         [ #  # ]:          0 :         if( 1 < (rPos.GetPoint()->nContent.GetIndex() - nEndCnt) )
     102                 :          0 :             return sal_False;
     103                 :            :     }
     104         [ #  # ]:          0 :     else if( rPos.GetPoint()->nContent.GetIndex() )
     105                 :          0 :         return sal_False;
     106                 :            :     else
     107                 :            :     {
     108         [ #  # ]:          0 :         SwNodeIndex aIdx( nEndNd );
     109                 :          0 :         SwCntntNode *const pCNd = aIdx.GetNode().GetCntntNode();
     110   [ #  #  #  # ]:          0 :         if( !GoNextNds( &aIdx, sal_True ) ||
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     111                 :          0 :             aIdx.GetIndex() != rPos.GetPoint()->nNode.GetIndex() ||
     112         [ #  # ]:          0 :             ( pCNd && pCNd->Len() != nEndCnt ))
     113                 :            :         {
     114                 :          0 :             return sal_False;
     115 [ #  # ][ #  # ]:          0 :         }
     116                 :            :     }
     117                 :            : 
     118         [ #  # ]:          0 :     if( rSet.Count() )
     119                 :            :     {
     120         [ #  # ]:          0 :         SfxItemIter aIter( rSet );
     121                 :          0 :         const SfxPoolItem *pItem, *pCurr = aIter.GetCurItem();
     122                 :          0 :         while( sal_True )
     123                 :            :         {
     124   [ #  #  #  #  :          0 :             if( SFX_ITEM_SET != aFlySet.GetItemState( pCurr->Which(),
             #  #  #  # ]
                 [ #  # ]
     125         [ #  # ]:          0 :                 sal_False, &pItem ) ||
     126                 :            :                 // Ankerattribute gesondert behandeln
     127                 :          0 :                 ( RES_ANCHOR == pCurr->Which()
     128                 :          0 :                     ? (ANCHOR(pCurr)->GetAnchorId() != ANCHOR(pItem)->GetAnchorId() ||
     129                 :          0 :                        ANCHOR(pCurr)->GetPageNum() != ANCHOR(pItem)->GetPageNum())
     130 [ #  # ][ #  # ]:          0 :                     : *pItem != *pCurr ))
     131                 :          0 :                         return sal_False;
     132                 :            : 
     133         [ #  # ]:          0 :             if( aIter.IsAtEnd() )
     134                 :          0 :                 break;
     135         [ #  # ]:          0 :             pCurr = aIter.NextItem();
     136 [ #  # ][ #  # ]:          0 :         }
     137                 :            :     }
     138                 :          0 :     return sal_True;
     139                 :            : }
     140                 :            : 
     141                 :          0 : void SwFlySave::SetFlySize( const SwTableNode& rTblNd )
     142                 :            : {
     143                 :            :     // sollte der Fly kleiner als diese Tabelle sein, dann
     144                 :            :     // korrigiere diesen (nur bei abs. Angaben!)
     145                 :          0 :     SwTwips nWidth = rTblNd.GetTable().GetFrmFmt()->GetFrmSize().GetWidth();
     146                 :          0 :     const SwFmtFrmSize& rSz = GetFrmSize( aFlySet );
     147         [ #  # ]:          0 :     if( nWidth > rSz.GetWidth() )
     148 [ #  # ][ #  # ]:          0 :         aFlySet.Put( SwFmtFrmSize( rSz.GetHeightSizeType(), nWidth, rSz.GetHeight() ));
                 [ #  # ]
     149                 :          0 : }
     150                 :            : 
     151                 :          0 : sal_Bool lcl_HasBreakAttrs( const SwCntntNode& rNd )
     152                 :            : {
     153                 :          0 :     sal_Bool bRet = sal_False;
     154         [ #  # ]:          0 :     const SfxItemSet& rSet = rNd.GetSwAttrSet();
     155                 :            :     const SfxPoolItem* pItem;
     156         [ #  # ]:          0 :     if( SFX_ITEM_SET == rSet.GetItemState( RES_BREAK, sal_True, &pItem ) &&
           [ #  #  #  # ]
                 [ #  # ]
     157                 :          0 :         SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak() )
     158                 :          0 :         bRet = sal_True;
     159         [ #  # ]:          0 :     else if( SFX_ITEM_SET == rSet.GetItemState( RES_PAGEDESC, sal_True, &pItem )&&
           [ #  #  #  # ]
                 [ #  # ]
     160                 :          0 :          0 != ((SwFmtPageDesc*)pItem)->GetPageDesc() )
     161                 :          0 :         bRet = sal_True;
     162                 :          0 :     return bRet;
     163                 :            : }
     164                 :            : 
     165                 :            : 
     166                 :          0 : void lcl_CpyBreakAttrs( SwCntntNode* pSrcNd, SwCntntNode* pDstNd,
     167                 :            :                         SwNodeIndex* pNewIdx )
     168                 :            : {
     169                 :            :     const SfxItemSet* pSet;
     170 [ #  # ][ #  # ]:          0 :     if( pSrcNd && pDstNd && 0 != ( pSet = pSrcNd->GetpSwAttrSet() ) )
         [ #  # ][ #  # ]
     171                 :            :     {
     172                 :            :         const SfxPoolItem *pDescItem, *pBreakItem;
     173                 :            : 
     174         [ #  # ]:          0 :         if( SFX_ITEM_SET != pSet->GetItemState( RES_BREAK,
     175         [ #  # ]:          0 :                                         sal_False, &pBreakItem ) )
     176                 :          0 :             pBreakItem = 0;
     177                 :            : 
     178         [ #  # ]:          0 :         if( SFX_ITEM_SET != pSet->GetItemState( RES_PAGEDESC,
     179         [ #  # ]:          0 :                                         sal_False, &pDescItem ) )
     180                 :          0 :             pDescItem = 0;
     181                 :            : 
     182 [ #  # ][ #  # ]:          0 :         if( pDescItem || pBreakItem )
     183                 :            :         {
     184 [ #  # ][ #  # ]:          0 :             if( lcl_HasBreakAttrs( *pDstNd ))
     185                 :            :             {
     186 [ #  # ][ #  # ]:          0 :                 SwPosition aPos( *pDstNd, SwIndex( pDstNd ));
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     187         [ #  # ]:          0 :                 aPos.nNode--;
     188         [ #  # ]:          0 :                 pDstNd->GetDoc()->AppendTxtNode( aPos );
     189         [ #  # ]:          0 :                 if( pNewIdx )
     190         [ #  # ]:          0 :                     *pNewIdx = aPos.nNode;
     191                 :            : 
     192                 :          0 :                 SwCntntNode* pOldNd = pDstNd;
     193                 :          0 :                 pDstNd = aPos.nNode.GetNode().GetCntntNode();
     194         [ #  # ]:          0 :                 pDstNd->ChgFmtColl( pOldNd->GetFmtColl() );
     195 [ #  # ][ #  # ]:          0 :                 if( pDstNd->HasSwAttrSet() )
     196                 :            :                 {
     197 [ #  # ][ #  # ]:          0 :                     SfxItemSet aSet( *pDstNd->GetpSwAttrSet() );
     198         [ #  # ]:          0 :                     aSet.ClearItem( RES_BREAK );
     199         [ #  # ]:          0 :                     aSet.ClearItem( RES_PAGEDESC );
     200 [ #  # ][ #  # ]:          0 :                     pDstNd->SetAttr( aSet );
     201         [ #  # ]:          0 :                 }
     202                 :            :             }
     203         [ #  # ]:          0 :             if( pBreakItem )
     204                 :            :             {
     205         [ #  # ]:          0 :                 pDstNd->SetAttr( *pBreakItem );
     206         [ #  # ]:          0 :                 pSrcNd->ResetAttr( RES_BREAK );
     207                 :            :             }
     208         [ #  # ]:          0 :             if( pDescItem )
     209                 :            :             {
     210         [ #  # ]:          0 :                 pDstNd->SetAttr( *pDescItem );
     211         [ #  # ]:          0 :                 pSrcNd->ResetAttr( RES_PAGEDESC );
     212                 :            :             }
     213                 :            :         }
     214                 :            :     }
     215                 :          0 : }
     216                 :            : 
     217                 :          0 : void SwRTFParser::SetFlysInDoc()
     218                 :            : {
     219                 :            :     // !! von Oben abarbeiten, CntntPos ist kein Index !
     220         [ #  # ]:          0 :     SwNodes & rNds = pDoc->GetNodes();
     221                 :            :     typedef std::pair<SwFlyFrmFmt*, SwFmtAnchor> frameEntry;
     222                 :            :     typedef std::deque<frameEntry> rtfframesAtIndex;
     223                 :            :     typedef std::map<const SwNode*, rtfframesAtIndex> rtfFmtMap;
     224         [ #  # ]:          0 :     rtfFmtMap aPrevFmts;
     225                 :            : 
     226         [ #  # ]:          0 :     SwFrmFmt* pParent = pDoc->GetFrmFmtFromPool( RES_POOLFRM_FRAME );
     227         [ #  # ]:          0 :     for( sal_uInt16 n = 0; n < aFlyArr.size(); ++n )
     228                 :            :     {
     229                 :          0 :         SwFlySave* pFlySave = aFlyArr[ n ];
     230                 :            : 
     231                 :            :         OSL_ENSURE( !pFlySave->nSttNd.GetNode().FindFlyStartNode(),
     232                 :            :                 "Content vom Fly steht in einem Fly" );
     233                 :            :         OSL_ENSURE( pFlySave->nSttNd.GetIndex() <= pFlySave->nEndNd.GetIndex(),
     234                 :            :                 "Fly hat falschen Bereich" );
     235                 :            : 
     236                 :            : 
     237                 :            : 
     238                 :            :         // wenn ein DropCap ist, dann Text im Node belassen,
     239                 :            :         // am Absatz das Absatz Attribut setzen. Ggfs noch die FontSize zuruecksetzen,
     240                 :            :         // damit das DropCap nicht zu gross wird.
     241         [ #  # ]:          0 :         if( pFlySave->nDropAnchor )
     242                 :            :         {
     243                 :          0 :             SwTxtNode* pSttNd = pFlySave->nSttNd.GetNode().GetTxtNode();
     244                 :          0 :             SwTxtNode* pEndNd = pFlySave->nEndNd.GetNode().GetTxtNode();
     245   [ #  #  #  #  :          0 :             if( pSttNd && pEndNd &&
           #  # ][ #  # ]
                 [ #  # ]
     246                 :          0 :                 pSttNd->GetIndex() + 1 == pEndNd->GetIndex()
     247                 :          0 :                 && pSttNd->GetTxt().Len()>0 /* #i38227# leave drop caps with no content as fly frames */ )
     248                 :            :             {
     249                 :          0 :                 sal_uLong nPos = pSttNd->GetIndex();
     250                 :          0 :                 SwDoc * pDoc1 = pSttNd->GetDoc();
     251                 :            : 
     252                 :            :                 sal_Bool bJoined;
     253                 :            :                 {
     254         [ #  # ]:          0 :                     SwPaM aTmp( *pSttNd, pSttNd->GetTxt().Len(), *pEndNd, 0 );
     255 [ #  # ][ #  # ]:          0 :                     bJoined = pDoc1->DeleteAndJoin( aTmp );
     256                 :            :                 }
     257                 :            : 
     258 [ #  # ][ #  # ]:          0 :                 SwTxtNode * pNd = (pDoc1->GetNodes()[nPos])->GetTxtNode();
     259                 :            : 
     260 [ #  # ][ #  # ]:          0 :                 if( bJoined && pNd != NULL)
     261                 :            :                 {
     262         [ #  # ]:          0 :                     SwFmtDrop aDropCap;
     263                 :          0 :                     aDropCap.GetLines() = (sal_uInt8)pFlySave->nDropLines;
     264                 :          0 :                     aDropCap.GetChars() = 1;
     265                 :            : 
     266 [ #  # ][ #  # ]:          0 :                     SwIndex aIdx( pEndNd );
     267         [ #  # ]:          0 :                     pNd->RstAttr( aIdx, 1, RES_CHRATR_FONTSIZE );
     268 [ #  # ][ #  # ]:          0 :                     pNd->SetAttr( aDropCap );
                 [ #  # ]
     269                 :            :                 }
     270 [ #  # ][ #  # ]:          0 :                 delete pFlySave;
     271                 :          0 :                 continue;
     272                 :            :             }
     273                 :            :         }
     274                 :            : 
     275                 :            :         // liegt Ende und Start vom Naechsten im gleichen Node, dann muss
     276                 :            :         // gesplittet werden
     277         [ #  # ]:          0 :         if (((static_cast<size_t>(n) + 1) < aFlyArr.size()) &&
           [ #  #  #  # ]
                 [ #  # ]
     278                 :            :             pFlySave->nEndCnt &&
     279                 :          0 :             pFlySave->nEndNd == aFlyArr[ n + 1 ]->nSttNd )
     280                 :            :         {
     281                 :          0 :             SwCntntNode *const pCNd = pFlySave->nEndNd.GetNode().GetCntntNode();
     282         [ #  # ]:          0 :             if( pCNd )
     283                 :            :             {
     284                 :            :                 SwPosition aPos( pFlySave->nEndNd,
     285 [ #  # ][ #  # ]:          0 :                                 SwIndex( pCNd, pFlySave->nEndCnt ));
         [ #  # ][ #  # ]
     286         [ #  # ]:          0 :                 pDoc->SplitNode( aPos, false );
     287 [ #  # ][ #  # ]:          0 :                 pFlySave->nEndNd--;
     288                 :            :             }
     289                 :            :             else
     290                 :          0 :                 pFlySave->nEndCnt = 0;
     291                 :            :         }
     292                 :            : 
     293                 :            :         // verschiebe den Inhalt von diesem Anchor in den Auto-TextBereich
     294                 :            :         // und erzeuge dadurch den richtigen SwG-Rahmen
     295         [ #  # ]:          0 :         SwNodeRange aRg(pFlySave->nSttNd, 0, pFlySave->nEndNd, 0);
     296                 :            :         //Make a new section, unless there is no content at all
     297 [ #  # ][ #  # ]:          0 :         const bool bMakeEmptySection = aRg.aStart < aRg.aEnd || ((aRg.aStart == aRg.aEnd) && pFlySave->nEndCnt);
                 [ #  # ]
     298                 :            : 
     299                 :            :         {
     300                 :            :             // Nur TextNodes koennen in Tabellen stehen !!
     301                 :          0 :             const SwNode* pNd = &pFlySave->nSttNd.GetNode();
     302         [ #  # ]:          0 :             if( pNd->IsNoTxtNode() )
     303                 :            :             {
     304                 :            :                 // die Size muss noch korrigiert werden!
     305                 :          0 :                 nAktPageDesc = 0;       // Standart PageDesc
     306         [ #  # ]:          0 :                 if( SFX_ITEM_SET != pFlySave->aFlySet.GetItemState(
     307         [ #  # ]:          0 :                     RES_FRM_SIZE, sal_False ) )
     308                 :            :                     _SetPictureSize( *(SwNoTxtNode*)pNd, aRg.aStart,
     309 [ #  # ][ #  # ]:          0 :                                     pFlySave->aFlySet );
     310 [ #  # ][ #  # ]:          0 :                 if( 0 != ( pNd = pNd->FindTableNode() ) )
     311         [ #  # ]:          0 :                     pFlySave->SetFlySize( *(SwTableNode*)pNd );
     312                 :            :             }
     313                 :            :             else
     314                 :            :             {
     315                 :            :                 // Take care for table nodes
     316         [ #  # ]:          0 :                 pNd = pNd->GetNodes()[ pNd->GetIndex() - 2 ]->GetTableNode();
     317         [ #  # ]:          0 :                 if( pNd ) // if the table starts imediately before aRg -> expand aRg
     318         [ #  # ]:          0 :                     aRg.aStart = *pNd;
     319                 :            : 
     320         [ #  # ]:          0 :                 if( bMakeEmptySection )
     321                 :            :                 {
     322                 :          0 :                     pNd = &aRg.aEnd.GetNode();
     323                 :          0 :                     sal_uLong nSectEnd = pNd->EndOfSectionIndex()+1;
     324                 :            : 
     325         [ #  # ]:          0 :                     if (!pNd->IsTableNode() && 0 !=(pNd = pNd->FindTableNode())
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     326                 :          0 :                         && (pNd->GetIndex() >= aRg.aStart.GetNode().GetIndex()) )
     327                 :            :                     {
     328                 :            :                         const SwNode* pTblBxNd;
     329                 :            : 
     330                 :            :                         // Ende der Tabelle ist hinter dieser Box ??
     331         [ #  # ]:          0 :                         if( pNd->EndOfSectionIndex() == nSectEnd )
     332         [ #  # ]:          0 :                             aRg.aEnd = nSectEnd+1;
     333                 :            :                         // is the end in the first box of the table, then
     334                 :            :                         // move before the table (Bug 67663)
     335                 :            :                         // but the range must not become emtpy, i.e. aStart==aEnd
     336                 :            :                         // because otherwise we will get a crash (126506) later on
     337 [ #  # ][ #  #  :          0 :                         else if( 0 != ( pTblBxNd = aRg.aEnd.GetNode().
             #  #  #  # ]
                 [ #  # ]
     338                 :            :                                                 FindTableBoxStartNode()) &&
     339                 :          0 :                                  pTblBxNd->GetIndex() - 1 == pNd->GetIndex() &&
     340                 :          0 :                                  &aRg.aStart.GetNode() != pNd )
     341         [ #  # ]:          0 :                             aRg.aEnd = *pNd;
     342                 :            :                         else
     343                 :            :                         {
     344                 :            :                             // Tabelle ist noch groesser, also splitte sie hier.
     345         [ #  # ]:          0 :                             rNds.SplitTable( aRg.aEnd, sal_True );
     346         [ #  # ]:          0 :                             aRg.aEnd = pNd->EndOfSectionIndex() + 1;
     347                 :            :                         }
     348                 :            :                     }
     349                 :            :                 }
     350                 :            :             }
     351                 :            :         }
     352                 :            : 
     353                 :            :         // vorm verschieben muss sich der Index auf die alte Position
     354                 :            :         // gemerkt werden, der Index wird mit verschoben !!!
     355                 :            : 
     356         [ #  # ]:          0 :         SwNodeIndex aTmpIdx( rNds.GetEndOfAutotext() );
     357                 :            :         SwStartNode* pSttNd = bMakeEmptySection
     358                 :            :                 ? rNds.MakeEmptySection( aTmpIdx, SwFlyStartNode )
     359                 :            :                 : rNds.MakeTextSection( aTmpIdx, SwFlyStartNode,
     360 [ #  # ][ #  # ]:          0 :                         (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
                 [ #  # ]
     361                 :            : 
     362                 :            :         // das ist die Verankerungs-Position (fuers Layout!)
     363         [ #  # ]:          0 :         pFlySave->nSttNd = aRg.aStart.GetIndex()-1;
     364         [ #  # ]:          0 :         if( bMakeEmptySection )
     365                 :            :         {
     366                 :            :             // check: the move does not clear the surrounded section. If all
     367                 :            :             // nodes moved away, then create a new TxtNode
     368                 :            :             {
     369                 :            :                 // i76403: an empty selection is not a good idea
     370 [ #  # ][ #  # ]:          0 :                 if( aRg.aStart == aRg.aEnd && aRg.aStart.GetNode().GetTxtNode() )
                 [ #  # ]
     371         [ #  # ]:          0 :                     aRg.aEnd++;
     372         [ #  # ]:          0 :                 SwNodeIndex aPrev( aRg.aStart, -1 );
     373   [ #  #  #  # ]:          0 :                 if( aPrev.GetNode().IsStartNode() &&
                 [ #  # ]
     374                 :          0 :                     aPrev.GetNode().EndOfSectionNode() == &aRg.aEnd.GetNode())
     375                 :            :                 {
     376                 :            :                     // create new txtnode, because the section does never be empty
     377         [ #  # ]:          0 :                     pDoc->GetNodes().MakeTxtNode( aRg.aEnd,
     378         [ #  # ]:          0 :                             (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
     379         [ #  # ]:          0 :                     aRg.aEnd--;
     380         [ #  # ]:          0 :                 }
     381                 :            :             }
     382         [ #  # ]:          0 :             aTmpIdx = *pSttNd->EndOfSectionNode();
     383                 :            :             pDoc->MoveNodeRange( aRg, aTmpIdx,
     384         [ #  # ]:          0 :                 IDocumentContentOperations::DOC_MOVEDEFAULT );
     385                 :            :         }
     386                 :            : 
     387                 :            :         // patch from cmc for #i52542#
     388         [ #  # ]:          0 :         if (pSttNd->GetIndex() + 1 == pSttNd->EndOfSectionIndex())
     389                 :            :         {
     390                 :            :             OSL_ENSURE(!this, "nothing in this frame, not legal");
     391 [ #  # ][ #  # ]:          0 :             delete pFlySave;
     392                 :          0 :             continue;
     393                 :            :         }
     394                 :            : 
     395 [ #  # ][ #  # ]:          0 :         pFlySave->aFlySet.Put( SwFmtCntnt( pSttNd ));
                 [ #  # ]
     396                 :            : 
     397                 :            :         CalculateFlySize( pFlySave->aFlySet, pFlySave->nSttNd,
     398         [ #  # ]:          0 :                           pFlySave->nPageWidth );
     399                 :            : 
     400                 :            :                 // THIS >>>>>
     401                 :            :         // if the section only contains one Node and this has a
     402                 :            :         // border or backgorund, then put it to the frame
     403                 :            :         // Not in our own RTF-Format!
     404                 :            :                 // <<<<< DOES NOT MAKE SENSE TO ME (flr)
     405                 :            :         // Added support for transparent frames.
     406 [ #  # ][ #  # ]:          0 :         if( pSttNd->GetIndex() + 1 != pSttNd->EndOfSectionIndex() &&
                 [ #  # ]
     407                 :          0 :             !bSwPageDesc )
     408                 :            :         {
     409 [ #  # ][ #  # ]:          0 :             SwCntntNode* pSrcNd = pDoc->GetNodes()[ pSttNd->GetIndex() + 1 ]->GetCntntNode();
     410                 :          0 :             SfxItemSet aTmpSet( pDoc->GetAttrPool(),
     411         [ #  # ]:          0 :                                     RES_BACKGROUND, RES_BOX );
     412         [ #  # ]:          0 :             const SvxBrushItem* pBackgroundBrush = (const SvxBrushItem*)pFlySave->aFlySet.GetItem(RES_BACKGROUND, sal_False);
     413 [ #  # ][ #  # ]:          0 :             if( pSrcNd && pSrcNd->HasSwAttrSet() )
         [ #  # ][ #  # ]
     414 [ #  # ][ #  # ]:          0 :                 aTmpSet.Put( *pSrcNd->GetpSwAttrSet() );
     415         [ #  # ]:          0 :             if (pBackgroundBrush)
     416                 :            :             {
     417         [ #  # ]:          0 :                 aTmpSet.Put(*pBackgroundBrush, RES_BACKGROUND);
     418                 :            :             }
     419                 :            :             else
     420                 :            :             {
     421         [ #  # ]:          0 :                 pBackgroundBrush = (const SvxBrushItem*)aTmpSet.GetItem(RES_BACKGROUND, sal_False);
     422         [ #  # ]:          0 :                 if (pBackgroundBrush)
     423                 :            :                 {
     424                 :          0 :                     Color& rBackgroundColor = const_cast<SvxBrushItem*>(pBackgroundBrush)->GetColor();
     425         [ #  # ]:          0 :                     rBackgroundColor.SetTransparency(0xFE);
     426                 :            :                 }
     427                 :            :                 else
     428                 :            :                 {
     429                 :          0 :                     Color aColor = Color(0xff, 0xff, 0xff);
     430         [ #  # ]:          0 :                     aColor.SetTransparency( 0xFE);
     431         [ #  # ]:          0 :                     SvxBrushItem aBrush(aColor, RES_BACKGROUND);
     432 [ #  # ][ #  # ]:          0 :                     aTmpSet.Put(aBrush, RES_BACKGROUND);
     433                 :            :                 }
     434                 :            :             }
     435                 :            :             // Topic 6.
     436         [ #  # ]:          0 :             pFlySave->aFlySet.Put( aTmpSet );
     437 [ #  # ][ #  # ]:          0 :             if( pSrcNd && pSrcNd->HasSwAttrSet() )
         [ #  # ][ #  # ]
     438                 :            :             {
     439         [ #  # ]:          0 :                 pSrcNd->ResetAttr( RES_BACKGROUND, RES_BOX );
     440         [ #  # ]:          0 :             }
     441                 :            :         }
     442                 :            : 
     443         [ #  # ]:          0 :         SwFlyFrmFmt* pFmt = pDoc->MakeFlyFrmFmt( aEmptyStr, pParent );
     444         [ #  # ]:          0 :         pFmt->SetFmtAttr( pFlySave->aFlySet );
     445         [ #  # ]:          0 :         const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
     446         [ #  # ]:          0 :         if (FLY_AS_CHAR != rAnchor.GetAnchorId())
     447                 :            :         {
     448                 :            :             // korrigiere noch den Absatz, ist immer der vorhergehende !
     449                 :            :             // wenn es diesen gibt! (DocAnfang!)
     450                 :            : 
     451                 :            :             // that is wrong. The anchor is ever the NEXT!
     452                 :            :             // there are an Bug in the ExportFilter which will
     453                 :            :             //              be fixed in the Version 517 - by SWG-Export
     454                 :            :             //              the fly will be after the paragraph - but in RTF
     455                 :            :             //              the flys will be before the paragraph.
     456 [ #  # ][ #  # ]:          0 :             if( !bSwPageDesc || 5430 < GetVersionNo() )
                 [ #  # ]
     457         [ #  # ]:          0 :                 pFlySave->nSttNd++;
     458                 :            : 
     459                 :            :             {
     460                 :            :                 // Seitenumbrueche in den Bodybereich verschieben!
     461                 :          0 :                 SwCntntNode* pSrcNd = aRg.aStart.GetNode().GetCntntNode();
     462                 :          0 :                 SwCntntNode* pDstNd = pFlySave->nSttNd.GetNode().GetCntntNode();
     463         [ #  # ]:          0 :                 if( !pDstNd )
     464 [ #  # ][ #  # ]:          0 :                     pDstNd = pDoc->GetNodes().GoNext( &pFlySave->nSttNd );
     465                 :            : 
     466         [ #  # ]:          0 :                 ::lcl_CpyBreakAttrs( pSrcNd, pDstNd, &pFlySave->nSttNd );
     467                 :            :             }
     468                 :            : 
     469         [ #  # ]:          0 :             const SwNodeIndex aSttNd(*pSttNd);
     470         [ #  # ]:          0 :             SwNodeIndex aEndNd(*pSttNd->EndOfSectionNode());
     471         [ #  # ]:          0 :             aEndNd--;
     472                 :            : 
     473         [ #  # ]:          0 :             SwPosition aPos( pFlySave->nSttNd );
     474         [ #  # ]:          0 :             SwFmtAnchor aAnchor(rAnchor);
     475         [ #  # ]:          0 :             aAnchor.SetAnchor(&aPos);
     476                 :            : 
     477                 :          0 :             const SwNode *pCurrentAnchor = &(pFlySave->nSttNd.GetNode());
     478 [ #  # ][ #  # ]:          0 :             aPrevFmts[pCurrentAnchor].push_back(frameEntry(pFmt, aAnchor));
         [ #  # ][ #  # ]
     479                 :            : 
     480         [ #  # ]:          0 :             while (aEndNd > aSttNd)
     481                 :            :             {
     482                 :            :                 typedef rtfframesAtIndex::iterator myIter;
     483         [ #  # ]:          0 :                 rtfframesAtIndex &rDeque = aPrevFmts[&(aEndNd.GetNode())];
     484                 :          0 :                 myIter aEnd = rDeque.end();
     485 [ #  # ][ #  # ]:          0 :                 for (myIter aIter = rDeque.begin(); aIter != aEnd; ++aIter)
                 [ #  # ]
     486                 :            :                 {
     487 [ #  # ][ #  # ]:          0 :                     aIter->second.SetAnchor(&aPos);
     488                 :            :                     // #i27767# - push on front to keep order of objects
     489                 :            :                     // for the correct object positioning
     490                 :            :                     // aPrevFmts[pCurrentAnchor].push_back(*aIter);
     491 [ #  # ][ #  # ]:          0 :                     aPrevFmts[pCurrentAnchor].push_front(*aIter);
                 [ #  # ]
     492                 :            :                 }
     493                 :          0 :                 rDeque.clear();
     494         [ #  # ]:          0 :                 aEndNd--;
     495 [ #  # ][ #  # ]:          0 :            }
         [ #  # ][ #  # ]
     496                 :            :         }
     497                 :            : 
     498                 :            :         // Create draw contact object, which also creates a <SdrObject> instance,
     499                 :            :         // in order to set the order number.
     500                 :            :         // The order number is assumed to be the order of the text flow.
     501                 :            :         SwFlyDrawContact* pContact =
     502                 :            :                 new SwFlyDrawContact( pFmt,
     503 [ #  # ][ #  # ]:          0 :                                       pFmt->GetDoc()->GetOrCreateDrawModel() );
                 [ #  # ]
     504 [ #  # ][ #  # ]:          0 :         pContact->GetMaster()->SetOrdNum( n );
     505                 :            : 
     506 [ #  # ][ #  # ]:          0 :         delete pFlySave;
     507 [ #  # ][ #  # ]:          0 :     }
         [ #  # ][ #  # ]
     508                 :            : 
     509                 :            :     typedef rtfFmtMap::reverse_iterator myriter;
     510                 :          0 :     myriter aEnd = aPrevFmts.rend();
     511 [ #  # ][ #  # ]:          0 :     for(myriter aIter = aPrevFmts.rbegin(); aIter != aEnd; ++aIter)
                 [ #  # ]
     512                 :            :     {
     513         [ #  # ]:          0 :         rtfframesAtIndex &rDeque = aIter->second;
     514                 :            :         typedef rtfframesAtIndex::iterator myIter;
     515                 :          0 :         myIter aQEnd = rDeque.end();
     516 [ #  # ][ #  # ]:          0 :         for (myIter aQIter = rDeque.begin(); aQIter != aQEnd; ++aQIter)
                 [ #  # ]
     517                 :            :         {
     518         [ #  # ]:          0 :             frameEntry &rEntry = *aQIter;
     519                 :          0 :             SwFlyFrmFmt *pFrm = rEntry.first;
     520                 :          0 :             SwFmtAnchor &rAnchor = rEntry.second;
     521         [ #  # ]:          0 :             pFrm->SetFmtAttr(rAnchor);
     522                 :            :         }
     523                 :            :     }
     524                 :            : 
     525                 :          0 :     aFlyArr.clear();
     526                 :          0 : }
     527                 :            : 
     528                 :            : // clips the text box to the min or max position if it is outside our min or max boundry
     529                 :          0 : long SwRTFParser::GetSafePos(long nPos)
     530                 :            : {
     531         [ #  # ]:          0 :     if(nPos > SHRT_MAX)
     532                 :          0 :         nPos = SHRT_MAX;
     533         [ #  # ]:          0 :     else if(nPos < SHRT_MIN)
     534                 :          0 :         nPos = SHRT_MIN;
     535                 :            : 
     536                 :          0 :     return nPos;
     537                 :            : }
     538                 :            : 
     539                 :          0 : void SwRTFParser::ReadFly( int nToken, SfxItemSet* pSet )
     540                 :            : {
     541                 :            :     // ein Set fuer die FrmFmt-Attribute
     542         [ #  # ]:          0 :     SfxItemSet aSet( pDoc->GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
     543         [ #  # ]:          0 :     if( !IsNewDoc() )
     544         [ #  # ]:          0 :         Reader::ResetFrmFmtAttrs( aSet );
     545                 :            : 
     546                 :            :     // der Fly beginnt immer in einem neuen Absatz
     547         [ #  # ]:          0 :     if( pPam->GetPoint()->nContent.GetIndex() )
     548         [ #  # ]:          0 :         InsertPara();
     549                 :            : 
     550                 :            :     // RTF-Defaults setzen:
     551                 :            :     // #i27767#
     552         [ #  # ]:          0 :     SwFmtAnchor aAnchor( FLY_AT_PARA );
     553         [ #  # ]:          0 :     SwFmtHoriOrient aHori( 0, text::HoriOrientation::LEFT, text::RelOrientation::FRAME );
     554         [ #  # ]:          0 :     SwFmtVertOrient aVert( 0, text::VertOrientation::TOP, text::RelOrientation::FRAME );
     555                 :            : 
     556         [ #  # ]:          0 :     SvxFrameDirectionItem aFrmDir( FRMDIR_HORI_LEFT_TOP, RES_FRAMEDIR );
     557                 :            : 
     558                 :          0 :     sal_uInt16 nCols = USHRT_MAX, nColSpace = USHRT_MAX, nAktCol = 0;
     559         [ #  # ]:          0 :     std::vector<sal_uInt16> aColumns;
     560                 :            : 
     561                 :          0 :     sal_Bool bChkDropCap = 0 == pSet;
     562                 :          0 :     sal_uInt16 nDropCapLines = 0, nDropCapAnchor = 0;
     563                 :          0 :     int nNumOpenBrakets = GetOpenBrakets();
     564                 :            : 
     565         [ #  # ]:          0 :     if( !pSet )
     566                 :            :     {
     567                 :          0 :         pSet = &aSet;
     568                 :            :     }
     569                 :            :     else
     570                 :            :     {
     571                 :            :         // die Werte aus dem uebergebenen!
     572 [ #  # ][ #  # ]:          0 :         aAnchor = (SwFmtAnchor&)pSet->Get( RES_ANCHOR );
     573         [ #  # ]:          0 :         aHori = (SwFmtHoriOrient&)pSet->Get( RES_HORI_ORIENT );
     574         [ #  # ]:          0 :         aVert = (SwFmtVertOrient&)pSet->Get( RES_VERT_ORIENT );
     575                 :            :     }
     576                 :            : 
     577                 :            :     // dann sammel mal alle Attribute zusammen
     578                 :          0 :     int bWeiter = sal_True;
     579                 :          0 :     int nAppliedProps=0;
     580   [ #  #  #  # ]:          0 :     do {
                 [ #  # ]
     581                 :          0 :         sal_uInt16 nVal = sal_uInt16(nTokenValue);
     582                 :            :         /*
     583                 :            :         #i5263#
     584                 :            :         Assume that a property genuinely contributes towards creating a frame,
     585                 :            :         and if turns out to be a non contributing one reduce the count.
     586                 :            :         */
     587                 :          0 :         ++nAppliedProps;
     588   [ #  #  #  #  :          0 :         switch( nToken )
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
          #  #  #  #  #  
                      # ]
     589                 :            :         {
     590                 :            :         case RTF_ABSW:
     591                 :            :             {
     592         [ #  # ]:          0 :                 SwFmtFrmSize aSz( ATT_MIN_SIZE, nTokenValue, 0 );
     593                 :            :                 const SfxPoolItem* pItem;
     594         [ #  # ]:          0 :                 if( SFX_ITEM_SET == pSet->GetItemState( RES_FRM_SIZE, sal_True,
     595         [ #  # ]:          0 :                     &pItem ))
     596                 :            :                 {
     597                 :          0 :                     aSz.SetHeightSizeType( ((SwFmtFrmSize*)pItem)->GetHeightSizeType() );
     598                 :          0 :                     aSz.SetHeight( ((SwFmtFrmSize*)pItem)->GetHeight() );
     599                 :            :                 }
     600         [ #  # ]:          0 :                 if( MINFLY > nTokenValue )  nTokenValue = MINFLY;
     601 [ #  # ][ #  # ]:          0 :                 aSet.Put( aSz );
     602                 :            :             }
     603                 :          0 :             break;
     604                 :            :         case RTF_ABSH:
     605                 :            :             {
     606         [ #  # ]:          0 :                 SwFmtFrmSize aSz( ATT_MIN_SIZE, 0, MINFLY );
     607                 :            :                 const SfxPoolItem* pItem;
     608         [ #  # ]:          0 :                 if( SFX_ITEM_SET == pSet->GetItemState( RES_FRM_SIZE, sal_True,
     609         [ #  # ]:          0 :                     &pItem ))
     610                 :            :                 {
     611                 :          0 :                     aSz.SetWidth( ((SwFmtFrmSize*)pItem)->GetWidth() );
     612                 :            :                 }
     613                 :            : 
     614         [ #  # ]:          0 :                 if( 0 > nTokenValue )
     615                 :            :                 {
     616                 :          0 :                     nTokenValue = -nTokenValue;
     617                 :          0 :                     aSz.SetHeightSizeType( ATT_FIX_SIZE );
     618                 :            :                 }
     619         [ #  # ]:          0 :                 if( MINFLY > nTokenValue )  nTokenValue = MINFLY;
     620                 :          0 :                 aSz.SetHeight( nTokenValue );
     621 [ #  # ][ #  # ]:          0 :                 aSet.Put( aSz );
     622                 :            :             }
     623                 :          0 :             break;
     624                 :            : 
     625                 :            :         case RTF_NOWRAP:
     626                 :            :             {
     627 [ #  # ][ #  # ]:          0 :                 pSet->Put( SwFmtSurround( SURROUND_NONE ));
                 [ #  # ]
     628                 :            :             }
     629                 :          0 :             break;
     630                 :            :         case RTF_DXFRTEXT:
     631                 :            :                 {
     632         [ #  # ]:          0 :                     SvxULSpaceItem aUL( RES_UL_SPACE );
     633         [ #  # ]:          0 :                     SvxLRSpaceItem aLR( RES_LR_SPACE );
     634                 :          0 :                     aUL.SetUpper( nVal );   aUL.SetLower( nVal );
     635                 :          0 :                     aLR.SetLeft( nVal );    aLR.SetRight( nVal );
     636         [ #  # ]:          0 :                     pSet->Put( aUL );
     637 [ #  # ][ #  # ]:          0 :                     pSet->Put( aLR );
                 [ #  # ]
     638                 :            :                 }
     639                 :          0 :                 break;
     640                 :            : 
     641                 :            :         case RTF_DFRMTXTX:
     642                 :            :                 {
     643         [ #  # ]:          0 :                     SvxLRSpaceItem aLR( RES_LR_SPACE );
     644                 :          0 :                     aLR.SetLeft( nVal );    aLR.SetRight( nVal );
     645 [ #  # ][ #  # ]:          0 :                     pSet->Put( aLR );
     646                 :            :                 }
     647                 :          0 :                 break;
     648                 :            :         case RTF_DFRMTXTY:
     649                 :            :                 {
     650         [ #  # ]:          0 :                     SvxULSpaceItem aUL( RES_UL_SPACE );
     651                 :          0 :                     aUL.SetUpper( nVal );   aUL.SetLower( nVal );
     652 [ #  # ][ #  # ]:          0 :                     pSet->Put( aUL );
     653                 :            :                 }
     654                 :          0 :                 break;
     655                 :            : 
     656                 :            :         case RTF_POSNEGX:
     657                 :          0 :         case RTF_POSX:      aHori.SetHoriOrient( text::HoriOrientation::NONE );
     658                 :          0 :                             aHori.SetPos( GetSafePos((long)nTokenValue) );
     659                 :          0 :                             break;
     660                 :          0 :         case RTF_POSXC:     aHori.SetHoriOrient( text::HoriOrientation::CENTER );     break;
     661                 :          0 :         case RTF_POSXI:     aHori.SetHoriOrient( text::HoriOrientation::LEFT );
     662                 :          0 :                             aHori.SetPosToggle( sal_True );
     663                 :          0 :                             break;
     664                 :          0 :         case RTF_POSXO:     aHori.SetHoriOrient( text::HoriOrientation::RIGHT );
     665                 :          0 :                             aHori.SetPosToggle( sal_True );
     666                 :          0 :                             break;
     667                 :          0 :         case RTF_POSXL:     aHori.SetHoriOrient( text::HoriOrientation::LEFT );       break;
     668                 :          0 :         case RTF_POSXR:     aHori.SetHoriOrient( text::HoriOrientation::RIGHT );      break;
     669                 :            : 
     670                 :            :         case RTF_POSNEGY:
     671                 :          0 :         case RTF_POSY:      aVert.SetVertOrient( text::VertOrientation::NONE );
     672                 :          0 :                             aVert.SetPos( GetSafePos((long)nTokenValue) );
     673                 :          0 :                             break;
     674                 :          0 :         case RTF_POSYT:     aVert.SetVertOrient( text::VertOrientation::TOP );    break;
     675                 :          0 :         case RTF_POSYB:     aVert.SetVertOrient( text::VertOrientation::BOTTOM ); break;
     676                 :          0 :         case RTF_POSYC:     aVert.SetVertOrient( text::VertOrientation::CENTER ); break;
     677                 :            : 
     678                 :          0 :         case RTF_PHMRG:     aHori.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA ); break;
     679                 :          0 :         case RTF_PVMRG:     aVert.SetRelationOrient( text::RelOrientation::PAGE_PRINT_AREA ); break;
     680                 :          0 :         case RTF_PHPG:      aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME ); break;
     681                 :          0 :         case RTF_PVPG:      aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );break;
     682                 :          0 :         case RTF_PHCOL:     aHori.SetRelationOrient( text::RelOrientation::FRAME ); break;
     683                 :          0 :         case RTF_PVPARA:    aVert.SetRelationOrient( text::RelOrientation::FRAME ); break;
     684                 :            : 
     685                 :            :         case RTF_POSYIL:
     686                 :          0 :             break;
     687                 :            :         case RTF_ABSLOCK:
     688                 :            :             /*
     689                 :            :             #i5263#
     690                 :            :             Not sufficient to make a frame at least word won't do it with just
     691                 :            :             an abslock
     692                 :            :             */
     693                 :          0 :             --nAppliedProps;
     694                 :          0 :             break;
     695                 :            :         case RTF_FRMTXLRTB:
     696                 :          0 :             aFrmDir.SetValue( FRMDIR_HORI_LEFT_TOP );
     697                 :          0 :             break;
     698                 :            :         case RTF_FRMTXTBRL:
     699                 :          0 :             aFrmDir.SetValue( FRMDIR_HORI_RIGHT_TOP );
     700                 :          0 :             break;
     701                 :            :         case RTF_FRMTXLRTBV:
     702                 :          0 :             aFrmDir.SetValue( FRMDIR_VERT_TOP_LEFT );
     703                 :          0 :             break;
     704                 :            :         case RTF_FRMTXTBRLV:
     705                 :          0 :             aFrmDir.SetValue( FRMDIR_VERT_TOP_RIGHT );
     706                 :          0 :             break;
     707                 :            : 
     708                 :            :         case RTF_DROPCAPLI:                         // Dropcaps !!
     709         [ #  # ]:          0 :                 if( bChkDropCap )
     710                 :            :                 {
     711                 :          0 :                     nDropCapLines = sal_uInt16( nTokenValue );
     712         [ #  # ]:          0 :                     if( !nDropCapAnchor )
     713                 :          0 :                         nDropCapAnchor = 1;
     714                 :            :                 }
     715                 :          0 :                 break;
     716                 :            :         case RTF_DROPCAPT:
     717         [ #  # ]:          0 :                 if( bChkDropCap )
     718                 :            :                 {
     719                 :          0 :                     nDropCapAnchor = sal_uInt16( nTokenValue );
     720         [ #  # ]:          0 :                     if( !nDropCapLines )
     721                 :          0 :                         nDropCapLines = 3;
     722                 :            :                 }
     723                 :          0 :                 break;
     724                 :            : 
     725                 :            : 
     726                 :            :         // fuer die "alten" Writer - haben die Spaltigkeit falsch heraus-
     727                 :            :         // geschrieben
     728                 :          0 :         case RTF_COLS:          nCols = sal_uInt16( nTokenValue );      break;
     729                 :          0 :         case RTF_COLSX:         nColSpace = sal_uInt16( nTokenValue );  break;
     730                 :            :         case RTF_COLNO:
     731                 :          0 :             nAktCol = sal_uInt16( nTokenValue );
     732 [ #  # ][ #  # ]:          0 :             if( RTF_COLW == GetNextToken() )
     733                 :            :             {
     734                 :          0 :                 sal_uInt16 nWidth = sal_uInt16( nTokenValue ), nSpace = 0;
     735 [ #  # ][ #  # ]:          0 :                 if( RTF_COLSR == GetNextToken() )
     736                 :          0 :                     nSpace = sal_uInt16( nTokenValue );
     737                 :            :                 else
     738         [ #  # ]:          0 :                     SkipToken( -1 );        // wieder zurueck
     739                 :            : 
     740         [ #  # ]:          0 :                 if( --nAktCol == ( aColumns.size() / 2 ) )
     741                 :            :                 {
     742         [ #  # ]:          0 :                     aColumns.push_back( nWidth + nSpace );
     743         [ #  # ]:          0 :                     aColumns.push_back( nSpace );
     744                 :            :                 }
     745                 :            :             }
     746                 :          0 :             break;
     747                 :            : 
     748                 :            :         case '{':
     749                 :            :             {
     750                 :          0 :                 short nSkip = 0;
     751 [ #  # ][ #  # ]:          0 :                 if( RTF_IGNOREFLAG != ( nToken = GetNextToken() ))
     752                 :            :                 {
     753         [ #  # ]:          0 :                     if( RTF_SHADINGDEF == (nToken & ~0xff) )
     754                 :            :                     {
     755         [ #  # ]:          0 :                         ReadBackgroundAttr( nToken, aSet );
     756         [ #  # ]:          0 :                         GetNextToken();     // Klammer ueberlesen
     757                 :            :                     }
     758                 :            :                     else
     759                 :          0 :                         nSkip = -1;
     760                 :            :                 }
     761 [ #  # ][ #  # ]:          0 :                 else if( RTF_APOCTL ==
     762                 :          0 :                     ((nToken = GetNextToken() ) & ~(0xff | RTF_SWGDEFS)) )
     763                 :            :                 {
     764                 :          0 :                     bReadSwFly = true;      // alles kommt in den akt. Fly
     765         [ #  # ]:          0 :                     SvxLRSpaceItem aLR( RES_LR_SPACE );
     766         [ #  # ]:          0 :                     SvxULSpaceItem aUL( RES_UL_SPACE );
     767                 :          0 :                     nCols = USHRT_MAX;      // neu aufsetzen
     768                 :          0 :                     nColSpace = USHRT_MAX;
     769 [ #  # ][ #  # ]:          0 :                     do {
         [ #  # ][ #  # ]
     770                 :          0 :                     nVal = sal_uInt16(nTokenValue);
     771   [ #  #  #  #  :          0 :                     switch( nToken )
          #  #  #  #  #  
          #  #  #  #  #  
                   #  # ]
     772                 :            :                     {
     773                 :            :                     // Swg-Frame-Tokens
     774                 :            :                     case RTF_FLYPRINT:
     775                 :            :                         {
     776 [ #  # ][ #  # ]:          0 :                             pSet->Put( SvxPrintItem( RES_PRINT, sal_False ));
                 [ #  # ]
     777                 :            :                         }
     778                 :          0 :                         break;
     779                 :            :                     case RTF_FLYOPAQUE:
     780                 :            :                         {
     781 [ #  # ][ #  # ]:          0 :                             pSet->Put( SvxOpaqueItem( RES_OPAQUE, sal_False ));
                 [ #  # ]
     782                 :            :                         }
     783                 :          0 :                         break;
     784                 :            : 
     785                 :            :                     case RTF_FLYPRTCTD:
     786                 :            :                         {
     787                 :          0 :                             RTFProtect aP( (sal_uInt8)nTokenValue );
     788         [ #  # ]:          0 :                             SvxProtectItem aProtectItem( RES_PROTECT );
     789                 :          0 :                             aProtectItem.SetCntntProtect( aP.GetCntnt() );
     790                 :          0 :                             aProtectItem.SetSizeProtect( aP.GetSize() );
     791                 :          0 :                             aProtectItem.SetPosProtect( aP.GetPos() );
     792 [ #  # ][ #  # ]:          0 :                             pSet->Put( aProtectItem );
     793                 :            :                         }
     794                 :          0 :                         break;
     795                 :            : 
     796                 :            :                     case RTF_FLYMAINCNT:
     797                 :            :                         {
     798                 :          0 :                             RTFSurround aMC( (sal_uInt8)nTokenValue );
     799         [ #  # ]:          0 :                             SwFmtSurround aSurr( (SwSurround)aMC.GetOrder());
     800         [ #  # ]:          0 :                             if( aMC.GetGoldCut() )
     801                 :          0 :                                 aSurr.SetSurround( SURROUND_IDEAL );
     802 [ #  # ][ #  # ]:          0 :                             pSet->Put( aSurr );
     803                 :            :                         }
     804                 :          0 :                         break;
     805                 :            :                     case RTF_FLYVERT:
     806                 :            :                         {
     807                 :          0 :                             RTFVertOrient aVO( nVal );
     808                 :          0 :                             aVert.SetVertOrient( aVO.GetOrient() );
     809                 :          0 :                             aVert.SetRelationOrient( aVO.GetRelation() );
     810                 :            :                         }
     811                 :          0 :                         break;
     812                 :            :                     case RTF_FLYHORZ:
     813                 :            :                         {
     814                 :          0 :                             RTFHoriOrient aHO( nVal );
     815                 :          0 :                             aHori.SetHoriOrient( aHO.GetOrient() );
     816                 :          0 :                             aHori.SetRelationOrient( aHO.GetRelation() );
     817                 :            :                         }
     818                 :          0 :                         break;
     819                 :          0 :                     case RTF_FLYOUTLEFT:        aLR.SetLeft( nVal );        break;
     820                 :          0 :                     case RTF_FLYOUTRIGHT:       aLR.SetRight( nVal );       break;
     821                 :          0 :                     case RTF_FLYOUTUPPER:       aUL.SetUpper( nVal );       break;
     822                 :          0 :                     case RTF_FLYOUTLOWER:       aUL.SetLower( nVal );       break;
     823                 :            :                     case RTF_FLYANCHOR:
     824         [ #  # ]:          0 :                             switch( GetNextToken() )
              [ #  #  # ]
     825                 :            :                             {
     826                 :            :                             case RTF_FLY_PAGE:
     827                 :          0 :                                 aAnchor.SetType( FLY_AT_PAGE );
     828                 :          0 :                                 aAnchor.SetPageNum( sal_uInt16(nTokenValue));
     829         [ #  # ]:          0 :                                 aAnchor.SetAnchor( 0 );
     830                 :          0 :                                 break;
     831                 :            : 
     832                 :            :                             case RTF_FLY_CNTNT:
     833                 :            :                                 {
     834         [ #  # ]:          0 :                                     SwNodeIndex aIdx( pPam->GetPoint()->nNode );
     835 [ #  # ][ #  # ]:          0 :                                     pDoc->GetNodes().GoPrevious( &aIdx );
     836         [ #  # ]:          0 :                                     SwPosition aPos( aIdx );
     837                 :          0 :                                     aAnchor.SetType( FLY_AT_PARA );
     838 [ #  # ][ #  # ]:          0 :                                     aAnchor.SetAnchor( &aPos );
                 [ #  # ]
     839                 :            :                                 }
     840                 :          0 :                                 break;
     841                 :            : 
     842                 :            : // die Bindung an die Spalte gibt es nicht mehr !!
     843                 :            : //                          case RTF_FLY_COLUMN:
     844                 :            :                             }
     845                 :          0 :                             break;
     846                 :          0 :                     case RTF_COLS:  nCols = sal_uInt16( nTokenValue );      break;
     847                 :          0 :                     case RTF_COLSX: nColSpace = sal_uInt16( nTokenValue );  break;
     848                 :            :                     case RTF_COLNO:
     849                 :          0 :                         nAktCol = sal_uInt16( nTokenValue );
     850 [ #  # ][ #  # ]:          0 :                         if( RTF_COLW == GetNextToken() )
     851                 :            :                         {
     852                 :          0 :                             sal_uInt16 nWidth = sal_uInt16( nTokenValue ), nSpace = 0;
     853 [ #  # ][ #  # ]:          0 :                             if( RTF_COLSR == GetNextToken() )
     854                 :          0 :                                 nSpace = sal_uInt16( nTokenValue );
     855                 :            :                             else
     856         [ #  # ]:          0 :                                 SkipToken( -1 );        // wieder zurueck
     857                 :            : 
     858         [ #  # ]:          0 :                             if( --nAktCol == ( aColumns.size() / 2 ) )
     859                 :            :                             {
     860         [ #  # ]:          0 :                                 aColumns.push_back( nWidth + nSpace );
     861         [ #  # ]:          0 :                                 aColumns.push_back( nSpace );
     862                 :            :                             }
     863                 :            :                         }
     864                 :          0 :                         break;
     865                 :            : 
     866                 :            :                     case '{':
     867 [ #  # ][ #  # ]:          0 :                         if( RTF_BRDBOX == ( nToken = GetNextToken() ) )
     868         [ #  # ]:          0 :                             ReadBorderAttr( nToken, aSet );
     869         [ #  # ]:          0 :                         else if( RTF_SHADINGDEF == (nToken & ~0xff ) )
     870         [ #  # ]:          0 :                             ReadBackgroundAttr( nToken, aSet );
     871         [ #  # ]:          0 :                         else if( RTF_IGNOREFLAG == nToken )
     872                 :            :                         {
     873                 :          0 :                             int bSkipGrp = sal_True;
     874         [ #  # ]:          0 :                             switch( nToken = GetNextToken() )
              [ #  #  # ]
     875                 :            :                             {
     876                 :            :                             case RTF_SHADOW:
     877                 :            :                             case RTF_BRDBOX:
     878 [ #  # ][ #  # ]:          0 :                                 ReadAttr( SkipToken( -2 ), &aSet );
     879                 :          0 :                                 bSkipGrp = sal_False;
     880                 :          0 :                                 break;
     881                 :            : 
     882                 :            :                             case RTF_BRDRT:
     883                 :            :                             case RTF_BRDRB:
     884                 :            :                             case RTF_BRDRR:
     885                 :            :                             case RTF_BRDRL:
     886                 :          0 :                                 bSkipGrp = sal_False;
     887 [ #  # ][ #  # ]:          0 :                                 ReadBorderAttr( SkipToken( -2 ), aSet );
     888                 :          0 :                                 break;
     889                 :            :                             }
     890                 :            : 
     891                 :            :                                 // keine weitere Klammer mehr ueberlesen!!!
     892         [ #  # ]:          0 :                             if( !bSkipGrp )
     893                 :          0 :                                 break;
     894                 :            : 
     895         [ #  # ]:          0 :                             SkipGroup();
     896                 :            :                         }
     897                 :            :                         else
     898         [ #  # ]:          0 :                             SkipGroup();
     899         [ #  # ]:          0 :                         GetNextToken();     // Klammer ueberlesen
     900                 :          0 :                         break;
     901                 :            :                     }
     902                 :          0 :                     } while( IsParserWorking() &&
     903                 :          0 :                                 '}' != ( nToken = GetNextToken() ));
     904                 :            : 
     905 [ #  # ][ #  # ]:          0 :                     if( aUL.GetUpper() || aUL.GetLower() )
                 [ #  # ]
     906         [ #  # ]:          0 :                         pSet->Put( aUL );
     907 [ #  # ][ #  # ]:          0 :                     if( aLR.GetLeft() || aLR.GetRight() )
                 [ #  # ]
     908 [ #  # ][ #  # ]:          0 :                         pSet->Put( aLR );
                 [ #  # ]
     909                 :            :                 }
     910         [ #  # ]:          0 :                 else if( RTF_BRDBOX == nToken )
     911         [ #  # ]:          0 :                     ReadBorderAttr( nToken, aSet );
     912         [ #  # ]:          0 :                 else if( RTF_SHADOW == nToken )
     913 [ #  # ][ #  # ]:          0 :                     ReadAttr( SkipToken( -2 ), &aSet );
     914         [ #  # ]:          0 :                 else if( RTF_SHADINGDEF == (nToken & ~0xff ) )
     915         [ #  # ]:          0 :                     ReadBackgroundAttr( nToken, aSet );
     916         [ #  # ]:          0 :                 else if( RTF_UNKNOWNCONTROL == nToken )
     917         [ #  # ]:          0 :                     SkipGroup();
     918                 :            :                 else
     919                 :          0 :                     nSkip = -2;
     920                 :            : 
     921         [ #  # ]:          0 :                 if( nSkip )
     922                 :            :                 {
     923         [ #  # ]:          0 :                     nToken = SkipToken( nSkip );
     924                 :          0 :                     bWeiter = sal_False;
     925                 :            :                 }
     926                 :            :             }
     927                 :          0 :             break;
     928                 :            : 
     929                 :            :         default:
     930                 :          0 :             --nAppliedProps; //Not sufficient to make a frame
     931                 :          0 :             bWeiter = sal_False;
     932                 :            :         }
     933                 :            : 
     934         [ #  # ]:          0 :         if( bWeiter )
     935         [ #  # ]:          0 :             nToken = GetNextToken();
     936                 :          0 :     } while( bWeiter && IsParserWorking() );
     937                 :            : 
     938         [ #  # ]:          0 :     pSet->Put( aAnchor );
     939         [ #  # ]:          0 :     pSet->Put( aHori );
     940         [ #  # ]:          0 :     pSet->Put( aVert );
     941                 :            : 
     942                 :            :     // #i27767# - set wrapping style influence
     943                 :            :     // #i35017# - constant name has changed
     944                 :            :     pSet->Put( SwFmtWrapInfluenceOnObjPos(
     945 [ #  # ][ #  # ]:          0 :                     text::WrapInfluenceOnPosition::ONCE_SUCCESSIVE ));
                 [ #  # ]
     946                 :            : 
     947         [ #  # ]:          0 :     SwFmtFollowTextFlow aFollowTextFlow( sal_False );
     948         [ #  # ]:          0 :     pSet->Put( aFollowTextFlow );
     949                 :            : 
     950 [ #  # ][ #  # ]:          0 :     if( !( aFrmDir == pSet->Get( RES_FRAMEDIR )) )
                 [ #  # ]
     951         [ #  # ]:          0 :         pSet->Put( aFrmDir );
     952                 :            : 
     953 [ #  # ][ #  # ]:          0 :     if( nCols && USHRT_MAX != nCols )
     954                 :            :     {
     955         [ #  # ]:          0 :         SwFmtCol aCol;
     956         [ #  # ]:          0 :         if( USHRT_MAX == nColSpace )
     957                 :          0 :             nColSpace = 720;
     958                 :            : 
     959                 :          0 :         sal_uLong nWidth = USHRT_MAX;
     960         [ #  # ]:          0 :         aCol.Init( nCols, nColSpace, sal_uInt16( nWidth ) );
     961         [ #  # ]:          0 :         if( nCols == ( aColumns.size() / 2 ) )
     962                 :            :         {
     963         [ #  # ]:          0 :             for( sal_uInt16 n = 0, i = 0; n < aColumns.size(); n += 2, ++i )
     964                 :            :             {
     965         [ #  # ]:          0 :                 SwColumn* pCol = &aCol.GetColumns()[ i ];
     966         [ #  # ]:          0 :                 sal_uLong nTmp = aColumns[ n ];
     967                 :          0 :                 nTmp *= USHRT_MAX;
     968                 :          0 :                 nTmp /= nWidth;
     969                 :          0 :                 pCol->SetWishWidth( sal_uInt16(nTmp) );
     970                 :            :             }
     971                 :            :         }
     972 [ #  # ][ #  # ]:          0 :         pSet->Put( aCol );
     973                 :            :     }
     974                 :            : 
     975         [ #  # ]:          0 :     if( pSet != &aSet )         // wurde der Set uebergeben, dann wars das
     976                 :            :         return ;
     977                 :            : 
     978                 :            :     // ein neues FlyFormat anlegen oder das alte benutzen ?
     979                 :            :     // (teste ob es die selben Attribute besitzt!)
     980                 :          0 :     SwFlySave* pFlySave = 0;
     981                 :          0 :     sal_uInt16 nFlyArrCnt = aFlyArr.size();
     982                 :            :     /*
     983                 :            :     #i5263#
     984                 :            :     There were not enough frame properties found to actually justify creating
     985                 :            :     an absolutely positioned frame.
     986                 :            :     */
     987         [ #  # ]:          0 :     if (nAppliedProps)
     988                 :            :     {
     989 [ #  # ][ #  # ]:          0 :         if( !nFlyArrCnt ||
                 [ #  # ]
     990         [ #  # ]:          0 :             !( pFlySave = aFlyArr[ nFlyArrCnt-1 ])->IsEqualFly( *pPam, aSet ))
     991                 :            :         {
     992 [ #  # ][ #  # ]:          0 :             pFlySave = new SwFlySave( *pPam, aSet );
     993                 :          0 :             Size aPgSize;
     994         [ #  # ]:          0 :             GetPageSize( aPgSize );
     995                 :          0 :             pFlySave->nPageWidth = aPgSize.Width();
     996                 :            : 
     997         [ #  # ]:          0 :             if( nDropCapAnchor )
     998                 :            :             {
     999                 :          0 :                 pFlySave->nDropAnchor = nDropCapAnchor;
    1000                 :          0 :                 pFlySave->nDropLines = nDropCapLines;
    1001                 :            :             }
    1002         [ #  # ]:          0 :             if (nFlyArrCnt >0){
    1003                 :          0 :                 SwFlySave* pFlySavePrev = aFlyArr[nFlyArrCnt-1];
    1004         [ #  # ]:          0 :                 if (pFlySave->nSttNd.GetIndex() < pFlySavePrev->nEndNd.GetIndex())
    1005                 :            :                 {
    1006         [ #  # ]:          0 :                      pFlySavePrev->nEndNd=pFlySave->nSttNd;
    1007                 :            :                 }
    1008                 :            :             }
    1009         [ #  # ]:          0 :             aFlyArr.push_back( pFlySave );
    1010                 :          0 :             nFlyArrCnt++;
    1011                 :            :             // #i83368# - reset
    1012                 :          0 :             mbReadCellWhileReadSwFly = false;
    1013                 :            :         }
    1014                 :            :     }
    1015                 :            : 
    1016                 :          0 :     SetPardTokenRead( sal_False );
    1017         [ #  # ]:          0 :     const SwTableNode* pTblNd = pPam->GetNode()->FindTableNode();
    1018                 :            : 
    1019 [ #  # ][ #  # ]:          0 :     while( !IsPardTokenRead() && IsParserWorking() )
                 [ #  # ]
    1020                 :            :     {
    1021 [ #  # ][ #  # ]:          0 :         if( RTF_PARD == nToken || nNumOpenBrakets > GetOpenBrakets() )
                 [ #  # ]
    1022                 :          0 :             break;
    1023                 :            : 
    1024         [ #  # ]:          0 :         NextToken( nToken );
    1025                 :            : 
    1026         [ #  # ]:          0 :         if( !IsPardTokenRead() )
    1027                 :            :         {
    1028                 :            :             // Added support for transparent frames.
    1029 [ #  # ][ #  # ]:          0 :             if (nToken == RTF_CBPAT && nFlyArrCnt > 0)
    1030                 :            :             {
    1031                 :          0 :                 sal_uInt16 _index=sal_uInt16(nTokenValue);
    1032         [ #  # ]:          0 :                 const Color& rColor = GetColor(_index);
    1033         [ #  # ]:          0 :                 SvxBrushItem aBrush(rColor, RES_BACKGROUND);
    1034                 :          0 :                 SwFlySave* pFS = aFlyArr[nFlyArrCnt-1];
    1035 [ #  # ][ #  # ]:          0 :                 pFS->aFlySet.Put(aBrush, RES_BACKGROUND);
    1036                 :            :             }
    1037                 :            : 
    1038         [ #  # ]:          0 :             nToken = GetNextToken();
    1039                 :            : 
    1040                 :            :             // BUG 22036: kommt zwischen Fly-Attributen ein unbekanntes,
    1041                 :            :             //              dann erzeuge nie 2 FlyFrames, sondern fasse
    1042                 :            :             //              beide zusammen !!!
    1043         [ #  # ]:          0 :             while( RTF_APOCTL == ( nToken & ~(0xff | RTF_SWGDEFS) ))
    1044                 :            :             {
    1045         [ #  # ]:          0 :                 if( RTF_FLY_INPARA == nToken )
    1046                 :          0 :                     break;
    1047                 :            : 
    1048 [ #  # ][ #  # ]:          0 :                 if( RTF_IGNOREFLAG == SkipToken( -1 ) )
    1049                 :            :                 {
    1050 [ #  # ][ #  # ]:          0 :                     if( '{' == SkipToken( -1 ) )
    1051                 :          0 :                         nToken = '{';
    1052                 :            :                     else
    1053         [ #  # ]:          0 :                         SkipToken( 2 );
    1054                 :            :                 }
    1055                 :            :                 else
    1056         [ #  # ]:          0 :                     SkipToken( 1 );
    1057                 :            : 
    1058 [ #  # ][ #  # ]:          0 :                 ReadFly( nToken, pFlySave ? &pFlySave->aFlySet : 0);
    1059         [ #  # ]:          0 :                 nToken = GetNextToken();
    1060                 :            :             }
    1061                 :            :         }
    1062                 :            :     }
    1063                 :            : 
    1064                 :            :     /*
    1065                 :            :     #i5263#
    1066                 :            :     There were enough frame properties found to actually justify creating
    1067                 :            :     an absolutely positioned frame.
    1068                 :            :     */
    1069         [ #  # ]:          0 :     if (!nAppliedProps)
    1070                 :            :     {
    1071                 :          0 :         bReadSwFly = false;
    1072         [ #  # ]:          0 :         SkipToken( -1 );
    1073                 :            :         return;
    1074                 :            :     }
    1075                 :            : 
    1076         [ #  # ]:          0 :     if( pTblNd && !pPam->GetPoint()->nContent.GetIndex() &&
           [ #  #  #  # ]
                 [ #  # ]
    1077                 :          0 :         pTblNd->EndOfSectionIndex() + 1 ==
    1078                 :          0 :             pPam->GetPoint()->nNode.GetIndex() )
    1079                 :            :     {
    1080                 :            :         // nicht mehr in der Tabelle, sondern dahinter ?
    1081                 :            :         // Dann aber wieder zurueck in die Tabelle
    1082         [ #  # ]:          0 :         pPam->Move( fnMoveBackward );
    1083                 :            :     }
    1084                 :            :     else
    1085                 :          0 :         pTblNd = 0;
    1086                 :            : 
    1087                 :            :     // wurde garnichts eingefuegt?
    1088   [ #  #  #  #  :          0 :     if( !pTblNd &&
           #  # ][ #  # ]
    1089                 :          0 :         pPam->GetPoint()->nNode == pFlySave->nSttNd &&
    1090                 :          0 :         !pPam->GetPoint()->nContent.GetIndex() )
    1091                 :            :     {
    1092                 :            :         // dann zerstoere den FlySave wieder.
    1093 [ #  # ][ #  # ]:          0 :         delete aFlyArr[ --nFlyArrCnt ];
    1094 [ #  # ][ #  # ]:          0 :         aFlyArr.erase( aFlyArr.begin() + nFlyArrCnt );
    1095                 :            : 
    1096                 :            :         // Remove the properties that have been parsed before in the paragraph
    1097         [ #  # ]:          0 :         GetAttrStack().pop_back();
    1098                 :            :     }
    1099                 :            :     else
    1100                 :            :     {
    1101                 :          0 :         sal_Bool bMovePaM = 0 != pTblNd;
    1102                 :            : 
    1103         [ #  # ]:          0 :         pFlySave->nEndNd = pPam->GetPoint()->nNode;
    1104                 :          0 :         pFlySave->nEndCnt = pPam->GetPoint()->nContent.GetIndex();
    1105                 :            : 
    1106         [ #  # ]:          0 :         if( bMovePaM )
    1107         [ #  # ]:          0 :             pPam->Move( fnMoveForward );
    1108                 :            : 
    1109         [ #  # ]:          0 :         pTblNd = pFlySave->nSttNd.GetNode().FindTableNode();
    1110 [ #  # ][ #  # ]:          0 :         if( pTblNd && !pFlySave->nEndCnt &&
         [ #  # ][ #  # ]
    1111         [ #  # ]:          0 :             pTblNd == pFlySave->nEndNd.GetNode().FindTableNode() )
    1112                 :            :         {
    1113                 :            :             // dann teste mal, ob das \pard nicht zu spaet kam und
    1114                 :            :             // eigentlich in die vorherige Zelle gehoert
    1115                 :          0 :             const SwStartNode* pSttBoxNd = pFlySave->nSttNd.GetNode().
    1116         [ #  # ]:          0 :                                             FindTableBoxStartNode(),
    1117                 :          0 :                             * pEndBoxNd = pFlySave->nEndNd.GetNode().
    1118         [ #  # ]:          0 :                                             FindTableBoxStartNode();
    1119 [ #  # ][ #  # ]:          0 :             if( pSttBoxNd && pEndBoxNd &&
                 [ #  # ]
           [ #  #  #  # ]
                 [ #  # ]
    1120                 :            :                 bMovePaM ? ( pSttBoxNd == pEndBoxNd )
    1121                 :          0 :                          : ( pSttBoxNd->EndOfSectionIndex() + 1 ==
    1122                 :          0 :                                 pEndBoxNd->GetIndex() &&
    1123                 :          0 :                                 pEndBoxNd->GetIndex() + 1 ==
    1124                 :          0 :                                 pFlySave->nEndNd.GetIndex() ))
    1125                 :            :             {
    1126                 :            :                 // dann gehoert das Ende in die vorherige Box!
    1127         [ #  # ]:          0 :                 SwPosition aPos( *pPam->GetPoint() );
    1128         [ #  # ]:          0 :                 pPam->GetPoint()->nNode = *pSttBoxNd->EndOfSectionNode();
    1129         [ #  # ]:          0 :                 pPam->Move( fnMoveBackward, fnGoNode );
    1130                 :            : 
    1131         [ #  # ]:          0 :                 DelLastNode();
    1132                 :            : 
    1133         [ #  # ]:          0 :                 pPam->GetPoint()->nNode = *pSttBoxNd->EndOfSectionNode();
    1134         [ #  # ]:          0 :                 pPam->Move( fnMoveBackward, fnGoNode );
    1135                 :            : 
    1136         [ #  # ]:          0 :                 pFlySave->nEndNd = pPam->GetPoint()->nNode;
    1137                 :          0 :                 pFlySave->nEndCnt = pPam->GetPoint()->nContent.GetIndex();
    1138                 :            : 
    1139 [ #  # ][ #  # ]:          0 :                 *pPam->GetPoint() = aPos;
    1140                 :            :             }
    1141                 :            :         }
    1142 [ #  # ][ #  #  :          0 :         else if( !bReadSwFly && !pFlySave->nEndCnt &&
             #  #  #  # ]
                 [ #  # ]
    1143                 :          0 :             pFlySave->nSttNd.GetIndex() + 1 == pFlySave->nEndNd.GetIndex() &&
    1144                 :          0 :             pFlySave->nSttNd.GetNode().IsTxtNode() )
    1145                 :            :         {
    1146                 :            : 
    1147                 :          0 :             SwTxtNode* pTxtNd = pFlySave->nSttNd.GetNode().GetTxtNode();
    1148                 :          0 :             SwTxtFlyCnt* pFlyCnt = 0;
    1149         [ #  # ]:          0 :             if( 1 == pTxtNd->GetTxt().Len() &&
           [ #  #  #  # ]
         [ #  # ][ #  # ]
    1150                 :            :                 0 != (pFlyCnt = static_cast<SwTxtFlyCnt*>(
    1151                 :            :                         pTxtNd->GetTxtAttrForCharAt(0, RES_TXTATR_FLYCNT))) &&
    1152                 :          0 :                 pFlyCnt->GetFlyCnt().GetFrmFmt() )
    1153                 :            :             {
    1154                 :            :                 // then move the content into the surrounded fly
    1155                 :          0 :                 SwFrmFmt* pFlyFmt = pFlyCnt->GetFlyCnt().GetFrmFmt();
    1156         [ #  # ]:          0 :                 const SwNodeIndex* pFlySNd = pFlyFmt->GetCntnt().GetCntntIdx();
    1157                 :            :                 SwNodeRange aRg( *pFlySNd, 1,
    1158 [ #  # ][ #  # ]:          0 :                                  *pFlySNd->GetNode().EndOfSectionNode(), 0 );
                 [ #  # ]
    1159                 :            : 
    1160                 :            :                 // merge the itemsets
    1161                 :          0 :                 SwFmtFrmSize aSz1( (SwFmtFrmSize&)pFlyFmt->GetAttrSet().
    1162 [ #  # ][ #  # ]:          0 :                                                 Get( RES_FRM_SIZE ));
    1163                 :            :                 SwFmtFrmSize aSz2( (SwFmtFrmSize&)pFlySave->aFlySet.
    1164 [ #  # ][ #  # ]:          0 :                                                 Get( RES_FRM_SIZE ));
    1165                 :            :                 // if
    1166   [ #  #  #  #  :          0 :                 if( !aRg.aStart.GetNode().IsNoTxtNode() ||
          #  #  #  #  #  
             #  #  #  #  
              # ][ #  # ]
    1167                 :          0 :                     !aSz1.GetHeight() || !aSz1.GetWidth() ||
    1168                 :          0 :                     !aSz2.GetHeight() || !aSz2.GetWidth() ||
    1169                 :          0 :                     ( aSz1.GetHeight() == aSz2.GetHeight() &&
    1170                 :          0 :                       aSz1.GetWidth() == aSz2.GetWidth() ) )
    1171                 :            :                 {
    1172         [ #  # ]:          0 :                     SfxItemSet aDiffs( pFlyFmt->GetAttrSet() );
    1173         [ #  # ]:          0 :                     aDiffs.ClearItem( RES_ANCHOR );
    1174         [ #  # ]:          0 :                     aDiffs.ClearItem( RES_FRM_SIZE );
    1175         [ #  # ]:          0 :                     aDiffs.ClearItem( RES_CNTNT );
    1176         [ #  # ]:          0 :                     aDiffs.Differentiate( pFlySave->aFlySet );
    1177         [ #  # ]:          0 :                     pFlySave->aFlySet.Put( aDiffs );
    1178                 :            : 
    1179                 :          0 :                     sal_Bool bSet = sal_False;
    1180 [ #  # ][ #  # ]:          0 :                     if( aSz1.GetHeight() && !aSz2.GetHeight() )
                 [ #  # ]
    1181                 :            :                     {
    1182                 :          0 :                         bSet = sal_True;
    1183                 :          0 :                         aSz2.SetHeight( aSz1.GetHeight() );
    1184                 :            :                     }
    1185 [ #  # ][ #  # ]:          0 :                     if( aSz1.GetWidth() && !aSz2.GetWidth() )
                 [ #  # ]
    1186                 :            :                     {
    1187                 :          0 :                         bSet = sal_True;
    1188                 :          0 :                         aSz2.SetWidth( aSz1.GetWidth() );
    1189                 :            :                     }
    1190         [ #  # ]:          0 :                     if( bSet )
    1191         [ #  # ]:          0 :                         pFlySave->aFlySet.Put( aSz2 );
    1192                 :            : 
    1193                 :            :                     // move any PageBreak/Desc Attr to the next Para
    1194                 :            :                     {
    1195                 :          0 :                         SwCntntNode* pSrcNd = pFlySave->nSttNd.GetNode().GetCntntNode();
    1196                 :          0 :                         SwCntntNode* pDstNd = pFlySave->nEndNd.GetNode().GetCntntNode();
    1197                 :            : 
    1198         [ #  # ]:          0 :                         ::lcl_CpyBreakAttrs( pSrcNd, pDstNd, &pFlySave->nEndNd );
    1199                 :            :                     }
    1200                 :            : 
    1201                 :            :                     // create new txtnode, because the section does never be empty
    1202         [ #  # ]:          0 :                     pDoc->GetNodes().MakeTxtNode( aRg.aStart,
    1203         [ #  # ]:          0 :                                 (SwTxtFmtColl*)pDoc->GetDfltTxtFmtColl() );
    1204                 :            : 
    1205         [ #  # ]:          0 :                     SwNodeIndex aTmp( pFlySave->nSttNd, +1 );
    1206                 :            :                     pDoc->MoveNodeRange( aRg, aTmp,
    1207         [ #  # ]:          0 :                             IDocumentContentOperations::DOC_MOVEDEFAULT );
    1208                 :            : 
    1209                 :            :                     // now delete the redundant txtnode
    1210 [ #  # ][ #  # ]:          0 :                     pDoc->GetNodes().Delete( pFlySave->nSttNd, 1 );
         [ #  # ][ #  # ]
    1211 [ #  # ][ #  # ]:          0 :                 }
                 [ #  # ]
    1212                 :            :             }
    1213                 :            :         }
    1214                 :            :     }
    1215                 :            : 
    1216                 :          0 :     bReadSwFly = false;
    1217 [ #  # ][ #  # ]:          0 :     SkipToken( -1 );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1218                 :            : }
    1219                 :            : 
    1220                 :            : 
    1221                 :          0 : void SwRTFParser::InsPicture( const String& rGrfNm, const Graphic* pGrf,
    1222                 :            :                                 const SvxRTFPictureType* pPicType )
    1223                 :            : {
    1224                 :            :     // kennzeichen fuer Swg-Dokumente:
    1225                 :            :     // (dann ist das FlyFmt fuer die Grafik!)
    1226                 :            :     SwGrfNode * pGrfNd;
    1227                 :            :     // #i83368# - Assure that graphic node is enclosed by fly frame node.
    1228 [ #  # ][ #  # ]:          0 :     if ( bReadSwFly && !mbReadCellWhileReadSwFly )
    1229                 :            :     {
    1230                 :            :         OSL_ENSURE(!aFlyArr.empty(),
    1231                 :            :             "SwRTFParser::InsPicture: fly array empty.");
    1232         [ #  # ]:          0 :         if (!aFlyArr.empty())
    1233                 :            :         {
    1234                 :            :         // erzeuge nur einen normalen GrafikNode und ersetze diesen gegen
    1235                 :            :         // den vorhandenen Textnode
    1236                 :          0 :         SwNodeIndex& rIdx = pPam->GetPoint()->nNode;
    1237                 :          0 :         pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx,
    1238                 :            :                     rGrfNm, aEmptyStr,    // Name der Graphic !!
    1239                 :            :                     pGrf,
    1240                 :          0 :                     (SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl() );
    1241                 :            : 
    1242         [ #  # ]:          0 :         if( pGrfAttrSet )
    1243                 :          0 :             pGrfNd->SetAttr( *pGrfAttrSet );
    1244                 :            : 
    1245                 :          0 :         SwFlySave* pFlySave = aFlyArr[ aFlyArr.size()-1 ];
    1246                 :          0 :         pFlySave->nSttNd = rIdx.GetIndex() - 1;
    1247                 :            : 
    1248         [ #  # ]:          0 :         if( 1 < aFlyArr.size() )
    1249                 :            :         {
    1250                 :          0 :             pFlySave = aFlyArr[ aFlyArr.size() - 2 ];
    1251         [ #  # ]:          0 :             if( pFlySave->nEndNd == rIdx )
    1252                 :          0 :                 pFlySave->nEndNd = rIdx.GetIndex() - 1;
    1253                 :            :         }
    1254                 :          0 :         }
    1255                 :            :     }
    1256                 :            :     else
    1257                 :            :     {
    1258                 :            :         // wenn normale RTF-Grafik, dann steht diese im Textfluss !
    1259         [ #  # ]:          0 :         SwAttrSet aFlySet( pDoc->GetAttrPool(), RES_OPAQUE, RES_ANCHOR );
    1260                 :          0 :         const SwPosition* pPos = pPam->GetPoint();
    1261                 :            : 
    1262         [ #  # ]:          0 :         SwFmtAnchor aAnchor( FLY_AS_CHAR );
    1263         [ #  # ]:          0 :         aAnchor.SetAnchor( pPos );
    1264         [ #  # ]:          0 :         aFlySet.Put( aAnchor );
    1265 [ #  # ][ #  # ]:          0 :         aFlySet.Put( SwFmtVertOrient( 0, text::VertOrientation::TOP ));
                 [ #  # ]
    1266                 :            : 
    1267 [ #  # ][ #  # ]:          0 :         if (pDoc->IsInHeaderFooter(pPos->nNode))
    1268                 :            :         {
    1269         [ #  # ]:          0 :             SvxOpaqueItem aOpaqueItem(RES_OPAQUE, sal_False);
    1270         [ #  # ]:          0 :             SwFmtSurround aSurroundItem(SURROUND_THROUGHT);
    1271         [ #  # ]:          0 :             aFlySet.Put(aOpaqueItem);
    1272 [ #  # ][ #  # ]:          0 :             aFlySet.Put(aSurroundItem);
                 [ #  # ]
    1273                 :            :         }
    1274                 :            : 
    1275                 :            :         SwFlyFrmFmt* pFlyFmt = pDoc->Insert( *pPam,
    1276                 :            :                     rGrfNm, aEmptyStr,      // Name der Graphic !!
    1277                 :            :                     pGrf,
    1278                 :            :                     &aFlySet,               // Attribute fuer den FlyFrm
    1279         [ #  # ]:          0 :                     pGrfAttrSet, NULL );            // Attribute fuer die Grafik
    1280                 :            : 
    1281   [ #  #  #  # ]:          0 :         pGrfNd = pDoc->GetNodes()[ pFlyFmt->GetCntnt().GetCntntIdx()->
    1282         [ #  # ]:          0 :                                             GetIndex()+1 ]->GetGrfNode();
    1283                 :            : 
    1284                 :            :         _SetPictureSize( *pGrfNd, pPos->nNode,
    1285                 :          0 :                         (SfxItemSet&)pFlyFmt->GetAttrSet(),
    1286         [ #  # ]:          0 :                         pPicType );
    1287         [ #  # ]:          0 :         if( pPicType )
    1288                 :            :         {
    1289                 :          0 :             PictPropertyNameValuePairs::const_iterator aIt = pPicType->aPropertyPairs.begin();
    1290                 :          0 :             PictPropertyNameValuePairs::const_iterator aEnd = pPicType->aPropertyPairs.end();
    1291 [ #  # ][ #  # ]:          0 :             while( aIt != aEnd)
    1292                 :            :             {
    1293         [ #  # ]:          0 :                 if( aIt->first == "wzDescription" )
    1294                 :            :                 {
    1295         [ #  # ]:          0 :                     SwXFrame::GetOrCreateSdrObject( pFlyFmt );
    1296 [ #  # ][ #  # ]:          0 :                     pDoc->SetFlyFrmDescription( *(pFlyFmt), aIt->second );
                 [ #  # ]
    1297                 :            :                 }
    1298         [ #  # ]:          0 :                 else if( aIt->first == "wzName" )
    1299                 :            :                 {
    1300         [ #  # ]:          0 :                     SwXFrame::GetOrCreateSdrObject( pFlyFmt );
    1301 [ #  # ][ #  # ]:          0 :                     pDoc->SetFlyFrmTitle( *(pFlyFmt), aIt->second );
                 [ #  # ]
    1302                 :            :                 }
    1303                 :          0 :                 ++aIt;
    1304                 :            :             }
    1305 [ #  # ][ #  # ]:          0 :         }
    1306                 :            : 
    1307                 :            :     }
    1308                 :            : 
    1309         [ #  # ]:          0 :     if( pGrfAttrSet )
    1310         [ #  # ]:          0 :         DELETEZ( pGrfAttrSet );
    1311                 :          0 : }
    1312                 :            : 
    1313                 :          0 : void SwRTFParser::_SetPictureSize( const SwNoTxtNode& rNd,
    1314                 :            :                                     const SwNodeIndex& rAnchor,
    1315                 :            :                                     SfxItemSet& rSet,
    1316                 :            :                                     const SvxRTFPictureType* pPicType )
    1317                 :            : {
    1318         [ #  # ]:          0 :     Size aSize( ((SwNoTxtNode&)rNd).GetTwipSize() );
    1319         [ #  # ]:          0 :     if( pPicType )
    1320                 :            :     {
    1321         [ #  # ]:          0 :         if( rNd.IsGrfNode() )
    1322                 :            :         {
    1323 [ #  # ][ #  # ]:          0 :             if( SvxRTFPictureType::WIN_METAFILE != pPicType->eStyle &&
                 [ #  # ]
    1324                 :            :                 pPicType->nGoalWidth && pPicType->nGoalHeight )
    1325                 :            :             {
    1326                 :          0 :                 aSize.Width() = pPicType->nGoalWidth;
    1327                 :          0 :                 aSize.Height() =pPicType->nGoalHeight;
    1328                 :            :             }
    1329         [ #  # ]:          0 :             else if( SvxRTFPictureType::MAC_QUICKDRAW == pPicType->eStyle )
    1330                 :            :             {
    1331                 :            :                 // IMMER auf 72 DPI bezogen, also 1pt == 20 Twip !!
    1332                 :          0 :                 aSize.Width() = pPicType->nWidth * 20;
    1333                 :          0 :                 aSize.Height() = pPicType->nHeight * 20;
    1334                 :            :             }
    1335                 :            :             else
    1336                 :            :             {
    1337                 :            :                 // von 100TH_MM nach TWIP umrechenen!
    1338                 :            :                 // When \picwgoal resp \pichgoal are present, then use them.
    1339                 :            :                 //          The values of \picwgoal and \picwgoal are already given in twips.
    1340         [ #  # ]:          0 :                 aSize.Width() = (pPicType->nGoalWidth?pPicType->nGoalWidth:(pPicType->nWidth*144)/254);
    1341         [ #  # ]:          0 :                 aSize.Height() = (pPicType->nGoalHeight?pPicType->nGoalHeight:(pPicType->nHeight*144)/254);
    1342                 :            :             }
    1343         [ #  # ]:          0 :             ((SwGrfNode&)rNd).SetTwipSize( aSize );
    1344                 :            :         }
    1345                 :            : 
    1346         [ #  # ]:          0 :         if( 100 != pPicType->nScalX )
    1347                 :          0 :             aSize.Width() = (((long)pPicType->nScalX) * ( aSize.Width() -
    1348                 :          0 :                         ( pPicType->nCropL + pPicType->nCropR ))) / 100L;
    1349                 :            : 
    1350         [ #  # ]:          0 :         if( 100 != pPicType->nScalY )
    1351                 :          0 :             aSize.Height() = (((long)pPicType->nScalY) * ( aSize.Height() -
    1352                 :          0 :                         ( pPicType->nCropT + pPicType->nCropB ))) / 100L;
    1353                 :            :     }
    1354                 :            : 
    1355                 :            :     //steht der Fly etwa in einer Tabelle ?
    1356                 :          0 :     const SwNode* pAnchorNd = & rAnchor.GetNode();
    1357         [ #  # ]:          0 :     const SwTableNode* pTblNd = pAnchorNd->FindTableNode();
    1358         [ #  # ]:          0 :     if( pTblNd )
    1359                 :            :     {
    1360                 :            :         // Box feststellen:
    1361                 :          0 :         const SwTableBox* pBox = pTblNd->GetTable().GetTblBox(
    1362         [ #  # ]:          0 :                                 pAnchorNd->StartOfSectionIndex() );
    1363         [ #  # ]:          0 :         if( pBox )
    1364                 :            :         {
    1365         [ #  # ]:          0 :             long nBoxWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth();
    1366         [ #  # ]:          0 :             if( aSize.Width() > nBoxWidth )
    1367                 :          0 :                 aSize.Width() = nBoxWidth;
    1368                 :            :         }
    1369                 :            :     }
    1370                 :            : 
    1371                 :            :     // if no size exist, then the size is set by the swapin of the graphic.
    1372                 :            :     SwGrfNode* pGrfNd;
    1373 [ #  # ][ #  # ]:          0 :     if( !aSize.Width() && !aSize.Height() &&
           [ #  #  #  # ]
                 [ #  # ]
    1374                 :          0 :         0 != (pGrfNd = (SwGrfNode*)rNd.GetGrfNode() ) && pGrfNd->IsGrfLink() )
    1375                 :          0 :         pGrfNd->SetChgTwipSize( sal_True );
    1376                 :            : 
    1377                 :            :         // min. Werte einhalten !!
    1378         [ #  # ]:          0 :     if( aSize.Width() < MINFLY )
    1379                 :          0 :         aSize.Width() = MINFLY;
    1380         [ #  # ]:          0 :     if( aSize.Height() < MINFLY)
    1381                 :          0 :         aSize.Height() = MINFLY;
    1382                 :            : 
    1383         [ #  # ]:          0 :     if( pPicType )
    1384                 :            :     {
    1385                 :          0 :         sal_Bool bChg = sal_False;
    1386         [ #  # ]:          0 :         SwCropGrf aCrop;
    1387                 :            : 
    1388         [ #  # ]:          0 :         if( pPicType->nCropT )
    1389                 :            :         {
    1390                 :          0 :             aCrop.SetTop( pPicType->nCropT );
    1391                 :          0 :             bChg = sal_True;
    1392                 :            :         }
    1393         [ #  # ]:          0 :         if( pPicType->nCropB )
    1394                 :            :         {
    1395                 :          0 :             aCrop.SetBottom( pPicType->nCropB );
    1396                 :          0 :             bChg = sal_True;
    1397                 :            :         }
    1398         [ #  # ]:          0 :         if( pPicType->nCropL )
    1399                 :            :         {
    1400                 :          0 :             aCrop.SetLeft( pPicType->nCropL );
    1401                 :          0 :             bChg = sal_True;
    1402                 :            :         }
    1403         [ #  # ]:          0 :         if( pPicType->nCropR )
    1404                 :            :         {
    1405                 :          0 :             aCrop.SetRight( pPicType->nCropR );
    1406                 :          0 :             bChg = sal_True;
    1407                 :            :         }
    1408                 :            : 
    1409         [ #  # ]:          0 :         if( bChg )
    1410                 :            :         {
    1411                 :            :             // dann mal an die CropWerte an die GrafikSize anpassen.
    1412         [ #  # ]:          0 :             ((SwNoTxtNode&)rNd).SetAttr( aCrop );
    1413         [ #  # ]:          0 :         }
    1414                 :            :     }
    1415 [ #  # ][ #  # ]:          0 :     rSet.Put( SwFmtFrmSize( ATT_FIX_SIZE, aSize.Width(), aSize.Height() ));
                 [ #  # ]
    1416                 :          0 : }
    1417                 :            : 
    1418                 :          0 : void SwRTFParser::GetPageSize( Size& rSize )
    1419                 :            : {
    1420                 :            :     OSL_ENSURE(!maSegments.empty(), "not possible");
    1421         [ #  # ]:          0 :     if (maSegments.empty())
    1422                 :            :     {
    1423                 :          0 :         rSize.Width() = 12240 - 1800 - 1800;
    1424                 :          0 :         rSize.Height() = 15840 - 1440 - 1440;
    1425                 :          0 :         return;
    1426                 :            :     }
    1427                 :            : 
    1428                 :          0 :     const rtfSection &rSect = maSegments.back();
    1429                 :            : 
    1430                 :          0 :     rSize.Width() = rSect.maPageInfo.mnPgwsxn - rSect.maPageInfo.mnMarglsxn - rSect.maPageInfo.mnMargrsxn;
    1431                 :          0 :     rSize.Height() = rSect.maPageInfo.mnPghsxn - rSect.maPageInfo.mnMargtsxn - rSect.maPageInfo.mnMargbsxn;
    1432                 :            : 
    1433                 :          0 :     long nCols = rSect.NoCols();
    1434         [ #  # ]:          0 :     if (1 < nCols)
    1435                 :            :     {
    1436                 :          0 :         rSize.Width() /= nCols;
    1437                 :          0 :         rSize.Height() /= nCols;
    1438                 :            :     }
    1439                 :            : }
    1440                 :            : 
    1441                 :          0 : void SwRTFParser::ReadBitmapData()
    1442                 :            : {
    1443         [ #  # ]:          0 :     Graphic aGrf;
    1444         [ #  # ]:          0 :     SvxRTFPictureType aPicType;
    1445 [ #  # ][ #  # ]:          0 :     if( ReadBmpData( aGrf, aPicType ) )
    1446 [ #  # ][ #  # ]:          0 :         InsPicture( aEmptyStr, &aGrf, &aPicType );
    1447                 :          0 : }
    1448                 :            : 
    1449                 :            : #ifdef READ_OLE_OBJECT
    1450                 :            : void SwRTFParser::ReadOLEData()
    1451                 :            : {
    1452                 :            :     SvCacheStream aTmpFile( 0xA000 );
    1453                 :            :     Graphic aGrf;
    1454                 :            :     SvxRTFPictureType aPicType, aOleType;
    1455                 :            : 
    1456                 :            :     int nToken, bValidOle = sal_True, bWeiter = sal_True;
    1457                 :            :     int nOpenBrakets = 1;       // die erste wurde schon vorher erkannt !!
    1458                 :            : 
    1459                 :            :     String* pStr = 0;
    1460                 :            :     String sObjClass, sObjName, sObjData;
    1461                 :            : 
    1462                 :            :     while( nOpenBrakets && IsParserWorking() && bWeiter && bValidOle )
    1463                 :            :     {
    1464                 :            :         nToken = GetNextToken();
    1465                 :            :         sal_uInt16 nVal = sal_uInt16( nTokenValue );
    1466                 :            :         switch( nToken )
    1467                 :            :         {
    1468                 :            :         case '}':       --nOpenBrakets; pStr = 0; break;
    1469                 :            :         case '{':
    1470                 :            :             {
    1471                 :            :                 if( RTF_IGNOREFLAG != GetNextToken() )
    1472                 :            :                     nToken = SkipToken( -1 );
    1473                 :            :                 else if( RTF_UNKNOWNCONTROL != GetNextToken() )
    1474                 :            :                     nToken = SkipToken( -2 );
    1475                 :            :                 else
    1476                 :            :                 {
    1477                 :            :                     // gleich herausfiltern
    1478                 :            :                     ReadUnknownData();
    1479                 :            :                     nToken = GetNextToken();
    1480                 :            :                     if( '}' != nToken )
    1481                 :            :                         eState = SVPAR_ERROR;
    1482                 :            :                     break;
    1483                 :            :                 }
    1484                 :            :                 ++nOpenBrakets;
    1485                 :            :             }
    1486                 :            :             break;
    1487                 :            : 
    1488                 :            :         case RTF_OBJECT:
    1489                 :            :         case RTF_OBJEMB:        // default ist embedded
    1490                 :            :         case RTF_LINKSELF:      // ??
    1491                 :            :         case RTF_OBJLOCK:       // ??
    1492                 :            :         case RTF_OBJUPDATE:     // ??
    1493                 :            :         case RTF_OBJTIME:       // ??
    1494                 :            :         case RTF_OBJSETSIZE:
    1495                 :            :         case RTF_OBJALIGN:
    1496                 :            :         case RTF_OBJTRANSY:
    1497                 :            :         case RTF_OBJATTPH:
    1498                 :            :             break;
    1499                 :            : 
    1500                 :            :         case RTF_OBJLINK:       // ?? welche Daten sind das ??
    1501                 :            :         case RTF_OBJAUTLINK:    // ??       -""-            ??
    1502                 :            :         case RTF_OBJSUB:
    1503                 :            :         case RTF_OBJPUB:
    1504                 :            :         case RTF_OBJICEMB:
    1505                 :            :         case RTF_OBJOCX:
    1506                 :            :         case RTF_OBJHTML:
    1507                 :            :         case RTF_OBJALIAS:
    1508                 :            :         case RTF_OBJSECT:
    1509                 :            :             bValidOle = sal_False;      // diese Typen koennen wir nicht
    1510                 :            :             break;
    1511                 :            : 
    1512                 :            :         case RTF_OBJCLASS:
    1513                 :            :             // Daten lesen
    1514                 :            :             pStr = &sObjClass;
    1515                 :            :             break;
    1516                 :            : 
    1517                 :            :         case RTF_OBJNAME:
    1518                 :            :             // Daten lesen
    1519                 :            :             pStr = &sObjName;
    1520                 :            :             break;
    1521                 :            : 
    1522                 :            :         case RTF_OBJDATA:
    1523                 :            :             pStr = &sObjData;
    1524                 :            :             break;
    1525                 :            : 
    1526                 :            :         case RTF_RESULT:
    1527                 :            :             {
    1528                 :            :                 // hier weitermachen, wenn das OLE-Object ungueltig ist
    1529                 :            :                 bWeiter = sal_False;
    1530                 :            :             }
    1531                 :            :             break;
    1532                 :            :         case RTF_RSLTBMP:           // diese sollten wir ignorieren
    1533                 :            :         case RTF_RSLTMERGE:
    1534                 :            :         case RTF_RSLTPICT:
    1535                 :            :         case RTF_RSLTRTF:
    1536                 :            :         case RTF_RSLTTXT:
    1537                 :            :             break;
    1538                 :            : 
    1539                 :            :         case RTF_OBJW:          aOleType.nWidth = nVal; break;
    1540                 :            :         case RTF_OBJH:          aOleType.nHeight = nVal; break;
    1541                 :            :         case RTF_OBJCROPT:      aOleType.nCropT = (short)nTokenValue; break;
    1542                 :            :         case RTF_OBJCROPB:      aOleType.nCropB = (short)nTokenValue; break;
    1543                 :            :         case RTF_OBJCROPL:      aOleType.nCropL = (short)nTokenValue; break;
    1544                 :            :         case RTF_OBJCROPR:      aOleType.nCropR = (short)nTokenValue; break;
    1545                 :            :         case RTF_OBJSCALEX:     aOleType.nScalX = nVal; break;
    1546                 :            :         case RTF_OBJSCALEY:     aOleType.nScalY = nVal; break;
    1547                 :            : 
    1548                 :            :         case RTF_TEXTTOKEN:
    1549                 :            :             if( 1 < nOpenBrakets && pStr )
    1550                 :            :             {
    1551                 :            :                 if( pStr == &sObjData )
    1552                 :            :                 {
    1553                 :            :                     xub_StrLen nHexLen = HexToBin( aToken );
    1554                 :            :                     if( STRING_NOTFOUND != nHexLen )
    1555                 :            :                         bValidOle = sal_False;
    1556                 :            :                     else
    1557                 :            :                     {
    1558                 :            :                         aTmpFile.Write( (sal_Char*)aToken.GetBuffer(), nHexLen );
    1559                 :            :                         bValidOle = 0 == aTmpFile.GetError();
    1560                 :            :                     }
    1561                 :            :                 }
    1562                 :            :                 else
    1563                 :            :                     *pStr += aToken;
    1564                 :            :             }
    1565                 :            :             break;
    1566                 :            :         }
    1567                 :            :     }
    1568                 :            : 
    1569                 :            :     if( bValidOle )
    1570                 :            :     {
    1571                 :            :         bValidOle = sal_False;      // erstmal
    1572                 :            :     }
    1573                 :            : 
    1574                 :            :     if( !bWeiter )      // dann stehen wir noch im Result
    1575                 :            :     {
    1576                 :            :         // ist das Ole-Object Ok?
    1577                 :            :         // -> dann solange SkipGroup rufen, bis zur letzten
    1578                 :            :         //      schliessenden Klammer
    1579                 :            :         // ansonsten alle Token verarbeiten, bis zur letzten
    1580                 :            :         //      schliessenden Klammer
    1581                 :            : 
    1582                 :            :         bWeiter = sal_True;
    1583                 :            :         while( nOpenBrakets && IsParserWorking() && bWeiter )
    1584                 :            :         {
    1585                 :            :             switch( nToken = GetNextToken() )
    1586                 :            :             {
    1587                 :            :             case '}':       --nOpenBrakets; break;
    1588                 :            :             case '{':       ++nOpenBrakets;  break;
    1589                 :            :             }
    1590                 :            :             if( nOpenBrakets && !bValidOle )
    1591                 :            :                 NextToken( nToken );
    1592                 :            :         }
    1593                 :            :     }
    1594                 :            : 
    1595                 :            :     if( !bValidOle && '}' != nToken )
    1596                 :            :         SkipGroup();
    1597                 :            : 
    1598                 :            :     SkipToken( -1 );        // die schliesende Klammer wird "oben" ausgewertet
    1599                 :            : }
    1600                 :            : #endif
    1601                 :            : 
    1602                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10