/// <summary> /// Converts Text into DDL. /// </summary> internal override void Serialize(Serializer serializer) { string text = DdlEncoder.StringToText(_content.Value); // To make DDL more readable write soft hypens as keywords. text = text.Replace(new string((char)173, 1), "\\-"); serializer.Write(text); }
/// <summary> /// Converts Sections into DDL. /// </summary> internal override void Serialize(Serializer serializer) { int count = Count; for (int index = 0; index < count; ++index) { Section section = this[index]; section.Serialize(serializer); } }
/// <summary> /// Converts DocumentElements into DDL. /// </summary> internal override void Serialize(Serializer serializer) { int count = Count; if (count == 1 && this[0] is Paragraph) { // Omit keyword if paragraph has no attributes set. Paragraph paragraph = (Paragraph)this[0]; if (paragraph.Style == "" && paragraph.IsNull("Format")) { paragraph.SerializeContentOnly = true; paragraph.Serialize(serializer); paragraph.SerializeContentOnly = false; return; } } for (int index = 0; index < count; index++) { DocumentObject documentElement = this[index]; documentElement.Serialize(serializer); } }
/// <summary> /// Converts Document into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteComment(this.comment.Value); serializer.WriteLine("\\document"); int pos = serializer.BeginAttributes(); if (!this.IsNull("Info")) this.Info.Serialize(serializer); if (!this.defaultTabStop.IsNull) serializer.WriteSimpleAttribute("DefaultTabStop", DefaultTabStop); if (!this.footnoteLocation.IsNull) serializer.WriteSimpleAttribute("FootnoteLocation", FootnoteLocation); if (!this.footnoteNumberingRule.IsNull) serializer.WriteSimpleAttribute("FootnoteNumberingRule", FootnoteNumberingRule); if (!this.footnoteNumberStyle.IsNull) serializer.WriteSimpleAttribute("FootnoteNumberStyle", FootnoteNumberStyle); if (!this.footnoteStartingNumber.IsNull) serializer.WriteSimpleAttribute("FootnoteStartingNumber", FootnoteStartingNumber); if (!this.imagePath.IsNull) serializer.WriteSimpleAttribute("ImagePath", ImagePath); if (!this.useCmykColor.IsNull) serializer.WriteSimpleAttribute("UseCmykColor", UseCmykColor); serializer.EndAttributes(pos); serializer.BeginContent(); Styles.Serialize(serializer); if (!this.IsNull("Sections")) Sections.Serialize(serializer); serializer.EndContent(); serializer.Flush(); }
/// <summary> /// Converts HeadersFooters into DDL. /// </summary> internal override void Serialize(Serializer serializer) { bool hasPrimary = HasHeaderFooter(HeaderFooterIndex.Primary); bool hasEvenPage = HasHeaderFooter(HeaderFooterIndex.EvenPage); bool hasFirstPage = HasHeaderFooter(HeaderFooterIndex.FirstPage); // \primary... if (hasPrimary) Primary.Serialize(serializer, "primary"); // \even... if (hasEvenPage) EvenPage.Serialize(serializer, "evenpage"); // \firstpage... if (hasFirstPage) FirstPage.Serialize(serializer, "firstpage"); }
/// <summary> /// Converts Shading into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (isCleared) serializer.WriteLine("Shading = null"); int pos = serializer.BeginContent("Shading"); if (!this.visible.IsNull) serializer.WriteSimpleAttribute("Visible", this.Visible); if (!this.color.IsNull) serializer.WriteSimpleAttribute("Color", this.Color); serializer.EndContent(pos); }
/// <summary> /// Converts ListInfo into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (!this.listType.IsNull) serializer.WriteSimpleAttribute("ListInfo.ListType", this.ListType); if (!this.numberPosition.IsNull) serializer.WriteSimpleAttribute("ListInfo.NumberPosition", this.NumberPosition); if (!this.continuePreviousList.IsNull) serializer.WriteSimpleAttribute("ListInfo.ContinuePreviousList", this.ContinuePreviousList); }
/// <summary> /// Serialize a style, but serialize its base style first (if that was not yet done). /// </summary> void SerializeStyle(Serializer serializer, int index, ref bool[] fSerialized, ref bool[] fSerializePending, ref bool newLine) { Style style = this[index]; // It is not possible to modify the default paragraph font if (style.Name == Style.DefaultParagraphFontName) return; // Circular dependencies cannot occur if changing the base style is implemented // correctly. But before we proof that, we check it here. if (fSerializePending[index]) { string message = String.Format("Circular dependency detected according to style '{0}'.", style.Name); throw new InvalidOperationException(message); } // Only style 'Normal' has no base style if (style.BaseStyle != "") { int idxBaseStyle = GetIndex(style.BaseStyle); if (idxBaseStyle != -1) { if (!fSerialized[idxBaseStyle]) { fSerializePending[index] = true; SerializeStyle(serializer, idxBaseStyle, ref fSerialized, ref fSerializePending, ref newLine); fSerializePending[index] = false; } } } int pos2 = serializer.BeginBlock(); if (newLine) serializer.WriteLineNoCommit(); style.Serialize(serializer); if (serializer.EndBlock(pos2)) newLine = true; fSerialized[index] = true; }
/// <summary> /// Converts DocumentObject into DDL. /// </summary> internal abstract void Serialize(Serializer serializer);
/// <summary> /// Converts Footnote into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteLine("\\footnote"); int pos = serializer.BeginAttributes(); if (_reference.Value != string.Empty) serializer.WriteSimpleAttribute("Reference", Reference); if (_style.Value != string.Empty) serializer.WriteSimpleAttribute("Style", Style); if (!IsNull("Format")) _format.Serialize(serializer, "Format", null); serializer.EndAttributes(pos); pos = serializer.BeginContent(); if (!IsNull("Elements")) _elements.Serialize(serializer); serializer.EndContent(pos); }
/// <summary> /// Converts Paragraph into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (!serializeContentOnly) { serializer.WriteComment(this.comment.Value); serializer.WriteLine("\\paragraph"); int pos = serializer.BeginAttributes(); if (this.style.Value != "") serializer.WriteLine("Style = \"" + this.style.Value + "\""); if (!this.IsNull("Format")) this.format.Serialize(serializer, "Format", null); serializer.EndAttributes(pos); serializer.BeginContent(); if (!this.IsNull("Elements")) this.Elements.Serialize(serializer); serializer.CloseUpLine(); serializer.EndContent(); } else { this.Elements.Serialize(serializer); serializer.CloseUpLine(); } }
/// <summary> /// Converts Style into DDL. /// </summary> internal override void Serialize(Serializer serializer) { // For build-in styles all properties that differ from their default values // are serialized. // For user-defined styles all non-null properties are serialized. //!!!newTHHO 26.07.2007 Modified method for built-in styles. //!!!newTHHO 26.07.2007 Modified method for user-defined styles. Styles buildInStyles = Styles.BuildInStyles; Style refStyle = null; Font refFont = null; ParagraphFormat refFormat = null; serializer.WriteComment(this.comment.Value); if (this.buildIn.Value) { // BaseStyle is never null, but empty only for "Normal" and "DefaultParagraphFont" if (this.BaseStyle == "") { // case: style is "Normal" if (String.Compare(this.name.Value, Style.DefaultParagraphName, true) != 0) throw new ArgumentException("Internal Error: BaseStyle not set."); refStyle = buildInStyles[buildInStyles.GetIndex(this.Name)]; refFormat = refStyle.ParagraphFormat; refFont = refFormat.Font; string name = DdlEncoder.QuoteIfNameContainsBlanks(this.Name); serializer.WriteLineNoCommit(name); } else { // case: any build-in style except "Normal" refStyle = buildInStyles[buildInStyles.GetIndex(this.Name)]; refFormat = refStyle.ParagraphFormat; refFont = refFormat.Font; if (String.Compare(this.BaseStyle, refStyle.BaseStyle, true) == 0) { // case: build-in style with unmodified base style name string name = DdlEncoder.QuoteIfNameContainsBlanks(this.Name); serializer.WriteLineNoCommit(name); // It's fine if we have the predefined base style, but ... // ... the base style may have been modified or may even have a modified base style. // Methinks it's wrong to compare with the built-in style, so let's compare with the // real base style: refStyle = Document.Styles[Document.Styles.GetIndex(this.baseStyle.Value)]; refFormat = refStyle.ParagraphFormat; refFont = refFormat.Font; // Note: we must write "Underline = none" if the base style has "Underline = single" - we cannot // detect this if we compare with the built-in style that has no underline. // Known problem: Default values like "OutlineLevel = Level1" will now be serialized // TODO: optimize... } else { // case: build-in style with modified base style name string name = DdlEncoder.QuoteIfNameContainsBlanks(this.Name); string baseName = DdlEncoder.QuoteIfNameContainsBlanks(this.BaseStyle); serializer.WriteLine(name + " : " + baseName); refStyle = Document.Styles[Document.Styles.GetIndex(this.baseStyle.Value)]; refFormat = refStyle.ParagraphFormat; refFont = refFormat.Font; } } } else { // case: user-defined style; base style always exists string name = DdlEncoder.QuoteIfNameContainsBlanks(this.Name); string baseName = DdlEncoder.QuoteIfNameContainsBlanks(this.BaseStyle); serializer.WriteLine(name + " : " + baseName); #if true Style refStyle0 = Document.Styles[Document.Styles.GetIndex(this.baseStyle.Value)]; refStyle = Document.Styles[this.baseStyle.Value]; refFormat = refStyle != null ? refStyle.ParagraphFormat : null; refFont = refStyle.Font; #else refFormat = null; #endif } serializer.BeginContent(); if (!this.IsNull("ParagraphFormat")) { if (!this.ParagraphFormat.IsNull("Font")) this.Font.Serialize(serializer, refFormat != null ? refFormat.Font : null); if (this.Type == StyleType.Paragraph) this.ParagraphFormat.Serialize(serializer, "ParagraphFormat", refFormat); } serializer.EndContent(); }
/// <summary> /// Converts Border into DDL. /// </summary> internal void Serialize(Serializer serializer, string name, Border refBorder) { if (_fClear.Value) serializer.WriteLine(name + " = null"); int pos = serializer.BeginContent(name); if (!_visible.IsNull && (refBorder == null || (Visible != refBorder.Visible))) serializer.WriteSimpleAttribute("Visible", Visible); if (!_style.IsNull && (refBorder == null || (Style != refBorder.Style))) serializer.WriteSimpleAttribute("Style", Style); if (!_width.IsNull && (refBorder == null || (Width != refBorder.Width))) serializer.WriteSimpleAttribute("Width", Width); if (!_color.IsNull && (refBorder == null || (Color != refBorder.Color))) serializer.WriteSimpleAttribute("Color", Color); serializer.EndContent(pos); }
/// <summary> /// Converts Border into DDL. /// </summary> internal override void Serialize(Serializer serializer) { throw new Exception("A Border cannot be serialized alone."); }
/// <summary> /// Converts Character into DDL. /// </summary> internal override void Serialize(Serializer serializer) { string text = String.Empty; if (_count == 1) { if ((SymbolName)_symbolName.Value == SymbolName.Tab) text = "\\tab "; else if ((SymbolName)_symbolName.Value == SymbolName.LineBreak) text = "\\linebreak\x0D\x0A"; else if ((SymbolName)_symbolName.Value == SymbolName.ParaBreak) text = "\x0D\x0A\x0D\x0A"; //else if (symbolType == SymbolName.MarginBreak) // text = "\\marginbreak "; if (text != "") { serializer.Write(text); return; } } if (((uint)_symbolName.Value & 0xF0000000) == 0xF0000000) { // SymbolName == SpaceType? if (((uint)_symbolName.Value & 0xF1000000) == 0xF1000000) { if ((SymbolName)_symbolName.Value == SymbolName.Blank) { //Note: Don't try to optimize it by leaving away the braces in case a single space is added. //This would lead to confusion with '(' in directly following text. text = "\\space(" + Count + ")"; } else { if (_count == 1) text = "\\space(" + SymbolName + ")"; else text = "\\space(" + SymbolName + ", " + Count + ")"; } } else { text = "\\symbol(" + SymbolName + ")"; } } else { // symbolType is a (unicode) character text = " \\chr(0x" + _symbolName.Value.ToString("X") + ")"; } serializer.Write(text); }
/// <summary> /// Converts Font into DDL. Properties with the same value as in an optionally given /// font are not serialized. /// </summary> internal void Serialize(Serializer serializer, Font font) { if (this.Parent is FormattedText) { string fontStyle = ""; if (((FormattedText)this.Parent).style.IsNull) { // Check if we can use a DDL keyword. FontProperties notNull = CheckWhatIsNotNull(); if (notNull == FontProperties.Size) { serializer.Write("\\fontsize(" + size.ToString() + ")"); return; } else if (notNull == FontProperties.Bold && bold.Value) { serializer.Write("\\bold"); return; } else if (notNull == FontProperties.Italic && italic.Value) { serializer.Write("\\italic"); return; } else if (notNull == FontProperties.Color) { serializer.Write("\\fontcolor(" + color.ToString() + ")"); return; } } else fontStyle = "(\"" + ((FormattedText)this.Parent).Style + "\")"; //bool needBlank = false; // nice, but later... serializer.Write("\\font" + fontStyle + "["); if (!this.name.IsNull && this.name.Value != "") serializer.WriteSimpleAttribute("Name", this.Name); #if DEBUG // Test if (!this.size.IsNull && this.Size != 0 && this.Size.Point == 0) this.GetType(); #endif if ((!this.size.IsNull)) serializer.WriteSimpleAttribute("Size", this.Size); if (!this.bold.IsNull) serializer.WriteSimpleAttribute("Bold", this.Bold); if (!this.italic.IsNull) serializer.WriteSimpleAttribute("Italic", this.Italic); if (!this.underline.IsNull) serializer.WriteSimpleAttribute("Underline", this.Underline); if (!this.superscript.IsNull) serializer.WriteSimpleAttribute("Superscript", this.Superscript); if (!this.subscript.IsNull) serializer.WriteSimpleAttribute("Subscript", this.Subscript); if (!this.color.IsNull) serializer.WriteSimpleAttribute("Color", this.Color); serializer.Write("]"); } else { int pos = serializer.BeginContent("Font"); #if true // Don't write null values if font is null. // Do write null values if font is not null! if ((!name.IsNull && Name != String.Empty && font == null) || (font != null && !name.IsNull && Name != String.Empty && Name != font.Name)) serializer.WriteSimpleAttribute("Name", Name); // Test if (!size.IsNull && Size != 0 && Size.Point == 0) GetType(); if (!size.IsNull && (font == null || Size != font.Size)) serializer.WriteSimpleAttribute("Size", Size); //NBool and NEnum have to be compared directly to check whether the value Null is if (!bold.IsNull && (font == null || Bold != font.Bold || font.bold.IsNull)) serializer.WriteSimpleAttribute("Bold", Bold); if (!italic.IsNull && (font == null || Italic != font.Italic || font.italic.IsNull)) serializer.WriteSimpleAttribute("Italic", Italic); if (!underline.IsNull && (font == null || Underline != font.Underline || font.underline.IsNull)) serializer.WriteSimpleAttribute("Underline", Underline); if (!superscript.IsNull && (font == null || Superscript != font.Superscript || font.superscript.IsNull)) serializer.WriteSimpleAttribute("Superscript", Superscript); if (!subscript.IsNull && (font == null || Subscript != font.Subscript || font.subscript.IsNull)) serializer.WriteSimpleAttribute("Subscript", Subscript); if (!color.IsNull && (font == null || this.Color.Argb != font.Color.Argb))// && this.Color.RGB != Color.Transparent.RGB) serializer.WriteSimpleAttribute("Color", this.Color); #else if ((!this.name.IsNull && this.Name != String.Empty) && (font == null || this.Name != font.Name)) serializer.WriteSimpleAttribute("Name", this.Name); if (!this.size.IsNull && (font == null || this.Size != font.Size)) serializer.WriteSimpleAttribute("Size", this.Size); //NBool and NEnum have to be compared directly to check whether the value Null is if (!this.bold.IsNull && (font == null || this.Bold != font.Bold)) serializer.WriteSimpleAttribute("Bold", this.Bold); if (!this.italic.IsNull && (font == null || this.Italic != font.Italic)) serializer.WriteSimpleAttribute("Italic", this.Italic); if (!this.underline.IsNull && (font == null || this.Underline != font.Underline)) serializer.WriteSimpleAttribute("Underline", this.Underline); if (!this.superscript.IsNull && (font == null || this.Superscript != font.Superscript)) serializer.WriteSimpleAttribute("Superscript", this.Superscript); if (!this.subscript.IsNull && (font == null || this.Subscript != font.Subscript)) serializer.WriteSimpleAttribute("Subscript", this.Subscript); if (!this.color.IsNull && (font == null || this.Color.Argb != font.Color.Argb))// && this.Color.RGB != Color.Transparent.RGB) serializer.WriteSimpleAttribute("Color", this.Color); #endif serializer.EndContent(pos); } }
/// <summary> /// Converts Styles into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteComment(_comment.Value); int pos = serializer.BeginContent("\\styles"); // A style can only be added to Styles if its base style exists. Therefore the // styles collection is consistent at any one time by definition. But because it // is possible to change the base style of a style, the sequence of the styles // in the styles collection can be in an order that a style comes before its base // style. The styles in an DDL file must be ordered such that each style appears // after its base style. We cannot simply reorder the styles collection, because // the predefined styles are expected at a fixed position. // The solution is to reorder the styles during serialization. int count = Count; bool[] fSerialized = new bool[count]; // already serialized fSerialized[0] = true; // consider DefaultParagraphFont as serialized bool[] fSerializePending = new bool[count]; // currently serializing bool newLine = false; // gets true if at least one style was written //Start from 1 and do not serialize DefaultParagraphFont for (int index = 1; index < count; index++) { if (!fSerialized[index]) { Style style = this[index]; SerializeStyle(serializer, index, ref fSerialized, ref fSerializePending, ref newLine); } } serializer.EndContent(pos); }
/// <summary> /// Converts ParagraphFormat into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (this.parent is Style) this.Serialize(serializer, "ParagraphFormat", null); else this.Serialize(serializer, "Format", null); }
//#endregion //#region Internal /// <summary> /// Converts PageBreak into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteLine("\\pagebreak"); }
/// <summary> /// Converts ParagraphFormat into DDL. /// </summary> internal void Serialize(Serializer serializer, string name, ParagraphFormat refFormat) { int pos = serializer.BeginContent(name); if (!this.IsNull("Font") && Parent.GetType() != typeof(Style)) this.Font.Serialize(serializer); // If a refFormat is specified, it is important to compare the fields and not the properties. // Only the fields holds the internal information whether a value is NULL. In contrast to the // Efw.Application framework the nullable values and all the meta stuff is kept internal to // give the user the illusion of simplicity. if (!this.alignment.IsNull && (refFormat == null || (this.alignment != refFormat.alignment))) serializer.WriteSimpleAttribute("Alignment", this.Alignment); if (!this.leftIndent.IsNull && (refFormat == null || (this.leftIndent != refFormat.leftIndent))) serializer.WriteSimpleAttribute("LeftIndent", this.LeftIndent); if (!this.firstLineIndent.IsNull && (refFormat == null || this.firstLineIndent != refFormat.firstLineIndent)) serializer.WriteSimpleAttribute("FirstLineIndent", this.FirstLineIndent); if (!this.rightIndent.IsNull && (refFormat == null || this.rightIndent != refFormat.rightIndent)) serializer.WriteSimpleAttribute("RightIndent", this.RightIndent); if (!this.spaceBefore.IsNull && (refFormat == null || this.spaceBefore != refFormat.spaceBefore)) serializer.WriteSimpleAttribute("SpaceBefore", this.SpaceBefore); if (!this.spaceAfter.IsNull && (refFormat == null || this.spaceAfter != refFormat.spaceAfter)) serializer.WriteSimpleAttribute("SpaceAfter", this.SpaceAfter); if (!this.lineSpacingRule.IsNull && (refFormat == null || this.lineSpacingRule != refFormat.lineSpacingRule)) serializer.WriteSimpleAttribute("LineSpacingRule", this.LineSpacingRule); if (!this.lineSpacing.IsNull && (refFormat == null || this.lineSpacing != refFormat.lineSpacing)) serializer.WriteSimpleAttribute("LineSpacing", this.LineSpacing); if (!this.keepTogether.IsNull && (refFormat == null || this.keepTogether != refFormat.keepTogether)) serializer.WriteSimpleAttribute("KeepTogether", this.KeepTogether); if (!this.keepWithNext.IsNull && (refFormat == null || this.keepWithNext != refFormat.keepWithNext)) serializer.WriteSimpleAttribute("KeepWithNext", this.KeepWithNext); if (!this.widowControl.IsNull && (refFormat == null || this.widowControl != refFormat.widowControl)) serializer.WriteSimpleAttribute("WidowControl", this.WidowControl); if (!this.pageBreakBefore.IsNull && (refFormat == null || this.pageBreakBefore != refFormat.pageBreakBefore)) serializer.WriteSimpleAttribute("PageBreakBefore", this.PageBreakBefore); if (!this.outlineLevel.IsNull && (refFormat == null || this.outlineLevel != refFormat.outlineLevel)) serializer.WriteSimpleAttribute("OutlineLevel", this.OutlineLevel); if (!this.IsNull("ListInfo")) this.ListInfo.Serialize(serializer); if (!this.IsNull("TabStops")) this.tabStops.Serialize(serializer); if (!this.IsNull("Borders")) { if (refFormat != null) this.borders.Serialize(serializer, refFormat.Borders); else this.borders.Serialize(serializer, null); } if (!this.IsNull("Shading")) this.shading.Serialize(serializer); serializer.EndContent(pos); }
/// <summary> /// Converts PageSetup into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteComment(this.comment.Value); int pos = serializer.BeginContent("PageSetup"); if (!this.pageHeight.IsNull) serializer.WriteSimpleAttribute("PageHeight", this.PageHeight); if (!this.pageWidth.IsNull) serializer.WriteSimpleAttribute("PageWidth", this.PageWidth); if (!this.orientation.IsNull) serializer.WriteSimpleAttribute("Orientation", this.Orientation); if (!this.leftMargin.IsNull) serializer.WriteSimpleAttribute("LeftMargin", this.LeftMargin); if (!this.rightMargin.IsNull) serializer.WriteSimpleAttribute("RightMargin", this.RightMargin); if (!this.topMargin.IsNull) serializer.WriteSimpleAttribute("TopMargin", this.TopMargin); if (!this.bottomMargin.IsNull) serializer.WriteSimpleAttribute("BottomMargin", this.BottomMargin); if (!this.footerDistance.IsNull) serializer.WriteSimpleAttribute("FooterDistance", this.FooterDistance); if (!this.headerDistance.IsNull) serializer.WriteSimpleAttribute("HeaderDistance", this.HeaderDistance); if (!this.oddAndEvenPagesHeaderFooter.IsNull) serializer.WriteSimpleAttribute("OddAndEvenPagesHeaderFooter", this.OddAndEvenPagesHeaderFooter); if (!this.differentFirstPageHeaderFooter.IsNull) serializer.WriteSimpleAttribute("DifferentFirstPageHeaderFooter", this.DifferentFirstPageHeaderFooter); if (!this.sectionStart.IsNull) serializer.WriteSimpleAttribute("SectionStart", this.SectionStart); if (!this.pageFormat.IsNull) serializer.WriteSimpleAttribute("PageFormat", this.PageFormat); if (!this.mirrorMargins.IsNull) serializer.WriteSimpleAttribute("MirrorMargins", this.MirrorMargins); if (!this.horizontalPageBreak.IsNull) serializer.WriteSimpleAttribute("HorizontalPageBreak", this.HorizontalPageBreak); if (!this.startingNumber.IsNull) serializer.WriteSimpleAttribute("StartingNumber", this.StartingNumber); serializer.EndContent(pos); }
/// <summary> /// Converts Borders into DDL. /// </summary> internal override void Serialize(Serializer serializer) { this.Serialize(serializer, null); }
/// <summary> /// Converts Section into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteComment(this.comment.Value); serializer.WriteLine("\\section"); int pos = serializer.BeginAttributes(); if (!this.IsNull("PageSetup")) this.PageSetup.Serialize(serializer); serializer.EndAttributes(pos); serializer.BeginContent(); if (!this.IsNull("headers")) this.headers.Serialize(serializer); if (!this.IsNull("footers")) this.footers.Serialize(serializer); if (!this.IsNull("elements")) this.elements.Serialize(serializer); serializer.EndContent(); }
/// <summary> /// Converts Borders into DDL. /// </summary> internal void Serialize(Serializer serializer, Borders refBorders) { if (this.clearAll) serializer.WriteLine("Borders = null"); int pos = serializer.BeginContent("Borders"); if (!this.visible.IsNull && (refBorders == null || refBorders.visible.IsNull || (this.Visible != refBorders.Visible))) serializer.WriteSimpleAttribute("Visible", this.Visible); if (!this.style.IsNull && (refBorders == null || (this.Style != refBorders.Style))) serializer.WriteSimpleAttribute("Style", this.Style); if (!this.width.IsNull && (refBorders == null || (this.width.Value != refBorders.width.Value))) serializer.WriteSimpleAttribute("Width", this.Width); if (!this.color.IsNull && (refBorders == null || ((this.Color.Argb != refBorders.Color.Argb)))) serializer.WriteSimpleAttribute("Color", this.Color); if (!this.distanceFromTop.IsNull && (refBorders == null || (this.DistanceFromTop.Point != refBorders.DistanceFromTop.Point))) serializer.WriteSimpleAttribute("DistanceFromTop", this.DistanceFromTop); if (!this.distanceFromBottom.IsNull && (refBorders == null || (this.DistanceFromBottom.Point != refBorders.DistanceFromBottom.Point))) serializer.WriteSimpleAttribute("DistanceFromBottom", this.DistanceFromBottom); if (!this.distanceFromLeft.IsNull && (refBorders == null || (this.DistanceFromLeft.Point != refBorders.DistanceFromLeft.Point))) serializer.WriteSimpleAttribute("DistanceFromLeft", this.DistanceFromLeft); if (!this.distanceFromRight.IsNull && (refBorders == null || (this.DistanceFromRight.Point != refBorders.DistanceFromRight.Point))) serializer.WriteSimpleAttribute("DistanceFromRight", this.DistanceFromRight); if (!this.IsNull("Top")) this.top.Serialize(serializer, "Top", null); if (!this.IsNull("Left")) this.left.Serialize(serializer, "Left", null); if (!this.IsNull("Bottom")) this.bottom.Serialize(serializer, "Bottom", null); if (!this.IsNull("Right")) this.right.Serialize(serializer, "Right", null); if (!this.IsNull("DiagonalDown")) this.diagonalDown.Serialize(serializer, "DiagonalDown", null); if (!this.IsNull("DiagonalUp")) this.diagonalUp.Serialize(serializer, "DiagonalUp", null); serializer.EndContent(pos); }
/// <summary> /// Converts Hyperlink into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (this.name.Value == string.Empty) throw new InvalidOperationException(DomSR.MissingObligatoryProperty("Name", "Hyperlink")); serializer.Write("\\hyperlink"); string str = "[Name = \"" + this.Name.Replace("\\", "\\\\").Replace("\"", "\\\"") + "\""; if (!this.type.IsNull) str += " Type = " + this.Type; str += "]"; serializer.Write(str); serializer.Write("{"); if (this.elements != null) elements.Serialize(serializer); serializer.Write("}"); }
/// <summary> /// Converts DocumentInfo into DDL. /// </summary> internal override void Serialize(Serializer serializer) { serializer.WriteComment(this.comment.Value); int pos = serializer.BeginContent("Info"); if (this.Title != String.Empty) serializer.WriteSimpleAttribute("Title", this.Title); if (this.Subject != String.Empty) serializer.WriteSimpleAttribute("Subject", this.Subject); if (this.Author != String.Empty) serializer.WriteSimpleAttribute("Author", this.Author); if (this.Keywords != String.Empty) serializer.WriteSimpleAttribute("Keywords", this.Keywords); serializer.EndContent(pos); }
/// <summary> /// Converts TabStop into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (this.AddTab) { serializer.WriteLine("TabStops +="); serializer.BeginContent(); serializer.WriteSimpleAttribute("Position", this.Position); if (!this.alignment.IsNull) serializer.WriteSimpleAttribute("Alignment", this.Alignment); if (!this.leader.IsNull) serializer.WriteSimpleAttribute("Leader", this.Leader); serializer.EndContent(); } else serializer.WriteLine("TabStops -= \"" + this.Position.ToString() + "\""); }
/// <summary> /// Converts TabStops into DDL. /// </summary> internal override void Serialize(Serializer serializer) { if (_fClearAll) serializer.WriteLine("TabStops = null"); int count = Count; for (int index = 0; index < count; index++) { TabStop tabstop = this[index]; tabstop.Serialize(serializer); } }
/// <summary> /// Converts ParagraphElements into DDL. /// </summary> internal override void Serialize(Serializer serializer) { int count = Count; for (int index = 0; index < count; ++index) { DocumentObject element = this[index]; element.Serialize(serializer); } }
/// <summary> /// Converts FormattedText into DDL. /// </summary> internal override void Serialize(Serializer serializer) { bool isFormatted = false; if (!this.IsNull("Font")) { this.Font.Serialize(serializer); isFormatted = true; } else { if (!this.style.IsNull) { serializer.Write("\\font(\"" + this.Style + "\")"); isFormatted = true; } } if (isFormatted) serializer.Write("{"); if (!this.IsNull("Elements")) this.Elements.Serialize(serializer); if (isFormatted) serializer.Write("}"); }