Example #1
0
        public void SubtractDefaultFromDistinct(FlagProperties defaultFlags, Property[] defaultProperties)
        {
            FlagProperties y  = defaultFlags ^ this.distinctFlagProperties;
            FlagProperties y2 = (this.distinctFlagProperties & y) | (this.distinctFlagProperties & ~defaultFlags);

            if (this.distinctFlagProperties != y2)
            {
                this.PushUndoEntry((PropertyId)74, this.distinctFlagProperties);
                this.distinctFlagProperties = y2;
            }
            if (defaultProperties != null)
            {
                bool flag = false;
                foreach (Property property in defaultProperties)
                {
                    if (this.distinctPropertyMask.IsSet(property.Id) && this.properties[(int)(property.Id - PropertyId.FontColor)] == property.Value)
                    {
                        if (!flag)
                        {
                            this.PushUndoEntry(this.distinctPropertyMask);
                            flag = true;
                        }
                        this.distinctPropertyMask.Clear(property.Id);
                    }
                }
            }
        }
Example #2
0
        public void SubtractDefaultFromDistinct(FlagProperties defaultFlags, Property[] defaultProperties)
        {
            var overridenFlagsPropertiesMask = defaultFlags ^ distinctFlagProperties;
            var newDistinctFlagProperties    = (distinctFlagProperties & overridenFlagsPropertiesMask) | (distinctFlagProperties & ~defaultFlags);

            if (distinctFlagProperties != newDistinctFlagProperties)
            {
                PushUndoEntry(PropertyUndoEntry.DistinctFlagPropertiesFakeId, distinctFlagProperties);
                distinctFlagProperties = newDistinctFlagProperties;
            }

            if (defaultProperties != null)
            {
                var savedDistinctMask = false;
                foreach (var prop in defaultProperties)
                {
                    if (distinctPropertyMask.IsSet(prop.Id) && properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] == prop.Value)
                    {
                        if (!savedDistinctMask)
                        {
                            PushUndoEntry(distinctPropertyMask);
                            savedDistinctMask = true;
                        }

                        distinctPropertyMask.Clear(prop.Id);
                    }
                }
            }
        }
Example #3
0
        public void SubtractDefaultFromDistinct(FlagProperties defaultFlags, Property[] defaultProperties)
        {
            FlagProperties overridenFlagsPropertiesMask = defaultFlags ^ this.distinctFlagProperties;
            FlagProperties newDistinctFlagProperties    = (this.distinctFlagProperties & overridenFlagsPropertiesMask) | (distinctFlagProperties & ~defaultFlags);

            if (this.distinctFlagProperties != newDistinctFlagProperties)
            {
                this.PushUndoEntry(PropertyUndoEntry.DistinctFlagPropertiesFakeId, this.distinctFlagProperties);
                this.distinctFlagProperties = newDistinctFlagProperties;
            }

            if (defaultProperties != null)
            {
                bool savedDistinctMask = false;
                foreach (Property prop in defaultProperties)
                {
                    if (this.distinctPropertyMask.IsSet(prop.Id) && this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] == prop.Value)
                    {
                        if (!savedDistinctMask)
                        {
                            this.PushUndoEntry(this.distinctPropertyMask);
                            savedDistinctMask = true;
                        }

                        this.distinctPropertyMask.Clear(prop.Id);
                    }
                }
            }
        }
Example #4
0
        public PropertyValue GetProperty(PropertyId id)
        {
            FormatStore.NodeEntry[] array = this.nodes.Plane(this.nodeHandle);
            int num = this.nodes.Index(this.nodeHandle);

            if (FlagProperties.IsFlagProperty(id))
            {
                return(array[num].FlagProperties.GetPropertyValue(id));
            }
            if (array[num].PropertyMask.IsSet(id))
            {
                for (int i = 0; i < array[num].Properties.Length; i++)
                {
                    Property property = array[num].Properties[i];
                    if (property.Id == id)
                    {
                        return(property.Value);
                    }
                    if (property.Id > id)
                    {
                        break;
                    }
                }
            }
            return(PropertyValue.Null);
        }
