LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/layout - atrfrm.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1105 1559 70.9 %
Date: 2013-07-09 Functions: 187 227 82.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/text/WrapTextMode.hpp>
      21             : #include <com/sun/star/text/TextContentAnchorType.hpp>
      22             : #include <com/sun/star/container/XIndexContainer.hpp>
      23             : #include <com/sun/star/text/TextGridMode.hpp>
      24             : #include <svtools/unoimap.hxx>
      25             : #include <svtools/imap.hxx>
      26             : #include <svtools/imapobj.hxx>
      27             : #include <unosett.hxx>
      28             : #include <unostyle.hxx>
      29             : #include <fmtclds.hxx>
      30             : #include <fmtornt.hxx>
      31             : #include <fmthdft.hxx>
      32             : #include <fmtpdsc.hxx>
      33             : #include <fmtcntnt.hxx>
      34             : #include <fmtfsize.hxx>
      35             : #include <fmtfordr.hxx>
      36             : #include <fmtsrnd.hxx>
      37             : #include <fmtlsplt.hxx>
      38             : #include <fmtrowsplt.hxx>
      39             : #include <fmtftntx.hxx>
      40             : #include <fmteiro.hxx>
      41             : #include <fmturl.hxx>
      42             : #include <fmtcnct.hxx>
      43             : #include <section.hxx>
      44             : #include <fmtline.hxx>
      45             : #include <tgrditem.hxx>
      46             : #include <hfspacingitem.hxx>
      47             : #include <IDocumentUndoRedo.hxx>
      48             : #include <pagefrm.hxx>
      49             : #include <rootfrm.hxx>
      50             : #include <cntfrm.hxx>
      51             : #include <crsrsh.hxx>
      52             : #include <dflyobj.hxx>
      53             : #include <dcontact.hxx>
      54             : #include <frmtool.hxx>
      55             : #include <flyfrms.hxx>
      56             : #include <pagedesc.hxx>
      57             : #include <grfatr.hxx>
      58             : #include <ndnotxt.hxx>
      59             : #include <docary.hxx>
      60             : #include <node2lay.hxx>
      61             : #include <fmtclbl.hxx>
      62             : #include <swunohelper.hxx>
      63             : #include <unoframe.hxx>
      64             : #include <unotextbodyhf.hxx>
      65             : #include <SwStyleNameMapper.hxx>
      66             : #include <editeng/brushitem.hxx>
      67             : #include <svtools/grfmgr.hxx>
      68             : #include <unomid.h>
      69             : #include <comcore.hrc>
      70             : #include <svx/svdundo.hxx> // #111827#
      71             : #include <sortedobjs.hxx>
      72             : #include <HandleAnchorNodeChg.hxx>
      73             : #include <switerator.hxx>
      74             : #include <pagedeschint.hxx>
      75             : #ifndef NDEBUG
      76             : #include <ndtxt.hxx>
      77             : #endif
      78             : 
      79             : using namespace ::com::sun::star;
      80             : 
      81        3367 : TYPEINIT1(SwFmtVertOrient, SfxPoolItem);
      82        3243 : TYPEINIT1(SwFmtHoriOrient, SfxPoolItem);
      83       11004 : TYPEINIT2(SwFmtHeader,  SfxPoolItem, SwClient );
      84       10581 : TYPEINIT2(SwFmtFooter,  SfxPoolItem, SwClient );
      85       10614 : TYPEINIT2(SwFmtPageDesc,  SfxPoolItem, SwClient );
      86        6198 : TYPEINIT1_AUTOFACTORY(SwFmtLineNumber, SfxPoolItem);
      87             : 
      88         326 : static sal_Int16 lcl_IntToRelation(const uno::Any& rVal)
      89             : {
      90         326 :     sal_Int16 nVal = text::RelOrientation::FRAME;
      91         326 :     if (!(rVal >>= nVal))
      92             :         SAL_WARN("sw.core", "lcl_IntToRelation: read from Any failed!");
      93         326 :     return nVal;
      94             : }
      95             : 
      96         936 : void DelHFFormat( SwClient *pToRemove, SwFrmFmt *pFmt )
      97             : {
      98             :     //If the client is the last one who uses this format, then we have to delete
      99             :     //it - before this is done, we may need to delete the content-section.
     100         936 :     SwDoc* pDoc = pFmt->GetDoc();
     101         936 :     pFmt->Remove( pToRemove );
     102         936 :     if( pDoc->IsInDtor() )
     103             :     {
     104         173 :         delete pFmt;
     105        1109 :         return;
     106             :     }
     107             : 
     108             :     // Anything other than frames registered?
     109         763 :     bool bDel = true;
     110             :     {
     111             :         // nested scope because DTOR of SwClientIter resets the flag bTreeChg.
     112             :         // It's suboptimal if the format is deleted beforehand.
     113         763 :         SwClientIter aIter( *pFmt );        // TODO
     114         763 :         SwClient *pLast = aIter.GoStart();
     115         763 :         if( pLast )
     116         508 :             do {
     117         508 :                 bDel = pLast->IsA( TYPE(SwFrm) )
     118         508 :                     || SwXHeadFootText::IsXHeadFootText(pLast);
     119        1271 :             } while( bDel && 0 != ( pLast = ++aIter ));
     120             :     }
     121             : 
     122         763 :     if ( bDel )
     123             :     {
     124             :         // If there is a Crsr registered in one of the nodes, we need to call the
     125             :         // ParkCrsr in an (arbitrary) shell.
     126         255 :         SwFmtCntnt& rCnt = (SwFmtCntnt&)pFmt->GetCntnt();
     127         255 :         if ( rCnt.GetCntntIdx() )
     128             :         {
     129         255 :             SwNode *pNode = 0;
     130             :             {
     131             :                 // #i92993#
     132             :                 // Begin with start node of page header/footer to assure that
     133             :                 // complete content is checked for cursors and the complete content
     134             :                 // is deleted on below made method call <pDoc->DeleteSection(pNode)>
     135             : //                SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 1 );
     136         255 :                 SwNodeIndex aIdx( *rCnt.GetCntntIdx(), 0 );
     137             :                 // If there is a Crsr registered in one of the nodes, we need to call the
     138             :                 // ParkCrsr in an (arbitrary) shell.
     139         255 :                 pNode = & aIdx.GetNode();
     140         255 :                 sal_uInt32 nEnd = pNode->EndOfSectionIndex();
     141        1058 :                 while ( aIdx < nEnd )
     142             :                 {
     143         815 :                     if ( pNode->IsCntntNode() &&
     144         267 :                          ((SwCntntNode*)pNode)->GetDepends() )
     145             :                     {
     146           0 :                         SwCrsrShell *pShell = SwIterator<SwCrsrShell,SwCntntNode>::FirstElement( *(SwCntntNode*)pNode );
     147           0 :                         if( pShell )
     148             :                         {
     149           0 :                             pShell->ParkCrsr( aIdx );
     150           0 :                                 aIdx = nEnd-1;
     151             :                         }
     152             :                     }
     153         548 :                     ++aIdx;
     154         548 :                     pNode = & aIdx.GetNode();
     155         255 :                 }
     156             :             }
     157         255 :             rCnt.SetNewCntntIdx( (const SwNodeIndex*)0 );
     158             : 
     159             :             // When deleting a header/footer-format, we ALWAYS need to disable
     160             :             // the undo function (Bug 31069)
     161         255 :             ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
     162             : 
     163             :             OSL_ENSURE( pNode, "A big problem." );
     164         255 :             pDoc->DeleteSection( pNode );
     165             :         }
     166         255 :         delete pFmt;
     167             :     }
     168             : }
     169             : 
     170             : //  class SwFmtFrmSize
     171             : //  Partially implemented inline in hxx
     172             : 
     173        5159 : SwFmtFrmSize::SwFmtFrmSize( SwFrmSize eSize, SwTwips nWidth, SwTwips nHeight )
     174             :     : SfxPoolItem( RES_FRM_SIZE ),
     175             :     aSize( nWidth, nHeight ),
     176             :     eFrmHeightType( eSize ),
     177        5159 :     eFrmWidthType( ATT_FIX_SIZE )
     178             : {
     179        5159 :     nWidthPercent = nHeightPercent = 0;
     180        5159 : }
     181             : 
     182          25 : SwFmtFrmSize& SwFmtFrmSize::operator=( const SwFmtFrmSize& rCpy )
     183             : {
     184          25 :     aSize = rCpy.GetSize();
     185          25 :     eFrmHeightType = rCpy.GetHeightSizeType();
     186          25 :     eFrmWidthType = rCpy.GetWidthSizeType();
     187          25 :     nHeightPercent = rCpy.GetHeightPercent();
     188          25 :     nWidthPercent  = rCpy.GetWidthPercent();
     189          25 :     return *this;
     190             : }
     191             : 
     192       57776 : int  SwFmtFrmSize::operator==( const SfxPoolItem& rAttr ) const
     193             : {
     194             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
     195       98692 :     return( eFrmHeightType  == ((SwFmtFrmSize&)rAttr).eFrmHeightType &&
     196       81806 :             eFrmWidthType  == ((SwFmtFrmSize&)rAttr).eFrmWidthType &&
     197       46103 :             aSize           == ((SwFmtFrmSize&)rAttr).GetSize()&&
     198       68181 :             nWidthPercent   == ((SwFmtFrmSize&)rAttr).GetWidthPercent() &&
     199       62968 :             nHeightPercent  == ((SwFmtFrmSize&)rAttr).GetHeightPercent() );
     200             : }
     201             : 
     202        3750 : SfxPoolItem*  SwFmtFrmSize::Clone( SfxItemPool* ) const
     203             : {
     204        3750 :     return new SwFmtFrmSize( *this );
     205             : }
     206             : 
     207         131 : bool SwFmtFrmSize::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     208             : {
     209             :     // here we convert always!
     210         131 :     nMemberId &= ~CONVERT_TWIPS;
     211         131 :     switch ( nMemberId )
     212             :     {
     213             :         case MID_FRMSIZE_SIZE:
     214             :         {
     215          29 :             awt::Size aTmp;
     216          29 :             aTmp.Height = TWIP_TO_MM100(aSize.Height());
     217          29 :             aTmp.Width = TWIP_TO_MM100(aSize.Width());
     218          29 :             rVal.setValue(&aTmp, ::getCppuType((const awt::Size*)0));
     219             :         }
     220          29 :         break;
     221             :         case MID_FRMSIZE_REL_HEIGHT:
     222          12 :             rVal <<= (sal_Int16)(GetHeightPercent() != 0xFF ? GetHeightPercent() : 0);
     223          12 :         break;
     224             :         case MID_FRMSIZE_REL_WIDTH:
     225          17 :             rVal <<= (sal_Int16)(GetWidthPercent() != 0xFF ? GetWidthPercent() : 0);
     226          17 :         break;
     227             :         case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
     228             :         {
     229          10 :             sal_Bool bTmp = 0xFF == GetHeightPercent();
     230          10 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
     231             :         }
     232          10 :         break;
     233             :         case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
     234             :         {
     235          10 :             sal_Bool bTmp = 0xFF == GetWidthPercent();
     236          10 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
     237             :         }
     238          10 :         break;
     239             :         case MID_FRMSIZE_WIDTH :
     240          19 :             rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Width());
     241          19 :         break;
     242             :         case MID_FRMSIZE_HEIGHT:
     243             :             // #95848# returned size should never be zero.
     244             :             // (there was a bug that allowed for setting height to 0.
     245             :             // Thus there some documents existing with that not allowed
     246             :             // attribut value which may cause problems on import.)
     247          13 :             rVal <<= (sal_Int32)TWIP_TO_MM100(aSize.Height() < MINLAY ? MINLAY : aSize.Height() );
     248          13 :         break;
     249             :         case MID_FRMSIZE_SIZE_TYPE:
     250          12 :             rVal <<= (sal_Int16)GetHeightSizeType();
     251          12 :         break;
     252             :         case MID_FRMSIZE_IS_AUTO_HEIGHT:
     253             :         {
     254           3 :             sal_Bool bTmp = ATT_FIX_SIZE != GetHeightSizeType();
     255           3 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
     256             :         }
     257           3 :         break;
     258             :         case MID_FRMSIZE_WIDTH_TYPE:
     259           6 :             rVal <<= (sal_Int16)GetWidthSizeType();
     260           6 :         break;
     261             :     }
     262         131 :     return true;
     263             : }
     264             : 
     265         794 : bool SwFmtFrmSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     266             : {
     267         794 :     bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
     268         794 :     nMemberId &= ~CONVERT_TWIPS;
     269         794 :     bool bRet = true;
     270         794 :     switch ( nMemberId )
     271             :     {
     272             :         case MID_FRMSIZE_SIZE:
     273             :         {
     274         133 :             awt::Size aVal;
     275         133 :             if(!(rVal >>= aVal))
     276           0 :                 bRet = false;
     277             :             else
     278             :             {
     279         133 :                 Size aTmp(aVal.Width, aVal.Height);
     280         133 :                 if(bConvert)
     281             :                 {
     282         133 :                     aTmp.Height() = MM100_TO_TWIP(aTmp.Height());
     283         133 :                     aTmp.Width() = MM100_TO_TWIP(aTmp.Width());
     284             :                 }
     285         133 :                 if(aTmp.Height() && aTmp.Width())
     286         133 :                     aSize = aTmp;
     287             :                 else
     288           0 :                     bRet = false;
     289             :             }
     290             :         }
     291         133 :         break;
     292             :         case MID_FRMSIZE_REL_HEIGHT:
     293             :         {
     294          22 :             sal_Int16 nSet = 0;
     295          22 :             rVal >>= nSet;
     296          22 :             if(nSet >= 0 && nSet <= 0xfe)
     297          22 :                 SetHeightPercent((sal_uInt8)nSet);
     298             :             else
     299           0 :                 bRet = false;
     300             :         }
     301          22 :         break;
     302             :         case MID_FRMSIZE_REL_WIDTH:
     303             :         {
     304          24 :             sal_Int16 nSet = 0;
     305          24 :             rVal >>= nSet;
     306          24 :             if(nSet >= 0 && nSet <= 0xfe)
     307          24 :                 SetWidthPercent((sal_uInt8)nSet);
     308             :             else
     309           0 :                 bRet = false;
     310             :         }
     311          24 :         break;
     312             :         case MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH:
     313             :         {
     314          21 :             sal_Bool bSet = *(sal_Bool*)rVal.getValue();
     315          21 :             if(bSet)
     316           0 :                 SetHeightPercent(0xff);
     317          21 :             else if( 0xff == GetHeightPercent() )
     318           0 :                 SetHeightPercent( 0 );
     319             :         }
     320          21 :         break;
     321             :         case MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT:
     322             :         {
     323          21 :             sal_Bool bSet = *(sal_Bool*)rVal.getValue();
     324          21 :             if(bSet)
     325           0 :                 SetWidthPercent(0xff);
     326          21 :             else if( 0xff == GetWidthPercent() )
     327           0 :                 SetWidthPercent(0);
     328             :         }
     329          21 :         break;
     330             :         case MID_FRMSIZE_WIDTH :
     331             :         {
     332         221 :             sal_Int32 nWd = 0;
     333         221 :             if(rVal >>= nWd)
     334             :             {
     335         221 :                 if(bConvert)
     336         221 :                     nWd = MM100_TO_TWIP(nWd);
     337         221 :                 if(nWd < MINLAY)
     338           0 :                    nWd = MINLAY;
     339         221 :                 aSize.Width() = nWd;
     340             :             }
     341             :             else
     342           0 :                 bRet = sal_False;
     343             :         }
     344         221 :         break;
     345             :         case MID_FRMSIZE_HEIGHT:
     346             :         {
     347         217 :             sal_Int32 nHg = 0;
     348         217 :             if(rVal >>= nHg)
     349             :             {
     350         217 :                 if(bConvert)
     351         217 :                     nHg = MM100_TO_TWIP(nHg);
     352         217 :                 if(nHg < MINLAY)
     353           0 :                     nHg = MINLAY;
     354         217 :                 aSize.Height() = nHg;
     355             :             }
     356             :             else
     357           0 :                 bRet = false;
     358             :         }
     359         217 :         break;
     360             :         case MID_FRMSIZE_SIZE_TYPE:
     361             :         {
     362         102 :             sal_Int16 nType = 0;
     363         102 :             if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE )
     364             :             {
     365         102 :                 SetHeightSizeType((SwFrmSize)nType);
     366             :             }
     367             :             else
     368           0 :                 bRet = false;
     369             :         }
     370         102 :         break;
     371             :         case MID_FRMSIZE_IS_AUTO_HEIGHT:
     372             :         {
     373           3 :             sal_Bool bSet = *(sal_Bool*)rVal.getValue();
     374           3 :             SetHeightSizeType(bSet ? ATT_VAR_SIZE : ATT_FIX_SIZE);
     375             :         }
     376           3 :         break;
     377             :         case MID_FRMSIZE_WIDTH_TYPE:
     378             :         {
     379          30 :             sal_Int16 nType = 0;
     380          30 :             if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE )
     381             :             {
     382          29 :                 SetWidthSizeType((SwFrmSize)nType);
     383             :             }
     384             :             else
     385           1 :                 bRet = false;
     386             :         }
     387          30 :         break;
     388             :         default:
     389           0 :             bRet = false;
     390             :     }
     391         794 :     return bRet;
     392             : }
     393             : 
     394             : //  class SwFmtFillOrder
     395             : //  Partially implemented inline in hxx
     396             : 
     397        2040 : SwFmtFillOrder::SwFmtFillOrder( SwFillOrder nFO )
     398        2040 :     : SfxEnumItem( RES_FILL_ORDER, sal_uInt16(nFO) )
     399        2040 : {}
     400             : 
     401         901 : SfxPoolItem*  SwFmtFillOrder::Clone( SfxItemPool* ) const
     402             : {
     403         901 :     return new SwFmtFillOrder( GetFillOrder() );
     404             : }
     405             : 
     406           0 : sal_uInt16  SwFmtFillOrder::GetValueCount() const
     407             : {
     408           0 :     return SW_FILL_ORDER_END - SW_FILL_ORDER_BEGIN;
     409             : }
     410             : 
     411             : //  class SwFmtHeader
     412             : //  Partially implemented inline in hxx
     413             : 
     414           9 : SwFmtHeader::SwFmtHeader( SwFrmFmt *pHeaderFmt )
     415             :     : SfxPoolItem( RES_HEADER ),
     416             :     SwClient( pHeaderFmt ),
     417           9 :     bActive( pHeaderFmt ? sal_True : sal_False )
     418             : {
     419           9 : }
     420             : 
     421        1618 : SwFmtHeader::SwFmtHeader( const SwFmtHeader &rCpy )
     422             :     : SfxPoolItem( RES_HEADER ),
     423        1618 :     SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
     424        3236 :     bActive( rCpy.IsActive() )
     425             : {
     426        1618 : }
     427             : 
     428         119 : SwFmtHeader::SwFmtHeader( sal_Bool bOn )
     429             :     : SfxPoolItem( RES_HEADER ),
     430             :     SwClient( 0 ),
     431         119 :     bActive( bOn )
     432             : {
     433         119 : }
     434             : 
     435        4994 :  SwFmtHeader::~SwFmtHeader()
     436             : {
     437        1745 :     if ( GetHeaderFmt() )
     438         540 :         DelHFFormat( this, GetHeaderFmt() );
     439        3249 : }
     440             : 
     441        2350 : int  SwFmtHeader::operator==( const SfxPoolItem& rAttr ) const
     442             : {
     443             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
     444        3710 :     return ( GetRegisteredIn() == ((SwFmtHeader&)rAttr).GetRegisteredIn() &&
     445        3710 :              bActive == ((SwFmtHeader&)rAttr).IsActive() );
     446             : }
     447             : 
     448        1472 : SfxPoolItem*  SwFmtHeader::Clone( SfxItemPool* ) const
     449             : {
     450        1472 :     return new SwFmtHeader( *this );
     451             : }
     452             : 
     453         231 : void SwFmtHeader::RegisterToFormat( SwFmt& rFmt )
     454             : {
     455         231 :     rFmt.Add(this);
     456         231 : }
     457             : 
     458             : //  class SwFmtFooter
     459             : //  Partially implemented inline in hxx
     460             : 
     461          11 : SwFmtFooter::SwFmtFooter( SwFrmFmt *pFooterFmt )
     462             :     : SfxPoolItem( RES_FOOTER ),
     463             :     SwClient( pFooterFmt ),
     464          11 :     bActive( pFooterFmt ? sal_True : sal_False )
     465             : {
     466          11 : }
     467             : 
     468        1520 : SwFmtFooter::SwFmtFooter( const SwFmtFooter &rCpy )
     469             :     : SfxPoolItem( RES_FOOTER ),
     470        1520 :     SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
     471        3040 :     bActive( rCpy.IsActive() )
     472             : {
     473        1520 : }
     474             : 
     475         118 : SwFmtFooter::SwFmtFooter( sal_Bool bOn )
     476             :     : SfxPoolItem( RES_FOOTER ),
     477             :     SwClient( 0 ),
     478         118 :     bActive( bOn )
     479             : {
     480         118 : }
     481             : 
     482        4744 :  SwFmtFooter::~SwFmtFooter()
     483             : {
     484        1648 :     if ( GetFooterFmt() )
     485         396 :         DelHFFormat( this, GetFooterFmt() );
     486        3096 : }
     487             : 
     488         178 : void SwFmtFooter::RegisterToFormat( SwFmt& rFmt )
     489             : {
     490         178 :     rFmt.Add(this);
     491         178 : }
     492             : 
     493        2310 : int  SwFmtFooter::operator==( const SfxPoolItem& rAttr ) const
     494             : {
     495             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
     496        3797 :     return ( GetRegisteredIn() == ((SwFmtFooter&)rAttr).GetRegisteredIn() &&
     497        3797 :              bActive == ((SwFmtFooter&)rAttr).IsActive() );
     498             : }
     499             : 
     500        1416 : SfxPoolItem*  SwFmtFooter::Clone( SfxItemPool* ) const
     501             : {
     502        1416 :     return new SwFmtFooter( *this );
     503             : }
     504             : 
     505             : //  class SwFmtCntnt
     506             : //  Partially implemented inline in hxx
     507             : 
     508        4558 : SwFmtCntnt::SwFmtCntnt( const SwFmtCntnt &rCpy )
     509        4558 :     : SfxPoolItem( RES_CNTNT )
     510             : {
     511        4558 :     pStartNode = rCpy.GetCntntIdx() ?
     512        4558 :                     new SwNodeIndex( *rCpy.GetCntntIdx() ) : 0;
     513        4558 : }
     514             : 
     515         890 : SwFmtCntnt::SwFmtCntnt( const SwStartNode *pStartNd )
     516         890 :     : SfxPoolItem( RES_CNTNT )
     517             : {
     518         890 :     pStartNode = pStartNd ? new SwNodeIndex( *pStartNd ) : 0;
     519         890 : }
     520             : 
     521       15481 :  SwFmtCntnt::~SwFmtCntnt()
     522             : {
     523        5447 :     delete pStartNode;
     524       10034 : }
     525             : 
     526         669 : void SwFmtCntnt::SetNewCntntIdx( const SwNodeIndex *pIdx )
     527             : {
     528         669 :     delete pStartNode;
     529         669 :     pStartNode = pIdx ? new SwNodeIndex( *pIdx ) : 0;
     530         669 : }
     531             : 
     532         928 : int  SwFmtCntnt::operator==( const SfxPoolItem& rAttr ) const
     533             : {
     534             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
     535         928 :     if( (sal_IntPtr)pStartNode ^ (sal_IntPtr)((SwFmtCntnt&)rAttr).pStartNode )
     536         928 :         return 0;
     537           0 :     if( pStartNode )
     538           0 :         return ( *pStartNode == *((SwFmtCntnt&)rAttr).GetCntntIdx() );
     539           0 :     return 1;
     540             : }
     541             : 
     542        4555 : SfxPoolItem*  SwFmtCntnt::Clone( SfxItemPool* ) const
     543             : {
     544        4555 :     return new SwFmtCntnt( *this );
     545             : }
     546             : 
     547             : //  class SwFmtPageDesc
     548             : //  Partially implemented inline in hxx
     549             : 
     550        4504 : SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy )
     551             :     : SfxPoolItem( RES_PAGEDESC ),
     552        4504 :     SwClient( (SwPageDesc*)rCpy.GetPageDesc() ),
     553             :     nNumOffset( rCpy.nNumOffset ),
     554             :     nDescNameIdx( rCpy.nDescNameIdx ),
     555        9008 :     pDefinedIn( 0 )
     556             : {
     557        4504 : }
     558             : 
     559         516 : SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc )
     560             :     : SfxPoolItem( RES_PAGEDESC ),
     561             :     SwClient( (SwPageDesc*)pDesc ),
     562             :     nNumOffset( 0 ),
     563             :     nDescNameIdx( 0xFFFF ), // IDX_NO_VALUE
     564         516 :     pDefinedIn( 0 )
     565             : {
     566         516 : }
     567             : 
     568           0 : SwFmtPageDesc &SwFmtPageDesc::operator=(const SwFmtPageDesc &rCpy)
     569             : {
     570           0 :     if (rCpy.GetPageDesc())
     571           0 :         RegisterToPageDesc(*const_cast<SwPageDesc*>(rCpy.GetPageDesc()));
     572           0 :     nNumOffset = rCpy.nNumOffset;
     573           0 :     nDescNameIdx = rCpy.nDescNameIdx;
     574           0 :     pDefinedIn = 0;
     575             : 
     576           0 :     return *this;
     577             : }
     578             : 
     579        9434 :  SwFmtPageDesc::~SwFmtPageDesc() {}
     580             : 
     581         462 : bool SwFmtPageDesc::KnowsPageDesc() const
     582             : {
     583         462 :     return (GetRegisteredIn() != 0);
     584             : }
     585             : 
     586         157 : int  SwFmtPageDesc::operator==( const SfxPoolItem& rAttr ) const
     587             : {
     588             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
     589         250 :     return  ( pDefinedIn == ((SwFmtPageDesc&)rAttr).pDefinedIn ) &&
     590         250 :             ( nNumOffset == ((SwFmtPageDesc&)rAttr).nNumOffset ) &&
     591         250 :             ( GetPageDesc() == ((SwFmtPageDesc&)rAttr).GetPageDesc() );
     592             : }
     593             : 
     594        4031 : SfxPoolItem*  SwFmtPageDesc::Clone( SfxItemPool* ) const
     595             : {
     596        4031 :     return new SwFmtPageDesc( *this );
     597             : }
     598             : 
     599           0 : void SwFmtPageDesc::SwClientNotify( const SwModify&, const SfxHint& rHint )
     600             : {
     601           0 :     const SwPageDescHint* pHint = dynamic_cast<const SwPageDescHint*>(&rHint);
     602           0 :     if ( pHint )
     603             :     {
     604             :         // mba: shouldn't that be broadcasted also?
     605           0 :         SwFmtPageDesc aDfltDesc( pHint->GetPageDesc() );
     606           0 :         SwPageDesc* pDesc = pHint->GetPageDesc();
     607           0 :         const SwModify* pMod = GetDefinedIn();
     608           0 :         if ( pMod )
     609             :         {
     610           0 :             if( pMod->ISA( SwCntntNode ) )
     611           0 :                 ((SwCntntNode*)pMod)->SetAttr( aDfltDesc );
     612           0 :             else if( pMod->ISA( SwFmt ))
     613           0 :                 ((SwFmt*)pMod)->SetFmtAttr( aDfltDesc );
     614             :             else
     615             :             {
     616             :                 OSL_FAIL( "What kind of SwModify is this?" );
     617           0 :                 RegisterToPageDesc( *pDesc );
     618             :             }
     619             :         }
     620             :         else
     621             :             // there could be an Undo-copy
     622           0 :             RegisterToPageDesc( *pDesc );
     623             :     }
     624           0 : }
     625             : 
     626         340 : void SwFmtPageDesc::RegisterToPageDesc( SwPageDesc& rDesc )
     627             : {
     628         340 :     rDesc.Add( this );
     629         340 : }
     630             : 
     631         865 : void SwFmtPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
     632             : {
     633         865 :     if( !pDefinedIn )
     634        1303 :         return;
     635             : 
     636         427 :     const sal_uInt16 nWhichId = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
     637         427 :     switch( nWhichId )
     638             :     {
     639             :         case RES_OBJECTDYING:
     640             :                 //The Pagedesc where I'm registered dies, therefore I unregister
     641             :                 //from that format. During this I get deleted!
     642         427 :             if( IS_TYPE( SwFmt, pDefinedIn ))
     643             :             {
     644             :                 bool const bResult =
     645           0 :                     static_cast<SwFmt*>(pDefinedIn)->ResetFmtAttr(RES_PAGEDESC);
     646             :                 OSL_ENSURE( bResult, "FmtPageDesc not deleted" );
     647             :                 (void) bResult; // unused in non-debug
     648             :             }
     649         427 :             else if( IS_TYPE( SwCntntNode, pDefinedIn ))
     650             :             {
     651             :                 bool const bResult = static_cast<SwCntntNode*>(pDefinedIn)
     652           0 :                         ->ResetAttr(RES_PAGEDESC);
     653             :                 OSL_ENSURE( bResult, "FmtPageDesc not deleted" );
     654             :                 (void) bResult; // unused in non-debug
     655             :             }
     656         427 :             break;
     657             : 
     658             :         default:
     659             :             /* do nothing */;
     660             :     }
     661             : }
     662             : 
     663          36 : bool SwFmtPageDesc::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     664             : {
     665             :     // here we convert always!
     666          36 :     nMemberId &= ~CONVERT_TWIPS;
     667          36 :     bool    bRet = true;
     668          36 :     switch ( nMemberId )
     669             :     {
     670             :         case MID_PAGEDESC_PAGENUMOFFSET:
     671          20 :             rVal <<= (sal_Int16)GetNumOffset();
     672          20 :             break;
     673             : 
     674             :         case MID_PAGEDESC_PAGEDESCNAME:
     675             :             {
     676          16 :                 const SwPageDesc* pDesc = GetPageDesc();
     677          16 :                 if( pDesc )
     678             :                 {
     679          12 :                     String aString;
     680          12 :                     SwStyleNameMapper::FillProgName(pDesc->GetName(), aString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, true );
     681          12 :                     rVal <<= OUString( aString );
     682             :                 }
     683             :                 else
     684           4 :                     rVal.clear();
     685             :             }
     686          16 :             break;
     687             :         default:
     688             :             OSL_ENSURE( !this, "unknown MemberId" );
     689           0 :             bRet = false;
     690             :     }
     691          36 :     return bRet;
     692             : }
     693             : 
     694          24 : bool SwFmtPageDesc::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     695             : {
     696             :     // here we convert always!
     697          24 :     nMemberId &= ~CONVERT_TWIPS;
     698          24 :     bool bRet = true;
     699          24 :     switch ( nMemberId )
     700             :     {
     701             :         case MID_PAGEDESC_PAGENUMOFFSET:
     702             :         {
     703          24 :             sal_Int16 nOffset = 0;
     704          24 :             if(rVal >>= nOffset)
     705          24 :                 SetNumOffset( nOffset );
     706             :             else
     707           0 :                 bRet = false;
     708             :         }
     709          24 :         break;
     710             : 
     711             :         case MID_PAGEDESC_PAGEDESCNAME:
     712             :             /* Doesn't work, because the attribute doesn't need the name but a
     713             :              * pointer to the PageDesc (it's a client of it). The pointer can
     714             :              * only be requested from the document using the name.
     715             :              */
     716             :         default:
     717             :             OSL_ENSURE( !this, "unknown MemberId" );
     718           0 :             bRet = false;
     719             :     }
     720          24 :     return bRet;
     721             : }
     722             : 
     723             : 
     724             : //  class SwFmtCol
     725             : //  Partially implemented inline in hxx
     726             : 
     727          16 : SwColumn::SwColumn() :
     728             :     nWish ( 0 ),
     729             :     nUpper( 0 ),
     730             :     nLower( 0 ),
     731             :     nLeft ( 0 ),
     732          16 :     nRight( 0 )
     733             : {
     734          16 : }
     735             : 
     736           0 : sal_Bool SwColumn::operator==( const SwColumn &rCmp ) const
     737             : {
     738           0 :     return (nWish    == rCmp.GetWishWidth() &&
     739           0 :             GetLeft()  == rCmp.GetLeft() &&
     740           0 :             GetRight() == rCmp.GetRight() &&
     741           0 :             GetUpper() == rCmp.GetUpper() &&
     742           0 :             GetLower() == rCmp.GetLower()) ? sal_True : sal_False;
     743             : }
     744             : 
     745         100 : SwFmtCol::SwFmtCol( const SwFmtCol& rCpy )
     746             :     : SfxPoolItem( RES_COL ),
     747             :     eLineStyle( rCpy.eLineStyle ),
     748             :     nLineWidth( rCpy.nLineWidth),
     749             :     aLineColor( rCpy.aLineColor),
     750         100 :     nLineHeight( rCpy.GetLineHeight() ),
     751         100 :     eAdj( rCpy.GetLineAdj() ),
     752         100 :     aColumns( (sal_Int8)rCpy.GetNumCols() ),
     753         100 :     nWidth( rCpy.GetWishWidth() ),
     754         500 :     bOrtho( rCpy.IsOrtho() )
     755             : {
     756         116 :     for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
     757             :     {
     758          16 :         SwColumn *pCol = new SwColumn( rCpy.GetColumns()[i] );
     759          16 :         aColumns.push_back( pCol );
     760             :     }
     761         100 : }
     762             : 
     763         351 : SwFmtCol::~SwFmtCol() {}
     764             : 
     765           0 : SwFmtCol& SwFmtCol::operator=( const SwFmtCol& rCpy )
     766             : {
     767           0 :     eLineStyle  = rCpy.eLineStyle;
     768           0 :     nLineWidth  = rCpy.nLineWidth;
     769           0 :     aLineColor  = rCpy.aLineColor;
     770           0 :     nLineHeight = rCpy.GetLineHeight();
     771           0 :     eAdj        = rCpy.GetLineAdj();
     772           0 :     nWidth      = rCpy.GetWishWidth();
     773           0 :     bOrtho      = rCpy.IsOrtho();
     774             : 
     775           0 :     if ( !aColumns.empty() )
     776           0 :         aColumns.clear();
     777           0 :     for ( sal_uInt16 i = 0; i < rCpy.GetNumCols(); ++i )
     778             :     {
     779           0 :         SwColumn *pCol = new SwColumn( rCpy.GetColumns()[i] );
     780           0 :         aColumns.push_back( pCol );
     781             :     }
     782           0 :     return *this;
     783             : }
     784             : 
     785          79 : SwFmtCol::SwFmtCol()
     786             :     : SfxPoolItem( RES_COL )
     787             :     , eLineStyle( table::BorderLineStyle::NONE)
     788             :     ,
     789             :     nLineWidth(0),
     790             :     nLineHeight( 100 ),
     791             :     eAdj( COLADJ_NONE ),
     792             :     nWidth( USHRT_MAX ),
     793          79 :     bOrtho( sal_True )
     794             : {
     795          79 : }
     796             : 
     797         309 : int SwFmtCol::operator==( const SfxPoolItem& rAttr ) const
     798             : {
     799             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "no equal attributes" );
     800         309 :     const SwFmtCol &rCmp = (const SwFmtCol&)rAttr;
     801         927 :     if( !(eLineStyle        == rCmp.eLineStyle  &&
     802         618 :           nLineWidth        == rCmp.nLineWidth  &&
     803         618 :           aLineColor        == rCmp.aLineColor  &&
     804         618 :           nLineHeight        == rCmp.GetLineHeight() &&
     805         618 :           eAdj               == rCmp.GetLineAdj() &&
     806         469 :           nWidth             == rCmp.GetWishWidth() &&
     807         160 :           bOrtho             == rCmp.IsOrtho() &&
     808         469 :           aColumns.size() == rCmp.GetNumCols()) )
     809         217 :         return 0;
     810             : 
     811          92 :     for ( sal_uInt16 i = 0; i < aColumns.size(); ++i )
     812           0 :         if ( !(aColumns[i] == rCmp.GetColumns()[i]) )
     813           0 :             return 0;
     814             : 
     815          92 :     return 1;
     816             : }
     817             : 
     818         100 : SfxPoolItem*  SwFmtCol::Clone( SfxItemPool* ) const
     819             : {
     820         100 :     return new SwFmtCol( *this );
     821             : }
     822             : 
     823          48 : sal_uInt16 SwFmtCol::GetGutterWidth( sal_Bool bMin ) const
     824             : {
     825          48 :     sal_uInt16 nRet = 0;
     826          48 :     if ( aColumns.size() == 2 )
     827           2 :         nRet = aColumns[0].GetRight() + aColumns[1].GetLeft();
     828          46 :     else if ( aColumns.size() > 2 )
     829             :     {
     830           2 :         bool bSet = false;
     831           6 :         for ( sal_uInt16 i = 1; i < aColumns.size()-1; ++i )
     832             :         {
     833           4 :             const sal_uInt16 nTmp = aColumns[i].GetRight() + aColumns[i+1].GetLeft();
     834           4 :             if ( bSet )
     835             :             {
     836           2 :                 if ( nTmp != nRet )
     837             :                 {
     838           0 :                     if ( !bMin )
     839           0 :                         return USHRT_MAX;
     840           0 :                     if ( nRet > nTmp )
     841           0 :                         nRet = nTmp;
     842             :                 }
     843             :             }
     844             :             else
     845           2 :             {   bSet = true;
     846           2 :                 nRet = nTmp;
     847             :             }
     848             :         }
     849             :     }
     850          48 :     return nRet;
     851             : }
     852             : 
     853           0 : void SwFmtCol::SetGutterWidth( sal_uInt16 nNew, sal_uInt16 nAct )
     854             : {
     855           0 :     if ( bOrtho )
     856           0 :         Calc( nNew, nAct );
     857             :     else
     858             :     {
     859           0 :         sal_uInt16 nHalf = nNew / 2;
     860           0 :         for ( sal_uInt16 i = 0; i < aColumns.size(); ++i )
     861           0 :         {   SwColumn *pCol = &aColumns[i];
     862           0 :             pCol->SetLeft ( nHalf );
     863           0 :             pCol->SetRight( nHalf );
     864           0 :             if ( i == 0 )
     865           0 :                 pCol->SetLeft( 0 );
     866           0 :             else if ( i == (aColumns.size() - 1) )
     867           0 :                 pCol->SetRight( 0 );
     868             :         }
     869             :     }
     870           0 : }
     871             : 
     872           1 : void SwFmtCol::Init( sal_uInt16 nNumCols, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
     873             : {
     874             :     // Deleting seems to be a bit radical on the first sight; but otherwise we
     875             :     // have to initialize all values of the remaining SwCloumns.
     876           1 :     if ( !aColumns.empty() )
     877           0 :         aColumns.clear();
     878           3 :     for ( sal_uInt16 i = 0; i < nNumCols; ++i )
     879           2 :     {   SwColumn *pCol = new SwColumn;
     880           2 :         aColumns.push_back( pCol );
     881             :     }
     882           1 :     bOrtho = sal_True;
     883           1 :     nWidth = USHRT_MAX;
     884           1 :     if( nNumCols )
     885           1 :         Calc( nGutterWidth, nAct );
     886           1 : }
     887             : 
     888           0 : void SwFmtCol::SetOrtho( sal_Bool bNew, sal_uInt16 nGutterWidth, sal_uInt16 nAct )
     889             : {
     890           0 :     bOrtho = bNew;
     891           0 :     if ( bNew && !aColumns.empty() )
     892           0 :         Calc( nGutterWidth, nAct );
     893           0 : }
     894             : 
     895           2 : sal_uInt16 SwFmtCol::CalcColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
     896             : {
     897             :     assert(nCol < aColumns.size());
     898           2 :     if ( nWidth != nAct )
     899             :     {
     900           1 :         long nW = aColumns[nCol].GetWishWidth();
     901           1 :         nW *= nAct;
     902           1 :         nW /= nWidth;
     903           1 :         return sal_uInt16(nW);
     904             :     }
     905             :     else
     906           1 :         return aColumns[nCol].GetWishWidth();
     907             : }
     908             : 
     909           0 : sal_uInt16 SwFmtCol::CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const
     910             : {
     911             :     assert(nCol < aColumns.size());
     912           0 :     sal_uInt16 nRet = CalcColWidth( nCol, nAct );
     913           0 :     const SwColumn *pCol = &aColumns[nCol];
     914           0 :     nRet = nRet - pCol->GetLeft();
     915           0 :     nRet = nRet - pCol->GetRight();
     916           0 :     return nRet;
     917             : }
     918             : 
     919           1 : void SwFmtCol::Calc( sal_uInt16 nGutterWidth, sal_uInt16 nAct )
     920             : {
     921           1 :     if(!GetNumCols())
     922           1 :         return;
     923             :     //First set the column widths with the current width, then calculate the
     924             :     //column's requested width using the requested total width.
     925             : 
     926           1 :     const sal_uInt16 nGutterHalf = nGutterWidth ? nGutterWidth / 2 : 0;
     927             : 
     928             :     //Width of PrtAreas is totalwidth - spacings / count
     929             :     const sal_uInt16 nPrtWidth =
     930           1 :                 (nAct - ((GetNumCols()-1) * nGutterWidth)) / GetNumCols();
     931           1 :     sal_uInt16 nAvail = nAct;
     932             : 
     933             :     //The fist column is PrtWidth + (gap width / 2)
     934           1 :     const sal_uInt16 nLeftWidth = nPrtWidth + nGutterHalf;
     935           1 :     SwColumn *pCol = &aColumns.front();
     936           1 :     pCol->SetWishWidth( nLeftWidth );
     937           1 :     pCol->SetRight( nGutterHalf );
     938           1 :     pCol->SetLeft ( 0 );
     939           1 :     nAvail = nAvail - nLeftWidth;
     940             : 
     941             :     //Column 2 to n-1 is PrtWidth + gap width
     942           1 :     const sal_uInt16 nMidWidth = nPrtWidth + nGutterWidth;
     943             :     sal_uInt16 i;
     944             : 
     945           1 :     for ( i = 1; i < GetNumCols()-1; ++i )
     946             :     {
     947           0 :         pCol = &aColumns[i];
     948           0 :         pCol->SetWishWidth( nMidWidth );
     949           0 :         pCol->SetLeft ( nGutterHalf );
     950           0 :         pCol->SetRight( nGutterHalf );
     951           0 :         nAvail = nAvail - nMidWidth;
     952             :     }
     953             : 
     954             :     //The last column is equivalent to the first one - to compensate rounding
     955             :     //errors we add the remaining space of the other columns to the last one.
     956           1 :     pCol = &aColumns.back();
     957           1 :     pCol->SetWishWidth( nAvail );
     958           1 :     pCol->SetLeft ( nGutterHalf );
     959           1 :     pCol->SetRight( 0 );
     960             : 
     961             :     //Convert the current width to the requested width.
     962           3 :     for ( i = 0; i < aColumns.size(); ++i )
     963             :     {
     964           2 :         pCol = &aColumns[i];
     965           2 :         long nTmp = pCol->GetWishWidth();
     966           2 :         nTmp *= GetWishWidth();
     967           2 :         nTmp /= nAct;
     968           2 :         pCol->SetWishWidth( sal_uInt16(nTmp) );
     969             :     }
     970             : }
     971             : 
     972          48 : bool SwFmtCol::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
     973             : {
     974             :     // here we convert always!
     975          48 :     nMemberId &= ~CONVERT_TWIPS;
     976          48 :     if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
     977             :     {
     978             :         OSL_FAIL("not implemented");
     979             :     }
     980             :     else
     981             :     {
     982          48 :         uno::Reference< text::XTextColumns >  xCols = new SwXTextColumns(*this);
     983          48 :         rVal.setValue(&xCols, ::getCppuType((uno::Reference< text::XTextColumns>*)0));
     984             :     }
     985          48 :     return true;
     986             : }
     987             : 
     988          40 : bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
     989             : {
     990             :     // here we convert always!
     991          40 :     nMemberId &= ~CONVERT_TWIPS;
     992          40 :     bool bRet = false;
     993          40 :     if(MID_COLUMN_SEPARATOR_LINE == nMemberId)
     994             :     {
     995             :         OSL_FAIL("not implemented");
     996             :     }
     997             :     else
     998             :     {
     999          40 :         uno::Reference< text::XTextColumns > xCols;
    1000          40 :         rVal >>= xCols;
    1001          40 :         if(xCols.is())
    1002             :         {
    1003          40 :             uno::Sequence<text::TextColumn> aSetColumns = xCols->getColumns();
    1004          40 :             const text::TextColumn* pArray = aSetColumns.getConstArray();
    1005          40 :             aColumns.clear();
    1006             :             //max count is 64k here - this is something the array can't do
    1007          40 :             sal_uInt16 nCount = std::min( (sal_uInt16)aSetColumns.getLength(),
    1008          80 :                                      (sal_uInt16) 0x3fff );
    1009          40 :             sal_uInt16 nWidthSum = 0;
    1010             :             // #101224# one column is no column
    1011             :             //
    1012          40 :             if(nCount > 1)
    1013          19 :                 for(sal_uInt16 i = 0; i < nCount; i++)
    1014             :                 {
    1015          14 :                     SwColumn* pCol = new SwColumn;
    1016          14 :                     pCol->SetWishWidth( static_cast<sal_uInt16>(pArray[i].Width) );
    1017          14 :                     nWidthSum = static_cast<sal_uInt16>(nWidthSum + pArray[i].Width);
    1018          14 :                     pCol->SetLeft ( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].LeftMargin)) );
    1019          14 :                     pCol->SetRight( static_cast<sal_uInt16>(MM100_TO_TWIP(pArray[i].RightMargin)) );
    1020          14 :                     aColumns.insert(aColumns.begin() + i, pCol);
    1021             :                 }
    1022          40 :             bRet = true;
    1023          40 :             nWidth = nWidthSum;
    1024          40 :             bOrtho = sal_False;
    1025             : 
    1026          80 :             uno::Reference<lang::XUnoTunnel> xNumTunnel(xCols, uno::UNO_QUERY);
    1027          40 :             SwXTextColumns* pSwColums = 0;
    1028          40 :             if(xNumTunnel.is())
    1029             :             {
    1030             :                 pSwColums = reinterpret_cast< SwXTextColumns * >(
    1031             :                     sal::static_int_cast< sal_IntPtr >(
    1032          40 :                     xNumTunnel->getSomething( SwXTextColumns::getUnoTunnelId() )));
    1033             :             }
    1034          40 :             if(pSwColums)
    1035             :             {
    1036          40 :                 bOrtho = pSwColums->IsAutomaticWidth();
    1037          40 :                 nLineWidth = pSwColums->GetSepLineWidth();
    1038          40 :                 aLineColor.SetColor(pSwColums->GetSepLineColor());
    1039          40 :                 nLineHeight = pSwColums->GetSepLineHeightRelative();
    1040          40 :                 switch ( pSwColums->GetSepLineStyle() )
    1041             :                 {
    1042             :                     default:
    1043          40 :                     case 0: eLineStyle = table::BorderLineStyle::NONE; break;
    1044           0 :                     case 1: eLineStyle = table::BorderLineStyle::SOLID; break;
    1045           0 :                     case 2: eLineStyle = table::BorderLineStyle::DOTTED; break;
    1046           0 :                     case 3: eLineStyle = table::BorderLineStyle::DASHED; break;
    1047             :                 }
    1048          40 :                 if(!pSwColums->GetSepLineIsOn())
    1049          40 :                     eAdj = COLADJ_NONE;
    1050           0 :                 else switch(pSwColums->GetSepLineVertAlign())
    1051             :                 {
    1052           0 :                     case 0: eAdj = COLADJ_TOP;  break;  //VerticalAlignment_TOP
    1053           0 :                     case 1: eAdj = COLADJ_CENTER;break; //VerticalAlignment_MIDDLE
    1054           0 :                     case 2: eAdj = COLADJ_BOTTOM;break; //VerticalAlignment_BOTTOM
    1055           0 :                     default: OSL_ENSURE( !this, "unknown alignment" ); break;
    1056             :                 }
    1057          40 :             }
    1058          40 :         }
    1059             :     }
    1060          40 :     return bRet;
    1061             : }
    1062             : 
    1063             : 
    1064             : //  class SwFmtSurround
    1065             : //  Partially implemented inline in hxx
    1066             : 
    1067         462 : SwFmtSurround::SwFmtSurround( SwSurround eFly ) :
    1068         462 :     SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )
    1069             : {
    1070         462 :     bAnchorOnly = bContour = bOutside = sal_False;
    1071         462 : }
    1072             : 
    1073         646 : SwFmtSurround::SwFmtSurround( const SwFmtSurround &rCpy ) :
    1074         646 :     SfxEnumItem( RES_SURROUND, rCpy.GetValue() )
    1075             : {
    1076         646 :     bAnchorOnly = rCpy.bAnchorOnly;
    1077         646 :     bContour = rCpy.bContour;
    1078         646 :     bOutside = rCpy.bOutside;
    1079         646 : }
    1080             : 
    1081         667 : int  SwFmtSurround::operator==( const SfxPoolItem& rAttr ) const
    1082             : {
    1083             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    1084         917 :     return ( GetValue() == ((SwFmtSurround&)rAttr).GetValue() &&
    1085         497 :              bAnchorOnly== ((SwFmtSurround&)rAttr).bAnchorOnly &&
    1086        1159 :              bContour== ((SwFmtSurround&)rAttr).bContour &&
    1087         912 :              bOutside== ((SwFmtSurround&)rAttr).bOutside );
    1088             : }
    1089             : 
    1090         601 : SfxPoolItem*  SwFmtSurround::Clone( SfxItemPool* ) const
    1091             : {
    1092         601 :     return new SwFmtSurround( *this );
    1093             : }
    1094             : 
    1095           0 : sal_uInt16  SwFmtSurround::GetValueCount() const
    1096             : {
    1097           0 :     return SURROUND_END - SURROUND_BEGIN;
    1098             : }
    1099             : 
    1100             : 
    1101          45 : bool SwFmtSurround::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1102             : {
    1103             :     // here we convert always!
    1104          45 :     nMemberId &= ~CONVERT_TWIPS;
    1105          45 :     bool bRet = true;
    1106          45 :     switch ( nMemberId )
    1107             :     {
    1108             :         case MID_SURROUND_SURROUNDTYPE:
    1109          22 :                 rVal <<= (text::WrapTextMode)GetSurround();
    1110          22 :         break;
    1111             :         case MID_SURROUND_ANCHORONLY:
    1112             :         {
    1113           9 :             sal_Bool bTmp = IsAnchorOnly();
    1114           9 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    1115             :         }
    1116           9 :                 break;
    1117             :         case MID_SURROUND_CONTOUR:
    1118             :         {
    1119           7 :             sal_Bool bTmp = IsContour();
    1120           7 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    1121             :         }
    1122           7 :                 break;
    1123             :         case MID_SURROUND_CONTOUROUTSIDE:
    1124             :         {
    1125           7 :             sal_Bool bTmp = IsOutside();
    1126           7 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    1127             :         }
    1128           7 :                 break;
    1129             :         default:
    1130             :             OSL_ENSURE( !this, "unknown MemberId" );
    1131           0 :             bRet = false;
    1132             :     }
    1133          45 :     return bRet;
    1134             : }
    1135             : 
    1136         222 : bool SwFmtSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1137             : {
    1138             :     // here we convert always!
    1139         222 :     nMemberId &= ~CONVERT_TWIPS;
    1140         222 :     bool bRet = true;
    1141         222 :     switch ( nMemberId )
    1142             :     {
    1143             :         case MID_SURROUND_SURROUNDTYPE:
    1144             :         {
    1145         160 :             sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
    1146         160 :             if( eVal >= 0 && eVal < (sal_Int16)SURROUND_END )
    1147         160 :                 SetValue( static_cast<sal_uInt16>(eVal) );
    1148             :             else {
    1149             :                 //exception
    1150             :                 ;
    1151             :             }
    1152             :         }
    1153         160 :         break;
    1154             : 
    1155             :         case MID_SURROUND_ANCHORONLY:
    1156          28 :             SetAnchorOnly( *(sal_Bool*)rVal.getValue() );
    1157          28 :             break;
    1158             :         case MID_SURROUND_CONTOUR:
    1159          24 :             SetContour( *(sal_Bool*)rVal.getValue() );
    1160          24 :             break;
    1161             :         case MID_SURROUND_CONTOUROUTSIDE:
    1162          10 :             SetOutside( *(sal_Bool*)rVal.getValue() );
    1163          10 :             break;
    1164             :         default:
    1165             :             OSL_ENSURE( !this, "unknown MemberId" );
    1166           0 :             bRet = false;
    1167             :     }
    1168         222 :     return bRet;
    1169             : }
    1170             : 
    1171           0 : SvStream& SwFmtVertOrient::Store(SvStream &rStream, sal_uInt16 /*version*/) const
    1172             : {
    1173             : #if SAL_TYPES_SIZEOFLONG == 8
    1174             :     rStream.WriteInt64(nYPos);
    1175             : #else
    1176           0 :     rStream << static_cast<sal_Int32>(nYPos);
    1177             : #endif
    1178           0 :     rStream << eOrient << eRelation;
    1179           0 :     return rStream;
    1180             : }
    1181             : 
    1182           0 : SfxPoolItem* SwFmtVertOrient::Create(SvStream &rStream, sal_uInt16 /*itemVersion*/) const
    1183             : {
    1184           0 :     SwTwips yPos(0);
    1185           0 :     sal_Int16 orient(0);
    1186           0 :     sal_Int16 relation(0);
    1187             :     // compatibility hack for Table Auto Format: SwTwips is "long" :(
    1188             :     // (this means that the file format is platform dependent)
    1189             : #if SAL_TYPES_SIZEOFLONG == 8
    1190             :     rStream.ReadInt64(yPos);
    1191             : #else
    1192             :     sal_Int32 n;
    1193           0 :     rStream >> n;
    1194           0 :     yPos = n;
    1195             : #endif
    1196           0 :     rStream >> orient >> relation;
    1197             : 
    1198           0 :     return new SwFmtVertOrient(yPos, orient, relation);
    1199             : }
    1200             : 
    1201             : //  class SwFmtVertOrient
    1202             : //  Partially implemented inline in hxx
    1203             : 
    1204       79702 : SwFmtVertOrient::SwFmtVertOrient( SwTwips nY, sal_Int16 eVert,
    1205             :                                   sal_Int16 eRel )
    1206             :     : SfxPoolItem( RES_VERT_ORIENT ),
    1207             :     nYPos( nY ),
    1208             :     eOrient( eVert ),
    1209       79702 :     eRelation( eRel )
    1210       79702 : {}
    1211             : 
    1212        3533 : int  SwFmtVertOrient::operator==( const SfxPoolItem& rAttr ) const
    1213             : {
    1214             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "not the same attributes" );
    1215        5402 :     return ( nYPos     == ((SwFmtVertOrient&)rAttr).nYPos &&
    1216        5058 :              eOrient   == ((SwFmtVertOrient&)rAttr).eOrient &&
    1217        5058 :              eRelation == ((SwFmtVertOrient&)rAttr).eRelation );
    1218             : }
    1219             : 
    1220        1366 : SfxPoolItem*  SwFmtVertOrient::Clone( SfxItemPool* ) const
    1221             : {
    1222        1366 :     return new SwFmtVertOrient( nYPos, eOrient, eRelation );
    1223             : }
    1224             : 
    1225         226 : bool SwFmtVertOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1226             : {
    1227             :     // here we convert always!
    1228         226 :     nMemberId &= ~CONVERT_TWIPS;
    1229         226 :     bool bRet = true;
    1230         226 :     switch ( nMemberId )
    1231             :     {
    1232             :         case MID_VERTORIENT_ORIENT:
    1233             :         {
    1234          52 :             rVal <<= (sal_Int16)eOrient;
    1235             :         }
    1236          52 :         break;
    1237             :         case MID_VERTORIENT_RELATION:
    1238          36 :                 rVal <<= (sal_Int16)eRelation;
    1239          36 :         break;
    1240             :         case MID_VERTORIENT_POSITION:
    1241         138 :                 rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
    1242         138 :                 break;
    1243             :         default:
    1244             :             OSL_ENSURE( !this, "unknown MemberId" );
    1245           0 :             bRet = false;
    1246             :     }
    1247         226 :     return bRet;
    1248             : }
    1249             : 
    1250         531 : bool SwFmtVertOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1251             : {
    1252         531 :     bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
    1253         531 :     nMemberId &= ~CONVERT_TWIPS;
    1254         531 :     bool bRet = true;
    1255         531 :     switch ( nMemberId )
    1256             :     {
    1257             :         case MID_VERTORIENT_ORIENT:
    1258             :         {
    1259         233 :             sal_uInt16 nVal = text::VertOrientation::NONE;
    1260         233 :             rVal >>= nVal;
    1261         233 :             eOrient = nVal;
    1262             :         }
    1263         233 :         break;
    1264             :         case MID_VERTORIENT_RELATION:
    1265             :         {
    1266         180 :             eRelation = lcl_IntToRelation(rVal);
    1267             :         }
    1268         180 :         break;
    1269             :         case MID_VERTORIENT_POSITION:
    1270             :         {
    1271         118 :             sal_Int32 nVal = 0;
    1272         118 :             rVal >>= nVal;
    1273         118 :             if(bConvert)
    1274         118 :                 nVal = MM100_TO_TWIP(nVal);
    1275         118 :             SetPos( nVal );
    1276             :         }
    1277         118 :         break;
    1278             :         default:
    1279             :             OSL_ENSURE( !this, "unknown MemberId" );
    1280           0 :             bRet = false;
    1281             :     }
    1282         531 :     return bRet;
    1283             : }
    1284             : 
    1285             : 
    1286             : 
    1287             : //  class SwFmtHoriOrient
    1288             : //  Partially implemented inline in hxx
    1289             : 
    1290        2096 : SwFmtHoriOrient::SwFmtHoriOrient( SwTwips nX, sal_Int16 eHori,
    1291             :                               sal_Int16 eRel, sal_Bool bPos )
    1292             :     : SfxPoolItem( RES_HORI_ORIENT ),
    1293             :     nXPos( nX ),
    1294             :     eOrient( eHori ),
    1295             :     eRelation( eRel ),
    1296        2096 :     bPosToggle( bPos )
    1297        2096 : {}
    1298             : 
    1299        1878 : int  SwFmtHoriOrient::operator==( const SfxPoolItem& rAttr ) const
    1300             : {
    1301             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    1302        2821 :     return ( nXPos == ((SwFmtHoriOrient&)rAttr).nXPos &&
    1303        1596 :              eOrient == ((SwFmtHoriOrient&)rAttr).eOrient &&
    1304        2922 :              eRelation == ((SwFmtHoriOrient&)rAttr).eRelation &&
    1305        2269 :              bPosToggle == ((SwFmtHoriOrient&)rAttr).bPosToggle );
    1306             : }
    1307             : 
    1308        1203 : SfxPoolItem*  SwFmtHoriOrient::Clone( SfxItemPool* ) const
    1309             : {
    1310        1203 :     return new SwFmtHoriOrient( nXPos, eOrient, eRelation, bPosToggle );
    1311             : }
    1312             : 
    1313         190 : bool SwFmtHoriOrient::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1314             : {
    1315             :     // here we convert always!
    1316         190 :     nMemberId &= ~CONVERT_TWIPS;
    1317         190 :     bool bRet = true;
    1318         190 :     switch ( nMemberId )
    1319             :     {
    1320             :         case MID_HORIORIENT_ORIENT:
    1321             :         {
    1322          26 :             rVal <<= (sal_Int16)eOrient;
    1323             :         }
    1324          26 :         break;
    1325             :         case MID_HORIORIENT_RELATION:
    1326          16 :             rVal <<= (sal_Int16)eRelation;
    1327          16 :         break;
    1328             :         case MID_HORIORIENT_POSITION:
    1329         137 :                 rVal <<= (sal_Int32)TWIP_TO_MM100(GetPos());
    1330         137 :                 break;
    1331             :         case MID_HORIORIENT_PAGETOGGLE:
    1332             :         {
    1333          11 :             sal_Bool bTmp = IsPosToggle();
    1334          11 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    1335             :         }
    1336          11 :                 break;
    1337             :         default:
    1338             :             OSL_ENSURE( !this, "unknown MemberId" );
    1339           0 :             bRet = false;
    1340             :     }
    1341         190 :     return bRet;
    1342             : }
    1343             : 
    1344         534 : bool SwFmtHoriOrient::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1345             : {
    1346         534 :     bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
    1347         534 :     nMemberId &= ~CONVERT_TWIPS;
    1348         534 :     bool bRet = true;
    1349         534 :     switch ( nMemberId )
    1350             :     {
    1351             :         case MID_HORIORIENT_ORIENT:
    1352             :         {
    1353         217 :             sal_Int16 nVal = text::HoriOrientation::NONE;
    1354         217 :             rVal >>= nVal;
    1355         217 :             eOrient = nVal;
    1356             :         }
    1357         217 :         break;
    1358             :         case MID_HORIORIENT_RELATION:
    1359             :         {
    1360         146 :             eRelation = lcl_IntToRelation(rVal);
    1361             :         }
    1362         146 :         break;
    1363             :         case MID_HORIORIENT_POSITION:
    1364             :         {
    1365         118 :             sal_Int32 nVal = 0;
    1366         118 :             if(!(rVal >>= nVal))
    1367           0 :                 bRet = false;
    1368         118 :             if(bConvert)
    1369         118 :                 nVal = MM100_TO_TWIP(nVal);
    1370         118 :             SetPos( nVal );
    1371             :         }
    1372         118 :         break;
    1373             :         case MID_HORIORIENT_PAGETOGGLE:
    1374          53 :                 SetPosToggle( *(sal_Bool*)rVal.getValue());
    1375          53 :             break;
    1376             :         default:
    1377             :             OSL_ENSURE( !this, "unknown MemberId" );
    1378           0 :             bRet = false;
    1379             :     }
    1380         534 :     return bRet;
    1381             : }
    1382             : 
    1383             : 
    1384             : 
    1385             : //  class SwFmtAnchor
    1386             : //  Partially implemented inline in hxx
    1387             : 
    1388         917 : SwFmtAnchor::SwFmtAnchor( RndStdIds nRnd, sal_uInt16 nPage )
    1389             :     : SfxPoolItem( RES_ANCHOR ),
    1390             :     nAnchorId( nRnd ),
    1391             :     nPageNum( nPage ),
    1392             :     // OD 2004-05-05 #i28701# - get always new increased order number
    1393         917 :     mnOrder( ++mnOrderCounter )
    1394         917 : {}
    1395             : 
    1396        6046 : SwFmtAnchor::SwFmtAnchor( const SwFmtAnchor &rCpy )
    1397             :     : SfxPoolItem( RES_ANCHOR )
    1398        6046 :     , m_pCntntAnchor( (rCpy.GetCntntAnchor())
    1399        2593 :             ?  new SwPosition( *rCpy.GetCntntAnchor() ) : 0 )
    1400        6046 :     , nAnchorId( rCpy.GetAnchorId() )
    1401        6046 :     , nPageNum( rCpy.GetPageNum() )
    1402             :     // OD 2004-05-05 #i28701# - get always new increased order number
    1403       26777 :     , mnOrder( ++mnOrderCounter )
    1404             : {
    1405        6046 : }
    1406             : 
    1407       11456 : SwFmtAnchor::~SwFmtAnchor()
    1408             : {
    1409       11456 : }
    1410             : 
    1411        2040 : void SwFmtAnchor::SetAnchor( const SwPosition *pPos )
    1412             : {
    1413             :     // anchor only to paragraphs, or start nodes in case of FLY_AT_FLY
    1414             :     // also allow table node, this is used when a table is selected and is converted to a frame by the UI
    1415             :     assert(!pPos
    1416             :             || ((FLY_AT_FLY == nAnchorId) &&
    1417             :                     dynamic_cast<SwStartNode*>(&pPos->nNode.GetNode()))
    1418             :             || (FLY_AT_PARA == nAnchorId && dynamic_cast<SwTableNode*>(&pPos->nNode.GetNode()))
    1419             :             || dynamic_cast<SwTxtNode*>(&pPos->nNode.GetNode()));
    1420        2040 :     m_pCntntAnchor .reset( (pPos) ? new SwPosition( *pPos ) : 0 );
    1421             :     // Flys anchored AT paragraph should not point into the paragraph content
    1422        3578 :     if (m_pCntntAnchor &&
    1423        4615 :         ((FLY_AT_PARA == nAnchorId) || (FLY_AT_FLY == nAnchorId)))
    1424             :     {
    1425         167 :         m_pCntntAnchor->nContent.Assign( 0, 0 );
    1426             :     }
    1427        2040 : }
    1428             : 
    1429          11 : SwFmtAnchor& SwFmtAnchor::operator=(const SwFmtAnchor& rAnchor)
    1430             : {
    1431          11 :     nAnchorId  = rAnchor.GetAnchorId();
    1432          11 :     nPageNum   = rAnchor.GetPageNum();
    1433             :     // OD 2004-05-05 #i28701# - get always new increased order number
    1434          11 :     mnOrder = ++mnOrderCounter;
    1435             : 
    1436          11 :     m_pCntntAnchor.reset( (rAnchor.GetCntntAnchor())
    1437           0 :         ? new SwPosition(*(rAnchor.GetCntntAnchor()))
    1438          11 :         : 0 );
    1439          11 :     return *this;
    1440             : }
    1441             : 
    1442        1644 : int  SwFmtAnchor::operator==( const SfxPoolItem& rAttr ) const
    1443             : {
    1444             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    1445        1644 :     SwFmtAnchor const& rFmtAnchor(static_cast<SwFmtAnchor const&>(rAttr));
    1446             :     // OD 2004-05-05 #i28701# - Note: <mnOrder> hasn't to be considered.
    1447        3109 :     return ( nAnchorId == rFmtAnchor.GetAnchorId() &&
    1448        4027 :              nPageNum == rFmtAnchor.GetPageNum()   &&
    1449             :                 // compare anchor: either both do not point into a textnode or
    1450             :                 // both do (valid m_pCntntAnchor) and the positions are equal
    1451        2699 :              ((m_pCntntAnchor.get() == rFmtAnchor.m_pCntntAnchor.get()) ||
    1452        3403 :               (m_pCntntAnchor && rFmtAnchor.GetCntntAnchor() &&
    1453        2537 :                (*m_pCntntAnchor == *rFmtAnchor.GetCntntAnchor()))));
    1454             : }
    1455             : 
    1456        4452 : SfxPoolItem*  SwFmtAnchor::Clone( SfxItemPool* ) const
    1457             : {
    1458        4452 :     return new SwFmtAnchor( *this );
    1459             : }
    1460             : 
    1461             : // OD 2004-05-05 #i28701#
    1462             : sal_uInt32 SwFmtAnchor::mnOrderCounter = 0;
    1463             : 
    1464             : // OD 2004-05-05 #i28701#
    1465         211 : sal_uInt32 SwFmtAnchor::GetOrder() const
    1466             : {
    1467         211 :     return mnOrder;
    1468             : }
    1469             : 
    1470         290 : bool SwFmtAnchor::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1471             : {
    1472             :     // here we convert always!
    1473         290 :     nMemberId &= ~CONVERT_TWIPS;
    1474         290 :     bool bRet = true;
    1475         290 :     switch ( nMemberId )
    1476             :     {
    1477             :         case MID_ANCHOR_ANCHORTYPE:
    1478             : 
    1479             :             text::TextContentAnchorType eRet;
    1480         290 :             switch (GetAnchorId())
    1481             :             {
    1482             :                 case  FLY_AT_CHAR:
    1483         101 :                     eRet = text::TextContentAnchorType_AT_CHARACTER;
    1484         101 :                     break;
    1485             :                 case  FLY_AT_PAGE:
    1486          28 :                     eRet = text::TextContentAnchorType_AT_PAGE;
    1487          28 :                     break;
    1488             :                 case  FLY_AT_FLY:
    1489           0 :                     eRet = text::TextContentAnchorType_AT_FRAME;
    1490           0 :                     break;
    1491             :                 case  FLY_AS_CHAR:
    1492          96 :                     eRet = text::TextContentAnchorType_AS_CHARACTER;
    1493          96 :                     break;
    1494             :                 //case  FLY_AT_PARA:
    1495             :                 default:
    1496          65 :                     eRet = text::TextContentAnchorType_AT_PARAGRAPH;
    1497             :             }
    1498         290 :             rVal <<= eRet;
    1499         580 :         break;
    1500             :         case MID_ANCHOR_PAGENUM:
    1501           0 :             rVal <<= (sal_Int16)GetPageNum();
    1502           0 :         break;
    1503             :         case MID_ANCHOR_ANCHORFRAME:
    1504             :         {
    1505           0 :             if (m_pCntntAnchor && FLY_AT_FLY == nAnchorId)
    1506             :             {
    1507           0 :                 SwFrmFmt* pFmt = m_pCntntAnchor->nNode.GetNode().GetFlyFmt();
    1508           0 :                 if(pFmt)
    1509             :                 {
    1510           0 :                     uno::Reference<container::XNamed> xNamed = SwXFrames::GetObject( *pFmt, FLYCNTTYPE_FRM );
    1511           0 :                     uno::Reference<text::XTextFrame> xRet(xNamed, uno::UNO_QUERY);
    1512           0 :                     rVal <<= xRet;
    1513             :                 }
    1514             :             }
    1515             :         }
    1516           0 :         break;
    1517             :         default:
    1518             :             OSL_ENSURE( !this, "unknown MemberId" );
    1519           0 :             bRet = false;
    1520             :     }
    1521         290 :     return bRet;
    1522             : }
    1523             : 
    1524         393 : bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1525             : {
    1526             :     // here we convert always!
    1527         393 :     nMemberId &= ~CONVERT_TWIPS;
    1528         393 :     bool bRet = true;
    1529         393 :     switch ( nMemberId )
    1530             :     {
    1531             :         case MID_ANCHOR_ANCHORTYPE:
    1532             :         {
    1533             :             RndStdIds   eAnchor;
    1534         385 :             switch( SWUnoHelper::GetEnumAsInt32( rVal ) )
    1535             :             {
    1536             :                 case  text::TextContentAnchorType_AS_CHARACTER:
    1537         210 :                     eAnchor = FLY_AS_CHAR;
    1538         210 :                     break;
    1539             :                 case  text::TextContentAnchorType_AT_PAGE:
    1540          16 :                     eAnchor = FLY_AT_PAGE;
    1541          16 :                     if( GetPageNum() > 0 )
    1542             :                     {
    1543             :                         // If the anchor type is page and a valid page number
    1544             :                         // has been set, the content position isn't required
    1545             :                         // any longer.
    1546           1 :                         m_pCntntAnchor.reset();
    1547             :                     }
    1548          16 :                     break;
    1549             :                 case  text::TextContentAnchorType_AT_FRAME:
    1550           0 :                     eAnchor = FLY_AT_FLY;
    1551           0 :                     break;
    1552             :                 case  text::TextContentAnchorType_AT_CHARACTER:
    1553         101 :                     eAnchor = FLY_AT_CHAR;
    1554         101 :                     break;
    1555             :                 //case  text::TextContentAnchorType_AT_PARAGRAPH:
    1556             :                 default:
    1557          58 :                     eAnchor = FLY_AT_PARA;
    1558          58 :                     break;
    1559             :             }
    1560         385 :             SetType( eAnchor );
    1561             :         }
    1562         385 :         break;
    1563             :         case MID_ANCHOR_PAGENUM:
    1564             :         {
    1565           8 :             sal_Int16 nVal = 0;
    1566           8 :             if((rVal >>= nVal) && nVal > 0)
    1567             :             {
    1568           8 :                 SetPageNum( nVal );
    1569           8 :                 if (FLY_AT_PAGE == GetAnchorId())
    1570             :                 {
    1571             :                     // If the anchor type is page and a valid page number
    1572             :                     // is set, the content paoition has to be deleted to not
    1573             :                     // confuse the layout (frmtool.cxx). However, if the
    1574             :                     // anchor type is not page, any content position will
    1575             :                     // be kept.
    1576           7 :                     m_pCntntAnchor.reset();
    1577             :                 }
    1578             :             }
    1579             :             else
    1580           0 :                 bRet = false;
    1581             :         }
    1582           8 :         break;
    1583             :         case MID_ANCHOR_ANCHORFRAME:
    1584             :         //no break here!;
    1585             :         default:
    1586             :             OSL_ENSURE( !this, "unknown MemberId" );
    1587           0 :             bRet = false;
    1588             :     }
    1589         393 :     return bRet;
    1590             : }
    1591             : 
    1592             : //  class SwFmtURL
    1593             : //  Partially implemented inline in hxx
    1594             : 
    1595             : 
    1596          33 : SwFmtURL::SwFmtURL() :
    1597             :     SfxPoolItem( RES_URL ),
    1598             :     pMap( 0 ),
    1599          33 :     bIsServerMap( sal_False )
    1600             : {
    1601          33 : }
    1602             : 
    1603          21 : SwFmtURL::SwFmtURL( const SwFmtURL &rURL) :
    1604             :     SfxPoolItem( RES_URL ),
    1605          21 :     sTargetFrameName( rURL.GetTargetFrameName() ),
    1606          21 :     sURL( rURL.GetURL() ),
    1607          21 :     sName( rURL.GetName() ),
    1608          84 :     bIsServerMap( rURL.IsServerMap() )
    1609             : {
    1610          21 :     pMap = rURL.GetMap() ? new ImageMap( *rURL.GetMap() ) : 0;
    1611          21 : }
    1612             : 
    1613         144 : SwFmtURL::~SwFmtURL()
    1614             : {
    1615          54 :     delete pMap;
    1616          90 : }
    1617             : 
    1618           1 : int SwFmtURL::operator==( const SfxPoolItem &rAttr ) const
    1619             : {
    1620             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "not the same attributes" );
    1621           1 :     const SwFmtURL &rCmp = (SwFmtURL&)rAttr;
    1622           2 :     bool bRet = bIsServerMap     == rCmp.IsServerMap() &&
    1623           2 :                 sURL             == rCmp.GetURL() &&
    1624           3 :                 sTargetFrameName == rCmp.GetTargetFrameName() &&
    1625           2 :                 sName            == rCmp.GetName();
    1626           1 :     if ( bRet )
    1627             :     {
    1628           1 :         if ( pMap && rCmp.GetMap() )
    1629           1 :             bRet = *pMap == *rCmp.GetMap();
    1630             :         else
    1631           0 :             bRet = pMap == rCmp.GetMap();
    1632             :     }
    1633           1 :     return bRet;
    1634             : }
    1635             : 
    1636           3 : SfxPoolItem* SwFmtURL::Clone( SfxItemPool* ) const
    1637             : {
    1638           3 :     return new SwFmtURL( *this );
    1639             : }
    1640             : 
    1641           0 : void SwFmtURL::SetURL(const OUString &rURL, bool bServerMap)
    1642             : {
    1643           0 :     sURL = rURL;
    1644           0 :     bIsServerMap = bServerMap;
    1645           0 : }
    1646             : 
    1647           0 : void SwFmtURL::SetMap( const ImageMap *pM )
    1648             : {
    1649           0 :     delete pMap;
    1650           0 :     pMap = pM ? new ImageMap( *pM ) : 0;
    1651           0 : }
    1652             : 
    1653             : extern const SvEventDescription* sw_GetSupportedMacroItems();
    1654             : 
    1655          12 : bool SwFmtURL::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1656             : {
    1657             :     // here we convert always!
    1658          12 :     nMemberId &= ~CONVERT_TWIPS;
    1659          12 :     bool bRet = true;
    1660          12 :     switch ( nMemberId )
    1661             :     {
    1662             :         case MID_URL_URL:
    1663             :         {
    1664           0 :             OUString sRet = GetURL();
    1665           0 :             rVal <<= sRet;
    1666             :         }
    1667           0 :         break;
    1668             :         case MID_URL_TARGET:
    1669             :         {
    1670           0 :             OUString sRet = GetTargetFrameName();
    1671           0 :             rVal <<= sRet;
    1672             :         }
    1673           0 :         break;
    1674             :         case MID_URL_HYPERLINKNAME:
    1675           0 :             rVal <<= OUString( GetName() );
    1676           0 :             break;
    1677             :         case MID_URL_CLIENTMAP:
    1678             :         {
    1679          12 :             uno::Reference< uno::XInterface > xInt;
    1680          12 :             if(pMap)
    1681             :             {
    1682           1 :                 xInt = SvUnoImageMap_createInstance( *pMap, sw_GetSupportedMacroItems() );
    1683             :             }
    1684             :             else
    1685             :             {
    1686          11 :                 ImageMap aEmptyMap;
    1687          11 :                 xInt = SvUnoImageMap_createInstance( aEmptyMap, sw_GetSupportedMacroItems() );
    1688             :             }
    1689          24 :             uno::Reference< container::XIndexContainer > xCont(xInt, uno::UNO_QUERY);
    1690          24 :             rVal <<= xCont;
    1691             :         }
    1692          12 :         break;
    1693             :         case MID_URL_SERVERMAP:
    1694             :         {
    1695           0 :             sal_Bool bTmp = IsServerMap();
    1696           0 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    1697             :         }
    1698           0 :             break;
    1699             :         default:
    1700             :             OSL_ENSURE( !this, "unknown MemberId" );
    1701           0 :             bRet = false;
    1702             :     }
    1703          12 :     return bRet;
    1704             : }
    1705             : 
    1706           1 : bool SwFmtURL::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1707             : {
    1708             :     // here we convert always!
    1709           1 :     nMemberId &= ~CONVERT_TWIPS;
    1710           1 :     bool bRet = true;
    1711           1 :     switch ( nMemberId )
    1712             :     {
    1713             :         case MID_URL_URL:
    1714             :         {
    1715           0 :             OUString sTmp;
    1716           0 :             rVal >>= sTmp;
    1717           0 :             SetURL( sTmp, bIsServerMap );
    1718             :         }
    1719           0 :         break;
    1720             :         case MID_URL_TARGET:
    1721             :         {
    1722           0 :             OUString sTmp;
    1723           0 :             rVal >>= sTmp;
    1724           0 :             SetTargetFrameName( sTmp );
    1725             :         }
    1726           0 :         break;
    1727             :         case MID_URL_HYPERLINKNAME:
    1728             :         {
    1729           0 :             OUString sTmp;
    1730           0 :             rVal >>= sTmp;
    1731           0 :             SetName( sTmp );
    1732             :         }
    1733           0 :         break;
    1734             :         case MID_URL_CLIENTMAP:
    1735             :         {
    1736           1 :             uno::Reference<container::XIndexContainer> xCont;
    1737           1 :             if(!rVal.hasValue())
    1738           0 :                 DELETEZ(pMap);
    1739           1 :             else if(rVal >>= xCont)
    1740             :             {
    1741           1 :                 if(!pMap)
    1742           1 :                     pMap = new ImageMap;
    1743           1 :                 bRet = SvUnoImageMap_fillImageMap( xCont, *pMap );
    1744             :             }
    1745             :             else
    1746           0 :                 bRet = false;
    1747             :         }
    1748           1 :         break;
    1749             :         case MID_URL_SERVERMAP:
    1750           0 :             bIsServerMap = *(sal_Bool*)rVal.getValue();
    1751           0 :             break;
    1752             :         default:
    1753             :             OSL_ENSURE( !this, "unknown MemberId" );
    1754           0 :             bRet = false;
    1755             :     }
    1756           1 :     return bRet;
    1757             : }
    1758             : 
    1759             : 
    1760             : // class SwNoReadOnly
    1761             : 
    1762          27 : SfxPoolItem* SwFmtEditInReadonly::Clone( SfxItemPool* ) const
    1763             : {
    1764          27 :     return new SwFmtEditInReadonly( Which(), GetValue() );
    1765             : }
    1766             : 
    1767             : // class SwFmtLayoutSplit
    1768             : 
    1769           3 : SfxPoolItem* SwFmtLayoutSplit::Clone( SfxItemPool* ) const
    1770             : {
    1771           3 :     return new SwFmtLayoutSplit( GetValue() );
    1772             : }
    1773             : 
    1774             : // class SwFmtRowSplit
    1775             : 
    1776         409 : SfxPoolItem* SwFmtRowSplit::Clone( SfxItemPool* ) const
    1777             : {
    1778         409 :     return new SwFmtRowSplit( GetValue() );
    1779             : }
    1780             : 
    1781             : 
    1782             : // class SwFmtNoBalancedColumns
    1783             : 
    1784           5 : SfxPoolItem* SwFmtNoBalancedColumns::Clone( SfxItemPool* ) const
    1785             : {
    1786           5 :     return new SwFmtNoBalancedColumns( GetValue() );
    1787             : }
    1788             : 
    1789             : // class SwFmtFtnEndAtTxtEnd
    1790             : 
    1791           0 : sal_uInt16 SwFmtFtnEndAtTxtEnd::GetValueCount() const
    1792             : {
    1793           0 :     return sal_uInt16( FTNEND_ATTXTEND_END );
    1794             : }
    1795             : 
    1796          54 : SwFmtFtnEndAtTxtEnd& SwFmtFtnEndAtTxtEnd::operator=(
    1797             :                         const SwFmtFtnEndAtTxtEnd& rAttr )
    1798             : {
    1799          54 :     SfxEnumItem::SetValue( rAttr.GetValue() );
    1800          54 :     aFmt = rAttr.aFmt;
    1801          54 :     nOffset = rAttr.nOffset;
    1802          54 :     sPrefix = rAttr.sPrefix;
    1803          54 :     sSuffix = rAttr.sSuffix;
    1804          54 :     return *this;
    1805             : }
    1806             : 
    1807         111 : int SwFmtFtnEndAtTxtEnd::operator==( const SfxPoolItem& rItem ) const
    1808             : {
    1809         111 :     const SwFmtFtnEndAtTxtEnd& rAttr = (SwFmtFtnEndAtTxtEnd&)rItem;
    1810         158 :     return SfxEnumItem::operator==( rAttr ) &&
    1811          89 :             aFmt.GetNumberingType() == rAttr.aFmt.GetNumberingType() &&
    1812          68 :             nOffset == rAttr.nOffset &&
    1813         150 :             sPrefix == rAttr.sPrefix &&
    1814         124 :             sSuffix == rAttr.sSuffix;
    1815             : }
    1816             : 
    1817          66 : bool SwFmtFtnEndAtTxtEnd::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1818             : {
    1819          66 :     nMemberId &= ~CONVERT_TWIPS;
    1820          66 :     switch(nMemberId)
    1821             :     {
    1822             :         case MID_COLLECT     :
    1823             :         {
    1824          10 :             sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND;
    1825          10 :             rVal.setValue(&bVal, ::getBooleanCppuType());
    1826             :         }
    1827          10 :         break;
    1828             :         case MID_RESTART_NUM :
    1829             :         {
    1830          10 :             sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ;
    1831          10 :             rVal.setValue(&bVal, ::getBooleanCppuType());
    1832             :         }
    1833          10 :         break;
    1834          10 :         case MID_NUM_START_AT: rVal <<= (sal_Int16) nOffset; break;
    1835             :         case MID_OWN_NUM     :
    1836             :         {
    1837          10 :             sal_Bool bVal = GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT;
    1838          10 :             rVal.setValue(&bVal, ::getBooleanCppuType());
    1839             :         }
    1840          10 :         break;
    1841           6 :         case MID_NUM_TYPE    : rVal <<= aFmt.GetNumberingType(); break;
    1842          10 :         case MID_PREFIX      : rVal <<= OUString(sPrefix); break;
    1843          10 :         case MID_SUFFIX      : rVal <<= OUString(sSuffix); break;
    1844           0 :         default: return sal_False;
    1845             :     }
    1846          66 :     return true;
    1847             : }
    1848             : 
    1849          27 : bool SwFmtFtnEndAtTxtEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    1850             : {
    1851          27 :     bool bRet = true;
    1852          27 :     nMemberId &= ~CONVERT_TWIPS;
    1853          27 :     switch(nMemberId)
    1854             :     {
    1855             :         case MID_COLLECT     :
    1856             :         {
    1857           4 :             sal_Bool bVal = *(sal_Bool*)rVal.getValue();
    1858           4 :             if(!bVal && GetValue() >= FTNEND_ATTXTEND)
    1859           3 :                 SetValue(FTNEND_ATPGORDOCEND);
    1860           1 :             else if(bVal && GetValue() < FTNEND_ATTXTEND)
    1861           1 :                 SetValue(FTNEND_ATTXTEND);
    1862             :         }
    1863           4 :         break;
    1864             :         case MID_RESTART_NUM :
    1865             :         {
    1866           4 :             sal_Bool bVal = *(sal_Bool*)rVal.getValue();
    1867           4 :             if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMSEQ)
    1868           2 :                 SetValue(FTNEND_ATTXTEND);
    1869           2 :             else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMSEQ)
    1870           2 :                 SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
    1871             :         }
    1872           4 :         break;
    1873             :         case MID_NUM_START_AT:
    1874             :         {
    1875           4 :             sal_Int16 nVal = 0;
    1876           4 :             rVal >>= nVal;
    1877           4 :             if(nVal >= 0)
    1878           4 :                 nOffset = nVal;
    1879             :             else
    1880           0 :                 bRet = false;
    1881             :         }
    1882           4 :         break;
    1883             :         case MID_OWN_NUM     :
    1884             :         {
    1885           4 :             sal_Bool bVal = *(sal_Bool*)rVal.getValue();
    1886           4 :             if(!bVal && GetValue() >= FTNEND_ATTXTEND_OWNNUMANDFMT)
    1887           0 :                 SetValue(FTNEND_ATTXTEND_OWNNUMSEQ);
    1888           4 :             else if(bVal && GetValue() < FTNEND_ATTXTEND_OWNNUMANDFMT)
    1889           4 :                 SetValue(FTNEND_ATTXTEND_OWNNUMANDFMT);
    1890             :         }
    1891           4 :         break;
    1892             :         case MID_NUM_TYPE    :
    1893             :         {
    1894           3 :             sal_Int16 nVal = 0;
    1895           3 :             rVal >>= nVal;
    1896           6 :             if(nVal >= 0 &&
    1897           5 :                 (nVal <= SVX_NUM_ARABIC ||
    1898           4 :                     SVX_NUM_CHARS_UPPER_LETTER_N == nVal ||
    1899           2 :                         SVX_NUM_CHARS_LOWER_LETTER_N == nVal ))
    1900           1 :                 aFmt.SetNumberingType(nVal);
    1901             :             else
    1902           2 :                 bRet = false;
    1903             :         }
    1904           3 :         break;
    1905             :         case MID_PREFIX      :
    1906             :         {
    1907           4 :             OUString sVal; rVal >>= sVal;
    1908           4 :             sPrefix = sVal;
    1909             :         }
    1910           4 :         break;
    1911             :         case MID_SUFFIX      :
    1912             :         {
    1913           4 :             OUString sVal; rVal >>= sVal;
    1914           4 :             sSuffix = sVal;
    1915             :         }
    1916           4 :         break;
    1917           0 :         default: bRet = false;
    1918             :     }
    1919          27 :     return bRet;
    1920             : }
    1921             : 
    1922             : 
    1923             : // class SwFmtFtnAtTxtEnd
    1924             : 
    1925          26 : SfxPoolItem* SwFmtFtnAtTxtEnd::Clone( SfxItemPool* ) const
    1926             : {
    1927          26 :     SwFmtFtnAtTxtEnd* pNew = new SwFmtFtnAtTxtEnd;
    1928          26 :     *pNew = *this;
    1929          26 :     return pNew;
    1930             : }
    1931             : 
    1932             : // class SwFmtEndAtTxtEnd
    1933             : 
    1934          28 : SfxPoolItem* SwFmtEndAtTxtEnd::Clone( SfxItemPool* ) const
    1935             : {
    1936          28 :     SwFmtEndAtTxtEnd* pNew = new SwFmtEndAtTxtEnd;
    1937          28 :     *pNew = *this;
    1938          28 :     return pNew;
    1939             : }
    1940             : 
    1941             : //class SwFmtChain
    1942             : 
    1943             : 
    1944           0 : int SwFmtChain::operator==( const SfxPoolItem &rAttr ) const
    1945             : {
    1946             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    1947             : 
    1948           0 :     return GetPrev() == ((SwFmtChain&)rAttr).GetPrev() &&
    1949           0 :            GetNext() == ((SwFmtChain&)rAttr).GetNext();
    1950             : }
    1951             : 
    1952           0 : SwFmtChain::SwFmtChain( const SwFmtChain &rCpy ) :
    1953           0 :     SfxPoolItem( RES_CHAIN )
    1954             : {
    1955           0 :     SetPrev( rCpy.GetPrev() );
    1956           0 :     SetNext( rCpy.GetNext() );
    1957           0 : }
    1958             : 
    1959           1 : SfxPoolItem* SwFmtChain::Clone( SfxItemPool* ) const
    1960             : {
    1961           1 :     SwFmtChain *pRet = new SwFmtChain;
    1962           1 :     pRet->SetPrev( GetPrev() );
    1963           1 :     pRet->SetNext( GetNext() );
    1964           1 :     return pRet;
    1965             : }
    1966             : 
    1967           1 : void SwFmtChain::SetPrev( SwFlyFrmFmt *pFmt )
    1968             : {
    1969           1 :     if ( pFmt )
    1970           0 :         pFmt->Add( &aPrev );
    1971           1 :     else if ( aPrev.GetRegisteredIn() )
    1972           0 :         ((SwModify*)aPrev.GetRegisteredIn())->Remove( &aPrev );
    1973           1 : }
    1974             : 
    1975           1 : void SwFmtChain::SetNext( SwFlyFrmFmt *pFmt )
    1976             : {
    1977           1 :     if ( pFmt )
    1978           0 :         pFmt->Add( &aNext );
    1979           1 :     else if ( aNext.GetRegisteredIn() )
    1980           0 :         ((SwModify*)aNext.GetRegisteredIn())->Remove( &aNext );
    1981           1 : }
    1982             : 
    1983           2 : bool SwFmtChain::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    1984             : {
    1985             :     // here we convert always!
    1986           2 :     nMemberId &= ~CONVERT_TWIPS;
    1987           2 :     bool   bRet = true;
    1988           2 :     OUString aRet;
    1989           2 :     switch ( nMemberId )
    1990             :     {
    1991             :         case MID_CHAIN_PREVNAME:
    1992           0 :             if ( GetPrev() )
    1993           0 :                 aRet = GetPrev()->GetName();
    1994           0 :             break;
    1995             :         case MID_CHAIN_NEXTNAME:
    1996           2 :             if ( GetNext() )
    1997           0 :                 aRet = GetNext()->GetName();
    1998           2 :             break;
    1999             :         default:
    2000             :             OSL_ENSURE( !this, "unknown MemberId" );
    2001           0 :             bRet = false;
    2002             :     }
    2003           2 :     rVal <<= aRet;
    2004           2 :     return bRet;
    2005             : }
    2006             : 
    2007             : 
    2008             : 
    2009             : 
    2010             : //class SwFmtLineNumber
    2011             : 
    2012        2070 : SwFmtLineNumber::SwFmtLineNumber() :
    2013        2070 :     SfxPoolItem( RES_LINENUMBER )
    2014             : {
    2015        2070 :     nStartValue = 0;
    2016        2070 :     bCountLines = sal_True;
    2017        2070 : }
    2018             : 
    2019        4863 : SwFmtLineNumber::~SwFmtLineNumber()
    2020             : {
    2021        4863 : }
    2022             : 
    2023        3990 : int SwFmtLineNumber::operator==( const SfxPoolItem &rAttr ) const
    2024             : {
    2025             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    2026             : 
    2027        7978 :     return nStartValue  == ((SwFmtLineNumber&)rAttr).GetStartValue() &&
    2028        7978 :            bCountLines  == ((SwFmtLineNumber&)rAttr).IsCount();
    2029             : }
    2030             : 
    2031        1382 : SfxPoolItem* SwFmtLineNumber::Clone( SfxItemPool* ) const
    2032             : {
    2033        1382 :     return new SwFmtLineNumber( *this );
    2034             : }
    2035             : 
    2036          92 : bool SwFmtLineNumber::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    2037             : {
    2038             :     // here we convert always!
    2039          92 :     nMemberId &= ~CONVERT_TWIPS;
    2040          92 :     bool bRet = true;
    2041          92 :     switch ( nMemberId )
    2042             :     {
    2043             :         case MID_LINENUMBER_COUNT:
    2044             :         {
    2045          45 :             sal_Bool bTmp = IsCount();
    2046          45 :             rVal.setValue(&bTmp, ::getBooleanCppuType());
    2047             :         }
    2048          45 :         break;
    2049             :         case MID_LINENUMBER_STARTVALUE:
    2050          47 :             rVal <<= (sal_Int32)GetStartValue();
    2051          47 :             break;
    2052             :         default:
    2053             :             OSL_ENSURE( !this, "unknown MemberId" );
    2054           0 :             bRet = false;
    2055             :     }
    2056          92 :     return bRet;
    2057             : }
    2058             : 
    2059         431 : bool SwFmtLineNumber::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    2060             : {
    2061             :     // here we convert always!
    2062         431 :     nMemberId &= ~CONVERT_TWIPS;
    2063         431 :     bool bRet = true;
    2064         431 :     switch ( nMemberId )
    2065             :     {
    2066             :         case MID_LINENUMBER_COUNT:
    2067         293 :             SetCountLines( *(sal_Bool*)rVal.getValue() );
    2068         293 :             break;
    2069             :         case MID_LINENUMBER_STARTVALUE:
    2070             :         {
    2071         138 :             sal_Int32 nVal = 0;
    2072         138 :             if(rVal >>= nVal)
    2073         138 :                 SetStartValue( nVal );
    2074             :             else
    2075           0 :                 bRet = false;
    2076             :         }
    2077         138 :         break;
    2078             :         default:
    2079             :             OSL_ENSURE( !this, "unknown MemberId" );
    2080           0 :             bRet = false;
    2081             :     }
    2082         431 :     return bRet;
    2083             : }
    2084             : 
    2085             : /*************************************************************************
    2086             :  *    class SwTextGridItem
    2087             :  *************************************************************************/
    2088             : 
    2089          91 : SwTextGridItem::SwTextGridItem()
    2090             :     : SfxPoolItem( RES_TEXTGRID ), aColor( COL_LIGHTGRAY ), nLines( 20 ),
    2091             :       nBaseHeight( 400 ), nRubyHeight( 200 ), eGridType( GRID_NONE ),
    2092             :       bRubyTextBelow( 0 ), bPrintGrid( 1 ), bDisplayGrid( 1 ),
    2093          91 :       nBaseWidth(400), bSnapToChars( 1 ), bSquaredMode(1)
    2094             : {
    2095          91 : }
    2096             : 
    2097       13872 : SwTextGridItem::~SwTextGridItem()
    2098             : {
    2099       13872 : }
    2100             : 
    2101       11009 : int SwTextGridItem::operator==( const SfxPoolItem& rAttr ) const
    2102             : {
    2103             :     OSL_ENSURE( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
    2104       22012 :     return eGridType == ((SwTextGridItem&)rAttr).GetGridType() &&
    2105       16952 :            nLines == ((SwTextGridItem&)rAttr).GetLines() &&
    2106       10860 :            nBaseHeight == ((SwTextGridItem&)rAttr).GetBaseHeight() &&
    2107        9528 :            nRubyHeight == ((SwTextGridItem&)rAttr).GetRubyHeight() &&
    2108        9234 :            bRubyTextBelow == ((SwTextGridItem&)rAttr).GetRubyTextBelow() &&
    2109        8476 :            bDisplayGrid == ((SwTextGridItem&)rAttr).GetDisplayGrid() &&
    2110        6947 :            bPrintGrid == ((SwTextGridItem&)rAttr).GetPrintGrid() &&
    2111        6176 :            aColor == ((SwTextGridItem&)rAttr).GetColor() &&
    2112        6168 :            nBaseWidth == ((SwTextGridItem&)rAttr).GetBaseWidth() &&
    2113       17169 :            bSnapToChars == ((SwTextGridItem&)rAttr).GetSnapToChars() &&
    2114       14089 :            bSquaredMode == ((SwTextGridItem&)rAttr).GetSquaredMode();
    2115             : }
    2116             : 
    2117        6477 : SfxPoolItem* SwTextGridItem::Clone( SfxItemPool* ) const
    2118             : {
    2119        6477 :     return new SwTextGridItem( *this );
    2120             : }
    2121             : 
    2122           0 : SwTextGridItem& SwTextGridItem::operator=( const SwTextGridItem& rCpy )
    2123             : {
    2124           0 :     aColor = rCpy.GetColor();
    2125           0 :     nLines = rCpy.GetLines();
    2126           0 :     nBaseHeight = rCpy.GetBaseHeight();
    2127           0 :     nRubyHeight = rCpy.GetRubyHeight();
    2128           0 :     eGridType = rCpy.GetGridType();
    2129           0 :     bRubyTextBelow = rCpy.GetRubyTextBelow();
    2130           0 :     bPrintGrid = rCpy.GetPrintGrid();
    2131           0 :     bDisplayGrid = rCpy.GetDisplayGrid();
    2132           0 :     nBaseWidth = rCpy.GetBaseWidth();
    2133           0 :     bSnapToChars = rCpy.GetSnapToChars();
    2134           0 :     bSquaredMode = rCpy.GetSquaredMode();
    2135             : 
    2136           0 :     return *this;
    2137             : }
    2138             : 
    2139         115 : bool SwTextGridItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
    2140             : {
    2141         115 :     bool bRet = true;
    2142             : 
    2143         115 :     switch( nMemberId & ~CONVERT_TWIPS )
    2144             :     {
    2145             :         case MID_GRID_COLOR:
    2146           9 :             rVal <<= GetColor().GetColor();
    2147           9 :             break;
    2148             :         case MID_GRID_LINES:
    2149           9 :             rVal <<= GetLines();
    2150           9 :             break;
    2151             :         case MID_GRID_RUBY_BELOW:
    2152           9 :             rVal.setValue( &bRubyTextBelow, ::getBooleanCppuType() );
    2153           9 :             break;
    2154             :         case MID_GRID_PRINT:
    2155           9 :             rVal.setValue( &bPrintGrid, ::getBooleanCppuType() );
    2156           9 :             break;
    2157             :         case MID_GRID_DISPLAY:
    2158           9 :             rVal.setValue( &bDisplayGrid, ::getBooleanCppuType() );
    2159           9 :             break;
    2160             :         case MID_GRID_BASEHEIGHT:
    2161             :             OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
    2162             :                         "This value needs TWIPS-MM100 conversion" );
    2163           9 :             rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(nBaseHeight);
    2164           9 :             break;
    2165             :         case MID_GRID_BASEWIDTH:
    2166             :             OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
    2167             :                         "This value needs TWIPS-MM100 conversion" );
    2168           9 :             rVal <<= (sal_Int32) TWIP_TO_MM100_UNSIGNED(nBaseWidth);
    2169           9 :             break;
    2170             :         case MID_GRID_RUBYHEIGHT:
    2171             :             OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
    2172             :                         "This value needs TWIPS-MM100 conversion" );
    2173           9 :             rVal <<= (sal_Int32)TWIP_TO_MM100_UNSIGNED(nRubyHeight);
    2174           9 :             break;
    2175             :         case MID_GRID_TYPE:
    2176           9 :             switch( GetGridType() )
    2177             :             {
    2178             :                 case GRID_NONE:
    2179           9 :                     rVal <<= text::TextGridMode::NONE;
    2180           9 :                     break;
    2181             :                 case GRID_LINES_ONLY:
    2182           0 :                     rVal <<= text::TextGridMode::LINES;
    2183           0 :                     break;
    2184             :                 case GRID_LINES_CHARS:
    2185           0 :                     rVal <<= text::TextGridMode::LINES_AND_CHARS;
    2186           0 :                     break;
    2187             :                 default:
    2188             :                     OSL_FAIL("unknown SwTextGrid value");
    2189           0 :                     bRet = false;
    2190           0 :                     break;
    2191             :             }
    2192           9 :             break;
    2193             :         case MID_GRID_SNAPTOCHARS:
    2194           9 :             rVal.setValue( &bSnapToChars, ::getBooleanCppuType() );
    2195           9 :             break;
    2196             :         case MID_GRID_STANDARD_MODE:
    2197             :             {
    2198          25 :                 sal_Bool bStandardMode = !bSquaredMode;
    2199          25 :                 rVal.setValue( &bStandardMode, ::getBooleanCppuType() );
    2200             :             }
    2201          25 :             break;
    2202             :         default:
    2203             :             OSL_FAIL("Unknown SwTextGridItem member");
    2204           0 :             bRet = false;
    2205           0 :             break;
    2206             :     }
    2207             : 
    2208         115 :     return bRet;
    2209             : }
    2210             : 
    2211        2690 : bool SwTextGridItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
    2212             : {
    2213        2690 :     bool bRet = true;
    2214        2690 :     switch( nMemberId & ~CONVERT_TWIPS )
    2215             :     {
    2216             :         case MID_GRID_COLOR:
    2217             :         {
    2218          15 :             sal_Int32 nTmp = 0;
    2219          15 :             bRet = (rVal >>= nTmp);
    2220          15 :             if( bRet )
    2221          15 :                 SetColor( Color(nTmp) );
    2222             :         }
    2223          15 :         break;
    2224             :         case MID_GRID_LINES:
    2225             :         {
    2226         380 :             sal_Int16 nTmp = 0;
    2227         380 :             bRet = (rVal >>= nTmp);
    2228         380 :             if( bRet && (nTmp >= 0) )
    2229         380 :                 SetLines( (sal_uInt16)nTmp );
    2230             :             else
    2231           0 :                 bRet = false;
    2232             :         }
    2233         380 :         break;
    2234             :         case MID_GRID_RUBY_BELOW:
    2235          15 :             SetRubyTextBelow( *(sal_Bool*)rVal.getValue() );
    2236          15 :             break;
    2237             :         case MID_GRID_PRINT:
    2238         380 :             SetPrintGrid( *(sal_Bool*)rVal.getValue() );
    2239         380 :             break;
    2240             :         case MID_GRID_DISPLAY:
    2241         380 :             SetDisplayGrid( *(sal_Bool*)rVal.getValue() );
    2242         380 :             break;
    2243             :         case MID_GRID_BASEHEIGHT:
    2244             :         case MID_GRID_BASEWIDTH:
    2245             :         case MID_GRID_RUBYHEIGHT:
    2246             :         {
    2247             :             OSL_ENSURE( (nMemberId & CONVERT_TWIPS) != 0,
    2248             :                         "This value needs TWIPS-MM100 conversion" );
    2249         764 :             sal_Int32 nTmp = 0;
    2250         764 :             bRet = (rVal >>= nTmp);
    2251         764 :             nTmp = MM100_TO_TWIP( nTmp );
    2252         764 :             if( bRet && (nTmp >= 0) && ( nTmp <= USHRT_MAX) )
    2253        1528 :                 if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEHEIGHT )
    2254         380 :                     SetBaseHeight( (sal_uInt16)nTmp );
    2255         384 :                 else if( (nMemberId & ~CONVERT_TWIPS) == MID_GRID_BASEWIDTH )
    2256           4 :                     SetBaseWidth( (sal_uInt16)nTmp );
    2257             :                 else
    2258         380 :                     SetRubyHeight( (sal_uInt16)nTmp );
    2259             :             else
    2260           0 :                 bRet = false;
    2261             :         }
    2262         764 :         break;
    2263             :         case MID_GRID_TYPE:
    2264             :         {
    2265         380 :             sal_Int16 nTmp = 0;
    2266         380 :             bRet = (rVal >>= nTmp);
    2267         380 :             if( bRet )
    2268             :             {
    2269         380 :                 switch( nTmp )
    2270             :                 {
    2271             :                     case text::TextGridMode::NONE:
    2272         380 :                         SetGridType( GRID_NONE );
    2273         380 :                         break;
    2274             :                     case text::TextGridMode::LINES:
    2275           0 :                         SetGridType( GRID_LINES_ONLY );
    2276           0 :                         break;
    2277             :                     case text::TextGridMode::LINES_AND_CHARS:
    2278           0 :                         SetGridType( GRID_LINES_CHARS );
    2279           0 :                         break;
    2280             :                     default:
    2281           0 :                         bRet = false;
    2282           0 :                         break;
    2283             :                 }
    2284             :             }
    2285         380 :             break;
    2286             :         }
    2287             :         case MID_GRID_SNAPTOCHARS:
    2288           8 :             SetSnapToChars( *(sal_Bool*)rVal.getValue() );
    2289           8 :             break;
    2290             :         case MID_GRID_STANDARD_MODE:
    2291             :         {
    2292         368 :             sal_Bool bStandard = *(sal_Bool*)rVal.getValue();
    2293         368 :                SetSquaredMode( !bStandard );
    2294         368 :             break;
    2295             :         }
    2296             :         default:
    2297             :             OSL_FAIL("Unknown SwTextGridItem member");
    2298           0 :             bRet = false;
    2299             :     }
    2300             : 
    2301        2690 :     return bRet;
    2302             : }
    2303             : 
    2304         406 : void SwTextGridItem::SwitchPaperMode(sal_Bool bNew)
    2305             : {
    2306         406 :     if( bNew == bSquaredMode )
    2307             :     {
    2308             :         //same paper mode, not switch
    2309         406 :         return;
    2310             :     }
    2311             : 
    2312             :     // use default value when grid is disable
    2313           0 :     if( eGridType == GRID_NONE )
    2314             :     {
    2315           0 :         bSquaredMode = bNew;
    2316           0 :         Init();
    2317           0 :         return;
    2318             :     }
    2319             : 
    2320           0 :     if( bSquaredMode )
    2321             :     {
    2322             :         //switch from "squared mode" to "standard mode"
    2323           0 :         nBaseWidth = nBaseHeight;
    2324           0 :         nBaseHeight = nBaseHeight + nRubyHeight;
    2325           0 :         nRubyHeight = 0;
    2326             :     }
    2327             :     else
    2328             :     {
    2329             :         //switch from "standard mode" to "squared mode"
    2330           0 :         nRubyHeight = nBaseHeight/3;
    2331           0 :         nBaseHeight = nBaseHeight - nRubyHeight;
    2332           0 :         nBaseWidth = nBaseHeight;
    2333             :     }
    2334           0 :     bSquaredMode = !bSquaredMode;
    2335             : }
    2336             : 
    2337         388 : void SwTextGridItem::Init()
    2338             : {
    2339         388 :     if( bSquaredMode )
    2340             :     {
    2341           0 :         nLines = 20;
    2342           0 :         nBaseHeight = 400;
    2343           0 :         nRubyHeight = 200;
    2344           0 :         eGridType = GRID_NONE;
    2345           0 :         bRubyTextBelow = 0;
    2346           0 :         bPrintGrid = 1;
    2347           0 :         bDisplayGrid = 1;
    2348           0 :         bSnapToChars = 1;
    2349           0 :         nBaseWidth = 400;
    2350             :     }
    2351             :     else
    2352             :     {
    2353         388 :         nLines = 44;
    2354         388 :         nBaseHeight = 312;
    2355         388 :         nRubyHeight = 0;
    2356         388 :         eGridType = GRID_NONE;
    2357         388 :         bRubyTextBelow = 0;
    2358         388 :         bPrintGrid = 1;
    2359         388 :         bDisplayGrid = 1;
    2360         388 :         nBaseWidth = 210;
    2361         388 :         bSnapToChars = 1;
    2362             : 
    2363             :         //default grid type is line only in CJK env
    2364             :         //disable this function due to type area change
    2365             :         //if grid type change.
    2366             :         //if(SvtCJKOptions().IsAsianTypographyEnabled())
    2367             :         //{
    2368             :         //  bDisplayGrid = 0;
    2369             :         //  eGridType = GRID_LINES_ONLY;
    2370             :         //}
    2371             :     }
    2372         388 : }
    2373             : // class SwHeaderAndFooterEatSpacingItem
    2374             : 
    2375         105 : SfxPoolItem* SwHeaderAndFooterEatSpacingItem::Clone( SfxItemPool* ) const
    2376             : {
    2377         105 :     return new SwHeaderAndFooterEatSpacingItem( Which(), GetValue() );
    2378             : }
    2379             : 
    2380             : 
    2381             : //  class SwFrmFmt
    2382             : //  Partially implemented inline in hxx
    2383             : 
    2384       50791 : TYPEINIT1( SwFrmFmt, SwFmt );
    2385        8881 : IMPL_FIXEDMEMPOOL_NEWDEL_DLL( SwFrmFmt )
    2386             : 
    2387       62452 : void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
    2388             : {
    2389       62452 :     SwFmtHeader *pH = 0;
    2390       62452 :     SwFmtFooter *pF = 0;
    2391             : 
    2392       62452 :     sal_uInt16 nWhich = pNew ? pNew->Which() : 0;
    2393             : 
    2394       62452 :     if( RES_ATTRSET_CHG == nWhich )
    2395             :     {
    2396       62007 :         ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
    2397       62007 :             RES_HEADER, sal_False, (const SfxPoolItem**)&pH );
    2398       62007 :         ((SwAttrSetChg*)pNew)->GetChgSet()->GetItemState(
    2399       62007 :             RES_FOOTER, sal_False, (const SfxPoolItem**)&pF );
    2400             :     }
    2401         445 :     else if( RES_HEADER == nWhich )
    2402           0 :         pH = (SwFmtHeader*)pNew;
    2403         445 :     else if( RES_FOOTER == nWhich )
    2404           0 :         pF = (SwFmtFooter*)pNew;
    2405             : 
    2406       62452 :     if( pH && pH->IsActive() && !pH->GetHeaderFmt() )
    2407             :     {   //If he doesn't have one, I'll add one
    2408          86 :         SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_HEADER, 0 );
    2409          86 :         pH->RegisterToFormat( *pFmt );
    2410             :     }
    2411             : 
    2412       62452 :     if( pF && pF->IsActive() && !pF->GetFooterFmt() )
    2413             :     {   //If he doesn't have one, I'll add one
    2414          85 :         SwFrmFmt *pFmt = GetDoc()->MakeLayoutFmt( RND_STD_FOOTER, 0 );
    2415          85 :         pF->RegisterToFormat( *pFmt );
    2416             :     }
    2417             : 
    2418             :     // MIB 24.3.98: We always have to call Modify of the baseclass, for example
    2419             :     // because of RESET_FMTWRITTEN.
    2420             : //  if ( GetDepends() )
    2421       62452 :         SwFmt::Modify( pOld, pNew );
    2422             : 
    2423       62452 :     if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
    2424             :     {   // invalidate cached uno object
    2425         225 :         SetXObject(uno::Reference<uno::XInterface>(0));
    2426             :     }
    2427       62452 : }
    2428             : 
    2429          18 : void SwFrmFmt::RegisterToFormat( SwFmt& rFmt )
    2430             : {
    2431          18 :     rFmt.Add( this );
    2432          18 : }
    2433             : 
    2434             : //Deletes all Frms which are registered in aDepend.
    2435             : 
    2436         450 : void SwFrmFmt::DelFrms()
    2437             : {
    2438         450 :     SwIterator<SwFrm,SwFmt> aIter( *this );
    2439         450 :     SwFrm * pLast = aIter.First();
    2440         450 :     if( pLast )
    2441           9 :         do {
    2442           9 :                 pLast->Cut();
    2443           9 :                 delete pLast;
    2444         450 :         } while( 0 != ( pLast = aIter.Next() ));
    2445         450 : }
    2446             : 
    2447           0 : void SwFrmFmt::MakeFrms()
    2448             : {
    2449             :     OSL_ENSURE( !this, "Sorry not implemented." );
    2450           0 : }
    2451             : 
    2452             : 
    2453             : 
    2454          98 : SwRect SwFrmFmt::FindLayoutRect( const sal_Bool bPrtArea, const Point* pPoint,
    2455             :                                  const sal_Bool bCalcFrm ) const
    2456             : {
    2457          98 :     SwRect aRet;
    2458          98 :     SwFrm *pFrm = 0;
    2459          98 :     if( ISA( SwSectionFmt ) )
    2460             :     {
    2461             :         // get the Frame using Node2Layout
    2462           0 :         SwSectionNode* pSectNd = ((SwSectionFmt*)this)->GetSectionNode();
    2463           0 :         if( pSectNd )
    2464             :         {
    2465           0 :             SwNode2Layout aTmp( *pSectNd, pSectNd->GetIndex() - 1 );
    2466           0 :             pFrm = aTmp.NextFrm();
    2467             : 
    2468           0 :             if( pFrm && !pFrm->KnowsFormat(*this) )
    2469             :             {
    2470             :                 // the Section doesn't have his own Frame, so if someone
    2471             :                 // needs the real size, we have to implement this by requesting
    2472             :                 // the matching Frame from the end.
    2473             :                 // PROBLEM: what happens if SectionFrames overlaps multiple
    2474             :                 //          pages?
    2475           0 :                 if( bPrtArea )
    2476           0 :                     aRet = pFrm->Prt();
    2477             :                 else
    2478             :                 {
    2479           0 :                     aRet = pFrm->Frm();
    2480           0 :                     --aRet.Pos().Y();
    2481             :                 }
    2482           0 :                 pFrm = 0;       // the rect is finished by now
    2483           0 :             }
    2484             :         }
    2485             :     }
    2486             :     else
    2487             :     {
    2488          98 :         sal_uInt16 nFrmType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX;
    2489             :         pFrm = ::GetFrmOfModify( 0, *(SwModify*)this, nFrmType, pPoint,
    2490          98 :                                     0, bCalcFrm );
    2491             :     }
    2492             : 
    2493          98 :     if( pFrm )
    2494             :     {
    2495          98 :         if( bPrtArea )
    2496           0 :             aRet = pFrm->Prt();
    2497             :         else
    2498          98 :             aRet = pFrm->Frm();
    2499             :     }
    2500          98 :     return aRet;
    2501             : }
    2502             : 
    2503        2589 : SwContact* SwFrmFmt::FindContactObj()
    2504             : {
    2505        2589 :     return SwIterator<SwContact,SwFmt>::FirstElement( *this );
    2506             : }
    2507             : 
    2508        1165 : SdrObject* SwFrmFmt::FindSdrObject()
    2509             : {
    2510             :     // #i30669# - use method <FindContactObj()> instead of
    2511             :     // duplicated code.
    2512        1165 :     SwContact* pFoundContact = FindContactObj();
    2513        1165 :     return pFoundContact ? pFoundContact->GetMaster() : 0;
    2514             : }
    2515             : 
    2516         172 : SdrObject* SwFrmFmt::FindRealSdrObject()
    2517             : {
    2518         172 :     if( RES_FLYFRMFMT == Which() )
    2519             :     {
    2520         111 :         Point aNullPt;
    2521             :         SwFlyFrm* pFly = (SwFlyFrm*)::GetFrmOfModify( 0, *this, FRM_FLY,
    2522         111 :                                                     &aNullPt, 0, sal_False );
    2523         111 :         return pFly ? pFly->GetVirtDrawObj() : 0;
    2524             :     }
    2525          61 :     return FindSdrObject();
    2526             : }
    2527             : 
    2528             : 
    2529           0 : sal_Bool SwFrmFmt::IsLowerOf( const SwFrmFmt& rFmt ) const
    2530             : {
    2531             :     //Also linking from inside to outside or from outside to inside is not
    2532             :     //allowed.
    2533           0 :     SwFlyFrm *pSFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(*this);
    2534           0 :     if( pSFly )
    2535             :     {
    2536           0 :         SwFlyFrm *pAskFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement(rFmt);
    2537           0 :         if( pAskFly )
    2538           0 :             return pSFly->IsLowerOf( pAskFly );
    2539             :     }
    2540             : 
    2541             :     // let's try it using the node positions
    2542           0 :     const SwFmtAnchor* pAnchor = &rFmt.GetAnchor();
    2543           0 :     if ((FLY_AT_PAGE != pAnchor->GetAnchorId()) && pAnchor->GetCntntAnchor())
    2544             :     {
    2545           0 :         const SwFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts();
    2546           0 :         const SwNode* pFlyNd = pAnchor->GetCntntAnchor()->nNode.GetNode().
    2547           0 :                                 FindFlyStartNode();
    2548           0 :         while( pFlyNd )
    2549             :         {
    2550             :             // then we walk up using the anchor
    2551             :             sal_uInt16 n;
    2552           0 :             for( n = 0; n < rFmts.size(); ++n )
    2553             :             {
    2554           0 :                 const SwFrmFmt* pFmt = rFmts[ n ];
    2555           0 :                 const SwNodeIndex* pIdx = pFmt->GetCntnt().GetCntntIdx();
    2556           0 :                 if( pIdx && pFlyNd == &pIdx->GetNode() )
    2557             :                 {
    2558           0 :                     if( pFmt == this )
    2559           0 :                         return sal_True;
    2560             : 
    2561           0 :                     pAnchor = &pFmt->GetAnchor();
    2562           0 :                     if ((FLY_AT_PAGE == pAnchor->GetAnchorId()) ||
    2563           0 :                         !pAnchor->GetCntntAnchor() )
    2564             :                     {
    2565           0 :                         return sal_False;
    2566             :                     }
    2567             : 
    2568           0 :                     pFlyNd = pAnchor->GetCntntAnchor()->nNode.GetNode().
    2569           0 :                                 FindFlyStartNode();
    2570           0 :                     break;
    2571             :                 }
    2572             :             }
    2573           0 :             if( n >= rFmts.size() )
    2574             :             {
    2575             :                 OSL_ENSURE( !this, "Fly section but no format found" );
    2576           0 :                 return sal_False;
    2577             :             }
    2578             :         }
    2579             :     }
    2580           0 :     return sal_False;
    2581             : }
    2582             : 
    2583             : // #i31698#
    2584           0 : SwFrmFmt::tLayoutDir SwFrmFmt::GetLayoutDir() const
    2585             : {
    2586           0 :     return SwFrmFmt::HORI_L2R;
    2587             : }
    2588             : 
    2589         328 : void SwFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir )
    2590             : {
    2591             :     // empty body, because default implementation does nothing
    2592         328 : }
    2593             : 
    2594             : // #i28749#
    2595           0 : sal_Int16 SwFrmFmt::GetPositionLayoutDir() const
    2596             : {
    2597           0 :     return text::PositionLayoutDir::PositionInLayoutDirOfAnchor;
    2598             : }
    2599           0 : void SwFrmFmt::SetPositionLayoutDir( const sal_Int16 )
    2600             : {
    2601             :     // empty body, because default implementation does nothing
    2602           0 : }
    2603           0 : String SwFrmFmt::GetDescription() const
    2604             : {
    2605           0 :     return SW_RES(STR_FRAME);
    2606             : }
    2607             : 
    2608             : //  class SwFlyFrmFmt
    2609             : //  Partially implemented inline in hxx
    2610             : 
    2611        8094 : TYPEINIT1( SwFlyFrmFmt, SwFrmFmt );
    2612          33 : IMPL_FIXEDMEMPOOL_NEWDEL( SwFlyFrmFmt )
    2613             : 
    2614        1053 : SwFlyFrmFmt::~SwFlyFrmFmt()
    2615             : {
    2616         351 :     SwIterator<SwFlyFrm,SwFmt> aIter( *this );
    2617         351 :     SwFlyFrm * pLast = aIter.First();
    2618         351 :     if( pLast )
    2619           0 :         do {
    2620           0 :                 delete pLast;
    2621             :         } while( 0 != ( pLast = aIter.Next() ));
    2622             : 
    2623         702 :     SwIterator<SwFlyDrawContact,SwFmt> a2ndIter( *this );
    2624         351 :     SwFlyDrawContact* pC = a2ndIter.First();
    2625         351 :     if( pC )
    2626          27 :         do {
    2627          27 :                 delete pC;
    2628             : 
    2629         351 :         } while( 0 != ( pC = a2ndIter.Next() ));
    2630         702 : }
    2631             : 
    2632             : //Creates the Frms if the format describes a paragraph-bound frame.
    2633             : //MA: 1994-02-14, creates the Frms also for frames anchored at page.
    2634             : 
    2635         151 : void SwFlyFrmFmt::MakeFrms()
    2636             : {
    2637             :     // is there a layout?
    2638         151 :     if( !GetDoc()->GetCurrentViewShell() )
    2639          52 :         return; //swmod 071108//swmod 071225
    2640             : 
    2641         125 :     SwModify *pModify = 0;
    2642             :     // OD 24.07.2003 #111032# - create local copy of anchor attribute for possible changes.
    2643         125 :     SwFmtAnchor aAnchorAttr( GetAnchor() );
    2644         125 :     switch( aAnchorAttr.GetAnchorId() )
    2645             :     {
    2646             :     case FLY_AS_CHAR:
    2647             :     case FLY_AT_PARA:
    2648             :     case FLY_AT_CHAR:
    2649         117 :         if( aAnchorAttr.GetCntntAnchor() )
    2650             :         {
    2651         117 :             pModify = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
    2652             :         }
    2653         117 :         break;
    2654             : 
    2655             :     case FLY_AT_FLY:
    2656           0 :         if( aAnchorAttr.GetCntntAnchor() )
    2657             :         {
    2658             :             //First search in the content because this is O(1)
    2659             :             //This can go wrong for linked frames because in this case it's
    2660             :             //possible, that no Frame exists for this content.
    2661             :             //In such a situation we also need to search from StartNode to
    2662             :             //FrameFormat.
    2663           0 :             SwNodeIndex aIdx( aAnchorAttr.GetCntntAnchor()->nNode );
    2664           0 :             SwCntntNode *pCNd = GetDoc()->GetNodes().GoNext( &aIdx );
    2665             :             // #i105535#
    2666           0 :             if ( pCNd == 0 )
    2667             :             {
    2668           0 :                 pCNd = aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
    2669             :             }
    2670           0 :             if ( pCNd )
    2671             :             {
    2672           0 :                 if( SwIterator<SwFrm,SwCntntNode>::FirstElement( *pCNd ) )
    2673             :                 {
    2674           0 :                     pModify = pCNd;
    2675             :                 }
    2676             :             }
    2677             :             // #i105535#
    2678           0 :             if ( pModify == 0 )
    2679             :             {
    2680           0 :                 const SwNodeIndex &rIdx = aAnchorAttr.GetCntntAnchor()->nNode;
    2681           0 :                 SwFrmFmts& rFmts = *GetDoc()->GetSpzFrmFmts();
    2682           0 :                 for( sal_uInt16 i = 0; i < rFmts.size(); ++i )
    2683             :                 {
    2684           0 :                     SwFrmFmt* pFlyFmt = rFmts[i];
    2685           0 :                     if( pFlyFmt->GetCntnt().GetCntntIdx() &&
    2686           0 :                         rIdx == *pFlyFmt->GetCntnt().GetCntntIdx() )
    2687             :                     {
    2688           0 :                         pModify = pFlyFmt;
    2689           0 :                         break;
    2690             :                     }
    2691             :                 }
    2692           0 :             }
    2693             :         }
    2694           0 :         break;
    2695             : 
    2696             :     case FLY_AT_PAGE:
    2697             :         {
    2698           8 :             sal_uInt16 nPgNum = aAnchorAttr.GetPageNum();
    2699           8 :             SwPageFrm *pPage = (SwPageFrm*)GetDoc()->GetCurrentLayout()->Lower();   //swmod 080218
    2700           8 :             if( !nPgNum && aAnchorAttr.GetCntntAnchor() )
    2701             :             {
    2702             :                 SwCntntNode *pCNd =
    2703           7 :                     aAnchorAttr.GetCntntAnchor()->nNode.GetNode().GetCntntNode();
    2704           7 :                 SwIterator<SwFrm,SwCntntNode> aIter( *pCNd );
    2705           7 :                 for (SwFrm* pFrm = aIter.First();
    2706             :                      pFrm;
    2707             :                      /* unreachable, note unconditional break below
    2708             :                         pFrm = aIter.Next()
    2709             :                      */ )
    2710             :                 {
    2711           7 :                         pPage = pFrm->FindPageFrm();
    2712           7 :                         if( pPage )
    2713             :                         {
    2714           7 :                             nPgNum = pPage->GetPhyPageNum();
    2715             :                             // OD 24.07.2003 #111032# - update anchor attribute
    2716           7 :                             aAnchorAttr.SetPageNum( nPgNum );
    2717           7 :                             aAnchorAttr.SetAnchor( 0 );
    2718           7 :                             SetFmtAttr( aAnchorAttr );
    2719             :                         }
    2720           7 :                         break;
    2721           7 :                 }
    2722             :             }
    2723          16 :             while ( pPage )
    2724             :             {
    2725           8 :                 if ( pPage->GetPhyPageNum() == nPgNum )
    2726             :                 {
    2727             :                     // #i50432# - adjust synopsis of <PlaceFly(..)>
    2728           8 :                     pPage->PlaceFly( 0, this );
    2729           8 :                     break;
    2730             :                 }
    2731           0 :                 pPage = (SwPageFrm*)pPage->GetNext();
    2732             :             }
    2733             :         }
    2734           8 :         break;
    2735             :     default:
    2736           0 :         break;
    2737             :     }
    2738             : 
    2739         125 :     if( pModify )
    2740             :     {
    2741         117 :         SwIterator<SwFrm,SwModify> aIter( *pModify );
    2742         234 :         for( SwFrm *pFrm = aIter.First(); pFrm; pFrm = aIter.Next() )
    2743             :         {
    2744         234 :             bool bAdd = !pFrm->IsCntntFrm() ||
    2745         234 :                             !((SwCntntFrm*)pFrm)->IsFollow();
    2746             : 
    2747         117 :             if ( FLY_AT_FLY == aAnchorAttr.GetAnchorId() && !pFrm->IsFlyFrm() )
    2748             :             {
    2749             :                 // #i105535#
    2750             :                 // fallback to anchor type at-paragraph, if no fly frame is found.
    2751             : //                pFrm = pFrm->FindFlyFrm();
    2752           0 :                 SwFrm* pFlyFrm = pFrm->FindFlyFrm();
    2753           0 :                 if ( pFlyFrm )
    2754             :                 {
    2755           0 :                     pFrm = pFlyFrm;
    2756             :                 }
    2757             :                 else
    2758             :                 {
    2759           0 :                     aAnchorAttr.SetType( FLY_AT_PARA );
    2760           0 :                     SetFmtAttr( aAnchorAttr );
    2761           0 :                     MakeFrms();
    2762           0 :                     return;
    2763             :                 }
    2764             :             }
    2765             : 
    2766         117 :             if( pFrm->GetDrawObjs() )
    2767             :             {
    2768             :                 // #i28701# - new type <SwSortedObjs>
    2769          35 :                 SwSortedObjs &rObjs = *pFrm->GetDrawObjs();
    2770          88 :                 for( sal_uInt16 i = 0; i < rObjs.Count(); ++i)
    2771             :                 {
    2772             :                     // #i28701# - consider changed type of
    2773             :                     // <SwSortedObjs> entries.
    2774          57 :                     SwAnchoredObject* pObj = rObjs[i];
    2775         105 :                     if( pObj->ISA(SwFlyFrm) &&
    2776          48 :                         (&pObj->GetFrmFmt()) == this )
    2777             :                     {
    2778           4 :                         bAdd = false;
    2779           4 :                         break;
    2780             :                     }
    2781             :                 }
    2782             :             }
    2783             : 
    2784         117 :             if( bAdd )
    2785             :             {
    2786         113 :                 SwFlyFrm *pFly = 0;
    2787         113 :                 switch( aAnchorAttr.GetAnchorId() )
    2788             :                 {
    2789             :                 case FLY_AT_FLY:
    2790           0 :                     pFly = new SwFlyLayFrm( this, pFrm, pFrm );
    2791           0 :                     break;
    2792             : 
    2793             :                 case FLY_AT_PARA:
    2794             :                 case FLY_AT_CHAR:
    2795         100 :                     pFly = new SwFlyAtCntFrm( this, pFrm, pFrm );
    2796         100 :                     break;
    2797             : 
    2798             :                 case FLY_AS_CHAR:
    2799          13 :                     pFly = new SwFlyInCntFrm( this, pFrm, pFrm );
    2800          13 :                     break;
    2801             :                 default:
    2802             :                     OSL_ENSURE( !this, "Neuer Ankertyp" );
    2803           0 :                     break;
    2804             :                 }
    2805         113 :                 pFrm->AppendFly( pFly );
    2806         113 :                 SwPageFrm *pPage = pFly->FindPageFrm();
    2807         113 :                 if( pPage )
    2808         113 :                     ::RegistFlys( pPage, pFly );
    2809             :             }
    2810         117 :         }
    2811         125 :     }
    2812             : }
    2813             : 
    2814          10 : SwFlyFrm* SwFlyFrmFmt::GetFrm( const Point* pPoint, const sal_Bool bCalcFrm ) const
    2815             : {
    2816             :     return (SwFlyFrm*)::GetFrmOfModify( 0, *(SwModify*)this, FRM_FLY,
    2817          10 :                                             pPoint, 0, bCalcFrm );
    2818             : }
    2819             : 
    2820           0 : SwAnchoredObject* SwFlyFrmFmt::GetAnchoredObj( const Point* pPoint, const sal_Bool bCalcFrm ) const
    2821             : {
    2822           0 :     SwFlyFrm* pFlyFrm( GetFrm( pPoint, bCalcFrm ) );
    2823           0 :     if ( pFlyFrm )
    2824             :     {
    2825           0 :         return dynamic_cast<SwAnchoredObject*>(pFlyFrm);
    2826             :     }
    2827             :     else
    2828             :     {
    2829           0 :         return 0L;
    2830             :     }
    2831             : }
    2832             : 
    2833             : 
    2834          27 : bool SwFlyFrmFmt::GetInfo( SfxPoolItem& rInfo ) const
    2835             : {
    2836          27 :     switch( rInfo.Which() )
    2837             :     {
    2838             :     case RES_CONTENT_VISIBLE:
    2839             :         {
    2840           0 :             ((SwPtrMsgPoolItem&)rInfo).pObject = SwIterator<SwFrm,SwFmt>::FirstElement( *this );
    2841             :         }
    2842           0 :         return false;
    2843             : 
    2844             :     default:
    2845          27 :         return SwFrmFmt::GetInfo( rInfo );
    2846             :     }
    2847             : }
    2848             : 
    2849             : // #i73249#
    2850           2 : void SwFlyFrmFmt::SetObjTitle( const String& rTitle, bool bBroadcast )
    2851             : {
    2852           2 :     SdrObject* pMasterObject = FindSdrObject();
    2853             :     OSL_ENSURE( pMasterObject,
    2854             :             "<SwNoTxtNode::SetObjTitle(..)> - missing <SdrObject> instance" );
    2855           2 :     if ( !pMasterObject )
    2856             :     {
    2857           2 :         return;
    2858             :     }
    2859             : 
    2860           2 :     if( bBroadcast )
    2861             :     {
    2862           0 :         SwStringMsgPoolItem aOld( RES_TITLE_CHANGED, pMasterObject->GetTitle() );
    2863           0 :         SwStringMsgPoolItem aNew( RES_TITLE_CHANGED, rTitle );
    2864           0 :         pMasterObject->SetTitle( rTitle );
    2865           0 :         ModifyNotification( &aOld, &aNew );
    2866             :     }
    2867             :     else
    2868             :     {
    2869           2 :         pMasterObject->SetTitle( rTitle );
    2870             :     }
    2871             : }
    2872             : 
    2873         125 : const String SwFlyFrmFmt::GetObjTitle() const
    2874             : {
    2875         125 :     const SdrObject* pMasterObject = FindSdrObject();
    2876             :     OSL_ENSURE( pMasterObject,
    2877             :             "<SwFlyFrmFmt::GetObjTitle(..)> - missing <SdrObject> instance" );
    2878         125 :     if ( !pMasterObject )
    2879             :     {
    2880           0 :         return aEmptyStr;
    2881             :     }
    2882             : 
    2883         125 :     return pMasterObject->GetTitle();
    2884             : }
    2885             : 
    2886          12 : void SwFlyFrmFmt::SetObjDescription( const String& rDescription, bool bBroadcast )
    2887             : {
    2888          12 :     SdrObject* pMasterObject = FindSdrObject();
    2889             :     OSL_ENSURE( pMasterObject,
    2890             :             "<SwFlyFrmFmt::SetDescription(..)> - missing <SdrObject> instance" );
    2891          12 :     if ( !pMasterObject )
    2892             :     {
    2893          12 :         return;
    2894             :     }
    2895             : 
    2896          12 :     if( bBroadcast )
    2897             :     {
    2898          10 :         SwStringMsgPoolItem aOld( RES_DESCRIPTION_CHANGED, pMasterObject->GetDescription() );
    2899          20 :         SwStringMsgPoolItem aNew( RES_DESCRIPTION_CHANGED, rDescription );
    2900          10 :         pMasterObject->SetDescription( rDescription );
    2901          20 :         ModifyNotification( &aOld, &aNew );
    2902             :     }
    2903             :     else
    2904             :     {
    2905           2 :         pMasterObject->SetDescription( rDescription );
    2906             :     }
    2907             : }
    2908             : 
    2909         104 : const String SwFlyFrmFmt::GetObjDescription() const
    2910             : {
    2911         104 :     const SdrObject* pMasterObject = FindSdrObject();
    2912             :     OSL_ENSURE( pMasterObject,
    2913             :             "<SwNoTxtNode::GetDescription(..)> - missing <SdrObject> instance" );
    2914         104 :     if ( !pMasterObject )
    2915             :     {
    2916           0 :         return aEmptyStr;
    2917             :     }
    2918             : 
    2919         104 :     return pMasterObject->GetDescription();
    2920             : }
    2921             : 
    2922             : /** SwFlyFrmFmt::IsBackgroundTransparent - for #99657#
    2923             : 
    2924             :     OD 22.08.2002 - overloading virtual method and its default implementation,
    2925             :     because format of fly frame provides transparent backgrounds.
    2926             :     Method determines, if background of fly frame is transparent.
    2927             : 
    2928             :     @author OD
    2929             : 
    2930             :     @return true, if background color is transparent, but not "no fill"
    2931             :     or the transparency of a existing background graphic is set.
    2932             : */
    2933         897 : sal_Bool SwFlyFrmFmt::IsBackgroundTransparent() const
    2934             : {
    2935         897 :     sal_Bool bReturn = sal_False;
    2936             : 
    2937             :     /// NOTE: If background color is "no fill"/"auto fill" (COL_TRANSPARENT)
    2938             :     ///     and there is no background graphic, it "inherites" the background
    2939             :     ///     from its anchor.
    2940        3588 :     if ( (GetBackground().GetColor().GetTransparency() != 0) &&
    2941        3588 :          (GetBackground().GetColor() != COL_TRANSPARENT)
    2942             :        )
    2943             :     {
    2944           5 :         bReturn = sal_True;
    2945             :     }
    2946             :     else
    2947             :     {
    2948             :         const GraphicObject *pTmpGrf =
    2949         892 :                 static_cast<const GraphicObject*>(GetBackground().GetGraphicObject());
    2950         892 :         if ( (pTmpGrf) &&
    2951           0 :              (pTmpGrf->GetAttr().GetTransparency() != 0)
    2952             :            )
    2953             :         {
    2954           0 :             bReturn = sal_True;
    2955             :         }
    2956             :     }
    2957             : 
    2958         897 :     return bReturn;
    2959             : }
    2960             : 
    2961             : /** SwFlyFrmFmt::IsBackgroundBrushInherited - for #103898#
    2962             : 
    2963             :     OD 08.10.2002 - method to determine, if the brush for drawing the
    2964             :     background is "inherited" from its parent/grandparent.
    2965             :     This is the case, if no background graphic is set and the background
    2966             :     color is "no fill"/"auto fill"
    2967             :     NOTE: condition is "copied" from method <SwFrm::GetBackgroundBrush(..).
    2968             : 
    2969             :     @author OD
    2970             : 
    2971             :     @return true, if background brush is "inherited" from parent/grandparent
    2972             : */
    2973         890 : sal_Bool SwFlyFrmFmt::IsBackgroundBrushInherited() const
    2974             : {
    2975         890 :     sal_Bool bReturn = sal_False;
    2976             : 
    2977        1780 :     if ( (GetBackground().GetColor() == COL_TRANSPARENT) &&
    2978         890 :          !(GetBackground().GetGraphicObject()) )
    2979             :     {
    2980         890 :         bReturn = sal_True;
    2981             :     }
    2982             : 
    2983         890 :     return bReturn;
    2984             : }
    2985             : 
    2986             : // #125892#
    2987           0 : SwHandleAnchorNodeChg::SwHandleAnchorNodeChg( SwFlyFrmFmt& _rFlyFrmFmt,
    2988             :                                               const SwFmtAnchor& _rNewAnchorFmt,
    2989             :                                               SwFlyFrm* _pKeepThisFlyFrm )
    2990             :     : mrFlyFrmFmt( _rFlyFrmFmt ),
    2991           0 :       mbAnchorNodeChanged( false )
    2992             : {
    2993           0 :     const RndStdIds nNewAnchorType( _rNewAnchorFmt.GetAnchorId() );
    2994           0 :     if ( ((nNewAnchorType == FLY_AT_PARA) ||
    2995           0 :           (nNewAnchorType == FLY_AT_CHAR)) &&
    2996           0 :          _rNewAnchorFmt.GetCntntAnchor() &&
    2997           0 :          _rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode() )
    2998             :     {
    2999           0 :         const SwFmtAnchor& aOldAnchorFmt( _rFlyFrmFmt.GetAnchor() );
    3000           0 :         if ( aOldAnchorFmt.GetAnchorId() == nNewAnchorType &&
    3001           0 :              aOldAnchorFmt.GetCntntAnchor() &&
    3002           0 :              aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode() &&
    3003           0 :              aOldAnchorFmt.GetCntntAnchor()->nNode !=
    3004           0 :                                     _rNewAnchorFmt.GetCntntAnchor()->nNode )
    3005             :         {
    3006             :             // determine 'old' number of anchor frames
    3007           0 :             sal_uInt32 nOldNumOfAnchFrm( 0L );
    3008           0 :             SwIterator<SwFrm,SwCntntNode> aOldIter( *(aOldAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) );
    3009           0 :             for( SwFrm* pOld = aOldIter.First(); pOld; pOld = aOldIter.Next() )
    3010             :             {
    3011           0 :                 ++nOldNumOfAnchFrm;
    3012             :             }
    3013             :             // determine 'new' number of anchor frames
    3014           0 :             sal_uInt32 nNewNumOfAnchFrm( 0L );
    3015           0 :             SwIterator<SwFrm,SwCntntNode> aNewIter( *(_rNewAnchorFmt.GetCntntAnchor()->nNode.GetNode().GetCntntNode()) );
    3016           0 :             for( SwFrm* pNew = aNewIter.First(); pNew; pNew = aNewIter.Next() )
    3017             :             {
    3018           0 :                 ++nNewNumOfAnchFrm;
    3019             :             }
    3020           0 :             if ( nOldNumOfAnchFrm != nNewNumOfAnchFrm )
    3021             :             {
    3022             :                 // delete existing fly frames except <_pKeepThisFlyFrm>
    3023           0 :                 SwIterator<SwFrm,SwFmt> aIter( mrFlyFrmFmt );
    3024           0 :                 SwFrm* pFrm = aIter.First();
    3025           0 :                 if ( pFrm )
    3026             :                 {
    3027           0 :                     do {
    3028           0 :                         if ( pFrm != _pKeepThisFlyFrm )
    3029             :                         {
    3030           0 :                             pFrm->Cut();
    3031           0 :                             delete pFrm;
    3032             :                         }
    3033             :                     } while( 0 != ( pFrm = aIter.Next() ));
    3034             :                 }
    3035             :                 // indicate, that re-creation of fly frames necessary
    3036           0 :                 mbAnchorNodeChanged = true;
    3037           0 :             }
    3038             :         }
    3039             :     }
    3040           0 : }
    3041             : 
    3042           0 : SwHandleAnchorNodeChg::~SwHandleAnchorNodeChg()
    3043             : {
    3044           0 :     if ( mbAnchorNodeChanged )
    3045             :     {
    3046           0 :         mrFlyFrmFmt.MakeFrms();
    3047             :     }
    3048           0 : }
    3049             : //  class SwDrawFrmFmt
    3050             : //  Partially implemented inline in hxx
    3051             : 
    3052        2372 : TYPEINIT1( SwDrawFrmFmt, SwFrmFmt );
    3053          33 : IMPL_FIXEDMEMPOOL_NEWDEL( SwDrawFrmFmt )
    3054             : 
    3055        1194 : SwDrawFrmFmt::~SwDrawFrmFmt()
    3056             : {
    3057         398 :     SwContact *pContact = FindContactObj();
    3058         398 :     delete pContact;
    3059         796 : }
    3060             : 
    3061         245 : void SwDrawFrmFmt::MakeFrms()
    3062             : {
    3063         245 :     SwDrawContact *pContact = (SwDrawContact*)FindContactObj();
    3064         245 :     if ( pContact )
    3065         245 :          pContact->ConnectToLayout();
    3066         245 : }
    3067             : 
    3068         382 : void SwDrawFrmFmt::DelFrms()
    3069             : {
    3070         382 :     SwDrawContact *pContact = (SwDrawContact *)FindContactObj();
    3071         382 :     if ( pContact ) //for the reader and other unpredictable things.
    3072         382 :         pContact->DisconnectFromLayout();
    3073         382 : }
    3074             : 
    3075             : // #i31698#
    3076         371 : SwFrmFmt::tLayoutDir SwDrawFrmFmt::GetLayoutDir() const
    3077             : {
    3078         371 :     return meLayoutDir;
    3079             : }
    3080             : 
    3081         305 : void SwDrawFrmFmt::SetLayoutDir( const SwFrmFmt::tLayoutDir _eLayoutDir )
    3082             : {
    3083         305 :     meLayoutDir = _eLayoutDir;
    3084         305 : }
    3085             : 
    3086             : // #i28749#
    3087          39 : sal_Int16 SwDrawFrmFmt::GetPositionLayoutDir() const
    3088             : {
    3089          39 :     return mnPositionLayoutDir;
    3090             : }
    3091          42 : void SwDrawFrmFmt::SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir )
    3092             : {
    3093          42 :     switch ( _nPositionLayoutDir )
    3094             :     {
    3095             :         case text::PositionLayoutDir::PositionInHoriL2R:
    3096             :         case text::PositionLayoutDir::PositionInLayoutDirOfAnchor:
    3097             :         {
    3098          42 :             mnPositionLayoutDir = _nPositionLayoutDir;
    3099             :         }
    3100          42 :         break;
    3101             :         default:
    3102             :         {
    3103             :             OSL_FAIL( "<SwDrawFrmFmt::SetPositionLayoutDir(..)> - invalid attribute value." );
    3104             :         }
    3105             :     }
    3106          42 : }
    3107             : 
    3108           0 : String SwDrawFrmFmt::GetDescription() const
    3109             : {
    3110           0 :     String aResult;
    3111           0 :     const SdrObject * pSdrObj = FindSdrObject();
    3112             : 
    3113           0 :     if (pSdrObj)
    3114             :     {
    3115           0 :         if (pSdrObj != pSdrObjCached)
    3116             :         {
    3117           0 :             SdrObject * pSdrObjCopy = pSdrObj->Clone();
    3118           0 :             SdrUndoNewObj * pSdrUndo = new SdrUndoNewObj(*pSdrObjCopy);
    3119           0 :             sSdrObjCachedComment = pSdrUndo->GetComment();
    3120             : 
    3121           0 :             delete pSdrUndo;
    3122             : 
    3123           0 :             pSdrObjCached = pSdrObj;
    3124             :         }
    3125             : 
    3126           0 :         aResult = sSdrObjCachedComment;
    3127             :     }
    3128             :     else
    3129           0 :         aResult = SW_RESSTR(STR_GRAPHIC);
    3130             : 
    3131           0 :     return aResult;
    3132             : }
    3133             : 
    3134           0 : IMapObject* SwFrmFmt::GetIMapObject( const Point& rPoint,
    3135             :                                         const SwFlyFrm *pFly ) const
    3136             : {
    3137           0 :     const SwFmtURL &rURL = GetURL();
    3138           0 :     if( !rURL.GetMap() )
    3139           0 :         return 0;
    3140             : 
    3141           0 :     if( !pFly )
    3142             :     {
    3143           0 :         pFly = SwIterator<SwFlyFrm,SwFmt>::FirstElement( *this );
    3144           0 :         if( !pFly )
    3145           0 :             return 0;
    3146             :     }
    3147             : 
    3148             :     //Original size for OLE and graphic is TwipSize, otherwise the size of
    3149             :     //FrmFmt of the Fly.
    3150             :     const SwFrm *pRef;
    3151           0 :     SwNoTxtNode *pNd = 0;
    3152           0 :     Size aOrigSz;
    3153           0 :     if( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() )
    3154             :     {
    3155           0 :         pRef = pFly->Lower();
    3156           0 :         pNd = ((SwCntntFrm*)pRef)->GetNode()->GetNoTxtNode();
    3157           0 :         aOrigSz = pNd->GetTwipSize();
    3158             :     }
    3159             :     else
    3160             :     {
    3161           0 :         pRef = pFly;
    3162           0 :         aOrigSz = pFly->GetFmt()->GetFrmSize().GetSize();
    3163             :     }
    3164             : 
    3165           0 :     if( aOrigSz.Width() != 0 && aOrigSz.Height() != 0 )
    3166             :     {
    3167           0 :         Point aPos( rPoint );
    3168           0 :         Size aActSz ( pRef == pFly ? pFly->Frm().SSize() : pRef->Prt().SSize() );
    3169           0 :         const MapMode aSrc ( MAP_TWIP );
    3170           0 :         const MapMode aDest( MAP_100TH_MM );
    3171           0 :         aOrigSz = OutputDevice::LogicToLogic( aOrigSz, aSrc, aDest );
    3172           0 :         aActSz  = OutputDevice::LogicToLogic( aActSz,  aSrc, aDest );
    3173           0 :         aPos -= pRef->Frm().Pos();
    3174           0 :         aPos -= pRef->Prt().Pos();
    3175           0 :         aPos    = OutputDevice::LogicToLogic( aPos, aSrc, aDest );
    3176           0 :         sal_uInt32 nFlags = 0;
    3177           0 :         if ( pFly != pRef && pNd->IsGrfNode() )
    3178             :         {
    3179           0 :             const sal_uInt16 nMirror = pNd->GetSwAttrSet().
    3180           0 :                                         GetMirrorGrf().GetValue();
    3181           0 :             if ( RES_MIRROR_GRAPH_BOTH == nMirror )
    3182           0 :                 nFlags = IMAP_MIRROR_HORZ | IMAP_MIRROR_VERT;
    3183           0 :             else if ( RES_MIRROR_GRAPH_VERT == nMirror )
    3184           0 :                 nFlags = IMAP_MIRROR_VERT;
    3185           0 :             else if ( RES_MIRROR_GRAPH_HOR == nMirror )
    3186           0 :                 nFlags = IMAP_MIRROR_HORZ;
    3187             : 
    3188             :         }
    3189           0 :         return ((ImageMap*)rURL.GetMap())->GetHitIMapObject( aOrigSz,
    3190           0 :                                                 aActSz, aPos, nFlags );
    3191             :     }
    3192             : 
    3193           0 :     return 0;
    3194          99 : }
    3195             : 
    3196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10