summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-03-15 23:46:22 -0800
committerEike Rathke <erack@redhat.com>2020-04-07 16:47:48 +0200
commit2d5ea18732c6cc34d82575ae15d2c495da94375b (patch)
treee13a36a4a26aaa06225a55e3ed2ad317478da6cd /sfx2
parentf97aa84465473062061d742acf9929195db17eca (diff)
tdf#131190 Make custom page styles deletable again in Calc
This is a combination of 2 commits. tdf#131190 Make custom page styles deletable again in Calc Here is a patch to return the ability to delete custom page styles in Calc. This was lost in commit 30c9bc76d0718f0c01d34f81845d88413645b42c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90547 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com> (cherry picked from commit bb844eb299b614c1fa56e140630db070cf709a02) 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 ae402cc048fde7ffd3ca2696c08d5e54cc30d1be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91672 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Change-Id: I18936585cfbe45e0254beb882adc8709781f57e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91404 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/templdlg.cxx23
1 files changed, 21 insertions, 2 deletions
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 55d8a0f7d515..1714f65dbe00 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -2011,8 +2011,27 @@ void SfxCommonTemplateDialog_Impl::EnableDelete()
pStyleSheetPool->Find(aTemplName,eFam, pTreeBox->IsVisible()? SfxStyleSearchBits::All : nFilter);
OSL_ENSURE(pStyle, "Style not found");
- if (pStyle && pStyle->IsUserDefined() && (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);
}