Example #5
0
        public void SetProps(FlagProperties flagProperties, PropertyBitMask propertyMask, Property[] properties, int inheritanceMaskIndex)
        {
            FormatStore.NodeEntry[] array = this.nodes.Plane(this.nodeHandle);
            int num = this.nodes.Index(this.nodeHandle);

            array[num].FlagProperties       = flagProperties;
            array[num].PropertyMask         = propertyMask;
            array[num].Properties           = properties;
            array[num].InheritanceMaskIndex = inheritanceMaskIndex;
        }
Example #6
0
 public PropertyValue GetEffectiveProperty(PropertyId id)
 {
     if (FlagProperties.IsFlagProperty(id))
     {
         return(flagProperties.GetPropertyValue(id));
     }
     else if (propertyMask.IsSet(id))
     {
         return(properties[(int)(id - PropertyBitMask.FirstNonFlag)]);
     }
     return(PropertyValue.Null);
 }
Example #7
0
 public PropertyValue GetDistinctProperty(PropertyId id)
 {
     if (FlagProperties.IsFlagProperty(id))
     {
         return(this.distinctFlagProperties.GetPropertyValue(id));
     }
     else if (this.distinctPropertyMask.IsSet(id))
     {
         return(this.properties[(int)(id - PropertyBitMask.FirstNonFlag)]);
     }
     return(PropertyValue.Null);
 }
Example #8
0
 public PropertyValue GetDistinctProperty(PropertyId id)
 {
     if (FlagProperties.IsFlagProperty(id))
     {
         return(this.distinctFlagProperties.GetPropertyValue(id));
     }
     if (this.distinctPropertyMask.IsSet(id))
     {
         return(this.properties[(int)(id - PropertyId.FontColor)]);
     }
     return(PropertyValue.Null);
 }
Example #9
0
        public void SetProperty(PropertyId id, PropertyValue value)
        {
            FormatStore.NodeEntry[] array = this.nodes.Plane(this.nodeHandle);
            int num = this.nodes.Index(this.nodeHandle);

            if (FlagProperties.IsFlagProperty(id))
            {
                array[num].FlagProperties.SetPropertyValue(id, value);
                return;
            }
            int i = 0;

            if (array[num].Properties != null)
            {
                while (i < array[num].Properties.Length)
                {
                    Property property = array[num].Properties[i];
                    if (property.Id == id)
                    {
                        array[num].Properties[i].Set(id, value);
                        return;
                    }
                    if (property.Id > id)
                    {
                        break;
                    }
                    i++;
                }
            }
            if (array[num].Properties == null)
            {
                array[num].Properties = new Property[1];
                array[num].Properties[0].Set(id, value);
                array[num].PropertyMask.Set(id);
                return;
            }
            Property[] array2 = new Property[array[num].Properties.Length + 1];
            if (i != 0)
            {
                Array.Copy(array[num].Properties, 0, array2, 0, i);
            }
            if (i != array[num].Properties.Length)
            {
                Array.Copy(array[num].Properties, i, array2, i + 1, array[num].Properties.Length - i);
            }
            array2[i].Set(id, value);
            array[num].Properties = array2;
            array[num].PropertyMask.Set(id);
        }
Example #10
0
 private void PushUndoEntry(PropertyId fakePropId, FlagProperties flagProperties)
 {
     if (this.propertyUndoStackTop == this.propertyUndoStack.Length)
     {
         if (this.propertyUndoStack.Length >= 8960)
         {
             throw new TextConvertersException("property undo stack is too large");
         }
         int num = Math.Min(this.propertyUndoStack.Length * 2, 8960);
         PropertyState.PropertyUndoEntry[] destinationArray = new PropertyState.PropertyUndoEntry[num];
         Array.Copy(this.propertyUndoStack, 0, destinationArray, 0, this.propertyUndoStackTop);
         this.propertyUndoStack = destinationArray;
     }
     this.propertyUndoStack[this.propertyUndoStackTop++].Set(fakePropId, flagProperties);
 }
