From a9102a1c637272d88ef542d37b871bd9278cacb7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 3 May 2020 19:39:19 +0100 Subject: explicitly pass SfxStyleFamily to GenerateUnusedName MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7879578383d58cb65441c9049e91e33bb4827afb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93353 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- include/sfx2/styledlg.hxx | 3 ++- sfx2/source/dialog/mgetempl.cxx | 2 +- sfx2/source/dialog/styledlg.cxx | 4 ++-- sw/source/uibase/app/docst.cxx | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/sfx2/styledlg.hxx b/include/sfx2/styledlg.hxx index eb91875c5702..6fd7afde1f85 100644 --- a/include/sfx2/styledlg.hxx +++ b/include/sfx2/styledlg.hxx @@ -25,6 +25,7 @@ class SfxStyleSheetBase; class SfxStyleSheetBasePool; +enum class SfxStyleFamily; class SFX2_DLLPUBLIC SfxStyleDialogController : public SfxTabDialogController { @@ -43,7 +44,7 @@ public: virtual short Ok() override; - static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool); + static OUString GenerateUnusedName(SfxStyleSheetBasePool &rPool, SfxStyleFamily eFam); }; #endif diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index f924b41ac96d..44aba7480eaf 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -110,7 +110,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(weld::Container* pPage, weld::D if ( pStyle->GetName().isEmpty() && pPool ) { // NullString as Name -> generate Name - OUString aNoName(SfxStyleDialogController::GenerateUnusedName(*pPool)); + OUString aNoName(SfxStyleDialogController::GenerateUnusedName(*pPool, pStyle->GetFamily())); pStyle->SetName( aNoName ); aName = aNoName; aFollow = pStyle->GetFollow(); diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx index 133c338d1176..3f694ec66573 100644 --- a/sfx2/source/dialog/styledlg.cxx +++ b/sfx2/source/dialog/styledlg.cxx @@ -108,12 +108,12 @@ IMPL_LINK_NOARG(SfxStyleDialogController, CancelHdl, weld::Button&, void) m_xDialog->response(RET_CANCEL); } -OUString SfxStyleDialogController::GenerateUnusedName(SfxStyleSheetBasePool &rPool) +OUString SfxStyleDialogController::GenerateUnusedName(SfxStyleSheetBasePool &rPool, SfxStyleFamily eFam) { OUString aNo(SfxResId(STR_NONAME)); sal_uInt16 i = 1; OUString aNoName = aNo + OUString::number(i); - while (rPool.Find(aNoName, rPool.GetSearchFamily(), rPool.GetSearchMask())) + while (rPool.Find(aNoName, eFam, rPool.GetSearchMask())) { ++i; aNoName = aNo + OUString::number(i); diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 70a69a6d255c..72aaf1e8f918 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -310,7 +310,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) sParent = static_cast(pItem)->GetValue(); if (sName.isEmpty() && m_xBasePool.get()) - sName = SfxStyleDialogController::GenerateUnusedName(*m_xBasePool); + sName = SfxStyleDialogController::GenerateUnusedName(*m_xBasePool, nFamily); Edit(sName, sParent, nFamily, nMask, true, OString(), nullptr, &rReq, nSlot); } -- cgit