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

Generated by: LCOV version 1.10