Example #11
0
        private void PushUndoEntry(PropertyId fakePropId, FlagProperties flagProperties)
        {
            if (this.propertyUndoStackTop == this.propertyUndoStack.Length)
            {
                if (this.propertyUndoStack.Length >= PropertyState.MaxStackSize)
                {
                    throw new TextConvertersException("property undo stack is too large");
                }

                int newStackSize = Math.Min(this.propertyUndoStack.Length * 2, PropertyState.MaxStackSize);

                PropertyUndoEntry[] newPropertyUndoStack = new PropertyUndoEntry[newStackSize];
                Array.Copy(this.propertyUndoStack, 0, newPropertyUndoStack, 0, this.propertyUndoStackTop);
                this.propertyUndoStack = newPropertyUndoStack;
            }

            this.propertyUndoStack[this.propertyUndoStackTop++].Set(fakePropId, flagProperties);
        }
Example #12
0
        private void PushUndoEntry(PropertyId fakePropId, FlagProperties flagProperties)
        {
            if (propertyUndoStackTop == propertyUndoStack.Length)
            {
                if (propertyUndoStack.Length >= MaxStackSize)
                {
                    throw new TextConvertersException("property undo stack is too large");
                }

                var newStackSize = Math.Min(propertyUndoStack.Length * 2, MaxStackSize);

                var newPropertyUndoStack = new PropertyUndoEntry[newStackSize];
                Array.Copy(propertyUndoStack, 0, newPropertyUndoStack, 0, propertyUndoStackTop);
                propertyUndoStack = newPropertyUndoStack;
            }

            propertyUndoStack[propertyUndoStackTop++].Set(fakePropId, flagProperties);
        }
        // Token: 0x06001BC8 RID: 7112 RVA: 0x000D53E0 File Offset: 0x000D35E0
        public void AddProperties(int precedence, FlagProperties flagProperties, PropertyBitMask propertyMask, Property[] propList)
        {
            int entry = this.GetEntry(precedence);

            this.entries[entry].FlagProperties.Merge(flagProperties);
            if (propList != null)
            {
                foreach (Property property in propList)
                {
                    if (propertyMask.IsSet(property.Id))
                    {
                        if (property.Value.IsRefCountedHandle)
                        {
                            this.Store.AddRefValue(property.Value);
                        }
                        this.SetPropertyImpl(entry, property.Id, property.Value);
                    }
                }
            }
        }
 // Token: 0x06001BD0 RID: 7120 RVA: 0x000D5B10 File Offset: 0x000D3D10
 private void SetPropertyImpl(int entry, PropertyId id, PropertyValue value)
 {
     if (!FlagProperties.IsFlagProperty(id))
     {
         if (this.PropertyMask.IsSet(id))
         {
             int num;
             int num2;
             this.FindProperty(id, out num, out num2);
             if (num < entry)
             {
                 return;
             }
             if (num == entry)
             {
                 if (this.entries[entry].Properties[num2].Value.IsRefCountedHandle)
                 {
                     this.Store.ReleaseValue(this.entries[entry].Properties[num2].Value);
                 }
                 else if (this.entries[entry].Properties[num2].Value.IsRelativeHtmlFontUnits && value.IsRelativeHtmlFontUnits)
                 {
                     value = new PropertyValue(PropertyType.RelHtmlFontUnits, this.entries[entry].Properties[num2].Value.RelativeHtmlFontUnits + value.RelativeHtmlFontUnits);
                 }
                 this.entries[entry].Properties[num2].Value = value;
                 return;
             }
             this.RemoveProperty(num, num2);
         }
         if (!value.IsNull)
         {
             this.AddProperty(entry, id, value);
         }
         return;
     }
     if (!value.IsNull)
     {
         this.entries[entry].FlagProperties.Set(id, value.Bool);
         return;
     }
     this.entries[entry].FlagProperties.Remove(id);
 }
 // Token: 0x06001BC9 RID: 7113 RVA: 0x000D5474 File Offset: 0x000D3674
 public PropertyValue GetProperty(PropertyId id)
 {
     if (FlagProperties.IsFlagProperty(id))
     {
         for (int i = 0; i < this.topEntry; i++)
         {
             if (this.entries[i].FlagProperties.IsDefined(id))
             {
                 return(this.entries[i].FlagProperties.GetPropertyValue(id));
             }
         }
     }
     else if (this.PropertyMask.IsSet(id))
     {
         int num;
         int num2;
         this.FindProperty(id, out num, out num2);
         return(this.entries[num].Properties[num2].Value);
     }
     return(PropertyValue.Null);
 }
