sfx2/source/dialog/templdlg.cxx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
New commits: commit f6328abe3fcd7fb2ec72779ba3754abe761f626b Author: Jim Raykowski <[email protected]> AuthorDate: Fri Apr 3 14:02:19 2020 -0800 Commit: Eike Rathke <[email protected]> CommitDate: Tue Apr 7 15:51:18 2020 +0200 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 <[email protected]> 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); } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
