internal override void Render()
        {
            _rtfWriter.StartContent();
            int          currIdx = _styles.GetIndex(_style.Name);
            RendererBase rndrr   = null;

            if (_style.Type == StyleType.Character)
            {
                _rtfWriter.WriteControlWithStar("cs", currIdx);
                _rtfWriter.WriteControl("additive");
                rndrr = RendererFactory.CreateRenderer(_style.Font, _docRenderer);
            }
            else
            {
                _rtfWriter.WriteControl("s", currIdx);
                rndrr = RendererFactory.CreateRenderer(_style.ParagraphFormat, _docRenderer);
            }
            if (_style.BaseStyle != "")
            {
                int bsIdx = _styles.GetIndex(_style.BaseStyle);
                _rtfWriter.WriteControl("sbasedon", bsIdx);
            }
            rndrr.Render();
            _rtfWriter.WriteText(_style.Name);
            _rtfWriter.WriteSeparator();
            _rtfWriter.EndContent();
        }
        /// <summary>
        ///   Renders the paragraph content to RTF.
        /// </summary>
        private void RenderContent()
        {
            DocumentElements elements = DocumentRelations.GetParent(_paragraph) as DocumentElements;

            //First paragraph of a footnote writes the reference symbol:
            if (DocumentRelations.GetParent(elements) is Footnote && _paragraph == elements.First)
            {
                FootnoteRenderer ftntRenderer = new FootnoteRenderer(DocumentRelations.GetParent(elements) as Footnote,
                                                                     _docRenderer);
                ftntRenderer.RenderReference();
            }
            foreach (DocumentObject docObj in _paragraph.Elements)
            {
                if (docObj == _paragraph.Elements.LastObject)
                {
                    if (docObj is Character)
                    {
                        if (((Character)docObj).SymbolName == SymbolName.LineBreak)
                        {
                            continue; //Ignore last linebreak.
                        }
                    }
                }
                RendererBase rndrr = RendererFactory.CreateRenderer(docObj, _docRenderer);
                if (rndrr != null)
                {
                    rndrr.Render();
                }
            }
        }
        /// <summary>
        /// Renders a TextFrame to RTF.
        /// </summary>
        internal override void Render()
        {
            DocumentElements elms = DocumentRelations.GetParent(_textFrame) as DocumentElements;
            bool             renderInParagraph = RenderInParagraph();

            if (renderInParagraph)
            {
                StartDummyParagraph();
            }

            StartShapeArea();

            //Properties
            RenderNameValuePair("shapeType", "202");//202 entspr. Textrahmen.

            TranslateAsNameValuePair("MarginLeft", "dxTextLeft", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginTop", "dyTextTop", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginRight", "dxTextRight", RtfUnit.EMU, "0");
            TranslateAsNameValuePair("MarginBottom", "dyTextBottom", RtfUnit.EMU, "0");

            if (_textFrame.IsNull("Elements") ||
                !CollectionContainsObjectAssignableTo(_textFrame.Elements,
                                                      typeof(Shape), typeof(Table)))
            {
                TranslateAsNameValuePair("Orientation", "txflTextFlow", RtfUnit.Undefined, null);
            }
            else
            {
                TextOrientation orient = _textFrame.Orientation;
                if (orient != TextOrientation.Horizontal && orient != TextOrientation.HorizontalRotatedFarEast)
                {
                    Debug.WriteLine(Messages2.TextframeContentsNotTurned, "warning");
                }
            }
            _rtfWriter.StartContent();
            _rtfWriter.WriteControl("shptxt");
            _rtfWriter.StartContent();
            foreach (DocumentObject docObj in _textFrame.Elements)
            {
                RendererBase rndrr = RendererFactory.CreateRenderer(docObj, _docRenderer);
                if (rndrr != null)
                {
                    rndrr.Render();
                }
            }
            //Text fields need to close with a paragraph.
            RenderTrailingParagraph(_textFrame.Elements);

            _rtfWriter.EndContent();
            _rtfWriter.EndContent();
            EndShapeArea();
            if (renderInParagraph)
            {
                RenderLayoutPicture();
                EndDummyParagraph();
            }
        }
