예제 #1
0
    public static string GetIterators(Paragraph paragraph)
    {
      ParagraphIterator iter = new ParagraphIterator(paragraph.Elements);
      iter = iter.GetFirstLeaf();
      string retString = "";
      while (iter != null)
      {
        retString += "[" + iter.Current.GetType().Name + ":]";
        if (iter.Current is Text)
          retString += ((Text)iter.Current).Content;

        iter = iter.GetNextLeaf();
      }
      return retString;
    }
예제 #2
0
    string GetOutlineTitle()
    {
      ParagraphIterator iter = new ParagraphIterator(this.paragraph.Elements);
      iter = iter.GetFirstLeaf();

      bool ignoreBlank = true;
      string title = "";
      while (iter != null)
      {
        DocumentObject current = iter.Current;
        if (!ignoreBlank && (IsBlank(current) || IsTab(current) || IsLineBreak(current)))
        {
          title += " ";
          ignoreBlank = true;
        }
        else if (current is Text)
        {
          title += ((Text)current).Content;
          ignoreBlank = false;
        }
        else if (IsRenderedField(current))
        {
          title += GetFieldValue(current);
          ignoreBlank = false;
        }
        else if (IsSymbol(current))
        {
          title += GetSymbol((Character)current);
          ignoreBlank = false;
        }

        if (title.Length > 64)
          break;
        iter = iter.GetNextLeaf();
      }
      return title;
    }
예제 #3
0
    /// <summary>
    /// Initializes this instance for formatting.
    /// </summary>
    /// <param name="area">The area for formatting</param>
    /// <param name="previousFormatInfo">A previous format info.</param>
    /// <returns>False, if nothing of the paragraph will fit the area any more.</returns>
    private bool InitFormat(Area area, FormatInfo previousFormatInfo)
    {
      this.phase = Phase.Formatting;

      this.tabOffsets = new ArrayList();

      ParagraphFormatInfo prevParaFormatInfo = (ParagraphFormatInfo)previousFormatInfo;
      if (previousFormatInfo == null || prevParaFormatInfo.LineCount == 0)
      {
        ((ParagraphFormatInfo)this.renderInfo.FormatInfo).isStarting = true;
        ParagraphIterator parIt = new ParagraphIterator(this.paragraph.Elements);
        this.currentLeaf = parIt.GetFirstLeaf();
        this.isFirstLine = true;
      }
      else
      {
        this.currentLeaf = prevParaFormatInfo.GetLastLineInfo().endIter.GetNextLeaf();
        this.isFirstLine = false;
        ((ParagraphFormatInfo)this.renderInfo.FormatInfo).isStarting = false;
      }

      this.startLeaf = this.currentLeaf;
      this.currentVerticalInfo = CalcCurrentVerticalInfo();
      this.currentYPosition = area.Y + TopBorderOffset;
      this.formattingArea = area;
      Rectangle rect = this.formattingArea.GetFittingRect(this.currentYPosition, this.currentVerticalInfo.height);
      if (rect == null)
        return false;

      this.currentXPosition = rect.X + LeftIndent;
      if (this.isFirstLine)
        FormatListSymbol();

      return true;
    }
예제 #4
0
        /// <summary>
        /// Initializes this instance for formatting.
        /// </summary>
        /// <param name="area">The area for formatting</param>
        /// <param name="previousFormatInfo">A previous format info.</param>
        /// <returns>False, if nothing of the paragraph will fit the area any more.</returns>
        private bool InitFormat(Area area, FormatInfo previousFormatInfo)
        {
            _phase = Phase.Formatting;

            _tabOffsets = new List<TabOffset>();

            ParagraphFormatInfo prevParaFormatInfo = (ParagraphFormatInfo)previousFormatInfo;
            if (previousFormatInfo == null || prevParaFormatInfo.LineCount == 0)
            {
                ((ParagraphFormatInfo)_renderInfo.FormatInfo)._isStarting = true;
                ParagraphIterator parIt = new ParagraphIterator(_paragraph.Elements);
                _currentLeaf = parIt.GetFirstLeaf();
                _isFirstLine = true;
            }
            else
            {
                _currentLeaf = prevParaFormatInfo.GetLastLineInfo().EndIter.GetNextLeaf();
                _isFirstLine = false;
                ((ParagraphFormatInfo)_renderInfo.FormatInfo)._isStarting = false;
            }

            _startLeaf = _currentLeaf;
            _currentVerticalInfo = CalcCurrentVerticalInfo();
            _currentYPosition = area.Y + TopBorderOffset;
            _formattingArea = area;
            Rectangle rect = _formattingArea.GetFittingRect(_currentYPosition, _currentVerticalInfo.Height);
            if (rect == null)
                return false;

            _currentXPosition = rect.X + LeftIndent;
            if (_isFirstLine)
                FormatListSymbol();

            return true;
        }