[Libreoffice-commits] core.git: 2 commits - include/sfx2 sfx2/source sw/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Sun May 3 20:44:43 UTC 2020


 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(-)

New commits:
commit 00db5933ded1884b2ac453552badae20fa943478
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 3 19:46:13 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun May 3 22:44:21 2020 +0200

    use SfxStyleSearchBits::All for GenerateUnusedName
    
    use in SfxManageStyleSheetPage is definitely with
    SfxStyleSearchBits::All applied. It seems almost certain that
    use in SwDocShell::ExecStyleSheet would prefer that
    
    Change-Id: I245c3f02bcce87f124bf0e507b59738a6dff34d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93354
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sfx2/source/dialog/styledlg.cxx b/sfx2/source/dialog/styledlg.cxx
index 3f694ec66573..2614083f8f75 100644
--- a/sfx2/source/dialog/styledlg.cxx
+++ b/sfx2/source/dialog/styledlg.cxx
@@ -113,7 +113,7 @@ OUString SfxStyleDialogController::GenerateUnusedName(SfxStyleSheetBasePool &rPo
     OUString aNo(SfxResId(STR_NONAME));
     sal_uInt16 i = 1;
     OUString aNoName = aNo + OUString::number(i);
-    while (rPool.Find(aNoName, eFam, rPool.GetSearchMask()))
+    while (rPool.Find(aNoName, eFam))
     {
         ++i;
         aNoName = aNo + OUString::number(i);
commit a9102a1c637272d88ef542d37b871bd9278cacb7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Sun May 3 19:39:19 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Sun May 3 22:44:08 2020 +0200

    explicitly pass SfxStyleFamily to GenerateUnusedName
    
    Change-Id: I7879578383d58cb65441c9049e91e33bb4827afb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93353
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

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<const SfxStringItem*>(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);
         }


More information about the Libreoffice-commits mailing list