Exemple #4
0
        /// <summary>
        /// Renders a section to RTF
        /// </summary>
        internal override void Render()
        {
            _useEffectiveValue = true;

            Sections secs = DocumentRelations.GetParent(_section) as Sections;

            if (_section != secs.First)
            {
                _rtfWriter.WriteControl("pard");
                _rtfWriter.WriteControl("sect");
            }
            _rtfWriter.WriteControl("sectd");

            //Rendering some footnote attributes:
            _docRenderer.RenderSectionProperties();

            object pageStp = _section.PageSetup;

            if (pageStp != null)
            {
                RendererFactory.CreateRenderer((PageSetup)pageStp, _docRenderer).Render();
            }

            object hdrs = GetValueAsIntended("Headers");

            if (hdrs != null)
            {
                HeadersFootersRenderer hfr = new HeadersFootersRenderer(hdrs as HeadersFooters, _docRenderer);
                // PageSetup has to be set here, because HeaderFooter could be from a different section than PageSetup.
                hfr.PageSetup = (PageSetup)pageStp;
                hfr.Render();
            }

            object ftrs = GetValueAsIntended("Footers");

            if (ftrs != null)
            {
                HeadersFootersRenderer hfr = new HeadersFootersRenderer(ftrs as HeadersFooters, _docRenderer);
                hfr.PageSetup = (PageSetup)pageStp;
                hfr.Render();
            }

            if (!_section.IsNull("Elements"))
            {
                foreach (DocumentObject docObj in _section.Elements)
                {
                    RendererBase rndrr = RendererFactory.CreateRenderer(docObj, _docRenderer);
                    if (rndrr != null)
                    {
                        rndrr.Render();
                    }
                }
            }
        }
        /// <summary>
        /// Renders a section to RTF
        /// </summary>
        internal override void Render()
        {
            this.useEffectiveValue = true;

            Sections secs = DocumentRelations.GetParent(this.section) as Sections;

            if (this.section != secs.First)
            {
                this.rtfWriter.WriteControl("pard");
                this.rtfWriter.WriteControl("sect");
            }
            this.rtfWriter.WriteControl("sectd");

            //Rendering some footnote attributes:
            this.docRenderer.RenderSectionProperties();

            object pageStp = this.section.PageSetup;

            if (pageStp != null)
            {
                RendererFactory.CreateRenderer((PageSetup)pageStp, this.docRenderer).Render();
            }

            object hdrs = GetValueAsIntended("Headers");

            if (hdrs != null)
            {
                HeadersFootersRenderer hfr = new HeadersFootersRenderer(hdrs as HeadersFooters, this.docRenderer);
                //PageSetup muss hier gesetzt werden, da die HeaderFooter anderem Abschnitt gehören können als das PageSetup
                hfr.PageSetup = (PageSetup)pageStp;
                hfr.Render();
            }

            object ftrs = GetValueAsIntended("Footers");

            if (ftrs != null)
            {
                HeadersFootersRenderer hfr = new HeadersFootersRenderer(ftrs as HeadersFooters, this.docRenderer);
                hfr.PageSetup = (PageSetup)pageStp;
                hfr.Render();
            }

            if (!section.IsNull("Elements"))
            {
                foreach (DocumentObject docObj in this.section.Elements)
                {
                    RendererBase rndrr = RendererFactory.CreateRenderer(docObj, this.docRenderer);
                    if (rndrr != null)
                    {
                        rndrr.Render();
                    }
                }
            }
        }
Exemple #6
0
 /// <summary>
 /// Renders the footnote's content.
 /// </summary>
 private void RenderContent()
 {
     _rtfWriter.StartContent();
     _rtfWriter.WriteControl("footnote");
     foreach (DocumentObject obj in _footnote.Elements)
     {
         RendererBase rndrr = RendererFactory.CreateRenderer(obj, _docRenderer);
         if (rndrr != null)
         {
             rndrr.Render();
         }
     }
     _rtfWriter.EndContent();
 }
        /// <summary>
        /// Renders a single Header or Footer.
        /// </summary>
        internal override void Render()
        {
            StringCollection hdrFtrCtrls = GetHeaderFooterControls();

            foreach (string hdrFtrCtrl in hdrFtrCtrls)
            {
                this.rtfWriter.StartContent();
                this.rtfWriter.WriteControl(hdrFtrCtrl);
                //REM: Could be optimized by storing rendering results in a strings.
                foreach (DocumentObject docObj in this.headerFooter.Elements)
                {
                    RendererBase rndrr = RendererFactory.CreateRenderer(docObj, this.docRenderer);
                    if (rndrr != null)
                    {
                        rndrr.Render();
                    }
                }
                this.rtfWriter.EndContent();
            }
        }
Exemple #8
0
        internal override void Render()
        {
            useEffectiveValue = true;
            Cell cvrgCell = this.cellList.GetCoveringCell(this.cell);

            if (this.cell.Column.Index != cvrgCell.Column.Index)
            {
                return;
            }

            bool writtenAnyContent = false;

            if (!this.cell.IsNull("Elements"))
            {
                if (this.cell == cvrgCell)
                {
                    foreach (DocumentObject docObj in this.cell.Elements)
                    {
                        RendererBase rndrr = RendererFactory.CreateRenderer(docObj, this.docRenderer);
                        if (rndrr != null)
                        {
                            rndrr.Render();
                            writtenAnyContent = true;
                        }
                    }
                }
            }
            if (!writtenAnyContent)
            {
                //Format attributes need to be set here to satisfy Word 2000.
                this.rtfWriter.WriteControl("pard");
                RenderStyleAndFormat();
                this.rtfWriter.WriteControl("intbl");
                EndStyleAndFormatAfterContent();
            }
            this.rtfWriter.WriteControl("cell");
        }