public XLProtection(IXLStylized container, IXLProtection defaultProtection = null)
        {
            _container = container;
            if (defaultProtection == null) return;

            _locked = defaultProtection.Locked;
            _hidden = defaultProtection.Hidden;
        }
        public bool Equals(IXLProtection other)
        {
            var otherP = other as XLProtection;
            if (otherP == null)
                return false;

            return _locked == otherP._locked
                   && _hidden == otherP._hidden;
        }
        public bool Equals(IXLProtection other)
        {
            var otherP = other as XLProtection;

            if (otherP == null)
            {
                return(false);
            }

            return(Key == otherP.Key);
        }
Example #4
0
        public XLProtection(IXLStylized container, IXLProtection defaultProtection = null)
        {
            _container = container;
            if (defaultProtection == null)
            {
                return;
            }

            _locked = defaultProtection.Locked;
            _hidden = defaultProtection.Hidden;
        }
Example #5
0
        public bool Equals(IXLProtection other)
        {
            var otherP = other as XLProtection;

            if (otherP == null)
            {
                return(false);
            }

            return(_locked == otherP._locked &&
                   _hidden == otherP._hidden);
        }
        internal static XLProtectionKey GenerateKey(IXLProtection defaultProtection)
        {
            if (defaultProtection == null)
            {
                return(XLProtectionValue.Default.Key);
            }
            if (defaultProtection is XLProtection)
            {
                return((defaultProtection as XLProtection).Key);
            }

            return(new XLProtectionKey
            {
                Locked = defaultProtection.Locked,
                Hidden = defaultProtection.Hidden
            });
        }
 private static bool ProtectionsAreEqual(Protection protection, IXLProtection xlProtection)
 {
     var p = new XLProtection();
     if (protection != null)
     {
         if (protection.Locked != null)
             p.Locked = protection.Locked.Value;
         if (protection.Hidden != null)
             p.Hidden = protection.Hidden.Value;
     }
     return p.Equals(xlProtection);
 }
 public XLProtection(XLStyle style = null, IXLProtection d = null) : this(style, GenerateKey(d))
 {
 }