diff options
author | Gulsah Kose <gulsah.1004@gmail.com> | 2017-03-14 15:35:26 +0300 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-05-05 00:13:13 +0200 |
commit | 9691f2652f157f375881aea3bf5e39d72a133e0f (patch) | |
tree | 004315d3e3b16330a9e1326ab33cf8524d4c1d88 /sc/source | |
parent | 87a5be1cb579cb1e215c39990986c0a770c18b50 (diff) |
tdf#95885 Add new toolbar and toggle icons for Cell Protection
Change-Id: Ib0d7f2a8cc07988d27f5cf96e5c57727ad1eca71
Signed-off-by: Gulsah Kose <gulsah.1004@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/35218
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/view/formatsh.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index b55f25186ea3..259338a37ab4 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -73,6 +73,7 @@ #include "undostyl.hxx" #include "markdata.hxx" #include "markarr.hxx" +#include "attrib.hxx" #define ScFormatShell #define TableFont @@ -1719,6 +1720,26 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq ) rBindings.Invalidate( nSlot ); } break; + + case SID_SCATTR_CELLPROTECTION: // without parameter as toggle + { + const ScPatternAttr* pAttrs = pTabViewShell->GetSelectionPattern(); + bool bProtect = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetProtection(); + bool bHideFormula = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHideFormula(); + bool bHideCell = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHideCell(); + bool bHidePrint = static_cast<const ScProtectionAttr&>(pAttrs->GetItem(ATTR_PROTECTION)).GetHidePrint(); + + ScProtectionAttr aProtectionItem( !bProtect, bHideFormula, bHideCell, bHidePrint ); + pTabViewShell->ApplyAttr( aProtectionItem ); + + SfxAllItemSet aNewSet( GetPool() ); + aNewSet.Put( aProtectionItem, aProtectionItem.Which()); + aNewSet.Put( SfxBoolItem( SID_SCATTR_CELLPROTECTION, !bProtect ) ); + rReq.Done( aNewSet ); + + rBindings.Invalidate( nSlot ); + } + break; } } else @@ -2197,6 +2218,12 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet ) rSet.Put( *pNewItem ); } break; + case SID_SCATTR_CELLPROTECTION: + { + bool bProtect = static_cast<const ScProtectionAttr&>(rAttrSet.Get( ATTR_PROTECTION )).GetProtection(); + rSet.Put( SfxBoolItem(SID_SCATTR_CELLPROTECTION, bProtect) ); + } + break; } nWhich = aIter.NextWhich(); } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index fb1f35d5c35d..6a1087c6b135 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -278,6 +278,8 @@ void ScTabView::InvalidateAttribs() rBindings.Invalidate( SID_ALIGNBOTTOM ); rBindings.Invalidate( SID_ALIGNCENTERVER ); + rBindings.Invalidate( SID_SCATTR_CELLPROTECTION ); + // stuff for sidebar panels { rBindings.Invalidate( SID_H_ALIGNCELL ); |