diff options
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/mgetempl.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/dialog/styledlg.cxx | 14 |
2 files changed, 15 insertions, 10 deletions
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index 61a59365fb1f..2a7aff7f29cb 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -96,16 +96,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(Window* pParent, const SfxItemS if ( pStyle->GetName().isEmpty() && pPool ) { // NullString as Name -> generate Name - OUString aNoName( SfxResId(STR_NONAME).toString() ); - sal_uInt16 nNo = 1; - OUString aNo( aNoName ); - aNoName += OUString::number( nNo ); - while ( pPool->Find( aNoName ) ) - { - ++nNo; - aNoName = aNo; - aNoName += OUString::number( nNo ); - } + OUString aNoName(SfxStyleDialog::GenerateUnusedName(*pPool)); pStyle->SetName( aNoName ); aName = aNoName; aFollow = pStyle->GetFollow(); diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index c9231d4549c9..664468a769d5 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -147,5 +147,19 @@ IMPL_LINK( SfxStyleDialog, CancelHdl, Button *, pButton ) return 0; } +OUString SfxStyleDialog::GenerateUnusedName(SfxStyleSheetBasePool &rPool) +{ + OUString aNoName(SfxResId(STR_NONAME).toString()); + sal_uInt16 nNo = 1; + OUString aNo(aNoName); + aNoName += OUString::number(nNo); + while (rPool.Find(aNoName)) + { + ++nNo; + aNoName = aNo; + aNoName += OUString::number(nNo); + } + return aNoName; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |