Beispiel #1
0
        FormattedTextArea GetFormattedTextArea(TextArea area, XUnit width)
        {
            if (area == null)
                return null;

            FormattedTextArea formattedTextArea = new FormattedTextArea(_documentRenderer, area, _fieldInfos);

            if (!double.IsNaN(width))
                formattedTextArea.InnerWidth = width;

            formattedTextArea.Format(_gfx);
            return formattedTextArea;
        }
Beispiel #2
0
        /// <summary>
        /// Determines the type of the given textarea.
        /// </summary>
        internal string CheckTextArea(TextArea textArea)
        {
            if ((_headerArea != null) && (textArea == _headerArea))
                return "headerarea";
            if ((_footerArea != null) && (textArea == _footerArea))
                return "footerarea";
            if ((_leftArea != null) && (textArea == _leftArea))
                return "leftarea";
            if ((_rightArea != null) && (textArea == _rightArea))
                return "rightarea";
            if ((_topArea != null) && (textArea == _topArea))
                return "toparea";
            if ((_bottomArea != null) && (textArea == _bottomArea))
                return "bottomarea";

            return "";
        }
Beispiel #3
0
 FormattedTextArea GetFormattedTextArea(TextArea area)
 {
     return GetFormattedTextArea(area, double.NaN);
 }
Beispiel #4
0
        /// <summary>
        /// Parses the keywords «\headerarea», «\toparea», «\bottomarea», «\footerarea»,
        /// «\leftarea» or «\rightarea» inside a chart.
        /// </summary>
        private void ParseArea(TextArea area)
        {
            // Syntax:
            // 1.  \toparea{...}
            // 2.  \toparea[...]{...}
            //
            // Usage of header-, bottom-, footer-, left- and rightarea are similar.

            try
            {
                ReadCode();
                if (Symbol == Symbol.BracketLeft)
                {
                    ParseAttributes(area, false);
                    ReadCode();
                }

                if (Symbol != Symbol.BraceLeft)
                    return;

                if (IsParagraphContent())
                    ParseParagraphContent(area.Elements, null);
                else
                {
                    ReadCode(); // read beyond '{'
                    bool fContinue = true;
                    while (fContinue)
                    {
                        switch (Symbol)
                        {
                            case Symbol.BraceRight:
                                fContinue = false;
                                break;

                            case Symbol.Legend:
                                ParseLegend(area.AddLegend());
                                break;

                            case Symbol.Paragraph:
                                ParseParagraph(area.Elements);
                                break;

                            case Symbol.Table:
                                ParseTable(null, area.AddTable());
                                break;

                            case Symbol.TextFrame:
                                ParseTextFrame(area.Elements);
                                break;

                            case Symbol.Image:
                                Image image = new Image();
                                ParseImage(image, false);
                                area.Elements.Add(image);
                                break;

                            default:
                                ThrowParserException(DomMsgID.UnexpectedSymbol, Token);
                                break;
                        }
                    }
                }
                AssertSymbol(Symbol.BraceRight);
                ReadCode(); // read beyond '}'
            }
            catch (DdlParserException pe)
            {
                ReportParserException(pe);
                AdjustToNextBlock();
            }
        }
Beispiel #5
0
        internal override void VisitTextArea(TextArea textArea)
        {
            if (textArea == null || textArea._elements == null)
                return;

            Document document = textArea.Document;

            ParagraphFormat parentFormat;

            if (!textArea._style.IsNull)
            {
                Style style = textArea.Document.Styles[textArea.Style];
                if (style == null)
                    style = textArea.Document.Styles[StyleNames.InvalidStyleName];

                parentFormat = style._paragraphFormat;
            }
            else
            {
                Chart chart = (Chart)textArea._parent;
                parentFormat = chart._format;
                textArea._style = chart._style;
            }

            if (textArea._format == null)
                textArea.Format = parentFormat.Clone();
            else
                FlattenParagraphFormat(textArea._format, parentFormat);

            FlattenFillFormat(textArea._fillFormat);
            FlattenLineFormat(textArea._lineFormat, null);
        }
Beispiel #6
0
 internal FormattedTextArea(DocumentRenderer documentRenderer, TextArea textArea, FieldInfos fieldInfos)
 {
     TextArea = textArea;
     _fieldInfos = fieldInfos;
     _documentRenderer = documentRenderer;
 }
 internal virtual void VisitTextArea(TextArea textArea) { }
Beispiel #8
0
        /// <summary>
        /// Determines the type of the given textarea.
        /// </summary>
        internal string CheckTextArea(TextArea textArea)
        {
            if ((this.headerArea != null) && (textArea == this.headerArea))
            return "headerarea";
              if ((this.footerArea != null) && (textArea == this.footerArea))
            return "footerarea";
              if ((this.leftArea != null) && (textArea == this.leftArea))
            return "leftarea";
              if ((this.rightArea != null) && (textArea == this.rightArea))
            return "rightarea";
              if ((this.topArea != null) && (textArea == this.topArea))
            return "toparea";
              if ((this.bottomArea != null) && (textArea == this.bottomArea))
            return "bottomarea";

              return "";
        }
Beispiel #9
0
 internal FormattedTextArea(DocumentRenderer documentRenderer, TextArea textArea, FieldInfos fieldInfos)
 {
   this.textArea = textArea;
   this.fieldInfos = fieldInfos;
   this.documentRenderer = documentRenderer;
 }