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: 227 274 82.8 %
Date: 2012-12-27 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       61904 : TYPEINIT1( SwFmt, SwClient );
      31             : 
      32        1906 : 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        1906 :     nPoolHlpFileId( UCHAR_MAX )
      42             : {
      43        1906 :     aFmtName.AssignAscii( pFmtNm );
      44        1906 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      45        1906 :     bAutoFmt = sal_True;
      46        1906 :     bHidden = false;
      47             : 
      48        1906 :     if( pDrvdFrm )
      49         802 :         aSet.SetParent( &pDrvdFrm->aSet );
      50        1906 : }
      51             : 
      52        5480 : 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        5480 :     nPoolHlpFileId( UCHAR_MAX )
      63             : {
      64        5480 :     bWritten = bFmtInDTOR = bAutoUpdateFmt = sal_False; // LAYER_IMPL
      65        5480 :     bAutoFmt = sal_True;
      66        5480 :     bHidden = false;
      67             : 
      68        5480 :     if( pDrvdFrm )
      69        5480 :         aSet.SetParent( &pDrvdFrm->aSet );
      70        5480 : }
      71             : 
      72        1245 : SwFmt::SwFmt( const SwFmt& rFmt )
      73        1245 :     : SwModify( rFmt.DerivedFrom() ),
      74             :     aFmtName( rFmt.aFmtName ),
      75             :     aSet( rFmt.aSet ),
      76             :     nWhichId( rFmt.nWhichId ),
      77             :     nFmtId( 0 ),
      78        1245 :     nPoolFmtId( rFmt.GetPoolFmtId() ),
      79        1245 :     nPoolHelpId( rFmt.GetPoolHelpId() ),
      80        3735 :     nPoolHlpFileId( rFmt.GetPoolHlpFileId() )
      81             : {
      82        1245 :     bWritten = bFmtInDTOR = sal_False; // LAYER_IMPL
      83        1245 :     bAutoFmt = rFmt.bAutoFmt;
      84        1245 :     bHidden = rFmt.bHidden;
      85        1245 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
      86             : 
      87        1245 :     if( rFmt.DerivedFrom() )
      88        1245 :         aSet.SetParent( &rFmt.DerivedFrom()->aSet );
      89             :     // a few special treatments for attributes
      90        1245 :     aSet.SetModifyAtAttr( this );
      91        1245 : }
      92             : 
      93         837 : SwFmt &SwFmt::operator=(const SwFmt& rFmt)
      94             : {
      95         837 :     nWhichId = rFmt.nWhichId;
      96         837 :     nPoolFmtId = rFmt.GetPoolFmtId();
      97         837 :     nPoolHelpId = rFmt.GetPoolHelpId();
      98         837 :     nPoolHlpFileId = rFmt.GetPoolHlpFileId();
      99             : 
     100         837 :     if ( IsInCache() )
     101             :     {
     102           0 :         SwFrm::GetCache().Delete( this );
     103           0 :         SetInCache( sal_False );
     104             :     }
     105         837 :     SetInSwFntCache( sal_False );
     106             : 
     107             :     // copy only array with attributes delta
     108         837 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     109         837 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     110         837 :     aSet.Intersect_BC( rFmt.aSet, &aOld, &aNew );
     111         837 :     aSet.Put_BC( rFmt.aSet, &aOld, &aNew );
     112             : 
     113             :     // a few special treatments for attributes
     114         837 :     aSet.SetModifyAtAttr( this );
     115             : 
     116             :     // create PoolItem attribute for Modify
     117         837 :     if( aOld.Count() )
     118             :     {
     119         837 :         SwAttrSetChg aChgOld( aSet, aOld );
     120         837 :         SwAttrSetChg aChgNew( aSet, aNew );
     121         837 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     122             :     }
     123             : 
     124         837 :     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         837 :     bAutoFmt = rFmt.bAutoFmt;
     139         837 :     bHidden = rFmt.bHidden;
     140         837 :     bAutoUpdateFmt = rFmt.bAutoUpdateFmt;
     141         837 :     return *this;
     142             : }
     143             : 
     144          74 : void SwFmt::SetName( const String& rNewName, sal_Bool bBroadcast )
     145             : {
     146             :     OSL_ENSURE( !IsDefault(), "SetName: Defaultformat" );
     147          74 :     if( bBroadcast )
     148             :     {
     149          31 :         SwStringMsgPoolItem aOld( RES_NAME_CHANGED, aFmtName );
     150          31 :         SwStringMsgPoolItem aNew( RES_NAME_CHANGED, rNewName );
     151          31 :         aFmtName = rNewName;
     152          31 :         ModifyNotification( &aOld, &aNew );
     153             :     }
     154             :     else
     155             :     {
     156          43 :         aFmtName = rNewName;
     157             :     }
     158          74 : }
     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         191 : void SwFmt::CopyAttrs( const SwFmt& rFmt, sal_Bool bReplace )
     172             : {
     173             :     // copy only array with attributes delta
     174         191 :     if ( IsInCache() )
     175             :     {
     176           0 :         SwFrm::GetCache().Delete( this );
     177           0 :         SetInCache( sal_False );
     178             :     }
     179         191 :     SetInSwFntCache( sal_False );
     180             : 
     181             :     // special treatments for some attributes
     182         191 :     SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
     183             : 
     184         191 :     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         191 :     if( pChgSet->GetPool() != aSet.GetPool() )
     193           0 :         pChgSet->CopyToModify( *this );
     194             :     else
     195             :     {
     196         191 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     197         191 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     198             : 
     199         191 :         if ( 0 != aSet.Put_BC( *pChgSet, &aOld, &aNew ) )
     200             :         {
     201             :             // a few special treatments for attributes
     202         191 :             aSet.SetModifyAtAttr( this );
     203             : 
     204         191 :             SwAttrSetChg aChgOld( aSet, aOld );
     205         191 :             SwAttrSetChg aChgNew( aSet, aNew );
     206         191 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     207         191 :         }
     208             :     }
     209             : 
     210         191 :     if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // was a Set created?
     211           0 :         delete pChgSet;
     212         191 : }
     213             : 
     214        9156 : SwFmt::~SwFmt()
     215             : {
     216             :     // This happens at a ObjectDying message. Thus put all dependent
     217             :     // ones on DerivedFrom.
     218        4578 :     if( GetDepends() )
     219             :     {
     220             :         OSL_ENSURE( DerivedFrom(), "SwFmt::~SwFmt: Def dependents!" );
     221             : 
     222         313 :         bFmtInDTOR = sal_True;
     223             : 
     224         313 :         SwFmt* pParentFmt = DerivedFrom();
     225         313 :         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        1106 :             while( GetDepends() )
     234             :             {
     235         480 :                 SwFmtChg aOldFmt( this );
     236         480 :                 SwFmtChg aNewFmt( pParentFmt );
     237         480 :                 SwClient* pDepend = (SwClient*)GetDepends();
     238         480 :                 pParentFmt->Add( pDepend );
     239         480 :                 pDepend->ModifyNotification( &aOldFmt, &aNewFmt );
     240         480 :             }
     241             :         }
     242             :     }
     243        4578 : }
     244             : 
     245       55206 : void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue )
     246             : {
     247       55206 :     bool bContinue = true; // true = pass on to dependent ones
     248             : 
     249             :     sal_uInt16 nWhich = pOldValue ? pOldValue->Which() :
     250       55206 :                     pNewValue ? pNewValue->Which() : 0 ;
     251       55206 :     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       52182 :         if( ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet )
     281             :         {
     282             :             // pass only those that are not set
     283       27493 :             SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue );
     284       27493 :             SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue );
     285             : 
     286       27493 :             aOld.GetChgSet()->Differentiate( aSet );
     287       27493 :             aNew.GetChgSet()->Differentiate( aSet );
     288             : 
     289       27493 :             if( aNew.Count() )
     290       26382 :                 NotifyClients( &aOld, &aNew );
     291       27493 :             bContinue = false;
     292             :         }
     293       52182 :         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        4898 :         if( ((SwFmtChg*)pOldValue)->pChangedFmt != this &&
     300        2007 :             ((SwFmtChg*)pNewValue)->pChangedFmt == DerivedFrom() )
     301             :         {
     302             :             // attach Set to new parent
     303         152 :             aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 );
     304             :         }
     305        2891 :         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         133 :             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       55206 :     if( bContinue )
     332             :     {
     333             :         // walk over all dependent formats
     334       27713 :         NotifyClients( pOldValue, pNewValue );
     335             :     }
     336       55206 : }
     337             : 
     338         704 : sal_Bool SwFmt::SetDerivedFrom(SwFmt *pDerFrom)
     339             : {
     340         704 :     if ( pDerFrom )
     341             :     {
     342         561 :         const SwFmt* pFmt = pDerFrom;
     343        2299 :         while ( pFmt != 0 )
     344             :         {
     345        1177 :             if ( pFmt == this )
     346           0 :                 return sal_False;
     347             : 
     348        1177 :             pFmt=pFmt->DerivedFrom();
     349             :         }
     350             :     }
     351             :     else
     352             :     {
     353             :         // nothing provided, search for Dflt format
     354         143 :         pDerFrom = this;
     355         544 :         while ( pDerFrom->DerivedFrom() )
     356         258 :             pDerFrom = pDerFrom->DerivedFrom();
     357             :     }
     358         704 :     if ( (pDerFrom == DerivedFrom()) || (pDerFrom == this) )
     359          77 :         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         627 :     if ( IsInCache() )
     368             :     {
     369           0 :         SwFrm::GetCache().Delete( this );
     370           0 :         SetInCache( sal_False );
     371             :     }
     372         627 :     SetInSwFntCache( sal_False );
     373             : 
     374         627 :     pDerFrom->Add( this );
     375         627 :     aSet.SetParent( &pDerFrom->aSet );
     376             : 
     377         627 :     SwFmtChg aOldFmt( this );
     378         627 :     SwFmtChg aNewFmt( this );
     379         627 :     ModifyNotification( &aOldFmt, &aNewFmt );
     380             : 
     381         627 :     return sal_True;
     382             : }
     383             : 
     384       36733 : bool SwFmt::SetFmtAttr( const SfxPoolItem& rAttr )
     385             : {
     386       36733 :     if ( IsInCache() || IsInSwFntCache() )
     387             :     {
     388         214 :         const sal_uInt16 nWhich = rAttr.Which();
     389         214 :         CheckCaching( nWhich );
     390             :     }
     391             : 
     392             :     // if Modify is locked then no modifications will be sent;
     393             :     // but call Modify always for FrmFmts
     394       36733 :     bool bRet = false;
     395       36733 :     const sal_uInt16 nFmtWhich = Which();
     396       72865 :     if( IsModifyLocked() ||
     397       36132 :         ( !GetDepends() &&
     398             :           (RES_GRFFMTCOLL == nFmtWhich  ||
     399             :            RES_TXTFMTCOLL == nFmtWhich ) ) )
     400             :     {
     401        6939 :         if( ( bRet = (0 != aSet.Put( rAttr ))) )
     402        6813 :             aSet.SetModifyAtAttr( this );
     403             :         // #i71574#
     404        6939 :         if ( nFmtWhich == RES_TXTFMTCOLL && rAttr.Which() == RES_PARATR_NUMRULE )
     405             :         {
     406         137 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     407             :         }
     408             :     }
     409             :     else
     410             :     {
     411             :         // copy only array with attributes delta
     412       29794 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     413       29794 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     414             : 
     415       29794 :         bRet = 0 != aSet.Put_BC( rAttr, &aOld, &aNew );
     416       29794 :         if( bRet )
     417             :         {
     418             :             // some special treatments for attributes
     419       18644 :             aSet.SetModifyAtAttr( this );
     420             : 
     421       18644 :             SwAttrSetChg aChgOld( aSet, aOld );
     422       18644 :             SwAttrSetChg aChgNew( aSet, aNew );
     423       18644 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     424       29794 :         }
     425             :     }
     426       36733 :     return bRet;
     427             : }
     428             : 
     429        9067 : bool SwFmt::SetFmtAttr( const SfxItemSet& rSet )
     430             : {
     431        9067 :     if( !rSet.Count() )
     432           0 :         return false;
     433             : 
     434        9067 :     if ( IsInCache() )
     435             :     {
     436           0 :         SwFrm::GetCache().Delete( this );
     437           0 :         SetInCache( sal_False );
     438             :     }
     439        9067 :     SetInSwFntCache( sal_False );
     440             : 
     441             :     // if Modify is locked then no modifications will be sent;
     442             :     // but call Modify always for FrmFmts
     443        9067 :     bool bRet = false;
     444        9067 :     const sal_uInt16 nFmtWhich = Which();
     445       18117 :     if ( IsModifyLocked() ||
     446        9050 :          ( !GetDepends() &&
     447             :            ( RES_GRFFMTCOLL == nFmtWhich ||
     448             :              RES_TXTFMTCOLL == nFmtWhich ) ) )
     449             :     {
     450        2266 :         if( ( bRet = (0 != aSet.Put( rSet ))) )
     451        1842 :             aSet.SetModifyAtAttr( this );
     452             :         // #i71574#
     453        2266 :         if ( nFmtWhich == RES_TXTFMTCOLL )
     454             :         {
     455        2249 :             TxtFmtCollFunc::CheckTxtFmtCollForDeletionOfAssignmentToOutlineStyle( this );
     456             :         }
     457             :     }
     458             :     else
     459             :     {
     460        6801 :         SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     461        6801 :                   aNew( *aSet.GetPool(), aSet.GetRanges() );
     462        6801 :         bRet = 0 != aSet.Put_BC( rSet, &aOld, &aNew );
     463        6801 :         if( bRet )
     464             :         {
     465             :             // some special treatments for attributes
     466        4240 :             aSet.SetModifyAtAttr( this );
     467        4240 :             SwAttrSetChg aChgOld( aSet, aOld );
     468        4240 :             SwAttrSetChg aChgNew( aSet, aNew );
     469        4240 :             ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     470        6801 :         }
     471             :     }
     472        9067 :     return bRet;
     473             : }
     474             : 
     475             : // remove Hint using nWhich from array with delta
     476       19326 : bool SwFmt::ResetFmtAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 )
     477             : {
     478       19326 :     if( !aSet.Count() )
     479        1993 :         return false;
     480             : 
     481       17333 :     if( !nWhich2 || nWhich2 < nWhich1 )
     482       16611 :         nWhich2 = nWhich1; // then set to 1st ID, only this item
     483             : 
     484       17333 :     if ( IsInCache() || IsInSwFntCache() )
     485             :     {
     486           0 :         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       17333 :     if( IsModifyLocked() )
     492             :         return 0 != (( nWhich2 == nWhich1 )
     493           0 :                      ? aSet.ClearItem( nWhich1 )
     494         718 :                      : aSet.ClearItem_BC( nWhich1, nWhich2 ));
     495             : 
     496       16615 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     497       16615 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     498       16615 :     bool bRet = 0 != aSet.ClearItem_BC( nWhich1, nWhich2, &aOld, &aNew );
     499       16615 :     if( bRet )
     500             :     {
     501         144 :         SwAttrSetChg aChgOld( aSet, aOld );
     502         144 :         SwAttrSetChg aChgNew( aSet, aNew );
     503         144 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     504             :     }
     505       16615 :     return bRet;
     506             : }
     507             : 
     508             : // #i73790#
     509         421 : sal_uInt16 SwFmt::ResetAllFmtAttr()
     510             : {
     511         421 :     if( !aSet.Count() )
     512         126 :         return 0;
     513             : 
     514         295 :     if ( IsInCache() )
     515             :     {
     516           0 :         SwFrm::GetCache().Delete( this );
     517           0 :         SetInCache( sal_False );
     518             :     }
     519         295 :     SetInSwFntCache( sal_False );
     520             : 
     521             :     // if Modify is locked then no modifications will be sent
     522         295 :     if( IsModifyLocked() )
     523           0 :         return aSet.ClearItem( 0 );
     524             : 
     525         295 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     526         295 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     527         295 :     bool bRet = 0 != aSet.ClearItem_BC( 0, &aOld, &aNew );
     528         295 :     if( bRet )
     529             :     {
     530         295 :         SwAttrSetChg aChgOld( aSet, aOld );
     531         295 :         SwAttrSetChg aChgNew( aSet, aNew );
     532         295 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     533             :     }
     534         295 :     return aNew.Count();
     535             : }
     536             : 
     537        4051 : bool SwFmt::GetInfo( SfxPoolItem& rInfo ) const
     538             : {
     539        4051 :     return SwModify::GetInfo( rInfo );
     540             : }
     541             : 
     542         822 : void SwFmt::DelDiffs( const SfxItemSet& rSet )
     543             : {
     544         822 :     if( !aSet.Count() )
     545             :         return;
     546             : 
     547         822 :     if ( IsInCache() )
     548             :     {
     549           0 :         SwFrm::GetCache().Delete( this );
     550           0 :         SetInCache( sal_False );
     551             :     }
     552         822 :     SetInSwFntCache( sal_False );
     553             : 
     554             :     // if Modify is locked then no modifications will be sent
     555         822 :     if( IsModifyLocked() )
     556             :     {
     557           0 :         aSet.Intersect( rSet );
     558             :         return;
     559             :     }
     560             : 
     561         822 :     SwAttrSet aOld( *aSet.GetPool(), aSet.GetRanges() ),
     562         822 :               aNew( *aSet.GetPool(), aSet.GetRanges() );
     563         822 :     bool bRet = 0 != aSet.Intersect_BC( rSet, &aOld, &aNew );
     564         822 :     if( bRet )
     565             :     {
     566         354 :         SwAttrSetChg aChgOld( aSet, aOld );
     567         354 :         SwAttrSetChg aChgNew( aSet, aNew );
     568         354 :         ModifyNotification( &aChgOld, &aChgNew ); // send all modified ones
     569         822 :     }
     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          39 : sal_Bool SwFmt::IsShadowTransparent() const
     594             : {
     595          39 :     return sal_False;
     596             : }
     597             : 
     598             : /*
     599             :  * Document Interface Access
     600             :  */
     601        9174 : const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
     602         316 : const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
     603        1711 : IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
     604           3 : const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
     605        1869 : IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
     606         305 : IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
     607         236 : 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