LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sw/source/core/attr - format.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 240 279 86.0 %
Date: 2013-07-09 Functions: 27 33 81.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <doc.hxx>
      21             : #include <fmtcolfunc.hxx>
      22             : #include <frame.hxx>
      23             : #include <format.hxx>
      24             : #include <hintids.hxx>
      25             : #include <hints.hxx>
      26             : #include <paratr.hxx>
      27             : #include <swcache.hxx>
      28             : 
      29      182827 : TYPEINIT1( SwFmt, SwClient );
      30             : 
      31        5817 : SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
      32             :               const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm,
      33             :               sal_uInt16 nFmtWhich )
      34             :     : SwModify( pDrvdFrm ),
      35             :     aSet( rPool, pWhichRanges ),
      36             :     nWhichId( nFmtWhich ),
      37             :     nFmtId( 0 ),
      38             :     nPoolFmtId( USHRT_MAX ),
      39             :     nPoolHelpId( USHRT_MAX ),
      40        5817 :     nPoolHlpFileId( UCHAR_MAX )
      41             : {
      42        5817 :     aFmtName.AssignAscii( pFmtNm );
      43        5817 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      44        5817 :     bAutoFmt = sal_True;
      45        5817 :     bHidden = false;
      46             : 
      47        5817 :     if( pDrvdFrm )
      48        2225 :         aSet.SetParent( &pDrvdFrm->aSet );
      49        5817 : }
      50             : 
      51       16601 : SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
      52             :               const sal_uInt16* pWhichRanges, SwFmt* pDrvdFrm,
      53             :               sal_uInt16 nFmtWhich )
      54             :     : SwModify( pDrvdFrm ),
      55             :     aFmtName( rFmtNm ),
      56             :     aSet( rPool, pWhichRanges ),
      57             :     nWhichId( nFmtWhich ),
      58             :     nFmtId( 0 ),
      59             :     nPoolFmtId( USHRT_MAX ),
      60             :     nPoolHelpId( USHRT_MAX ),
      61       16601 :     nPoolHlpFileId( UCHAR_MAX )
      62             : {
      63       16601 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      64       16601 :     bAutoFmt = sal_True;
      65       16601 :     bHidden = false;
      66             : 
      67       16601 :     if( pDrvdFrm )
      68       16601 :         aSet.SetParent( &pDrvdFrm->aSet );
      69       16601 : }
      70             : 
      71        2253 : SwFmt::SwFmt( const SwFmt& rFmt )
      72        2253 :     : SwModify( rFmt.DerivedFrom() ),
      73             :     aFmtName( rFmt.aFmtName ),
      74             :     aSet( rFmt.aSet ),
      75             :     nWhichId( rFmt.nWhichId ),
      76             :     nFmtId( 0 ),
      77        2253 :     nPoolFmtId( rFmt.GetPoolFmtId() ),
      78        2253 :     nPoolHelpId( rFmt.GetPoolHelpId() ),
      79        6759 :     nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
      80             : {
      81        2253 :     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
      82        2253 :     bAutoFmt = rFmt.bAutoFmt;
      83        2253 :     bHidden = rFmt.bHidden;
      84        2253 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
      85             : 
      86        2253 :     if( rFmt.DerivedFrom() )
      87        2253 :         aSet.SetParent( &rFmt.DerivedFrom()->aSet );
      88             :     // a few special treatments for attributes
      89        2253 :     aSet.SetModifyAtAttr( this );
      90        2253 : }
      91             : 
      92        1675 : SwFmt &SwFmt::operator=(const SwFmt& rFmt)
      93             : {
      94        1675 :     nWhichId = rFmt.nWhichId;
      95        1675 :     nPoolFmtId = rFmt.GetPoolFmtId();
      96        1675 :     nPoolHelpId = rFmt.GetPoolHelpId();
      97        1675 :     nPoolHlpFileId = rFmt.GetPoolHlpFileId();
      98             : 
      99        1675 :     if ( IsInCache() )
     100             :     {
     101           0 :         SwFrm::GetCache().Delete( this );
     102           0 :         SetInCache( sal_False );
     103             :     }
     104        1675 :     SetInSwFntCache( sal_False );
     105             : 
     106             :     // copy only array with attributes delta
     107        1675 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     108        3350 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     109        1675 :     aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
     110        1675 :     aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
     111             : 
     112             :     // a few special treatments for attributes
     113        1675 :     aSet.SetModifyAtAttr( this );
     114             : 
     115             :     // create PoolItem attribute for Modify
     116        1675 :     if( aOld.Count() )
     117             :     {
     118        1645 :         SwAttrSetChg aChgOld( aSet, aOld );
     119        3290 :         SwAttrSetChg aChgNew( aSet, aNew );
     120        3290 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     121             :     }
     122             : 
     123        1675 :     if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
     124             :     {
     125           0 :         if( GetRegisteredIn() )
     126           0 :             GetRegisteredInNonConst()->Remove(this);
     127           0 :         if( rFmt.GetRegisteredIn() )
     128             :         {
     129           0 :             const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
     130           0 :             aSet.SetParent( &rFmt.aSet );
     131             :         }
     132             :         else
     133             :         {
     134           0 :             aSet.SetParent( 0 );
     135             :         }
     136             :     }
     137        1675 :     bAutoFmt = rFmt.bAutoFmt;
     138        1675 :     bHidden = rFmt.bHidden;
     139        1675 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
     140        3350 :     return *this;
     141             : }
     142             : 
     143         154 : void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
     144             : {
     145             :     OSL_ENSURE( !IsDefault(), "SetName: Defaultformat" );
     146         154 :     if( bBroadcast )
     147             :     {
     148          94 :         SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
     149         188 :         SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
     150          94 :         aFmtName = rNewName;
     151         188 :         ModifyNotification( &aOld, &aNew );
     152             :     }
     153             :     else
     154             :     {
     155          60 :         aFmtName = rNewName;
     156             :     }
     157         154 : }
     158             : 
     159             : /** Copy attributes
     160             : 
     161             :     This function is called in every Copy-Ctor for copying the attributes.
     162             :     The latter can be only copied as soon as the derived class exists since
     163             :     for setting them the Which() function is called and that has the default
     164             :     value of 0 in the base class and is then overridden by the derived class.
     165             : 
     166             :     If we copy over multiple documents then the new document has to be provided
     167             :     in which <this> is defined. Currently this is important for DropCaps
     168             :     because that contains data that needs to be copied deeply.
     169             : */
     170         301 : void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
     171             : {
     172             :     // copy only array with attributes delta
     173         301 :     if ( IsInCache() )
     174             :     {
     175           0 :         SwFrm::GetCache().Delete( this );
     176           0 :         SetInCache( sal_False );
     177             :     }
     178         301 :     SetInSwFntCache( sal_False );
     179             : 
     180             :     // special treatments for some attributes
     181         301 :     SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
     182             : 
     183         301 :     if( !bReplace )     // refresh only those that are not set?
     184             :     {
     185           0 :         if( pChgSet == (SwAttrSet*)&rFmt.aSet )
     186           0 :             pChgSet = new SwAttrSet( rFmt.aSet );
     187           0 :         pChgSet->Differentiate( aSet );
     188             :     }
     189             : 
     190             :     // copy only array with attributes delta
     191         301 :     if( pChgSet->GetPool() != aSet.GetPool() )
     192           0 :         pChgSet->CopyToModify( *this );
     193             :     else
     194             :     {
     195         301 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     196         602 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     197             : 
     198         301 :         if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
     199             :         {
     200             :             // a few special treatments for attributes
     201         301 :             aSet.SetModifyAtAttr( this );
     202             : 
     203         301 :             SwAttrSetChg aChgOld( aSet, aOld );
     204         602 :             SwAttrSetChg aChgNew( aSet, aNew );
     205         602 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     206         301 :         }
     207             :     }
     208             : 
     209         301 :     if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // was a Set created?
     210           0 :         delete pChgSet;
     211         301 : }
     212             : 
     213       49246 : SwFmt::~SwFmt()
     214             : {
     215             :     // This happens at a ObjectDying message. Thus put all dependent
     216             :     // ones on DerivedFrom.
     217       24623 :     if( GetDepends() )
     218             :     {
     219             :         OSL_ENSURE( DerivedFrom(), "SwFmt::~SwFmt: Def dependents!" );
     220             : 
     221        4287 :         bFmtInDTOR = sal_True;
     222             : 
     223        4287 :         SwFmt* pParentFmt = DerivedFrom();
     224        4287 :         if( !pParentFmt )
     225             :         {
     226             :             SAL_WARN(
     227             :                 "sw.core",
     228             :                 "~SwFmt: parent format missing from: " << GetName() );
     229             :         }
     230             :         else
     231             :         {
     232       13726 :             while( GetDepends() )
     233             :             {
     234        5198 :                 SwFmtChg aOldFmt( this );
     235       10396 :                 SwFmtChg aNewFmt( pParentFmt );
     236        5198 :                 SwClient* pDepend = (SwClient*)GetDepends();
     237        5198 :                 pParentFmt->Add( pDepend );
     238        5198 :                 pDepend->ModifyNotification( &aOldFmt, &aNewFmt );
     239        5198 :             }
     240             :         }
     241             :     }
     242       24623 : }
     243             : 
     244      145019 : void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
     245             : {
     246      145019 :     bool bContinue = true; // true = pass on to dependent ones
     247             : 
     248             :     sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
     249      145019 :                     pNewValue ? pNewValue->Which() : 0 ;
     250      145019 :     switch( nWhich )
     251             :     {
     252           0 :     case 0:     break;          // Which-Id of 0?
     253             : 
     254             :     case RES_OBJECTDYING :
     255             :         {
     256             :             // If the dying object is the parent format of this format so
     257             :             // attach this to the parent of the parent
     258           0 :             SwFmt* pFmt = (SwFmt*) ((SwPtrMsgPoolItem*)pNewValue)->pObject;
     259             : 
     260             :             // do not move if this is the topmost format
     261           0 :             if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
     262             :             {
     263           0 :                 if( pFmt->GetRegisteredIn() )
     264             :                 {
     265             :                     // if parent so register in new parent
     266           0 :                     pFmt->DerivedFrom()->Add( this );
     267           0 :                     aSet.SetParent( &DerivedFrom()->aSet );
     268             :                 }
     269             :                 else
     270             :                 {
     271             :                     // otherwise de-register at least from dying one
     272           0 :                     DerivedFrom()->Remove( this );
     273           0 :                     aSet.SetParent( 0 );
     274             :                 }
     275             :             }
     276             :         }
     277           0 :         break;
     278             :     case RES_ATTRSET_CHG:
     279      136845 :         if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
     280             :         {
     281             :             // pass only those that are not set
     282       81631 :             SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
     283      163262 :             SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
     284             : 
     285       81631 :             aOld.GetChgSet()->Differentiate( aSet );
     286       81631 :             aNew.GetChgSet()->Differentiate( aSet );
     287             : 
     288       81631 :             if( aNew.Count() )
     289       79595 :                 NotifyClients( &aOld, &aNew );
     290      163262 :             bContinue = false;
     291             :         }
     292      136845 :         break;
     293             :     case RES_FMT_CHG:
     294             :         // if the format parent will be moved so register my attribute set at
     295             :         // the new one
     296             : 
     297             :         // skip my own Modify
     298       13113 :         if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
     299        5355 :             ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
     300             :         {
     301             :             // attach Set to new parent
     302        1456 :             aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
     303             :         }
     304        7758 :         break;
     305             :     case RES_RESET_FMTWRITTEN:
     306             :         {
     307           0 :             ResetWritten();
     308             : 
     309             :             // mba: here we don't use the additional stuff from NotifyClients().
     310             :             // should we?!
     311             :             // mba: move the code that ignores this event to the clients
     312             : 
     313             :             // pass Hint only to dependent formats (no Frames)
     314           0 :             ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
     315           0 :             bContinue = false;
     316             :         }
     317           0 :         break;
     318             :     default:
     319             :         {
     320             :             // attribute is defined in this format
     321         416 :             if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
     322             :             {
     323             :                 // DropCaps might come into this block
     324             :                 OSL_ENSURE( RES_PARATR_DROP == nWhich, "Modify was sent without sender" );
     325           0 :                 bContinue = false;
     326             :             }
     327             :         }
     328             :     }
     329             : 
     330      145019 :     if( bContinue )
     331             :     {
     332             :         // walk over all dependent formats
     333       63388 :         NotifyClients( pOldValue, pNewValue );
     334             :     }
     335      145019 : }
     336             : 
     337        1788 : sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
     338             : {
     339        1788 :     if ( pDerFrom )
     340             :     {
     341        1376 :         const SwFmt* pFmt = pDerFrom;
     342        5698 :         while ( pFmt != 0 )
     343             :         {
     344        2946 :             if ( pFmt == this )
     345           0 :                 return sal_False;
     346             : 
     347        2946 :             pFmt=pFmt->DerivedFrom();
     348             :         }
     349             :     }
     350             :     else
     351             :     {
     352             :         // nothing provided, search for Dflt format
     353         412 :         pDerFrom = this;
     354        1577 :         while ( pDerFrom->DerivedFrom() )
     355         753 :             pDerFrom = pDerFrom->DerivedFrom();
     356             :     }
     357        1788 :     if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
     358         229 :         return sal_False;
     359             : 
     360             :     OSL_ENSURE( Which()==pDerFrom->Which()
     361             :             || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
     362             :             || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
     363             :             || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
     364             :             "SetDerivedFrom: derive apples from oranges?");
     365             : 
     366        1559 :     if ( IsInCache() )
     367             :     {
     368           3 :         SwFrm::GetCache().Delete( this );
     369           3 :         SetInCache( sal_False );
     370             :     }
     371        1559 :     SetInSwFntCache( sal_False );
     372             : 
     373        1559 :     pDerFrom->Add( this );
     374        1559 :     aSet.SetParent( &pDerFrom->aSet );
     375             : 
     376        1559 :     SwFmtChg aOldFmt( this );
     377        3118 :     SwFmtChg aNewFmt( this );
     378        1559 :     ModifyNotification( &aOldFmt, &aNewFmt );
     379             : 
     380        3118 :     return sal_True;
     381             : }
     382             : 
     383       73890 : bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
     384             : {
     385       73890 :     if ( IsInCache() || IsInSwFntCache() )
     386             :     {
     387         475 :         const sal_uInt16 nWhich = rAttr.Which();
     388         475 :         CheckCaching( nWhich );
     389             :     }
     390             : 
     391             :     // if Modify is locked then no modifications will be sent;
     392             :     // but call Modify always for FrmFmts
     393       73890 :     bool bRet = false;
     394       73890 :     const sal_uInt16 nFmtWhich = Which();
     395      161337 :     if( IsModifyLocked() ||
     396      136815 :         ( !GetDepends() &&
     397       64327 :           (RES_GRFFMTCOLL == nFmtWhich  ||
     398             :            RES_TXTFMTCOLL == nFmtWhich ) ) )
     399             :     {
     400       14959 :         if( ( bRet = (0 != aSet.Put( rAttr ))) )
     401       14460 :             aSet.SetModifyAtAttr( this );
     402             :         // #i71574#
     403       14959 :         if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
     404             :         {
     405         187 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     406             :         }
     407             :     }
     408             :     else
     409             :     {
     410             :         // copy only array with attributes delta
     411       58931 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     412      117862 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     413             : 
     414       58931 :         bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
     415       58931 :         if( bRet )
     416             :         {
     417             :             // some special treatments for attributes
     418       39080 :             aSet.SetModifyAtAttr( this );
     419             : 
     420       39080 :             SwAttrSetChg aChgOld( aSet, aOld );
     421       78160 :             SwAttrSetChg aChgNew( aSet, aNew );
     422       78160 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     423       58931 :         }
     424             :     }
     425       73890 :     return bRet;
     426             : }
     427             : 
     428       24142 : bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
     429             : {
     430       24142 :     if( !rSet.Count() )
     431          10 :         return false;
     432             : 
     433       24132 :     if ( IsInCache() )
     434             :     {
     435          78 :         SwFrm::GetCache().Delete( this );
     436          78 :         SetInCache( sal_False );
     437             :     }
     438       24132 :     SetInSwFntCache( sal_False );
     439             : 
     440             :     // if Modify is locked then no modifications will be sent;
     441             :     // but call Modify always for FrmFmts
     442       24132 :     bool bRet = false;
     443       24132 :     const sal_uInt16 nFmtWhich = Which();
     444       54440 :     if ( IsModifyLocked() ||
     445       39492 :          ( !GetDepends() &&
     446       15407 :            ( RES_GRFFMTCOLL == nFmtWhich ||
     447             :              RES_TXTFMTCOLL == nFmtWhich ) ) )
     448             :     {
     449        6223 :         if( ( bRet = (0 != aSet.Put( rSet ))) )
     450        5039 :             aSet.SetModifyAtAttr( this );
     451             :         // #i71574#
     452        6223 :         if ( nFmtWhich == RES_TXTFMTCOLL )
     453             :         {
     454        6176 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     455             :         }
     456             :     }
     457             :     else
     458             :     {
     459       17909 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     460       35818 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     461       17909 :         bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
     462       17909 :         if( bRet )
     463             :         {
     464             :             // some special treatments for attributes
     465       12780 :             aSet.SetModifyAtAttr( this );
     466       12780 :             SwAttrSetChg aChgOld( aSet, aOld );
     467       25560 :             SwAttrSetChg aChgNew( aSet, aNew );
     468       25560 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     469       17909 :         }
     470             :     }
     471       24132 :     return bRet;
     472             : }
     473             : 
     474             : // remove Hint using nWhich from array with delta
     475       36709 : bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
     476             : {
     477       36709 :     if( !aSet.Count() )
     478        6130 :         return false;
     479             : 
     480       30579 :     if( !nWhich2 || nWhich2 < nWhich1 )
     481       29128 :         nWhich2 = nWhich1; // then set to 1st ID, only this item
     482             : 
     483       30579 :     if ( IsInCache() || IsInSwFntCache() )
     484             :     {
     485         262 :         for( sal_uInt16 n = nWhich1; n < nWhich2; ++n )
     486          40 :             CheckCaching( n );
     487             :     }
     488             : 
     489             :     // if Modify is locked then no modifications will be sent
     490       30579 :     if( IsModifyLocked() )
     491        3650 :         return 0 != (( nWhich2 == nWhich1 )
     492         411 :                      ? aSet.ClearItem( nWhich1 )
     493        3239 :                      : aSet.ClearItem_BC( nWhich1, nWhich2 ));
     494             : 
     495       28754 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     496       57508 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     497       28754 :     bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
     498       28754 :     if( bRet )
     499             :     {
     500         243 :         SwAttrSetChg aChgOld( aSet, aOld );
     501         486 :         SwAttrSetChg aChgNew( aSet, aNew );
     502         486 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     503             :     }
     504       57508 :     return bRet;
     505             : }
     506             : 
     507             : // #i73790#
     508        1008 : sal_uInt16 SwFmt::ResetAllFmtAttr()
     509             : {
     510        1008 :     if( !aSet.Count() )
     511         337 :         return 0;
     512             : 
     513         671 :     if ( IsInCache() )
     514             :     {
     515           0 :         SwFrm::GetCache().Delete( this );
     516           0 :         SetInCache( sal_False );
     517             :     }
     518         671 :     SetInSwFntCache( sal_False );
     519             : 
     520             :     // if Modify is locked then no modifications will be sent
     521         671 :     if( IsModifyLocked() )
     522           0 :         return aSet.ClearItem( 0 );
     523             : 
     524         671 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     525        1342 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     526         671 :     bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
     527         671 :     if( bRet )
     528             :     {
     529         671 :         SwAttrSetChg aChgOld( aSet, aOld );
     530        1342 :         SwAttrSetChg aChgNew( aSet, aNew );
     531        1342 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     532             :     }
     533        1342 :     return aNew.Count();
     534             : }
     535             : 
     536      114279 : bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
     537             : {
     538      114279 :     return SwModify::GetInfo( rInfo );
     539             : }
     540             : 
     541        1508 : void SwFmt::DelDiffs( const SfxItemSet& rSet )
     542             : {
     543        1508 :     if( !aSet.Count() )
     544          60 :         return;
     545             : 
     546        1478 :     if ( IsInCache() )
     547             :     {
     548           0 :         SwFrm::GetCache().Delete( this );
     549           0 :         SetInCache( sal_False );
     550             :     }
     551        1478 :     SetInSwFntCache( sal_False );
     552             : 
     553             :     // if Modify is locked then no modifications will be sent
     554        1478 :     if( IsModifyLocked() )
     555             :     {
     556           0 :         aSet.Intersect( rSet );
     557           0 :         return;
     558             :     }
     559             : 
     560        1478 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     561        2956 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     562        1478 :     bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
     563        1478 :     if( bRet )
     564             :     {
     565         708 :         SwAttrSetChg aChgOld( aSet, aOld );
     566        1416 :         SwAttrSetChg aChgNew( aSet, aNew );
     567        1416 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     568        1478 :     }
     569             : }
     570             : 
     571             : /** SwFmt::IsBackgroundTransparent
     572             : 
     573             :     Virtual method to determine, if background of format is transparent.
     574             :     Default implementation returns false. Thus, subclasses have to overload
     575             :     method, if the specific subclass can have a transparent background.
     576             : 
     577             :     @return false, default implementation
     578             : */
     579           0 : sal_Bool SwFmt::IsBackgroundTransparent() const
     580             : {
     581           0 :     return sal_False;
     582             : }
     583             : 
     584             : /** SwFmt::IsShadowTransparent
     585             : 
     586             :     Virtual method to determine, if shadow of format is transparent.
     587             :     Default implementation returns false. Thus, subclasses have to overload
     588             :     method, if the specific subclass can have a transparent shadow.
     589             : 
     590             :     @return false, default implementation
     591             : */
     592         394 : sal_Bool SwFmt::IsShadowTransparent() const
     593             : {
     594         394 :     return sal_False;
     595             : }
     596             : 
     597             : /*
     598             :  * Document Interface Access
     599             :  */
     600       41417 : const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
     601        1839 : const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
     602        7508 : IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
     603           2 : const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
     604       17325 : IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
     605        1283 : IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
     606         793 : IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
     607          99 : IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
     608             : 
     609             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10