Example #16
0
        public void UndoProperties(int undoLevel)
        {
            InternalDebug.Assert(undoLevel <= this.propertyUndoStackTop);

            for (int i = this.propertyUndoStackTop - 1; i >= undoLevel; i--)
            {
                if (this.propertyUndoStack[i].IsFlags)
                {
                    this.flagProperties = this.propertyUndoStack[i].flags.flags;
                }
                else if (this.propertyUndoStack[i].IsDistinctFlags)
                {
                    this.distinctFlagProperties = this.propertyUndoStack[i].flags.flags;
                }
                else if (this.propertyUndoStack[i].IsDistinctMask1)
                {
                    this.distinctPropertyMask.Set1(this.propertyUndoStack[i].bits.bits);
                }
                else if (this.propertyUndoStack[i].IsDistinctMask2)
                {
                    this.distinctPropertyMask.Set2(this.propertyUndoStack[i].bits.bits);
                }
                else
                {
                    if (this.propertyUndoStack[i].property.Value.IsNull)
                    {
                        this.propertyMask.Clear(this.propertyUndoStack[i].property.Id);
                    }
                    else
                    {
                        this.properties[(int)(this.propertyUndoStack[i].property.Id - PropertyBitMask.FirstNonFlag)] = this.propertyUndoStack[i].property.Value;
                        this.propertyMask.Set(this.propertyUndoStack[i].property.Id);
                    }
                }
            }

            this.propertyUndoStackTop = undoLevel;
        }
Example #17
0
        public int ApplyProperties(FlagProperties flagProperties, Property[] propList, FlagProperties flagInheritanceMask, PropertyBitMask propertyInheritanceMask)
        {
            int undoStackPosition = this.propertyUndoStackTop;

            FlagProperties allInheritedFlagProperties = this.flagProperties & flagInheritanceMask;

            FlagProperties newEffectiveFlagProperties = allInheritedFlagProperties | flagProperties;

            if (newEffectiveFlagProperties != this.flagProperties)
            {
                this.PushUndoEntry(PropertyUndoEntry.FlagPropertiesFakeId, this.flagProperties);
                this.flagProperties = newEffectiveFlagProperties;
            }


            FlagProperties overridenFlagsPropertiesMask = allInheritedFlagProperties ^ flagProperties;

            FlagProperties newDistinctFlagProperties = (flagProperties & overridenFlagsPropertiesMask) | (flagProperties & ~allInheritedFlagProperties);

            if (newDistinctFlagProperties != this.distinctFlagProperties)
            {
                this.PushUndoEntry(PropertyUndoEntry.DistinctFlagPropertiesFakeId, this.distinctFlagProperties);
                this.distinctFlagProperties = newDistinctFlagProperties;
            }

            PropertyBitMask maskedOutProperties = this.propertyMask & ~propertyInheritanceMask;

            foreach (PropertyId propId in maskedOutProperties)
            {
                this.PushUndoEntry(propId, this.properties[(int)(propId - PropertyBitMask.FirstNonFlag)]);
            }

            PropertyBitMask newDistinctPropertyMask = PropertyBitMask.AllOff;

            this.propertyMask &= propertyInheritanceMask;

            if (propList != null)
            {
                foreach (Property prop in propList)
                {
                    if (this.propertyMask.IsSet(prop.Id))
                    {
                        if (this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] != prop.Value)
                        {
                            this.PushUndoEntry(prop.Id, this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)]);

                            if (prop.Value.IsNull)
                            {
                                this.propertyMask.Clear(prop.Id);
                            }
                            else
                            {
                                this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] = prop.Value;
                                newDistinctPropertyMask.Set(prop.Id);
                            }
                        }
                    }
                    else if (!prop.Value.IsNull)
                    {
                        if (!maskedOutProperties.IsSet(prop.Id))
                        {
                            this.PushUndoEntry(prop.Id, PropertyValue.Null);
                        }

                        this.properties[(int)(prop.Id - PropertyBitMask.FirstNonFlag)] = prop.Value;

                        this.propertyMask.Set(prop.Id);

                        newDistinctPropertyMask.Set(prop.Id);
                    }
                }
            }

            if (newDistinctPropertyMask != this.distinctPropertyMask)
            {
                this.PushUndoEntry(this.distinctPropertyMask);
                this.distinctPropertyMask = newDistinctPropertyMask;
            }

            return(undoStackPosition);
        }
