diff options
author | Jim Raykowski <raykowj@gmail.com> | 2020-04-03 14:02:19 -0800 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2020-04-07 15:51:18 +0200 |
commit | f6328abe3fcd7fb2ec72779ba3754abe761f626b (patch) | |
tree | 635f054a6d034f87c1f1575fee50bb0fa639e979 /sfx2 | |
parent | 33b3439e65bc22c2d149eb18c3d7d9da43699246 (diff) |
tdf#131190 Make custom page styles deletable again in Calc
Return the ability to delete custom page styles in Calc. This was lost
in commit 30c9bc76d0718f0c01d34f81845d88413645b42c
Change-Id: Iae402cc048fde7ffd3ca2696c08d5e54cc30d1be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91672
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/dialog/templdlg.cxx | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 5389cd906044..8ec385bff416 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -2060,13 +2060,27 @@ void SfxCommonTemplateDialog_Impl::EnableDelete() pStyleSheetPool->Find(aTemplName,eFam, pTreeBox->IsVisible()? SfxStyleSearchBits::All : nFilter); OSL_ENSURE(pStyle, "Style not found"); - // bIsCalcPageStyle is a hack to allow Calc page styles to be deleted - // remove when IsUsed is fixed for Calc page style - uno::Reference<frame::XFrame > xFrame = GetObjectShell()->GetFrame()->GetFrame().GetFrameInterface(); - bool bIsCalcPageStyle = (vcl::CommandInfoProvider::GetModuleIdentifier(xFrame) == "com.sun.star.sheet.SpreadsheetDocument") && - (pStyle->GetFamily() == SfxStyleFamily::Page); - if (pStyle && pStyle->IsUserDefined() && (bIsCalcPageStyle || pStyle->HasParentSupport() || !pStyle->IsUsed())) - bEnableDelete = true; + if (pStyle && pStyle->IsUserDefined()) + { + if (pStyle->HasClearParentSupport() || !pStyle->IsUsed()) + { + bEnableDelete = true; + } + else if (pStyle->GetFamily() == SfxStyleFamily::Page) + { + // Hack to allow Calc page styles to be deleted, + // remove when IsUsed is fixed for Calc page styles. + SfxViewFrame* pFrame = GetObjectShell()->GetFrame(); + if (pFrame) + { + uno::Reference<frame::XFrame > xFrame = pFrame->GetFrame().GetFrameInterface(); + if (vcl::CommandInfoProvider::GetModuleIdentifier(xFrame) == "com.sun.star.sheet.SpreadsheetDocument") + { + bEnableDelete = true; + } + } + } + } } EnableDel(bEnableDelete); } |