Related: fdo#79142 make SetName default to Reindexing
Change-Id: I408042bc7bf1a5a955203d65d2c68ebf9527b9b5
This commit is contained in:
parent
7b9b57b419
commit
05e2fd162e
12 changed files with 29 additions and 34 deletions
|
@ -54,7 +54,6 @@ class SfxManageStyleSheetPage : public SfxTabPage
|
|||
|
||||
SfxStyleSheetBase *pStyle;
|
||||
SfxStyleFamilies *pFamilies;
|
||||
SfxStyleSheetBasePool *pPool;
|
||||
const SfxStyleFamilyItem *pItem;
|
||||
OUString aBuf;
|
||||
bool bModified;
|
||||
|
|
|
@ -105,8 +105,13 @@ public:
|
|||
// returns the internal name of this style
|
||||
virtual const OUString& GetName() const;
|
||||
|
||||
// sets the internal name of this style
|
||||
virtual bool SetName( const OUString& );
|
||||
// sets the internal name of this style.
|
||||
//
|
||||
// If the name of a style is changed, then the styles container needs to be
|
||||
// reindexed (see IndexedStyleSheets). If you set bReindexNow to false to
|
||||
// defer that indexing, then you must call the Reindex manually on the
|
||||
// SfxStyleSheetBasePool parent.
|
||||
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true);
|
||||
|
||||
/** returns the display name of this style, it is used at the user interface.
|
||||
If the display name is empty, this method returns the internal name. */
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
virtual const OUString& GetParent() const SAL_OVERRIDE;
|
||||
virtual const OUString& GetFollow() const SAL_OVERRIDE;
|
||||
|
||||
virtual bool SetName( const OUString& ) SAL_OVERRIDE;
|
||||
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
|
||||
|
||||
void SetUsage( ScStyleSheet::Usage eUse ) const
|
||||
{ eUsage = eUse; }
|
||||
|
|
|
@ -303,13 +303,13 @@ const OUString& ScStyleSheet::GetFollow() const
|
|||
//! Flag gesetzt und abgefragt werden.
|
||||
//! Die ganze Abfrage muss raus, wenn fuer eine neue Datei-Version die Namens-Umsetzung wegfaellt.
|
||||
|
||||
bool ScStyleSheet::SetName( const OUString& rNew )
|
||||
bool ScStyleSheet::SetName(const OUString& rNew, bool bReindexNow)
|
||||
{
|
||||
OUString aFileStdName = OUString(STRING_STANDARD);
|
||||
if ( rNew == aFileStdName && aFileStdName != ScGlobal::GetRscString(STR_STYLENAME_STANDARD) )
|
||||
return false;
|
||||
else
|
||||
return SfxStyleSheet::SetName( rNew );
|
||||
return SfxStyleSheet::SetName(rNew, bReindexNow);
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual bool HasFollowSupport() const SAL_OVERRIDE;
|
||||
virtual bool HasParentSupport() const SAL_OVERRIDE;
|
||||
virtual bool HasClearParentSupport() const SAL_OVERRIDE;
|
||||
virtual bool SetName( const OUString& ) SAL_OVERRIDE;
|
||||
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
|
||||
virtual void SetHelpId( const OUString& r, sal_uLong nId ) SAL_OVERRIDE;
|
||||
|
||||
void AdjustToFontHeight(SfxItemSet& rSet, bool bOnlyMissingItems = true);
|
||||
|
|
|
@ -1103,7 +1103,6 @@ void SdDrawDocument::RenameLayoutTemplate(const OUString& rOldLayoutName, const
|
|||
aReplList.push_back(aReplData);
|
||||
|
||||
pSheet->SetName(aSheetName);
|
||||
mxStyleSheetPool.get()->Reindex();
|
||||
}
|
||||
|
||||
pSheet = aIter.Next();
|
||||
|
|
|
@ -1038,16 +1038,18 @@ void SdStyleSheetPool::UpdateStdNames()
|
|||
// Sheet does exist: old sheet has to be removed
|
||||
aEraseList.push_back( pStyle );
|
||||
}
|
||||
Reindex();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// styles that could not be renamed, must be removed
|
||||
for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
|
||||
Remove( aEraseList[ i ] );
|
||||
Reindex();
|
||||
if (!aEraseList.empty())
|
||||
{
|
||||
// styles that could not be renamed, must be removed
|
||||
for ( size_t i = 0, n = aEraseList.size(); i < n; ++i )
|
||||
Remove( aEraseList[ i ] );
|
||||
Reindex();
|
||||
}
|
||||
}
|
||||
|
||||
// Set new SvxNumBulletItem for the respective style sheet
|
||||
|
|
|
@ -625,15 +625,11 @@ bool SdStyleSheet::HasClearParentSupport() const
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool SdStyleSheet::SetName( const OUString& rName )
|
||||
bool SdStyleSheet::SetName(const OUString& rName, bool bReindexNow)
|
||||
{
|
||||
return SfxStyleSheet::SetName( rName );
|
||||
return SfxStyleSheet::SetName(rName, bReindexNow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SdStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
|
||||
{
|
||||
SfxStyleSheet::SetHelpId( r, nId );
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemSet& rAttrSet)
|
||||
: SfxTabPage(pParent, "ManageStylePage", "sfx/ui/managestylepage.ui", rAttrSet)
|
||||
, pStyle(&((SfxStyleDialog*)GetParentDialog())->GetStyleSheet())
|
||||
, pPool(NULL)
|
||||
, pItem(0)
|
||||
, bModified(false)
|
||||
, aName(pStyle->GetName())
|
||||
|
@ -79,6 +78,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
|
|||
OSL_ENSURE( pResMgr, "No ResMgr in Module" );
|
||||
pFamilies = new SfxStyleFamilies( ResId( DLG_STYLE_DESIGNER, *pResMgr ) );
|
||||
|
||||
SfxStyleSheetBasePool* pPool = 0;
|
||||
SfxObjectShell* pDocShell = SfxObjectShell::Current();
|
||||
|
||||
if ( pDocShell )
|
||||
|
@ -105,7 +105,6 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS
|
|||
aNoName += OUString::number( nNo );
|
||||
}
|
||||
pStyle->SetName( aNoName );
|
||||
pPool->Reindex();
|
||||
aName = aNoName;
|
||||
aFollow = pStyle->GetFollow();
|
||||
aParent = pStyle->GetParent();
|
||||
|
@ -420,11 +419,7 @@ void SfxManageStyleSheetPage::Reset( const SfxItemSet& /*rAttrSet*/ )
|
|||
OUString sCmp( pStyle->GetName() );
|
||||
|
||||
if ( sCmp != aName )
|
||||
{
|
||||
pStyle->SetName(aName);
|
||||
if (pPool)
|
||||
pPool->Reindex();
|
||||
}
|
||||
pStyle->SetName( aName );
|
||||
m_pNameRw->SetText( aName );
|
||||
m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
|
||||
|
||||
|
@ -547,8 +542,7 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
|
|||
if ( m_pNameRw->HasFocus() )
|
||||
LoseFocusHdl( m_pNameRw );
|
||||
|
||||
bool bOk = pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' '));
|
||||
if (!bOk)
|
||||
if (!pStyle->SetName(comphelper::string::stripStart(m_pNameRw->GetText(), ' ')))
|
||||
{
|
||||
InfoBox aBox( this, SfxResId( MSG_TABPAGE_INVALIDNAME ) );
|
||||
aBox.Execute();
|
||||
|
@ -556,8 +550,6 @@ int SfxManageStyleSheetPage::DeactivatePage( SfxItemSet* pItemSet )
|
|||
m_pNameRw->SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) );
|
||||
return SfxTabPage::KEEP_PAGE;
|
||||
}
|
||||
else if (pPool)
|
||||
pPool->Reindex();
|
||||
bModified = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@ const OUString& SfxStyleSheetBase::GetName() const
|
|||
return aName;
|
||||
}
|
||||
|
||||
bool SfxStyleSheetBase::SetName( const OUString& rName )
|
||||
bool SfxStyleSheetBase::SetName(const OUString& rName, bool bReIndexNow)
|
||||
{
|
||||
if(rName.isEmpty())
|
||||
return false;
|
||||
|
@ -178,6 +178,8 @@ bool SfxStyleSheetBase::SetName( const OUString& rName )
|
|||
if ( aFollow == aName )
|
||||
aFollow = rName;
|
||||
aName = rName;
|
||||
if (bReIndexNow)
|
||||
pPool->Reindex();
|
||||
pPool->SetSearchMask(eTmpFam, nTmpMask);
|
||||
pPool->Broadcast( SfxStyleSheetHintExtended(
|
||||
SFX_STYLESHEET_MODIFIED, aOldName, *this ) );
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
void PresetParent(const OUString& rName){ aParent = rName; }
|
||||
void PresetFollow(const OUString& rName){ aFollow = rName; }
|
||||
|
||||
virtual bool SetName( const OUString& rStr) SAL_OVERRIDE;
|
||||
virtual bool SetName(const OUString& rNewName, bool bReindexNow = true) SAL_OVERRIDE;
|
||||
virtual bool SetParent( const OUString& rStr) SAL_OVERRIDE;
|
||||
virtual bool SetFollow( const OUString& rStr) SAL_OVERRIDE;
|
||||
|
||||
|
|
|
@ -869,14 +869,14 @@ OUString SwDocStyleSheet::GetDescription()
|
|||
}
|
||||
|
||||
// Set names
|
||||
bool SwDocStyleSheet::SetName( const OUString& rStr)
|
||||
bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
|
||||
{
|
||||
if( rStr.isEmpty() )
|
||||
return false;
|
||||
|
||||
if( aName != rStr )
|
||||
{
|
||||
if( !SfxStyleSheetBase::SetName( rStr ))
|
||||
if( !SfxStyleSheetBase::SetName(rStr, bReindexNow))
|
||||
return false;
|
||||
}
|
||||
else if(!bPhysical)
|
||||
|
|
Loading…
Reference in a new issue