Example #1
0
        public virtual Effect ConstructEffect(int iDepth, XmlNodeInformation ni, EffectDescriptor ed)
        {
            var result = new GenericEffect(iDepth, ni, ed, GetAdditionalInfo());

            return result;

        }
Example #2
0
        public GenericEffect(int iDepth, XmlNodeInformation ni, EffectDescriptor td, List<NodeInfo> additionalInfo)
            : base(iDepth)
        {
            m_effectDescriptor = td;
            m_contentType = td.ContentType;

            if (( (td.Reversible) && (ni.GetAttributeValue("val") == "0")) || !td.DefaultPolarity || !td.DeleteNode)
            {
                m_bBlockPolarity = false;
                m_bConsumePolarity = false;
            }

            if (!td.DeleteNodeContent)
            {
                m_bBlockPolarity = false;
                m_bBlocksAtStartDepth = true;
            }

            if (td.AttributeBlockType != AttributeBlockType.None)
            {
                m_attributeBlockType = td.AttributeBlockType;
            }

            this.m_blockType = td.BlockType;

            BuildAdditionalInfo(ni, td, additionalInfo);
        }
        public override Effect ConstructEffect(int iDepth, XmlNodeInformation ni, EffectDescriptor ed)
        {
            var result = base.ConstructEffect(iDepth, ni, ed);
            if (GetInstructionType() == "HYPERLINK")
                result.ContentType = ContentType.Hyperlink;

            return result;
        }
 public static List<TriggeringNodeDefinition> UnwantedSlideReference(string sSlideRel)
 {
     List<TriggeringNodeDefinition> results = new List<TriggeringNodeDefinition>();
     {
         EffectDescriptor tdHiddenSlide = new EffectDescriptor();
         tdHiddenSlide.BlockType = Effect.BlockType.Structure;
         AttributeFilter filter = new EqualityAttributeFilter("id", sSlideRel);
         results.Add(new TriggeringNodeDefinition(NamespaceId.p, "sldId", filter, tdHiddenSlide));
     }
     return results;
 }
Example #5
0
 public EffectDescriptor Clone()
 {
     EffectDescriptor desc = new EffectDescriptor();
     desc.m_additionalLevels = m_additionalLevels;
     desc.m_ContentType = m_ContentType;
     desc.m_TextType = m_TextType;
     desc.m_DocText = m_DocText;
     desc.m_delegate = m_delegate;
     desc.m_AdditionaInfoDescriptors = this.m_AdditionaInfoDescriptors;
     desc.m_defaultPolarity = m_defaultPolarity;
     desc.m_blockType = m_blockType;
     return desc;
 }
 public static List<TriggeringNodeDefinition> HiddenSlide(int iSlideNumber)
 {
     List<TriggeringNodeDefinition> results = new List<TriggeringNodeDefinition>();
     {
         EffectDescriptor tdHiddenSlide = new EffectDescriptor();
         tdHiddenSlide.ContentType = ContentType.HiddenSlide;
         tdHiddenSlide.BlockType = Effect.BlockType.Structure;
         AttributeFilter filter = new EqualityAttributeFilter("show", "0");
         tdHiddenSlide.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("SlideNumber", iSlideNumber.ToString(), AdditionalInfoDescriptor.MappingType.FixedValue));
         results.Add(new TriggeringNodeDefinition(NamespaceId.p, "sld", filter, tdHiddenSlide));
     }
     return results;
 }
 public static List<TriggeringNodeDefinition> SlideComment(Dictionary<string, string> SlideCommentAuthorLookup)
 {
     List<TriggeringNodeDefinition> results = new List<TriggeringNodeDefinition>();
     {
         EffectDescriptor tdComments = new EffectDescriptor();
         tdComments.ContentType = ContentType.Comment;
         tdComments.BlockType = Effect.BlockType.Structure;
         AttributeFilter filter = new NullAttributeFilter();
         tdComments.DictStringToStringLookup = SlideCommentAuthorLookup;
         tdComments.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Author", "authorID", AdditionalInfoDescriptor.MappingType.StringToStringLookup));
         results.Add(new TriggeringNodeDefinition(NamespaceId.p, "cm", filter, tdComments));
     }
     return results;
 }
