Exemplo n.º 1
0
 public RtfLine(RtfLine otherLine)
     : this()
 {
     if (otherLine != null)
     {
         IsHeader = otherLine.IsHeader;
         TabStops.AddRange(otherLine.TabStops);
     }
 }
            public RtfConverterDouble(int[] currentLineTabStops,
				int[] prevLineTabStops, int[] currentParaTabStops)
            {
                m_CurrentLine = new RtfLine();
                if (currentLineTabStops != null)
                    m_CurrentLine.TabStops.AddRange(currentLineTabStops);
                m_PrevLine = new RtfLine();
                if (prevLineTabStops != null)
                    m_PrevLine.TabStops.AddRange(prevLineTabStops);
                if (currentParaTabStops != null)
                {
                    m_CurrentPara = new RtfLine();
                    m_CurrentPara.TabStops.AddRange(currentParaTabStops);
                }
            }
Exemplo n.º 3
0
 public RtfConverter(string fileName)
 {
     m_FileName = fileName;
     m_CurrentLine = new RtfLine();
 }
Exemplo n.º 4
0
 private void StartNewPara()
 {
     m_CurrentLine = new RtfLine();
     IsParaOpen = true;
 }
 public RtfProcessLine()
 {
     m_CurrentLine = new RtfLine();
     m_PrevLine = new RtfLine();
     m_CurrentLine = new RtfLine();
 }
        private void CreateOrContinuePara()
        {
            if (IsContinuationLine || IsSameParaKindAsPrevious)
                return;

            if (m_PrevLine.IsHeader == m_CurrentLine.IsHeader)
            {
                m_CurrentPara = new RtfLine(m_PrevLine);
                m_PrevLine = new RtfLine();
            }
            else
            {
                m_CurrentPara = new RtfLine(m_CurrentLine);
                m_PrevLine = new RtfLine();
            }
        }
        public void ProcessGroup(StringBuilder builder, RtfTreeNode node, RtfLine currentLine)
        {
            m_Builder = builder;
            m_PrevLine = m_CurrentLine;
            m_CurrentLine = currentLine;
            CreateOrContinuePara();

            var prevBuilder = m_Builder;
            m_Builder = new StringBuilder();
            int tabCount = 0;
            foreach (RtfTreeNode child in node.ChildNodes)
            {
                switch (child.NodeType)
                {
                    case RtfNodeType.Group:
                    case RtfNodeType.Text:
                    case RtfNodeType.Control:
                        AddText(m_Builder, child.Text);
                        break;
                    case RtfNodeType.Keyword:
                        {
                            switch(child.NodeKey)
                            {
                                case "tab":
                                    AddTabChar();
                                    tabCount++;
                                    break;
                                case "b":
                                    m_CurrentLine.IsHeader = true;
                                    break;
                                case "par":
                                    m_Builder.AppendLine();
                                    break;
                            }
                            break;
                        }
                }
            }
            var newBuilder = m_Builder;
            m_Builder = prevBuilder;
            if (IsContinuationLine)
            {
                var tabsToAdd = MissingTabStops;
                for (int i = 0; i < tabsToAdd; i++)
                    AddTabChar();
            }
            m_Builder.Append(newBuilder.ToString());
        }