Пример #1
0
    void ReMeasureLine(ref LineInfo lineInfo)
    {
      //--- Save ---------------------------------
      ParagraphIterator iter;
      int blankCount;
      XUnit xPosition;
      XUnit lineWidth;
      XUnit wordsWidth;
      XUnit blankWidth;
      SaveBeforeProbing(out iter, out blankCount, out wordsWidth, out xPosition, out lineWidth, out blankWidth);
      bool origLastTabPassed = this.lastTabPassed;
      //------------------------------------------
      this.currentLeaf = lineInfo.startIter;
      this.endLeaf = lineInfo.endIter;
      this.formattingArea = this.renderInfo.LayoutInfo.ContentArea;
      this.tabOffsets = new ArrayList();
      this.currentLineWidth = 0;
      this.currentWordsWidth = 0;

      Rectangle fittingRect = this.formattingArea.GetFittingRect(this.currentYPosition, this.currentVerticalInfo.height);
      if (fittingRect == null)
        GetType();
      if (fittingRect != null)
      {
        this.currentXPosition = fittingRect.X + this.LeftIndent;
        FormatListSymbol();
        bool goOn = true;
        while (goOn && this.currentLeaf != null)
        {
          if (this.currentLeaf.Current == lineInfo.lastTab)
            this.lastTabPassed = true;

          FormatElement(this.currentLeaf.Current);

          goOn = this.currentLeaf != null && this.currentLeaf.Current != this.endLeaf.Current;
          if (goOn)
            this.currentLeaf = this.currentLeaf.GetNextLeaf();
        }
        lineInfo.lineWidth = this.currentLineWidth;
        lineInfo.wordsWidth = this.currentWordsWidth;
        lineInfo.blankCount = this.currentBlankCount;
        lineInfo.tabOffsets = this.tabOffsets;
        lineInfo.reMeasureLine = false;
        this.lastTabPassed = origLastTabPassed;
      }
      RestoreAfterProbing(iter, blankCount, wordsWidth, xPosition, lineWidth, blankWidth);
    }
Пример #2
0
    /// <summary>
    /// Stores all line information.
    /// </summary>
    void StoreLineInformation()
    {
      PopSavedBlankWidth();

      XUnit topBorderOffset = TopBorderOffset;
      Area contentArea = this.renderInfo.LayoutInfo.ContentArea;
      if (topBorderOffset > 0)//May only occure for the first line.
        contentArea = this.formattingArea.GetFittingRect(this.formattingArea.Y, topBorderOffset);

      if (contentArea == null)
      {
        contentArea = this.formattingArea.GetFittingRect(this.currentYPosition, this.currentVerticalInfo.height);
      }
      else
        contentArea = contentArea.Unite(this.formattingArea.GetFittingRect(this.currentYPosition, this.currentVerticalInfo.height));

      XUnit bottomBorderOffset = this.BottomBorderOffset;
      if (bottomBorderOffset > 0)
        contentArea = contentArea.Unite(this.formattingArea.GetFittingRect(this.currentYPosition + this.currentVerticalInfo.height, bottomBorderOffset));

      LineInfo lineInfo = new LineInfo();
      lineInfo.vertical = this.currentVerticalInfo;

      if (this.startLeaf != null && this.startLeaf == this.currentLeaf)
        HandleNonFittingLine();

      lineInfo.lastTab = this.lastTab;
      this.renderInfo.LayoutInfo.ContentArea = contentArea;

      lineInfo.startIter = this.startLeaf;

      if (this.currentLeaf == null)
        lineInfo.endIter = new ParagraphIterator(this.paragraph.Elements).GetLastLeaf();
      else
        lineInfo.endIter = this.currentLeaf.GetPreviousLeaf();

      lineInfo.blankCount = this.currentBlankCount;

      lineInfo.wordsWidth = this.currentWordsWidth;

      lineInfo.lineWidth = this.currentLineWidth;
      lineInfo.tabOffsets = this.tabOffsets;
      lineInfo.reMeasureLine = this.reMeasureLine;

      this.savedWordWidth = 0;
      this.reMeasureLine = false;
      ((ParagraphFormatInfo)this.renderInfo.FormatInfo).AddLineInfo(lineInfo);
    }
