virtual public Stream ProcessPart(Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { Initialize(); ConstructFilter(partData, discoveryText, action); ExecuteFilter(); return m_outStream; }
public System.IO.Stream ProcessPart(System.IO.Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { switch (action) { case DocumentProcessingActions.Discover: return null; default: return partData; } }
internal override Stream ProcessPartData(IPartFilter pf, Stream inputData, RelatedPartProvider relPartProv, DocumentProcessingActions action) { if (!(pf is XmlPartFilter)) Assert.IsInstanceOf(typeof(DefaultPartFilter), pf, "Partfilter wasn't a default part filter"); Assert.IsNotNull(inputData, "input data unexpectedly null"); Assert.AreEqual(expectedAction, action, "action wasn't what we expected"); Assert.IsNotNull(relPartProv, "the related part provider is unexpectedly null"); return base.ProcessPartData(pf, inputData, relPartProv, action); }
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; }
public override Stream ProcessPart(Stream partData, DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { switch (action) { case DocumentProcessingActions.Discover: { Initialize(); ConstructFilter(partData, discoveryText, action); ExecuteFilter(); return m_outStream; } default: { return null; } } }
public void TestGetRelatedPartById() { using (Stream s = new FileStream(TESTFILE_DIR + "test002.docx", FileMode.Open)) { OPCPackage package = new OPCPackage(s); RelatedPartProvider rpp = new RelatedPartProvider(package, package.RootPart); PartInfo relatedPart = rpp.GetRelationPart("rId1"); Assert.AreEqual("word/document.xml", relatedPart.Target); relatedPart = rpp.GetRelationPart("rId2"); Assert.AreEqual("docProps/core.xml", relatedPart.Target); } }
public override Stream ProcessPart(Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { Stream result = base.ProcessPart(partData, discoveryText, relPartProvider, action); return null; }
virtual internal Stream ProcessPartData(IPartFilter pf, Stream inputData, RelatedPartProvider relPartProv, DocumentProcessingActions action) { pf.FilterTriggersToRequiredContentTypes(ContentTypesOfInterest); return pf.ProcessPart(inputData, m_docText, relPartProv, action); }
private void ProcessPart(PartInfo rel, OPCPackage inputPackage, OPCPackage outputPackage, DocumentProcessingActions action) { if (rel.External) { ProcessExternalPart(rel, outputPackage, action); return; } if (m_ProcessedParts.ContainsKey(rel.AbsolutePath())) { if (outputPackage != null) outputPackage.AddContent(rel, null, m_openXmlFormat); return; } m_ProcessedParts.Add(rel.AbsolutePath(), true); IPartFilter pf = GetPartFilter(rel, action); Stream inputData = rel.GetContent(); RelatedPartProvider relPartProv = new RelatedPartProvider(inputPackage, rel); Stream modifiedStream = ProcessPartData(pf, inputData, relPartProv, action); if (modifiedStream != null) outputPackage.AddContent(rel, modifiedStream, m_openXmlFormat); if (action != DocumentProcessingActions.PassThrough && pf.IsBlockedFilter) return; foreach (PartInfo subRel in pf.SortRelatedParts(rel.GetRelatedObjects())) { ProcessPart(subRel, m_inputPackage, m_outputPackage, action); } }
virtual public System.IO.Stream ProcessPart(System.IO.Stream partData, Workshare.FCS.Lite.Base.DocumentText discoveryText, RelatedPartProvider relPartProvider, DocumentProcessingActions action) { return null; }