Example #8
0
        private void BuildAdditionalInfo(XmlNodeInformation ni, EffectDescriptor td, List<NodeInfo> additionalInfo)
        {
            m_additionalInfo = additionalInfo;

            if (td.AdditionalInfoDescriptors == null)
                return;

            if (m_additionalInfo == null)
                m_additionalInfo = new List<NodeInfo>();

            foreach (AdditionalInfoDescriptor adi in td.AdditionalInfoDescriptors)
            {
                m_additionalInfo.Add(adi.BuildAdditionalInfo(ni, td));
            }
        }
        public NodeInfo BuildAdditionalInfo(XmlNodeInformation ni, EffectDescriptor td)
        {
            switch (Mapping)
            {
                case AdditionalInfoDescriptor.MappingType.FixedValue:
                   return (BuildNodeInfo(Name, Value));
                case AdditionalInfoDescriptor.MappingType.AttribValue:
                    return (BuildNodeInfo(Name, ni.GetAttributeValue(Value)));
                case AdditionalInfoDescriptor.MappingType.AttribNameAndValue:
                    return (BuildNodeInfo(ni.GetAttributeValue(Name), ni.GetAttributeValue(Value)));
                case AdditionalInfoDescriptor.MappingType.StringToStringLookup:
                    return (BuildNodeInfo(Name, LookupAttributeValueIntToString(ni, td)));
                case AdditionalInfoDescriptor.MappingType.AttribValueInDifferentNamespace:
                    return (BuildNodeInfo(Name, LookupAttributeInAnotherNamespace(ni, td)));
            }

            throw new InvalidOperationException();
        }
        private string LookupAttributeValueIntToString(XmlNodeInformation ni, EffectDescriptor td)
        {
			Dictionary<string, string> strings = td.DictStringToStringLookup;
			if (strings != null)
			{
				string sKeyName = Value;
				string sKey;
				if (LookupIsInAnotherNamespace)
				{
					sKey = ni.GetAttributeValue(LookupNamespace, sKeyName);
				}
				else
				{
					sKey = ni.GetAttributeValue(sKeyName);
				}
				string stringValue;
				if (!string.IsNullOrEmpty(sKey) && strings.TryGetValue(sKey, out stringValue))
				{
					return stringValue;
				}
			}
			return "Unknown";
        }
        private static TriggeringNodeDefinition ConstructEditTimeProp()
        {
            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = ContentType.DocumentStatistic;
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Name", "EditTime", AdditionalInfoDescriptor.MappingType.FixedValue));
            td.BlockType = Effect.BlockType.Structure;
            td.NameForContentProperty = "Value";

            return new TriggeringNodeDefinition("TotalTime", td);
        }
        private static TriggeringNodeDefinition ConstructCorePropTND(NamespaceId nsid, string nodename, string propName, ContentType contentType)
        {
            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = contentType;
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Name", propName, AdditionalInfoDescriptor.MappingType.FixedValue));
            td.BlockType = Effect.BlockType.Structure;
            td.NameForContentProperty = "Value";

            return new TriggeringNodeDefinition(nsid, nodename, null, null, td);
        }
        private static TriggeringNodeDefinition BuildTrackChangeReviewerDef(string nodeName)
        {
            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = ContentType.Reviewer;
            td.BlockType = Effect.BlockType.Structure;
            td.AttributeBlockType = Effect.AttributeBlockType.Author;
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("author", null, AdditionalInfoDescriptor.MappingType.AttribNameAndValue));
            td.DeleteNode = false;

            AttributeFilter filter = new NullAttributeFilter();
            return new TriggeringNodeDefinition(NamespaceId.w, nodeName, filter, td);
        }
        public static List<TriggeringNodeDefinition> GetAttachedTemplateDef(PartInfo settingsPart, OpenXmlFormat openXmlFormat)
        {
            List<TriggeringNodeDefinition> results = new List<TriggeringNodeDefinition>();
            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = ContentType.AttachedTemplate;
            td.BlockType = Effect.BlockType.Structure;

            td.DictStringToStringLookup = ConstructTemplateLookup(settingsPart, openXmlFormat);

            AdditionalInfoDescriptor adi = new AdditionalInfoDescriptor("Path", "id", AdditionalInfoDescriptor.MappingType.StringToStringLookup);
            adi.LookupNamespace = NamespaceId.r;
            adi.StringMangler = URLToPath;
            td.AddAdditionalInfoDescriptor(adi);
            adi = new AdditionalInfoDescriptor("Name", "id", AdditionalInfoDescriptor.MappingType.StringToStringLookup);
            adi.LookupNamespace = NamespaceId.r;
            adi.StringMangler = URLToFilename;
            td.AddAdditionalInfoDescriptor(adi);


            results.Add(new TriggeringNodeDefinition(NamespaceId.w, "attachedTemplate", null, null, td));

            return results;
        }
        private string LookupAttributeInAnotherNamespace(XmlNodeInformation ni, EffectDescriptor td)
        {
            string sKeyName = Value;

            string sKey = ni.GetAttributeValue(LookupNamespace, sKeyName);

            if (string.IsNullOrEmpty(sKey))
                return "Unknown";
            return sKey;
        }
 private static TriggeringNodeDefinition BuildSingleNodeBlock(string nodeName)
 {
     EffectDescriptor td = new EffectDescriptor();
     td.BlockType = Effect.BlockType.Structure;
     AttributeFilter filter = new NullAttributeFilter();
     return new TriggeringNodeDefinition(NamespaceId.w, nodeName, filter, td);
 }
        private static TriggeringNodeDefinition ConstructBuiltInPropTND(string propName)
        {
            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = ContentType.BuiltInProperty;
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Name", propName, AdditionalInfoDescriptor.MappingType.FixedValue));
            td.BlockType = Effect.BlockType.Structure;
            td.NameForContentProperty = "Value";

            return new TriggeringNodeDefinition(NamespaceId.extProps, propName, null, null, td);
        }
        private static TriggeringNodeDefinition BuildTrackChangeDef(string typeName, string nodeName, bool bRemoveContent)
        {

            EffectDescriptor td = new EffectDescriptor();
            td.ContentType = ContentType.TrackChange;
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Type", typeName, AdditionalInfoDescriptor.MappingType.FixedValue));
            td.AddAdditionalInfoDescriptor(new AdditionalInfoDescriptor("Author", "author", AdditionalInfoDescriptor.MappingType.AttribValue));
            td.DeleteNodeContent = bRemoveContent;

            TriggeringNodeDefinition result = new TriggeringNodeDefinition(NamespaceId.w, nodeName, null, null, td);
            return result;


        }
Example #19
0
 static public Effect BuildMergeNodeEffect(int iDepth, XmlNodeInformation ni, EffectDescriptor ed)
 {
     return new MergeNodeEffect(iDepth);
 }
 public static Effect Factory(int iDepth, XmlNodeInformation ni, EffectDescriptor ed)
 {
     return new DeleteNodeButKeepContentsEffect(iDepth);
 }