diff options
Diffstat (limited to 'svl/source/items/style.cxx')
-rw-r--r-- | svl/source/items/style.cxx | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 41551e5064..bfdbac6f3f 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -163,24 +163,24 @@ bool SfxStyleSheetBase::SetName(const OUString& rName, bool bReIndexNow) if(rName.isEmpty()) return false; - if( aName != rName ) - { - OUString aOldName = aName; - SfxStyleSheetBase *pOther = m_pPool->Find( rName, nFamily ) ; - if ( pOther && pOther != this ) - return false; + if( aName == rName ) + return true; - if ( !aName.isEmpty() ) - m_pPool->ChangeParent(aName, rName, nFamily, false); + OUString aOldName = aName; + SfxStyleSheetBase *pOther = m_pPool->Find( rName, nFamily ) ; + if ( pOther && pOther != this ) + return false; - if ( aFollow == aName ) - aFollow = rName; - aName = rName; - if (bReIndexNow) - m_pPool->Reindex(); + if ( !aName.isEmpty() ) + m_pPool->ChangeParent(aName, rName, nFamily, false); - m_pPool->Broadcast( SfxStyleSheetModifiedHint( aOldName, *this ) ); - } + if ( aFollow == aName ) + aFollow = rName; + aName = rName; + if (bReIndexNow) + m_pPool->ReindexOnNameChange(aOldName, rName); + + m_pPool->Broadcast( SfxStyleSheetModifiedHint( aOldName, *this ) ); return true; } @@ -890,6 +890,12 @@ SfxStyleSheetBasePool::Reindex() pImpl->mxIndexedStyleSheets->Reindex(); } +void +SfxStyleSheetBasePool::ReindexOnNameChange(const OUString& rOldName, const OUString& rNewName) +{ + pImpl->mxIndexedStyleSheets->ReindexOnNameChange(rOldName, rNewName); +} + const svl::IndexedStyleSheets& SfxStyleSheetBasePool::GetIndexedStyleSheets() const { |