Exemple #1
0
            internal DefinedPropertyIdEnumerator(PropertyBitMask mask)
            {
                this.bits       = ((ulong)mask.bits2 << 32) | mask.bits1;
                this.currentBit = 1;

                this.currentId = (this.bits != 0) ? PropertyId.LastFlag : PropertyId.MaxValue;
            }
Exemple #2
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;
        }
 private void PushUndoEntry(PropertyBitMask propertyMask)
 {
     if (this.propertyUndoStackTop + 1 >= this.propertyUndoStack.Length)
     {
         if (this.propertyUndoStackTop + 2 >= 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((PropertyId)75, propertyMask.Bits1);
     this.propertyUndoStack[this.propertyUndoStackTop++].Set((PropertyId)76, propertyMask.Bits2);
 }
Exemple #4
0
        private void PushUndoEntry(PropertyBitMask propertyMask)
        {
            if (this.propertyUndoStackTop + 1 >= this.propertyUndoStack.Length)
            {
                if (this.propertyUndoStackTop + 2 >= 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(PropertyUndoEntry.DistinctMask1FakeId, propertyMask.bits1);
            this.propertyUndoStack[this.propertyUndoStackTop++].Set(PropertyUndoEntry.DistinctMask2FakeId, propertyMask.bits2);
        }
Exemple #5
0
        private void PushUndoEntry(PropertyBitMask propertyMask)
        {
            if (propertyUndoStackTop + 1 >= propertyUndoStack.Length)
            {
                if (propertyUndoStackTop + 2 >= 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(PropertyUndoEntry.DistinctMask1FakeId, propertyMask.bits1);
            propertyUndoStack[propertyUndoStackTop++].Set(PropertyUndoEntry.DistinctMask2FakeId, propertyMask.bits2);
        }
        // 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);
                    }
                }
            }
        }
Exemple #7
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);
        }
Exemple #8
0
 public bool IsSubsetOf(PropertyBitMask overrideFlags)
 {
     return(0 == (this.bits1 & ~overrideFlags.bits1) && 0 == (this.bits2 & ~overrideFlags.bits2));
 }
Exemple #9
0
 public void Or(PropertyBitMask newBits)
 {
     this.bits1 |= newBits.bits1;
     this.bits2 |= newBits.bits2;
 }
        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;
        }
 // Token: 0x06001BCA RID: 7114 RVA: 0x000D54FC File Offset: 0x000D36FC
 public void GetPropertyList(out Property[] propertyList, out FlagProperties effectiveFlagProperties, out PropertyBitMask effectivePropertyMask)
 {
     effectiveFlagProperties = default(FlagProperties);
     effectivePropertyMask   = this.PropertyMask;
     for (int i = this.topEntry - 1; i >= 0; i--)
     {
         effectiveFlagProperties.Merge(this.entries[i].FlagProperties);
     }
     if (this.nonFlagPropertiesCount != 0)
     {
         propertyList = new Property[this.nonFlagPropertiesCount];
         if (this.topEntry == 1)
         {
             Array.Copy(this.entries[0].Properties, 0, propertyList, 0, this.nonFlagPropertiesCount);
         }
         else if (this.topEntry == 2)
         {
             Property[] properties  = this.entries[0].Properties;
             Property[] properties2 = this.entries[1].Properties;
             int        num         = 0;
             int        num2        = 0;
             int        count       = this.entries[0].Count;
             int        count2      = this.entries[1].Count;
             int        num3        = 0;
             for (;;)
             {
                 if (num < count)
                 {
                     if (num2 == count2 || properties[num].Id <= properties2[num2].Id)
                     {
                         propertyList[num3++] = properties[num++];
                     }
                     else
                     {
                         propertyList[num3++] = properties2[num2++];
                     }
                 }
                 else
                 {
                     if (num2 >= count2)
                     {
                         break;
                     }
                     propertyList[num3++] = properties2[num2++];
                 }
             }
         }
         else
         {
             PropertyId propertyId = PropertyId.MergedCell;
             int        num4       = 0;
             while ((propertyId += 1) < PropertyId.MaxValue)
             {
                 if (this.PropertyMask.IsSet(propertyId))
                 {
                     int num5;
                     int num6;
                     this.FindProperty(propertyId, out num5, out num6);
                     propertyList[num4++] = this.entries[num5].Properties[num6];
                 }
             }
         }
     }
     else
     {
         propertyList = null;
     }
     this.Clean();
 }
