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

Generated by: LCOV version 1.10