LCOV - code coverage report
Current view: top level - libreoffice/sw/source/core/attr - format.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 229 274 83.6 %
Date: 2012-12-17 Functions: 25 31 80.6 %
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 <rtl/strbuf.hxx>
      28             : #include <swcache.hxx>
      29             : 
      30      126188 : TYPEINIT1( SwFmt, SwClient );
      31             : 
      32        3912 : SwFmt::SwFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
      33             :               const sal_uInt16* pWhichRanges, SwFmt *pDrvdFrm,
      34             :               sal_uInt16 nFmtWhich )
      35             :     : SwModify( pDrvdFrm ),
      36             :     aSet( rPool, pWhichRanges ),
      37             :     nWhichId( nFmtWhich ),
      38             :     nFmtId( 0 ),
      39             :     nPoolFmtId( USHRT_MAX ),
      40             :     nPoolHelpId( USHRT_MAX ),
      41        3912 :     nPoolHlpFileId( UCHAR_MAX )
      42             : {
      43        3912 :     aFmtName.AssignAscii( pFmtNm );
      44        3912 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      45        3912 :     bAutoFmt = sal_True;
      46        3912 :     bHidden = false;
      47             : 
      48        3912 :     if( pDrvdFrm )
      49        1680 :         aSet.SetParent( &pDrvdFrm->aSet );
      50        3912 : }
      51             : 
      52       11448 : SwFmt::SwFmt( SwAttrPool& rPool, const String& rFmtNm,
      53             :               const sal_uInt16* pWhichRanges, SwFmt* pDrvdFrm,
      54             :               sal_uInt16 nFmtWhich )
      55             :     : SwModify( pDrvdFrm ),
      56             :     aFmtName( rFmtNm ),
      57             :     aSet( rPool, pWhichRanges ),
      58             :     nWhichId( nFmtWhich ),
      59             :     nFmtId( 0 ),
      60             :     nPoolFmtId( USHRT_MAX ),
      61             :     nPoolHelpId( USHRT_MAX ),
      62       11448 :     nPoolHlpFileId( UCHAR_MAX )
      63             : {
      64       11448 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      65       11448 :     bAutoFmt = sal_True;
      66       11448 :     bHidden = false;
      67             : 
      68       11448 :     if( pDrvdFrm )
      69       11448 :         aSet.SetParent( &pDrvdFrm->aSet );
      70       11448 : }
      71             : 
      72        2490 : SwFmt::SwFmt( const SwFmt& rFmt )
      73        2490 :     : SwModify( rFmt.DerivedFrom() ),
      74             :     aFmtName( rFmt.aFmtName ),
      75             :     aSet( rFmt.aSet ),
      76             :     nWhichId( rFmt.nWhichId ),
      77             :     nFmtId( 0 ),
      78        2490 :     nPoolFmtId( rFmt.GetPoolFmtId() ),
      79        2490 :     nPoolHelpId( rFmt.GetPoolHelpId() ),
      80        7470 :     nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
      81             : {
      82        2490 :     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
      83        2490 :     bAutoFmt = rFmt.bAutoFmt;
      84        2490 :     bHidden = rFmt.bHidden;
      85        2490 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
      86             : 
      87        2490 :     if( rFmt.DerivedFrom() )
      88        2490 :         aSet.SetParent( &rFmt.DerivedFrom()->aSet );
      89             :     // a few special treatments for attributes
      90        2490 :     aSet.SetModifyAtAttr( this );
      91        2490 : }
      92             : 
      93        1674 : SwFmt &SwFmt::operator=(const SwFmt& rFmt)
      94             : {
      95        1674 :     nWhichId = rFmt.nWhichId;
      96        1674 :     nPoolFmtId = rFmt.GetPoolFmtId();
      97        1674 :     nPoolHelpId = rFmt.GetPoolHelpId();
      98        1674 :     nPoolHlpFileId = rFmt.GetPoolHlpFileId();
      99             : 
     100        1674 :     if ( IsInCache() )
     101             :     {
     102           0 :         SwFrm::GetCache().Delete( this );
     103           0 :         SetInCache( sal_False );
     104             :     }
     105        1674 :     SetInSwFntCache( sal_False );
     106             : 
     107             :     // copy only array with attributes delta
     108        1674 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     109        1674 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     110        1674 :     aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
     111        1674 :     aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
     112             : 
     113             :     // a few special treatments for attributes
     114        1674 :     aSet.SetModifyAtAttr( this );
     115             : 
     116             :     // create PoolItem attribute for Modify
     117        1674 :     if( aOld.Count() )
     118             :     {
     119        1674 :         SwAttrSetChg aChgOld( aSet, aOld );
     120        1674 :         SwAttrSetChg aChgNew( aSet, aNew );
     121        1674 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     122             :     }
     123             : 
     124        1674 :     if( GetRegisteredIn() != rFmt.GetRegisteredIn() )
     125             :     {
     126           0 :         if( GetRegisteredIn() )
     127           0 :             GetRegisteredInNonConst()->Remove(this);
     128           0 :         if( rFmt.GetRegisteredIn() )
     129             :         {
     130           0 :             const_cast<SwFmt&>(rFmt).GetRegisteredInNonConst()->Add(this);
     131           0 :             aSet.SetParent( &rFmt.aSet );
     132             :         }
     133             :         else
     134             :         {
     135           0 :             aSet.SetParent( 0 );
     136             :         }
     137             :     }
     138        1674 :     bAutoFmt = rFmt.bAutoFmt;
     139        1674 :     bHidden = rFmt.bHidden;
     140        1674 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
     141        1674 :     return *this;
     142             : }
     143             : 
     144         152 : void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
     145             : {
     146             :     OSL_ENSURE( !IsDefault(), "SetName: Defaultformat" );
     147         152 :     if( bBroadcast )
     148             :     {
     149          62 :         SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
     150          62 :         SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
     151          62 :         aFmtName = rNewName;
     152          62 :         ModifyNotification( &aOld, &aNew );
     153             :     }
     154             :     else
     155             :     {
     156          90 :         aFmtName = rNewName;
     157             :     }
     158         152 : }
     159             : 
     160             : /** Copy attributes
     161             : 
     162             :     This function is called in every Copy-Ctor for copying the attributes.
     163             :     The latter can be only copied as soon as the derived class exists since
     164             :     for setting them the Which() function is called and that has the default
     165             :     value of 0 in the base class and is then overridden by the derived class.
     166             : 
     167             :     If we copy over multiple documents then the new document has to be provided
     168             :     in which <this> is defined. Currently this is important for DropCaps
     169             :     because that contains data that needs to be copied deeply.
     170             : */
     171         382 : void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
     172             : {
     173             :     // copy only array with attributes delta
     174         382 :     if ( IsInCache() )
     175             :     {
     176           0 :         SwFrm::GetCache().Delete( this );
     177           0 :         SetInCache( sal_False );
     178             :     }
     179         382 :     SetInSwFntCache( sal_False );
     180             : 
     181             :     // special treatments for some attributes
     182         382 :     SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
     183             : 
     184         382 :     if( !bReplace )     // refresh only those that are not set?
     185             :     {
     186           0 :         if( pChgSet == (SwAttrSet*)&rFmt.aSet )
     187           0 :             pChgSet = new SwAttrSet( rFmt.aSet );
     188           0 :         pChgSet->Differentiate( aSet );
     189             :     }
     190             : 
     191             :     // copy only array with attributes delta
     192         382 :     if( pChgSet->GetPool() != aSet.GetPool() )
     193           0 :         pChgSet->CopyToModify( *this );
     194             :     else
     195             :     {
     196         382 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     197         382 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     198             : 
     199         382 :         if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
     200             :         {
     201             :             // a few special treatments for attributes
     202         382 :             aSet.SetModifyAtAttr( this );
     203             : 
     204         382 :             SwAttrSetChg aChgOld( aSet, aOld );
     205         382 :             SwAttrSetChg aChgNew( aSet, aNew );
     206         382 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     207         382 :         }
     208             :     }
     209             : 
     210         382 :     if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // was a Set created?
     211           0 :         delete pChgSet;
     212         382 : }
     213             : 
     214       16540 : SwFmt::~SwFmt()
     215             : {
     216             :     // This happens at a ObjectDying message. Thus put all dependent
     217             :     // ones on DerivedFrom.
     218        8270 :     if( GetDepends() )
     219             :     {
     220             :         OSL_ENSURE( DerivedFrom(), "SwFmt::~SwFmt: Def dependents!" );
     221             : 
     222         508 :         bFmtInDTOR = sal_True;
     223             : 
     224         508 :         SwFmt* pParentFmt = DerivedFrom();
     225         508 :         if( !pParentFmt )
     226             :         {
     227             :             OSL_FAIL(rtl::OStringBuffer(
     228             :                     RTL_CONSTASCII_STRINGPARAM("~SwFmt: parent format missing from: ")).
     229             :                 append(rtl::OUStringToOString(GetName(), osl_getThreadTextEncoding())).getStr());
     230             :         }
     231             :         else
     232             :         {
     233        1888 :             while( GetDepends() )
     234             :             {
     235         872 :                 SwFmtChg aOldFmt( this );
     236         872 :                 SwFmtChg aNewFmt( pParentFmt );
     237         872 :                 SwClient* pDepend = (SwClient*)GetDepends();
     238         872 :                 pParentFmt->Add( pDepend );
     239         872 :                 pDepend->ModifyNotification( &aOldFmt, &aNewFmt );
     240         872 :             }
     241             :         }
     242             :     }
     243        8270 : }
     244             : 
     245      112411 : void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
     246             : {
     247      112411 :     bool bContinue = true; // true = pass on to dependent ones
     248             : 
     249             :     sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
     250      112411 :                     pNewValue ? pNewValue->Which() : 0 ;
     251      112411 :     switch( nWhich )
     252             :     {
     253           0 :     case 0:     break;          // Which-Id of 0?
     254             : 
     255             :     case RES_OBJECTDYING :
     256             :         {
     257             :             // If the dying object is the parent format of this format so
     258             :             // attach this to the parent of the parent
     259           0 :             SwFmt* pFmt = (SwFmt*) ((SwPtrMsgPoolItem*)pNewValue)->pObject;
     260             : 
     261             :             // do not move if this is the topmost format
     262           0 :             if( GetRegisteredIn() && GetRegisteredIn() == pFmt )
     263             :             {
     264           0 :                 if( pFmt->GetRegisteredIn() )
     265             :                 {
     266             :                     // if parent so register in new parent
     267           0 :                     pFmt->DerivedFrom()->Add( this );
     268           0 :                     aSet.SetParent( &DerivedFrom()->aSet );
     269             :                 }
     270             :                 else
     271             :                 {
     272             :                     // otherwise de-register at least from dying one
     273           0 :                     DerivedFrom()->Remove( this );
     274           0 :                     aSet.SetParent( 0 );
     275             :                 }
     276             :             }
     277             :         }
     278           0 :         break;
     279             :     case RES_ATTRSET_CHG:
     280      106320 :         if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
     281             :         {
     282             :             // pass only those that are not set
     283       56029 :             SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
     284       56029 :             SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
     285             : 
     286       56029 :             aOld.GetChgSet()->Differentiate( aSet );
     287       56029 :             aNew.GetChgSet()->Differentiate( aSet );
     288             : 
     289       56029 :             if( aNew.Count() )
     290       53614 :                 NotifyClients( &aOld, &aNew );
     291       56029 :             bContinue = false;
     292             :         }
     293      106320 :         break;
     294             :     case RES_FMT_CHG:
     295             :         // if the format parent will be moved so register my attribute set at
     296             :         // the new one
     297             : 
     298             :         // skip my own Modify
     299        9755 :         if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
     300        3934 :             ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
     301             :         {
     302             :             // attach Set to new parent
     303         254 :             aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
     304             :         }
     305        5821 :         break;
     306             :     case RES_RESET_FMTWRITTEN:
     307             :         {
     308           0 :             ResetWritten();
     309             : 
     310             :             // mba: here we don't use the additional stuff from NotifyClients().
     311             :             // should we?!
     312             :             // mba: move the code that ignores this event to the clients
     313             : 
     314             :             // pass Hint only to dependent formats (no Frames)
     315           0 :             ModifyBroadcast( pOldValue, pNewValue, TYPE(SwFmt) );
     316           0 :             bContinue = false;
     317             :         }
     318           0 :         break;
     319             :     default:
     320             :         {
     321             :             // attribute is defined in this format
     322         270 :             if( SFX_ITEM_SET == aSet.GetItemState( nWhich, sal_False ))
     323             :             {
     324             :                 // DropCaps might come into this block
     325             :                 OSL_ENSURE( RES_PARATR_DROP == nWhich, "Modify was sent without sender" );
     326           0 :                 bContinue = false;
     327             :             }
     328             :         }
     329             :     }
     330             : 
     331      112411 :     if( bContinue )
     332             :     {
     333             :         // walk over all dependent formats
     334       56382 :         NotifyClients( pOldValue, pNewValue );
     335             :     }
     336      112411 : }
     337             : 
     338        1648 : sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
     339             : {
     340        1648 :     if ( pDerFrom )
     341             :     {
     342        1287 :         const SwFmt* pFmt = pDerFrom;
     343        5355 :         while ( pFmt != 0 )
     344             :         {
     345        2781 :             if ( pFmt == this )
     346           0 :                 return sal_False;
     347             : 
     348        2781 :             pFmt=pFmt->DerivedFrom();
     349             :         }
     350             :     }
     351             :     else
     352             :     {
     353             :         // nothing provided, search for Dflt format
     354         361 :         pDerFrom = this;
     355        1356 :         while ( pDerFrom->DerivedFrom() )
     356         634 :             pDerFrom = pDerFrom->DerivedFrom();
     357             :     }
     358        1648 :     if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
     359         280 :         return sal_False;
     360             : 
     361             :     OSL_ENSURE( Which()==pDerFrom->Which()
     362             :             || ( Which()==RES_CONDTXTFMTCOLL && pDerFrom->Which()==RES_TXTFMTCOLL)
     363             :             || ( Which()==RES_TXTFMTCOLL && pDerFrom->Which()==RES_CONDTXTFMTCOLL)
     364             :             || ( Which()==RES_FLYFRMFMT && pDerFrom->Which()==RES_FRMFMT ),
     365             :             "SetDerivedFrom: derive apples from oranges?");
     366             : 
     367        1368 :     if ( IsInCache() )
     368             :     {
     369           0 :         SwFrm::GetCache().Delete( this );
     370           0 :         SetInCache( sal_False );
     371             :     }
     372        1368 :     SetInSwFntCache( sal_False );
     373             : 
     374        1368 :     pDerFrom->Add( this );
     375        1368 :     aSet.SetParent( &pDerFrom->aSet );
     376             : 
     377        1368 :     SwFmtChg aOldFmt( this );
     378        1368 :     SwFmtChg aNewFmt( this );
     379        1368 :     ModifyNotification( &aOldFmt, &aNewFmt );
     380             : 
     381        1368 :     return sal_True;
     382             : }
     383             : 
     384       77082 : bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
     385             : {
     386       77082 :     if ( IsInCache() || IsInSwFntCache() )
     387             :     {
     388         426 :         const sal_uInt16 nWhich = rAttr.Which();
     389         426 :         CheckCaching( nWhich );
     390             :     }
     391             : 
     392             :     // if Modify is locked then no modifications will be sent;
     393             :     // but call Modify always for FrmFmts
     394       77082 :     bool bRet = false;
     395       77082 :     const sal_uInt16 nFmtWhich = Which();
     396      152844 :     if( IsModifyLocked() ||
     397       75762 :         ( !GetDepends() &&
     398             :           (RES_GRFFMTCOLL == nFmtWhich  ||
     399             :            RES_TXTFMTCOLL == nFmtWhich ) ) )
     400             :     {
     401       14684 :         if( ( bRet = (0 != aSet.Put( rAttr ))) )
     402       14358 :             aSet.SetModifyAtAttr( this );
     403             :         // #i71574#
     404       14684 :         if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
     405             :         {
     406         298 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     407             :         }
     408             :     }
     409             :     else
     410             :     {
     411             :         // copy only array with attributes delta
     412       62398 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     413       62398 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     414             : 
     415       62398 :         bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
     416       62398 :         if( bRet )
     417             :         {
     418             :             // some special treatments for attributes
     419       37835 :             aSet.SetModifyAtAttr( this );
     420             : 
     421       37835 :             SwAttrSetChg aChgOld( aSet, aOld );
     422       37835 :             SwAttrSetChg aChgNew( aSet, aNew );
     423       37835 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     424       62398 :         }
     425             :     }
     426       77082 :     return bRet;
     427             : }
     428             : 
     429       18493 : bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
     430             : {
     431       18493 :     if( !rSet.Count() )
     432           0 :         return false;
     433             : 
     434       18493 :     if ( IsInCache() )
     435             :     {
     436           0 :         SwFrm::GetCache().Delete( this );
     437           0 :         SetInCache( sal_False );
     438             :     }
     439       18493 :     SetInSwFntCache( sal_False );
     440             : 
     441             :     // if Modify is locked then no modifications will be sent;
     442             :     // but call Modify always for FrmFmts
     443       18493 :     bool bRet = false;
     444       18493 :     const sal_uInt16 nFmtWhich = Which();
     445       36952 :     if ( IsModifyLocked() ||
     446       18459 :          ( !GetDepends() &&
     447             :            ( RES_GRFFMTCOLL == nFmtWhich ||
     448             :              RES_TXTFMTCOLL == nFmtWhich ) ) )
     449             :     {
     450        4752 :         if( ( bRet = (0 != aSet.Put( rSet ))) )
     451        3806 :             aSet.SetModifyAtAttr( this );
     452             :         // #i71574#
     453        4752 :         if ( nFmtWhich == RES_TXTFMTCOLL )
     454             :         {
     455        4718 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     456             :         }
     457             :     }
     458             :     else
     459             :     {
     460       13741 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     461       13741 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     462       13741 :         bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
     463       13741 :         if( bRet )
     464             :         {
     465             :             // some special treatments for attributes
     466        8614 :             aSet.SetModifyAtAttr( this );
     467        8614 :             SwAttrSetChg aChgOld( aSet, aOld );
     468        8614 :             SwAttrSetChg aChgNew( aSet, aNew );
     469        8614 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     470       13741 :         }
     471             :     }
     472       18493 :     return bRet;
     473             : }
     474             : 
     475             : // remove Hint using nWhich from array with delta
     476       41011 : bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
     477             : {
     478       41011 :     if( !aSet.Count() )
     479        4048 :         return false;
     480             : 
     481       36963 :     if( !nWhich2 || nWhich2 < nWhich1 )
     482       35519 :         nWhich2 = nWhich1; // then set to 1st ID, only this item
     483             : 
     484       36963 :     if ( IsInCache() || IsInSwFntCache() )
     485             :     {
     486           2 :         for( sal_uInt16 n = nWhich1; n < nWhich2; ++n )
     487           0 :             CheckCaching( n );
     488             :     }
     489             : 
     490             :     // if Modify is locked then no modifications will be sent
     491       36963 :     if( IsModifyLocked() )
     492             :         return 0 != (( nWhich2 == nWhich1 )
     493           2 :                      ? aSet.ClearItem( nWhich1 )
     494        1440 :                      : aSet.ClearItem_BC( nWhich1, nWhich2 ));
     495             : 
     496       35525 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     497       35525 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     498       35525 :     bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
     499       35525 :     if( bRet )
     500             :     {
     501         334 :         SwAttrSetChg aChgOld( aSet, aOld );
     502         334 :         SwAttrSetChg aChgNew( aSet, aNew );
     503         334 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     504             :     }
     505       35525 :     return bRet;
     506             : }
     507             : 
     508             : // #i73790#
     509        1095 : sal_uInt16 SwFmt::ResetAllFmtAttr()
     510             : {
     511        1095 :     if( !aSet.Count() )
     512         321 :         return 0;
     513             : 
     514         774 :     if ( IsInCache() )
     515             :     {
     516           0 :         SwFrm::GetCache().Delete( this );
     517           0 :         SetInCache( sal_False );
     518             :     }
     519         774 :     SetInSwFntCache( sal_False );
     520             : 
     521             :     // if Modify is locked then no modifications will be sent
     522         774 :     if( IsModifyLocked() )
     523           0 :         return aSet.ClearItem( 0 );
     524             : 
     525         774 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     526         774 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     527         774 :     bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
     528         774 :     if( bRet )
     529             :     {
     530         774 :         SwAttrSetChg aChgOld( aSet, aOld );
     531         774 :         SwAttrSetChg aChgNew( aSet, aNew );
     532         774 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     533             :     }
     534         774 :     return aNew.Count();
     535             : }
     536             : 
     537       12498 : bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
     538             : {
     539       12498 :     return SwModify::GetInfo( rInfo );
     540             : }
     541             : 
     542        1628 : void SwFmt::DelDiffs( const SfxItemSet& rSet )
     543             : {
     544        1628 :     if( !aSet.Count() )
     545             :         return;
     546             : 
     547        1628 :     if ( IsInCache() )
     548             :     {
     549           0 :         SwFrm::GetCache().Delete( this );
     550           0 :         SetInCache( sal_False );
     551             :     }
     552        1628 :     SetInSwFntCache( sal_False );
     553             : 
     554             :     // if Modify is locked then no modifications will be sent
     555        1628 :     if( IsModifyLocked() )
     556             :     {
     557           0 :         aSet.Intersect( rSet );
     558             :         return;
     559             :     }
     560             : 
     561        1628 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     562        1628 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     563        1628 :     bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
     564        1628 :     if( bRet )
     565             :     {
     566         830 :         SwAttrSetChg aChgOld( aSet, aOld );
     567         830 :         SwAttrSetChg aChgNew( aSet, aNew );
     568         830 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     569        1628 :     }
     570             : }
     571             : 
     572             : /** SwFmt::IsBackgroundTransparent
     573             : 
     574             :     Virtual method to determine, if background of format is transparent.
     575             :     Default implementation returns false. Thus, subclasses have to overload
     576             :     method, if the specific subclass can have a transparent background.
     577             : 
     578             :     @return false, default implementation
     579             : */
     580           0 : sal_Bool SwFmt::IsBackgroundTransparent() const
     581             : {
     582           0 :     return sal_False;
     583             : }
     584             : 
     585             : /** SwFmt::IsShadowTransparent
     586             : 
     587             :     Virtual method to determine, if shadow of format is transparent.
     588             :     Default implementation returns false. Thus, subclasses have to overload
     589             :     method, if the specific subclass can have a transparent shadow.
     590             : 
     591             :     @return false, default implementation
     592             : */
     593          94 : sal_Bool SwFmt::IsShadowTransparent() const
     594             : {
     595          94 :     return sal_False;
     596             : }
     597             : 
     598             : /*
     599             :  * Document Interface Access
     600             :  */
     601       20224 : const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
     602         754 : const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
     603        3390 : IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
     604           6 : const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
     605        4122 : IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
     606         616 : IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
     607         478 : IDocumentFieldsAccess* SwFmt::getIDocumentFieldsAccess() { return GetDoc(); }
     608           0 : IDocumentChartDataProviderAccess* SwFmt::getIDocumentChartDataProviderAccess() { return GetDoc(); }
     609             : 
     610             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10