Пример #3
0
    /// <summary>
    /// Renders a single line.
    /// </summary>
    /// <param name="lineInfo"></param>
    void RenderLine(LineInfo lineInfo)
    {
      this.currentVerticalInfo = lineInfo.vertical;
      this.currentLeaf = lineInfo.startIter;
      this.startLeaf = lineInfo.startIter;
      this.endLeaf = lineInfo.endIter;
      this.currentBlankCount = lineInfo.blankCount;
      this.currentLineWidth = lineInfo.lineWidth;
      this.currentWordsWidth = lineInfo.wordsWidth;
      this.currentXPosition = this.StartXPosition;
      this.tabOffsets = lineInfo.tabOffsets;
      this.lastTabPassed = lineInfo.lastTab == null;
      this.lastTab = lineInfo.lastTab;

      this.tabIdx = 0;

      bool ready = this.currentLeaf == null;
      if (this.isFirstLine)
        RenderListSymbol();

      while (!ready)
      {
        if (this.currentLeaf.Current == lineInfo.endIter.Current)
          ready = true;

        if (this.currentLeaf.Current == lineInfo.lastTab)
          this.lastTabPassed = true;
        RenderElement(this.currentLeaf.Current);
        this.currentLeaf = this.currentLeaf.GetNextLeaf();
      }
      this.currentYPosition += lineInfo.vertical.height;
      this.isFirstLine = false;
    }
Пример #4
0
 internal void AddLineInfo(LineInfo lineInfo)
 {
     _lineInfos.Add(lineInfo);
 }
Пример #5
0
 internal void AddLineInfo(LineInfo lineInfo)
 {
     this.lineInfos.Add(lineInfo);
 }
Пример #6
0
        void ReMeasureLine(ref LineInfo lineInfo)
        {
            //--- Save ---------------------------------
            ParagraphIterator iter;
            int blankCount;
            XUnit xPosition;
            XUnit lineWidth;
            XUnit wordsWidth;
            XUnit blankWidth;
            SaveBeforeProbing(out iter, out blankCount, out wordsWidth, out xPosition, out lineWidth, out blankWidth);
            bool origLastTabPassed = _lastTabPassed;
            //------------------------------------------
            _currentLeaf = lineInfo.StartIter;
            _endLeaf = lineInfo.EndIter;
            _formattingArea = _renderInfo.LayoutInfo.ContentArea;
            _tabOffsets = new List<TabOffset>();
            _currentLineWidth = 0;
            _currentWordsWidth = 0;

            Rectangle fittingRect = _formattingArea.GetFittingRect(_currentYPosition, _currentVerticalInfo.Height);
            if (fittingRect != null)
            {
                _currentXPosition = fittingRect.X + LeftIndent;
                FormatListSymbol();
                bool goOn = true;
                while (goOn && _currentLeaf != null)
                {
                    if (_currentLeaf.Current == lineInfo.LastTab)
                        _lastTabPassed = true;

                    FormatElement(_currentLeaf.Current);

                    goOn = _currentLeaf != null && _currentLeaf.Current != _endLeaf.Current;
                    if (goOn)
                        _currentLeaf = _currentLeaf.GetNextLeaf();
                }
                lineInfo.LineWidth = _currentLineWidth;
                lineInfo.WordsWidth = _currentWordsWidth;
                lineInfo.BlankCount = _currentBlankCount;
                lineInfo.TabOffsets = _tabOffsets;
                lineInfo.ReMeasureLine = false;
                _lastTabPassed = origLastTabPassed;
            }
            RestoreAfterProbing(iter, blankCount, wordsWidth, xPosition, lineWidth, blankWidth);
        }
