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

Jim Raykowski (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 21 02:48:53 UTC 2019


 sfx2/source/dialog/templdlg.cxx |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

New commits:
commit 30c9bc76d0718f0c01d34f81845d88413645b42c
Author:     Jim Raykowski <raykowj at gmail..com>
AuthorDate: Sat Nov 16 23:41:26 2019 -0900
Commit:     Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Nov 21 03:47:34 2019 +0100

    tdf#128557 Only show delete menu item when custom style is not in use
    
    or it has a parent style so when a custom paragraph style is in use it
    can be deleted and the style will revert to the parent
    
    Change-Id: I0e4ff953835c105241d3bb027d24841afdccc7ba
    Reviewed-on: https://gerrit.libreoffice.org/83008
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <raykowj at gmail.com>

diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 8ebb054a2a8d..2bda9d438466 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1995,6 +1995,7 @@ void SfxCommonTemplateDialog_Impl::ShowHdl()
 
 void SfxCommonTemplateDialog_Impl::EnableDelete()
 {
+    bool bEnableDelete(false);
     if(IsInitialized() && HasSelectedStyle())
     {
         OSL_ENSURE(pStyleSheetPool, "No StyleSheetPool");
@@ -2010,19 +2011,10 @@ void SfxCommonTemplateDialog_Impl::EnableDelete()
             pStyleSheetPool->Find(aTemplName,eFam, pTreeBox->IsVisible()? SfxStyleSearchBits::All : nFilter);
 
         OSL_ENSURE(pStyle, "Style not found");
-        if(pStyle && pStyle->IsUserDefined())
-        {
-            EnableDel(true);
-        }
-        else
-        {
-            EnableDel(false);
-        }
-    }
-    else
-    {
-        EnableDel(false);
+        if (pStyle && pStyle->IsUserDefined() && (pStyle->HasParentSupport() || !pStyle->IsUsed()))
+            bEnableDelete = true;
     }
+    EnableDel(bEnableDelete);
 }
 
 IMPL_LINK_NOARG( SfxCommonTemplateDialog_Impl, TreeListApplyHdl, SvTreeListBox *, bool )


More information about the Libreoffice-commits mailing list