Example #18
0
 public void Set(PropertyId fakePropId, FlagProperties flagProperties)
 {
     this.flags.fakeId = fakePropId;
     this.flags.flags  = flagProperties;
 }
Example #19
0
 public void ReverseMerge(FlagProperties baseFlags)
 {
     this.bits = (baseFlags.bits & ~((this.bits & AllDefinedBits) >> 1)) | this.bits;
 }
Example #20
0
 public static FlagProperties Merge(FlagProperties baseFlags, FlagProperties overrideFlags)
 {
     return(new FlagProperties((baseFlags.bits & ~((overrideFlags.bits & AllDefinedBits) >> 1)) | overrideFlags.bits));
 }
Example #21
0
 // Token: 0x06001BE1 RID: 7137 RVA: 0x000D5E67 File Offset: 0x000D4067
 public static FlagProperties Merge(FlagProperties baseFlags, FlagProperties overrideFlags)
 {
     return(new FlagProperties((baseFlags.bits & ~((overrideFlags.bits & 2863311530U) >> 1)) | overrideFlags.bits));
 }
Example #22
0
 // Token: 0x06001BF3 RID: 7155 RVA: 0x000D60AA File Offset: 0x000D42AA
 public void Merge(FlagProperties overrideFlags)
 {
     this.bits = ((this.bits & ~((overrideFlags.bits & 2863311530U) >> 1)) | overrideFlags.bits);
 }
Example #23
0
 // Token: 0x06001BF2 RID: 7154 RVA: 0x000D608A File Offset: 0x000D428A
 public bool IsSubsetOf(FlagProperties overrideFlags)
 {
     return(0U == (this.bits & 2863311530U & ~(overrideFlags.bits & 2863311530U)));
 }
