summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Widl <bernhard.widl@cib.de>2017-04-05 18:29:52 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-04-06 21:59:34 +0000
commit26030f92629b310e66b2335c2cec0413bb7ec828 (patch)
tree1a173339951706e86e4a76bb46a9d986e465ba46
parent42fa96ba5a8a793cb3377b24937fd0eabce85ae2 (diff)
tdf#97357 allow insert image if sheet is protected but few cells are not
- if the currently marked area is fuly unprotected, allow insert image - if there is no currently marked area, check the current cell Change-Id: I46608ae349f91f9f2e81a22dd55a817616ca3d3c Reviewed-on: https://gerrit.libreoffice.org/36160 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
-rw-r--r--sc/source/ui/view/tabvwshb.cxx24
1 files changed, 23 insertions, 1 deletions
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 52990c0f9428..0d5deada9a14 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -507,13 +507,35 @@ void ScTabViewShell::GetDrawInsState(SfxItemSet &rSet)
rSet.DisableItem( nWhich );
break;
- case SID_INSERT_GRAPHIC:
case SID_INSERT_AVMEDIA:
case SID_FONTWORK_GALLERY_FLOATER:
if ( bTabProt || bShared )
rSet.DisableItem( nWhich );
break;
+ case SID_INSERT_GRAPHIC:
+ if (bTabProt || bShared)
+ {
+ // do not disable 'insert graphic' item if the currently marked area is editable (not protected)
+ // if there is no marked area, check the current cell
+ bool bDisableInsertImage = true;
+ ScMarkData& rMark = GetViewData().GetMarkData();
+ if (!rMark.GetMarkedRanges().empty() && GetViewData().GetDocument()->IsSelectionEditable(rMark))
+ bDisableInsertImage = false;
+ else
+ {
+ if (GetViewData().GetDocument()->IsBlockEditable
+ (GetViewData().GetTabNo(), GetViewData().GetCurX(), GetViewData().GetCurY(), GetViewData().GetCurX(), GetViewData().GetCurY()))
+ {
+ bDisableInsertImage = false;
+ }
+ }
+
+ if (bDisableInsertImage)
+ rSet.DisableItem(nWhich);
+ }
+ break;
+
case SID_LINKS:
{
if (GetViewData().GetDocument()->GetLinkManager()->GetLinks().empty())