summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/formatsh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/formatsh.cxx')
-rw-r--r--sc/source/ui/view/formatsh.cxx27
1 files changed, 27 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();
}