Example #24
0
        private void FlushContainer(int stackPos)
        {
            FormatContainerType formatContainerType = this.FixContainerType(this.BuildStack[stackPos].Type, this.ContainerStyleBuildHelper);

            if (formatContainerType != this.BuildStack[stackPos].Type)
            {
                this.BuildStack[stackPos].Type = formatContainerType;
            }
            this.ContainerStyleBuildHelper.GetPropertyList(out this.BuildStack[stackPos].Properties, out this.BuildStack[stackPos].FlagProperties, out this.BuildStack[stackPos].PropertyMask);
            if (!this.BuildStack[stackPos].IsPropertyContainerOrNull)
            {
                if (!this.newLine && (byte)(this.BuildStack[stackPos].Type & FormatContainerType.BlockFlag) != 0)
                {
                    this.Store.AddBlockBoundary();
                    this.newLine             = true;
                    this.textQuotingExpected = true;
                }
                FormatNode formatNode;
                if (formatContainerType == FormatContainerType.Document)
                {
                    formatNode = this.Store.AllocateNode(this.BuildStack[stackPos].Type, 0U);
                }
                else
                {
                    formatNode = this.Store.AllocateNode(this.BuildStack[stackPos].Type);
                }
                formatNode.SetOnRightEdge();
                if ((byte)(this.BuildStack[stackPos].Type & FormatContainerType.InlineObjectFlag) != 0)
                {
                    this.Store.AddInlineObject();
                }
                FormatNode node = this.Store.GetNode(this.LastNodeInternal);
                int        num;
                this.GetParentForNewNode(formatNode, node, stackPos, out num).AppendChild(formatNode);
                this.BuildStack[stackPos].Node = formatNode.Handle;
                this.LastNodeInternal          = formatNode.Handle;
                FlagProperties  flagProperties2;
                Property[]      properties;
                PropertyBitMask propertyMask;
                if (num < stackPos)
                {
                    FlagProperties  flagProperties  = FlagProperties.AllOn;
                    PropertyBitMask propertyBitMask = PropertyBitMask.AllOn;
                    int             num2            = stackPos;
                    while (num2 >= num && (!flagProperties.IsClear || !propertyBitMask.IsClear))
                    {
                        if (num2 == stackPos || this.BuildStack[num2].Type == FormatContainerType.PropertyContainer)
                        {
                            flagProperties2 = (this.BuildStack[num2].FlagProperties & flagProperties);
                            this.ContainerStyleBuildHelper.AddProperties(11, flagProperties2, propertyBitMask, this.BuildStack[num2].Properties);
                            flagProperties  &= ~this.BuildStack[num2].FlagProperties;
                            propertyBitMask &= ~this.BuildStack[num2].PropertyMask;
                            flagProperties  &= FormatStoreData.GlobalInheritanceMasks[this.BuildStack[num2].InheritanceMaskIndex].FlagProperties;
                            propertyBitMask &= FormatStoreData.GlobalInheritanceMasks[this.BuildStack[num2].InheritanceMaskIndex].PropertyMask;
                        }
                        num2--;
                    }
                    this.ContainerStyleBuildHelper.GetPropertyList(out properties, out flagProperties2, out propertyMask);
                }
                else
                {
                    flagProperties2 = this.BuildStack[stackPos].FlagProperties;
                    propertyMask    = this.BuildStack[stackPos].PropertyMask;
                    properties      = this.BuildStack[stackPos].Properties;
                    if (properties != null)
                    {
                        for (int i = 0; i < properties.Length; i++)
                        {
                            if (properties[i].Value.IsRefCountedHandle)
                            {
                                this.Store.AddRefValue(properties[i].Value);
                            }
                        }
                    }
                }
                formatNode.SetProps(flagProperties2, propertyMask, properties, this.BuildStack[stackPos].InheritanceMaskIndex);
            }
            this.ContainerStyleBuildHelper.Clean();
            this.ContainerFlushed = true;
        }
Example #25
0
 // Token: 0x06001BF4 RID: 7156 RVA: 0x000D60D1 File Offset: 0x000D42D1
 public void ReverseMerge(FlagProperties baseFlags)
 {
     this.bits = ((baseFlags.bits & ~((this.bits & 2863311530U) >> 1)) | this.bits);
 }
Example #26
0
 public bool IsSubsetOf(FlagProperties overrideFlags)
 {
     return(0 == ((this.bits & AllDefinedBits) & ~(overrideFlags.bits & AllDefinedBits)));
 }
Example #27
0
 public void SubtractDefaultContainerPropertiesFromDistinct(FlagProperties flags, Property[] properties)
 {
     this.propertyState.SubtractDefaultFromDistinct(flags, properties);
 }
Example #28
0
 public void Mask(FlagProperties maskFlags)
 {
     this.bits &= (maskFlags.bits & AllDefinedBits) | ((maskFlags.bits & AllDefinedBits) >> 1);
 }
Example #29
0
 public static FlagProperties operator |(FlagProperties x, FlagProperties y)
 {
     return(FlagProperties.Merge(x, y));
 }
Example #30
0
        // Orphaned WPL code.
#if false
        public void Merge(FlagProperties overrideFlags)
        {
            this.bits = (this.bits & ~((overrideFlags.bits & AllDefinedBits) >> 1)) | overrideFlags.bits;
        }