/// <summary> /// Writes a DocumentObjectCollection type object to string. Indent a new block by /// indent + initialIndent characters. /// </summary> public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent, int initialIndent) { StringBuilder strBuilder = new StringBuilder(); StringWriter writer = null; DdlWriter wrt = null; try { writer = new StringWriter(strBuilder); wrt = new DdlWriter(writer); wrt.Indent = indent; wrt.InitialIndent = initialIndent; wrt.WriteDocument(docObjectContainer); wrt.Close(); } finally { if (wrt != null) { wrt.Close(); } if (writer != null) { #if !NETFX_CORE writer.Close(); #else writer.Dispose(); #endif } } return(strBuilder.ToString()); }
internal static Paragraph smethod_20(DocumentObjectCollection A_0) { if (A_0.Count != 0) { if (A_0.FirstItem is Table) { TableRow firstItem = (A_0.FirstItem as Table).Rows.FirstItem as TableRow; if (firstItem != null) { TableCell cell = firstItem.Cells.FirstItem as TableCell; if (cell != null) { return cell.method_55(); } } } else { if (!(A_0[0] is StructureDocumentTag)) { return (A_0.FirstItem as Paragraph); } if (A_0[0].ChildObjects.Count != 0) { if (A_0[0].ChildObjects[0] is Table) { return (A_0[0].ChildObjects[0] as Table).Rows[0].Cells[0].method_55(); } return (A_0[0].ChildObjects[0] as Paragraph); } } } return null; }
public override object GetValue(DocumentObject dom, GV flags) { if (!Enum.IsDefined(typeof(GV), flags)) { throw new ArgumentException("flags"); } //throw new InvalidEnumArgumentException("flags", (int)flags, typeof(GV)); Debug.Assert(this.memberInfo is FieldInfo, "Properties of DocumentObjectCollection not allowed."); DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection; if (val == null && flags == GV.ReadWrite) { val = CreateValue() as DocumentObjectCollection; val.parent = dom; FieldInfo.SetValue(dom, val); return(val); } if (val != null && val.IsNull() && flags == GV.GetNull) { return(null); } return(val); }
/// <summary> /// Fills the font, color and (later!) list hashtables so they can be rendered and used by other renderers. /// </summary> private void CollectTables(DocumentObject dom) { ValueDescriptorCollection vds = Meta.GetMeta(dom).ValueDescriptors; int count = vds.Count; for (int idx = 0; idx < count; idx++) { ValueDescriptor vd = vds[idx]; if (!vd.IsRefOnly && !vd.IsNull(dom)) { if (vd.ValueType == typeof(Color)) { Color clr = (Color)vd.GetValue(dom, GV.ReadWrite); clr = clr.GetMixedTransparencyColor(); if (!this.colorList.Contains(clr)) { this.colorList.Add(clr); } } else if (vd.ValueType == typeof(Font)) { Font fnt = vd.GetValue(dom, GV.ReadWrite) as Font; //ReadOnly if (!fnt.IsNull("Name") && !this.fontList.Contains(fnt.Name)) { this.fontList.Add(fnt.Name); } } else if (vd.ValueType == typeof(ListInfo)) { ListInfo lst = vd.GetValue(dom, GV.ReadWrite) as ListInfo; //ReadOnly if (!this.listList.Contains(lst)) { this.listList.Add(lst); } } if (typeof(DocumentObject).IsAssignableFrom(vd.ValueType)) { CollectTables(vd.GetValue(dom, GV.ReadWrite) as DocumentObject); //ReadOnly if (typeof(DocumentObjectCollection).IsAssignableFrom(vd.ValueType)) { DocumentObjectCollection coll = vd.GetValue(dom, GV.ReadWrite) as DocumentObjectCollection; //ReadOnly if (coll != null) { foreach (DocumentObject obj in coll) { //In SeriesCollection kann null vorkommen. if (obj != null) { CollectTables(obj); } } } } } } } }
public override void SetNull(DocumentObject dom) { DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection; if (val != null) { val.SetNull(); } }
/// <summary> /// Determines whether the given DocumentObject is null (not set). /// </summary> public override bool IsNull(DocumentObject dom) { DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection; if (val == null) { return(true); } return(val.IsNull()); }
/// <summary> /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by /// indent + initialIndent characters. /// </summary> public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent, int initialIndent) { using (var wrt = new DdlWriter(filename) { Indent = indent, InitialIndent = initialIndent }) { wrt.WriteDocument(docObjectContainer); } }
/// <summary> /// Indicates whether the container contains an element /// that is of one of the specified types or inherited. /// </summary> /// <param name="coll">The collection to search.</param> /// <param name="types">The types to find within the collection.</param> /// <returns>True, if an object of one of the given types is found within the collection.</returns> internal static bool CollectionContainsObjectAssignableTo(DocumentObjectCollection coll, params Type[] types) { foreach (object obj in coll) { foreach (Type type in types) { if (type.IsAssignableFrom(obj.GetType())) { return(true); } } } return(false); }
private void method_32(DocumentObjectCollection A_0, char[] A_1, bool A_2) { foreach (BodyRegion region in A_0) { if (region is Paragraph) { this.method_34(region as Paragraph, A_1, A_2); } else { this.method_33(region as Table, A_1, A_2); } } }
/// <summary> /// A shape that shall be placed between its predecessor and its successor must be embedded in a paragraph. /// </summary> protected virtual bool RenderInParagraph() { if (_shape.IsNull("RelativeVertical") || _shape.RelativeVertical == RelativeVertical.Line || _shape.RelativeVertical == RelativeVertical.Paragraph) { DocumentObjectCollection docObjects = DocumentRelations.GetParent(_shape) as DocumentObjectCollection; if (DocumentRelations.GetParent(docObjects) is Paragraph)//don't embed it twice! { return(false); } return(_shape.IsNull("WrapFormat.Style") || _shape.WrapFormat.Style == WrapStyle.TopBottom); } return(false); }
private static void smethod_1(Class422 A_0, DocumentObject A_1) { if ((A_1 is TextRange) && ((A_1 as TextRange).CharacterFormat != null)) { smethod_0(A_0, (A_1 as TextRange).CharacterFormat); } DocumentObjectCollection childObjects = A_1.ChildObjects; if ((A_1 != null) && (childObjects.Count > 0)) { for (int i = 0; i < childObjects.Count; i++) { smethod_1(A_0, childObjects[i]); } } }
/// <summary> /// Writes a DocumentObjectCollection type object to string. Indent a new block by /// indent + initialIndent characters. /// </summary> public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent, int initialIndent) { var sb = new StringBuilder(); using (var writer = new StringWriter(sb)) { using (var wrt = new DdlWriter(writer) { Indent = indent, InitialIndent = initialIndent }) { wrt.WriteDocument(docObjectContainer); } } return(sb.ToString()); }
public override object GetValue(DocumentObject dom, GV flags) { Debug.Assert(this.memberInfo is FieldInfo, "Properties of DocumentObjectCollection not allowed."); DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection; if (val == null && flags == GV.ReadWrite) { val = CreateValue() as DocumentObjectCollection; val.parent = dom; FieldInfo.SetValue(dom, val); return(val); } if (val != null && val.IsNull() && flags == GV.GetNull) { return(null); } return(val); }
/// <summary> /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by /// indent + initialIndent characters. /// </summary> public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent, int initialIndent) { DdlWriter wrt = null; try { wrt = new DdlWriter(filename); wrt.Indent = indent; wrt.InitialIndent = initialIndent; wrt.WriteDocument(docObjectContainer); } finally { if (wrt != null) { wrt.Close(); } } }
internal virtual void CloneCommit() { ICompositeObject obj2 = this as ICompositeObject; if (obj2 != null) { DocumentObjectCollection childObjects = obj2.ChildObjects; int num = 0; int count = childObjects.Count; while (num < count) { childObjects[num].CloneCommit(); if (childObjects.Count < count) { num--; count--; } num++; } } }
public override object GetValue(DocumentObject dom, GV flags) { if (!Enum.IsDefined(typeof(GV), flags)) { throw new /*InvalidEnum*/ ArgumentException(DomSR.InvalidEnumValue(flags), "flags"); } Debug.Assert(MemberInfo is FieldInfo, "Properties of DocumentObjectCollection not allowed."); DocumentObjectCollection val = FieldInfo.GetValue(dom) as DocumentObjectCollection; if (val == null && flags == GV.ReadWrite) { val = (DocumentObjectCollection)CreateValue(); val._parent = dom; FieldInfo.SetValue(dom, val); return(val); } if (val != null && val.IsNull() && flags == GV.GetNull) { return(null); } return(val); }
/// <summary> /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by /// indent + initialIndent characters. /// </summary> public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent) { WriteToFile(docObjectContainer, filename, indent, 0); }
public virtual void VisitDocumentObjectCollection(DocumentObjectCollection elements) { }
/// <summary> /// Writes a DocumentObjectCollection type object to string. Indent a new block by _indent characters. /// </summary> public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent) { return(WriteToString(docObjectContainer, indent, 0)); }
/// <summary> /// Writes the specified DocumentObjectCollection to DDL. /// </summary> public void WriteDocument(DocumentObjectCollection documentObjectContainer) { documentObjectContainer.Serialize(_serializer); _serializer.Flush(); }
internal virtual void VisitDocumentObjectCollection(DocumentObjectCollection elements) { }
internal override void VisitDocumentObjectCollection(DocumentObjectCollection elements) { List <int> textIndices = new List <int>(); if (elements is ParagraphElements) { for (int idx = 0; idx < elements.Count; ++idx) { if (elements[idx] is Text) { textIndices.Add(idx); } } } int[] indices = (int[])textIndices.ToArray(); if (indices != null) { int insertedObjects = 0; foreach (int idx in indices) { Text text = (Text)elements[idx + insertedObjects]; string currentString = ""; foreach (char ch in text.Content) { // TODO Add support for other breaking spaces (en space, em space, &c.). switch (ch) { case ' ': case '\r': case '\n': case '\t': if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text(" ")); ++insertedObjects; break; case '-': // minus. elements.InsertObject(idx + insertedObjects, new Text(currentString + ch)); ++insertedObjects; currentString = ""; break; // Characters that allow line breaks without indication. case '\u200B': // zero width space. case '\u200C': // zero width non-joiner. if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } break; case '': // soft hyphen. if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text("")); ++insertedObjects; //currentString = ""; break; default: currentString += ch; break; } } if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; } elements.RemoveObjectAt(idx + insertedObjects); --insertedObjects; } } }
/// <summary> /// Writes a DocumentObjectCollection type object to string. Indent a new block by /// indent + initialIndent characters. /// </summary> public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent, int initialIndent) { StringBuilder strBuilder = new StringBuilder(); StringWriter writer = null; DdlWriter wrt = null; try { writer = new StringWriter(strBuilder); wrt = new DdlWriter(writer); wrt.Indent = indent; wrt.InitialIndent = initialIndent; wrt.WriteDocument(docObjectContainer); wrt.Close(); } finally { if (wrt != null) wrt.Close(); if (writer != null) { #if !NETFX_CORE writer.Close(); #else writer.Dispose(); #endif } } return strBuilder.ToString(); }
/// <summary> /// Writes a DocumentObjectCollection type object to string. Indent a new block by _indent characters. /// </summary> public static string WriteToString(DocumentObjectCollection docObjectContainer, int indent) { return WriteToString(docObjectContainer, indent, 0); }
internal override void VisitDocumentObjectCollection(DocumentObjectCollection elements) { List <int> textIndices = new List <int>(); if (elements is ParagraphElements) { for (int idx = 0; idx < elements.Count; ++idx) { if (elements[idx] is Text) { textIndices.Add(idx); } } } int[] indices = (int[])textIndices.ToArray(); if (indices != null) { int insertedObjects = 0; foreach (int idx in indices) { Text text = (Text)elements[idx + insertedObjects]; string currentString = ""; foreach (char ch in text.Content) { switch (ch) { case ' ': case '\r': case '\n': case '\t': if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text(" ")); ++insertedObjects; break; case '-': //minus elements.InsertObject(idx + insertedObjects, new Text(currentString + ch)); ++insertedObjects; currentString = ""; break; case '': //soft hyphen if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text("")); ++insertedObjects; currentString = ""; break; default: currentString += ch; break; } } if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; } elements.RemoveObjectAt(idx + insertedObjects); --insertedObjects; } } }
internal ShapeBase(Document A_0) : base(A_0) { this.class43_0 = new Class43(); this.documentObjectCollection_0 = new ShapeItemCollection(A_0, this); }
/// <summary> /// Writes a DocumentObjectCollection type object to a DDL file. Indent a new block by /// indent + initialIndent characters. /// </summary> public static void WriteToFile(DocumentObjectCollection docObjectContainer, string filename, int indent, int initialIndent) { DdlWriter wrt = null; try { wrt = new DdlWriter(filename); wrt.Indent = indent; wrt.InitialIndent = initialIndent; wrt.WriteDocument(docObjectContainer); } finally { if (wrt != null) wrt.Close(); } }
internal override void VisitDocumentObjectCollection(DocumentObjectCollection elements) { ArrayList textIndices = new ArrayList(); if (elements is ParagraphElements) { for (int idx = 0; idx < elements.Count; ++idx) { if (elements[idx] is Text) textIndices.Add(idx); } } int[] indices = (int[])textIndices.ToArray(typeof(int)); if (indices != null) { int insertedObjects = 0; foreach (int idx in indices) { Text text = (Text)elements[idx + insertedObjects]; string currentString = ""; foreach (char ch in text.Content) { switch (ch) { case ' ': case '\r': case '\n': case '\t': if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text(" ")); ++insertedObjects; break; case '-': //minus elements.InsertObject(idx + insertedObjects, new Text(currentString + ch)); ++insertedObjects; currentString = ""; break; case '': //soft hyphen if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; currentString = ""; } elements.InsertObject(idx + insertedObjects, new Text("")); ++insertedObjects; currentString = ""; break; default: currentString += ch; break; } } if (currentString != "") { elements.InsertObject(idx + insertedObjects, new Text(currentString)); ++insertedObjects; } elements.RemoveObjectAt(idx + insertedObjects); --insertedObjects; } } }