Exemple #12
0
 // Token: 0x06001C0F RID: 7183 RVA: 0x000D64C1 File Offset: 0x000D46C1
 internal DefinedPropertyIdEnumerator(PropertyBitMask mask)
 {
     this.Bits       = ((ulong)mask.Bits2 << 32 | (ulong)mask.Bits1);
     this.CurrentBit = 1UL;
     this.CurrentId  = ((this.Bits != 0UL) ? PropertyId.MergedCell : PropertyId.MaxValue);
 }
Exemple #13
0
 // Token: 0x06001C06 RID: 7174 RVA: 0x000D63B3 File Offset: 0x000D45B3
 public bool IsSubsetOf(PropertyBitMask overrideFlags)
 {
     return((this.Bits1 & ~(overrideFlags.Bits1 != 0U)) == 0U && 0U == (this.Bits2 & ~overrideFlags.Bits2));
 }
        public int ApplyProperties(FlagProperties flagProperties, Property[] propList, FlagProperties flagInheritanceMask, PropertyBitMask propertyInheritanceMask)
        {
            int            result = this.propertyUndoStackTop;
            FlagProperties x      = this.flagProperties & flagInheritanceMask;
            FlagProperties x2     = x | flagProperties;

            if (x2 != this.flagProperties)
            {
                this.PushUndoEntry(PropertyId.MaxValue, this.flagProperties);
                this.flagProperties = x2;
            }
            FlagProperties y  = x ^ flagProperties;
            FlagProperties x3 = (flagProperties & y) | (flagProperties & ~x);

            if (x3 != this.distinctFlagProperties)
            {
                this.PushUndoEntry((PropertyId)74, this.distinctFlagProperties);
                this.distinctFlagProperties = x3;
            }
            PropertyBitMask propertyBitMask = this.propertyMask & ~propertyInheritanceMask;

            foreach (PropertyId propertyId in propertyBitMask)
            {
                this.PushUndoEntry(propertyId, this.properties[(int)(propertyId - PropertyId.FontColor)]);
            }
            PropertyBitMask allOff = PropertyBitMask.AllOff;

            this.propertyMask &= propertyInheritanceMask;
            if (propList != null)
            {
                foreach (Property property in propList)
                {
                    if (this.propertyMask.IsSet(property.Id))
                    {
                        if (this.properties[(int)(property.Id - PropertyId.FontColor)] != property.Value)
                        {
                            this.PushUndoEntry(property.Id, this.properties[(int)(property.Id - PropertyId.FontColor)]);
                            if (property.Value.IsNull)
                            {
                                this.propertyMask.Clear(property.Id);
                            }
                            else
                            {
                                this.properties[(int)(property.Id - PropertyId.FontColor)] = property.Value;
                                allOff.Set(property.Id);
                            }
                        }
                    }
                    else if (!property.Value.IsNull)
                    {
                        if (!propertyBitMask.IsSet(property.Id))
                        {
                            this.PushUndoEntry(property.Id, PropertyValue.Null);
                        }
                        this.properties[(int)(property.Id - PropertyId.FontColor)] = property.Value;
                        this.propertyMask.Set(property.Id);
                        allOff.Set(property.Id);
                    }
                }
            }
            if (allOff != this.distinctPropertyMask)
            {
                this.PushUndoEntry(this.distinctPropertyMask);
                this.distinctPropertyMask = allOff;
            }
            return(result);
        }