Пример #7
0
        /// <summary>
        /// Renders a single line.
        /// </summary>
        /// <param name="lineInfo"></param>
        void RenderLine(LineInfo lineInfo)
        {
            _currentVerticalInfo = lineInfo.Vertical;
            _currentLeaf = lineInfo.StartIter;
            _startLeaf = lineInfo.StartIter;
            _endLeaf = lineInfo.EndIter;
            _currentBlankCount = lineInfo.BlankCount;
            _currentLineWidth = lineInfo.LineWidth;
            _currentWordsWidth = lineInfo.WordsWidth;
            _currentXPosition = StartXPosition;
            _tabOffsets = lineInfo.TabOffsets;
            _lastTabPassed = lineInfo.LastTab == null;
            _lastTab = lineInfo.LastTab;

            _tabIdx = 0;

            bool ready = _currentLeaf == null;
            if (_isFirstLine)
                RenderListSymbol();

            while (!ready)
            {
                if (_currentLeaf.Current == lineInfo.EndIter.Current)
                    ready = true;

                if (_currentLeaf.Current == lineInfo.LastTab)
                    _lastTabPassed = true;
                RenderElement(_currentLeaf.Current);
                _currentLeaf = _currentLeaf.GetNextLeaf();
            }
            _currentYPosition += lineInfo.Vertical.Height;
            _isFirstLine = false;
        }
Пример #8
0
        /// <summary>
        /// Stores all line information.
        /// </summary>
        void StoreLineInformation()
        {
            PopSavedBlankWidth();

            XUnit topBorderOffset = TopBorderOffset;
            Area contentArea = _renderInfo.LayoutInfo.ContentArea;
            if (topBorderOffset > 0)//May only occure for the first line.
                contentArea = _formattingArea.GetFittingRect(_formattingArea.Y, topBorderOffset);

            if (contentArea == null)
                contentArea = _formattingArea.GetFittingRect(_currentYPosition, _currentVerticalInfo.Height);
            else
                contentArea = contentArea.Unite(_formattingArea.GetFittingRect(_currentYPosition, _currentVerticalInfo.Height));

            XUnit bottomBorderOffset = BottomBorderOffset;
            if (bottomBorderOffset > 0)
                contentArea = contentArea.Unite(_formattingArea.GetFittingRect(_currentYPosition + _currentVerticalInfo.Height, bottomBorderOffset));

            LineInfo lineInfo = new LineInfo();
            lineInfo.Vertical = _currentVerticalInfo;

            if (_startLeaf != null && _startLeaf == _currentLeaf)
                HandleNonFittingLine();

            lineInfo.LastTab = _lastTab;
            _renderInfo.LayoutInfo.ContentArea = contentArea;

            lineInfo.StartIter = _startLeaf;

            if (_currentLeaf == null)
                lineInfo.EndIter = new ParagraphIterator(_paragraph.Elements).GetLastLeaf();
            else
                lineInfo.EndIter = _currentLeaf.GetPreviousLeaf();

            lineInfo.BlankCount = _currentBlankCount;

            lineInfo.WordsWidth = _currentWordsWidth;

            lineInfo.LineWidth = _currentLineWidth;
            lineInfo.TabOffsets = _tabOffsets;
            lineInfo.ReMeasureLine = _reMeasureLine;

            _savedWordWidth = 0;
            _reMeasureLine = false;
            ((ParagraphFormatInfo)_renderInfo.FormatInfo).AddLineInfo(lineInfo);
        }
Пример #9
0
 internal void AddLineInfo(LineInfo lineInfo)
 {
     _lineInfos.Add(lineInfo);
 }
Пример #10
0
 internal void AddLineInfo(LineInfo lineInfo)
 {
     this.lineInfos.Add(lineInfo);
 }