diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2021-01-12 01:37:29 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2021-01-13 18:20:37 +0100 |
commit | 8dd78873a9de028c0d9f1f1aee537e85f74d2300 (patch) | |
tree | 873a19299f79a67f9623f8cd3a8d8f417b3ab26d /sw/source/core/attr/format.cxx | |
parent | dd7825765f83d09d132d1e6138b27cb03564aae8 (diff) |
Move SwFntCache link from SwModify down to SwFormat
- apparently only SwTextFormatColls are ever in the SwFntCache
- however lots of SwFormat members need to clear the cache
- so for now, only move it down to SwFormat
- this should make SwModify less of a kitchen sink
Change-Id: I389fc9f0a9d9b18b5914f24ae62c5d4119bc468f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109154
Tested-by: Jenkins
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Diffstat (limited to 'sw/source/core/attr/format.cxx')
-rw-r--r-- | sw/source/core/attr/format.cxx | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 6e0f55ef8da0..8dd42c7fc935 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -17,22 +17,23 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <doc.hxx> #include <DocumentSettingManager.hxx> //For SwFmt::getIDocumentSettingAccess() #include <IDocumentTimerAccess.hxx> +#include <doc.hxx> #include <fmtcolfunc.hxx> -#include <frame.hxx> #include <format.hxx> +#include <frame.hxx> +#include <frmatr.hxx> #include <hintids.hxx> #include <hints.hxx> -#include <swcache.hxx> -#include <frmatr.hxx> #include <osl/diagnose.h> +#include <sal/log.hxx> #include <svl/grabbagitem.hxx> #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx> #include <svx/unobrushitemhelper.hxx> #include <svx/xdef.hxx> -#include <sal/log.hxx> +#include <swcache.hxx> +#include <swfntcch.hxx> using namespace com::sun::star; @@ -49,7 +50,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, const char* pFormatNm, { m_bAutoUpdateFormat = false; // LAYER_IMPL m_bAutoFormat = true; - m_bFormatInDTOR = m_bHidden = false; + m_bFormatInDTOR = m_bHidden = m_bInSwFntCache = false; if( pDrvdFrame ) { @@ -70,7 +71,7 @@ SwFormat::SwFormat( SwAttrPool& rPool, const OUString& rFormatNm, { m_bAutoUpdateFormat = false; // LAYER_IMPL m_bAutoFormat = true; - m_bFormatInDTOR = m_bHidden = false; + m_bFormatInDTOR = m_bHidden = m_bInSwFntCache = false; if( pDrvdFrame ) { @@ -90,6 +91,7 @@ SwFormat::SwFormat( const SwFormat& rFormat ) : m_bFormatInDTOR = false; // LAYER_IMPL m_bAutoFormat = rFormat.m_bAutoFormat; m_bHidden = rFormat.m_bHidden; + m_bInSwFntCache = false; m_bAutoUpdateFormat = rFormat.m_bAutoUpdateFormat; if( auto pDerived = rFormat.DerivedFrom() ) @@ -116,7 +118,7 @@ SwFormat &SwFormat::operator=(const SwFormat& rFormat) SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; // copy only array with attributes delta SwAttrSet aOld( *m_aSet.GetPool(), m_aSet.GetRanges() ), @@ -183,7 +185,7 @@ void SwFormat::CopyAttrs( const SwFormat& rFormat ) SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; // special treatments for some attributes SwAttrSet* pChgSet = const_cast<SwAttrSet*>(&rFormat.m_aSet); @@ -230,6 +232,8 @@ SwFormat::~SwFormat() for(SwClient* pClient = aIter.First(); pClient; pClient = aIter.Next()) pClient->CheckRegistrationFormat(*this); assert(!HasWriterListeners()); + if(m_bInSwFntCache) + pSwFontCache->Delete( this ); } void SwFormat::SwClientNotify(const SwModify&, const SfxHint& rHint) @@ -357,7 +361,7 @@ bool SwFormat::SetDerivedFrom(SwFormat *pDerFrom) SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; pDerFrom->Add( this ); m_aSet.SetParent( &pDerFrom->m_aSet ); @@ -458,11 +462,9 @@ SfxItemState SwFormat::GetBackgroundState(std::unique_ptr<SvxBrushItem>& rItem) bool SwFormat::SetFormatAttr( const SfxPoolItem& rAttr ) { - if ( IsInCache() || IsInSwFntCache() ) - { - const sal_uInt16 nWhich = rAttr.Which(); - CheckCaching( nWhich ); - } + const sal_uInt16 nWhich = rAttr.Which(); + CheckCaching( nWhich ); + InvalidateInSwFntCache( nWhich ); bool bRet = false; @@ -547,7 +549,7 @@ bool SwFormat::SetFormatAttr( const SfxItemSet& rSet ) SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; bool bRet = false; @@ -644,11 +646,16 @@ bool SwFormat::ResetFormatAttr( sal_uInt16 nWhich1, sal_uInt16 nWhich2 ) if( !nWhich2 || nWhich2 < nWhich1 ) nWhich2 = nWhich1; // then set to 1st ID, only this item - if ( IsInCache() || IsInSwFntCache() ) + if ( IsInCache() ) { for( sal_uInt16 n = nWhich1; n < nWhich2; ++n ) CheckCaching( n ); } + if( m_bInSwFntCache ) + { + for( sal_uInt16 n = nWhich1; n < nWhich2; ++n ) + InvalidateInSwFntCache( n ); + } // if Modify is locked then no modifications will be sent if( IsModifyLocked() ) @@ -675,7 +682,7 @@ sal_uInt16 SwFormat::ResetAllFormatAttr() SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; // if Modify is locked then no modifications will be sent if( IsModifyLocked() ) @@ -699,7 +706,7 @@ void SwFormat::DelDiffs( const SfxItemSet& rSet ) SwFrame::GetCache().Delete( this ); SetInCache( false ); } - SetInSwFntCache( false ); + m_bInSwFntCache = false; // if Modify is locked then no modifications will be sent if( IsModifyLocked() ) |