summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail..com>2019-11-16 23:41:26 -0900
committerXisco FaulĂ­ <xiscofauli@libreoffice.org>2019-11-26 14:08:30 +0100
commit9cbc55167301cefe9889ad8e604439e0118b627f (patch)
treedb5c566a2d02f773bc6f9f2397d176d8f437cc7f
parentde0924073824e1e38d35f78f5f8de2a4feceae8e (diff)
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@gmail.com> (cherry picked from commit 30c9bc76d0718f0c01d34f81845d88413645b42c) Reviewed-on: https://gerrit.libreoffice.org/83367 Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
-rw-r--r--sfx2/source/dialog/templdlg.cxx16
1 files changed, 4 insertions, 12 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index b4c8f4393e8d..4710cd2c2aec 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1948,6 +1948,7 @@ void SfxCommonTemplateDialog_Impl::ShowHdl()
void SfxCommonTemplateDialog_Impl::EnableDelete()
{
+ bool bEnableDelete(false);
if(IsInitialized() && HasSelectedStyle())
{
OSL_ENSURE(pStyleSheetPool, "No StyleSheetPool");
@@ -1963,19 +1964,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 )