Exemplo n.º 1
0
		private TextType AddKeyWordProperty(TextType propType, string name, string value, ContentType property)
		{
			if (propType == null)
			{
				propType = new TextType(property);
				m_docText.AddTextType(propType);
			}

			TextNode newNode = new TextNode();
			newNode.AddParent(propType);
			propType.AddChild(newNode);

			newNode.AddInfo(new NodeInfo()
			{
				name = "Name",
				type = DataType.String,
				value = name
			});

			newNode.AddInfo(new NodeInfo()
			{
				name = "Value",
				type = DataType.String,
				value = value
			});

			return propType;
		}
        public override Stream ProcessPart(Stream partData, DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action)
        {
            //this is for the discovery on open documents - the copy loses all other macro information except this items
            //specifying macro content - there is a single vbaproject.bin file containing all macros
            //so far this appears to be valid

            if (DocumentProcessor.ActionIncludesCleaning(action))
                return null;

            if (action == DocumentProcessingActions.PassThrough)
                return partData;

            if (m_bInterestedInMacros)
            {
                List<IAbstractTextType> ttypes = discoveryText.GetTextTypes(ContentType.Macro);
                TextType macro = null;
                if (ttypes.Count > 0)
                {
                    macro = (TextType)ttypes[0];
                }
                else
                {
                    macro = new TextType(ContentType.Macro);
                    discoveryText.AddTextType(macro);
                }

                TextNode macroNode = new TextNode();
                NodeInfo ni = new NodeInfo();
                ni.name = "Id";
                ni.value = m_id;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                ni = new NodeInfo();
                ni.name = "Target";
                ni.value = m_target;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                ni = new NodeInfo();
                ni.name = "Type";
                ni.value = m_type;
                ni.type = DataType.String;
                macroNode.AddInfo(ni);

                macro.AddChild(macroNode);
            }

            Initialize();
            ConstructFilter(partData, discoveryText, action);
            ExecuteFilter();
            return m_outStream;
        }
Exemplo n.º 3
0
        public TextNodeBuilder(TextType textType, List<NodeInfo> additionalInfo, string nameForContentProperty)
        {
            m_textType = textType;
            m_textNode = new TextNode();
            m_nameForContentProperty = nameForContentProperty;

            if (additionalInfo != null)
            {
                foreach (NodeInfo ni in additionalInfo)
                    m_textNode.AddInfo(ni);
            }
        }
Exemplo n.º 4
0
        private void FlushText()
        {
	        TextNode newNode = new TextNode();
	        newNode.AddParent(_paraType);
            newNode.AddInfo(new NodeInfo()
                {
                    name = "Content",
                    type = DataType.String,
                    value = _builder.ToString()
                });

	        _paraType.AddChild(newNode);        
	        _iPos += _builder.Length;	        
            _builder.Clear();
        }
Exemplo n.º 5
0
 private void AddTextNode(ContentType textType, string value)
 {
     TextType tText = GetTextType(textType, true);
     if (tText != null)
     {
         TextNode newTextNode = new TextNode();
         AddNewNodeInfo(newTextNode, "Processed", "true", DataType.String);
         AddNewNodeInfo(newTextNode, "Type", "Diagram_Text", DataType.String);
         AddNewNodeInfo(newTextNode, "ModelId", m_currentModelId, DataType.String);
         AddNewNodeInfo(newTextNode, "Content", value, DataType.String);
         tText.AddChild(newTextNode);
     }
 }
Exemplo n.º 6
0
        private void PostProcessReviewerNames()
        {
            IAbstractTextType ttTrackChanges = GetTextType(ContentType.TrackChange, false);
            if (ttTrackChanges == null)
                return;

            List<string> authors = new List<string>();

            for (int i = 0; i < ttTrackChanges.GetChildCount(); i++)
            {
                IAbstractTextNode tnode = ttTrackChanges.GetChild(i);
                NodeInfo ni = tnode.GetInfo("Author")[0];
                //We do not wish to include blank authors.
                //This means they must have been removed!!
                if (!(authors.Contains(ni.value) || string.IsNullOrEmpty(ni.value)))
                    authors.Add(ni.value);
            }

            if (authors.Count == 0)
                return;

            TextType ttReviewers = GetTextType(ContentType.Reviewer, true);

            foreach (string author in authors)
            {
                TextNode tn = new TextNode();
                NodeInfo ni = new NodeInfo();
                ni.name = "Content";
                ni.value = author;
                ni.type = DataType.String;
                tn.AddInfo(ni);
                ttReviewers.AddChild(tn);
            }

        }
Exemplo n.º 7
0
        private void AddKeyWordProperty(string name, string value)
        {
	        TextType paraType = new TextType(ContentType.WorkshareProperty);
	        _docText.AddTextType(paraType);

	        TextNode newNode = new TextNode();
	        newNode.AddParent(paraType);
	        paraType.AddChild(newNode);

	        newNode.AddInfo(new NodeInfo()
                {	
	                name = "Name",
	                type = DataType.String,
	                value = name
                });

            newNode.AddInfo(new NodeInfo()
                {
                    name = "Value",
                    type = DataType.String,
                    value = value
                });
        }
        private void HandleOleLinks(XmlNodeInformation nodeInfo, OleLinkData oleData)
        {
            if (DocumentText != null)
            {
                TextType links = GetTextType(ContentType.Links, true);
                if (links.GetChildCount() == 0)
                {
                    TextNode linkNode = new TextNode();
                    AddNewNodeInfo(linkNode, "Processed", "true", DataType.String);
                    AddNewNodeInfo(linkNode, "ProgId", m_currentLinkProgId, DataType.String);
                    AddNewNodeInfo(linkNode, "Type", "File Link", DataType.String);
                    AddNewNodeInfo(linkNode, "RefIndex", "", DataType.String);
                    AddNewNodeInfo(linkNode, "RefName", "", DataType.String);
                    AddNewNodeInfo(linkNode, "LinkType", oleData.m_type, DataType.String);
                    AddNewNodeInfo(linkNode, "Path", m_currentLinkTargetPath, DataType.String);
                    AddNewNodeInfo(linkNode, "Id", oleData.m_id, DataType.String);

                    links.AddChild(linkNode);
                }
                else
                {
                    HandleOleLinks(links);
                }
            }
            m_currentOleItemNames.Clear();
        }