Inheritance: iTextSharp.text.rtf.RtfElement, IRtfExtendedElement
示例#1
0
        /**
         * Writes the content of the RtfList
         * @since 2.1.3
         */
        public override void WriteContent(Stream result)
        {
            if (!this.inTable)
            {
                result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            }

            int itemNr = 0;

            if (items != null)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    RtfElement thisRtfElement = (RtfElement)items[i];
                    //thisRtfElement.WriteContent(result);
                    if (thisRtfElement is RtfListItem)
                    {
                        itemNr++;
                        RtfListItem  rtfElement = (RtfListItem)thisRtfElement;
                        RtfListLevel listLevel  = rtfElement.GetParent();
                        if (listLevel.GetListLevel() == 0)
                        {
                            CorrectIndentation();
                        }

                        if (i == 0)
                        {
                            listLevel.WriteListBeginning(result);
                            WriteListNumbers(result);
                        }

                        WriteListTextBlock(result, itemNr, listLevel);

                        rtfElement.WriteContent(result);

                        if (i < (items.Count - 1) || !this.inTable || listLevel.GetListType() > 0) // TODO Fix no paragraph on last list item in tables
                        {
                            result.Write(RtfParagraph.PARAGRAPH, 0, RtfParagraph.PARAGRAPH.Length);
                        }
                        this.document.OutputDebugLinebreak(result);
                    }
                    else if (thisRtfElement is RtfList)
                    {
                        ((RtfList)thisRtfElement).WriteContent(result);
                        //              ((RtfList)thisRtfElement).WriteListBeginning(result);
                        WriteListNumbers(result);
                        this.document.OutputDebugLinebreak(result);
                    }
                }
            }
            if (!this.inTable)
            {
                result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
                result.Write(RtfParagraph.PARAGRAPH_DEFAULTS, 0, RtfParagraph.PARAGRAPH_DEFAULTS.Length);
            }
        }
        /// <summary>
        /// Writes the content of the RtfList
        /// @since 2.1.3
        /// </summary>
        public override void WriteContent(Stream result)
        {
            if (!InTable)
            {
                result.Write(OpenGroup, 0, OpenGroup.Length);
            }

            int itemNr = 0;

            if (_items != null)
            {
                for (int i = 0; i < _items.Count; i++)
                {
                    RtfElement thisRtfElement = (RtfElement)_items[i];
                    //thisRtfElement.WriteContent(result);
                    if (thisRtfElement is RtfListItem)
                    {
                        itemNr++;
                        RtfListItem  rtfElement = (RtfListItem)thisRtfElement;
                        RtfListLevel listLevel  = rtfElement.GetParent();
                        if (listLevel.GetListLevel() == 0)
                        {
                            CorrectIndentation();
                        }

                        if (i == 0)
                        {
                            listLevel.WriteListBeginning(result);
                            WriteListNumbers(result);
                        }

                        WriteListTextBlock(result, itemNr, listLevel);

                        rtfElement.WriteContent(result);

                        if (i < (_items.Count - 1) || !InTable || listLevel.GetListType() > 0)
                        { // TODO Fix no paragraph on last list item in tables
                            result.Write(RtfParagraph.Paragraph, 0, RtfParagraph.Paragraph.Length);
                        }
                        Document.OutputDebugLinebreak(result);
                    }
                    else if (thisRtfElement is RtfList)
                    {
                        ((RtfList)thisRtfElement).WriteContent(result);
                        //              ((RtfList)thisRtfElement).WriteListBeginning(result);
                        WriteListNumbers(result);
                        Document.OutputDebugLinebreak(result);
                    }
                }
            }
            if (!InTable)
            {
                result.Write(CloseGroup, 0, CloseGroup.Length);
                result.Write(RtfPhrase.ParagraphDefaults, 0, RtfPhrase.ParagraphDefaults.Length);
            }
        }
示例#3
0
 /**
  * Create a default set of listlevels
  * @since 2.1.3
  */
 protected void CreateDefaultLevels()
 {
     this.listLevels = new ArrayList();  // listlevels
     for (int i = 0; i <= 8; i++)
     {
         // create a list level
         RtfListLevel ll = new RtfListLevel(this.document);
         ll.SetListType(RtfListLevel.LIST_TYPE_NUMBERED);
         ll.SetFirstIndent(0);
         ll.SetLeftIndent(0);
         ll.SetLevelTextNumber(i);
         ll.SetTentative(true);
         ll.CorrectIndentation();
         this.listLevels.Add(ll);
     }
 }
示例#4
0
        /**
         *
         * @param result
         * @param itemNr
         * @param listLevel
         * @throws IOException
         * @since 2.1.3
         */
        protected void WriteListTextBlock(Stream result, int itemNr, RtfListLevel listLevel)
        {
            byte[] t;
            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(RtfList.LIST_TEXT, 0, RtfList.LIST_TEXT.Length);
            result.Write(RtfParagraph.PARAGRAPH_DEFAULTS, 0, RtfParagraph.PARAGRAPH_DEFAULTS.Length);
            if (this.inTable)
            {
                result.Write(RtfParagraph.IN_TABLE, 0, RtfParagraph.IN_TABLE.Length);
            }
            result.Write(RtfFontList.FONT_NUMBER, 0, RtfFontList.FONT_NUMBER.Length);
            if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET)
            {
                result.Write(t = IntToByteArray(listLevel.GetFontNumber().GetFontNumber()), 0, t.Length);
            }
            else
            {
                result.Write(t = IntToByteArray(listLevel.GetFontBullet().GetFontNumber()), 0, t.Length);
            }
            listLevel.WriteIndentation(result);
            result.Write(DELIMITER, 0, DELIMITER.Length);
            if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET)
            {
                switch (listLevel.GetListType())
                {
                case RtfListLevel.LIST_TYPE_NUMBERED: result.Write(t = IntToByteArray(itemNr), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_UPPER_LETTERS: result.Write(t = DocWriter.GetISOBytes(RomanAlphabetFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_LOWER_LETTERS: result.Write(t = DocWriter.GetISOBytes(RomanAlphabetFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_UPPER_ROMAN: result.Write(t = DocWriter.GetISOBytes(RomanNumberFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_LOWER_ROMAN: result.Write(t = DocWriter.GetISOBytes(RomanNumberFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;
                }
                result.Write(LIST_NUMBER_END, 0, LIST_NUMBER_END.Length);
            }
            else
            {
                this.document.FilterSpecialChar(result, listLevel.GetBulletCharacter(), true, false);
            }
            result.Write(TAB, 0, TAB.Length);
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
        }
示例#5
0
        /// <summary>
        /// @throws IOException
        /// @since 2.1.3
        /// </summary>
        /// <param name="result"></param>
        /// <param name="itemNr"></param>
        /// <param name="listLevel"></param>
        protected void WriteListTextBlock(Stream result, int itemNr, RtfListLevel listLevel)
        {
            byte[] t;
            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(ListText, 0, ListText.Length);
            result.Write(RtfPhrase.ParagraphDefaults, 0, RtfPhrase.ParagraphDefaults.Length);
            if (InTable)
            {
                result.Write(RtfPhrase.InTable, 0, RtfPhrase.InTable.Length);
            }
            result.Write(RtfFontList.FontNumber, 0, RtfFontList.FontNumber.Length);
            if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET)
            {
                result.Write(t = IntToByteArray(listLevel.GetFontNumber().GetFontNumber()), 0, t.Length);
            }
            else
            {
                result.Write(t = IntToByteArray(listLevel.GetFontBullet().GetFontNumber()), 0, t.Length);
            }
            listLevel.WriteIndentation(result);
            result.Write(Delimiter, 0, Delimiter.Length);
            if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET)
            {
                switch (listLevel.GetListType())
                {
                case RtfListLevel.LIST_TYPE_NUMBERED: result.Write(t = IntToByteArray(itemNr), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_UPPER_LETTERS: result.Write(t = DocWriter.GetIsoBytes(RomanAlphabetFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_LOWER_LETTERS: result.Write(t = DocWriter.GetIsoBytes(RomanAlphabetFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_UPPER_ROMAN: result.Write(t = DocWriter.GetIsoBytes(RomanNumberFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;

                case RtfListLevel.LIST_TYPE_LOWER_ROMAN: result.Write(t = DocWriter.GetIsoBytes(RomanNumberFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;
                }
                result.Write(ListNumberEnd, 0, ListNumberEnd.Length);
            }
            else
            {
                Document.FilterSpecialChar(result, listLevel.GetBulletCharacter(), true, false);
            }
            result.Write(Tab, 0, Tab.Length);
            result.Write(CloseGroup, 0, CloseGroup.Length);
        }
示例#6
0
 public RtfListLevel(RtfListLevel ll) : base(ll.document)
 {
     templateID           = document.GetRandomInt();
     this.alignment       = ll.alignment;
     this.bulletCharacter = ll.bulletCharacter;
     this.firstIndent     = ll.firstIndent;
     this.fontBullet      = ll.fontBullet;
     this.fontNumber      = ll.fontNumber;
     this.inHeader        = ll.inHeader;
     this.inTable         = ll.inTable;
     this.leftIndent      = ll.leftIndent;
     this.listLevel       = ll.listLevel;
     this.listNoRestart   = ll.listNoRestart;
     this.listStartAt     = ll.listStartAt;
     this.listType        = ll.listType;
     this.parent          = ll.parent;
     this.rightIndent     = ll.rightIndent;
     this.symbolIndent    = ll.symbolIndent;
 }
 public RtfListLevel(RtfListLevel ll) : base(ll.Document)
 {
     _templateId      = Document.GetRandomInt();
     _alignment       = ll._alignment;
     _bulletCharacter = ll._bulletCharacter;
     _firstIndent     = ll._firstIndent;
     _fontBullet      = ll._fontBullet;
     _fontNumber      = ll._fontNumber;
     InHeader         = ll.InHeader;
     InTable          = ll.InTable;
     _leftIndent      = ll._leftIndent;
     listLevel        = ll.listLevel;
     _listNoRestart   = ll._listNoRestart;
     _listStartAt     = ll._listStartAt;
     _listType        = ll._listType;
     _parent          = ll._parent;
     _rightIndent     = ll._rightIndent;
     _symbolIndent    = ll._symbolIndent;
 }
示例#8
0
        /**
         * Constructs a new RtfList for the specified List.
         *
         * @param doc The RtfDocument this RtfList belongs to
         * @param list The List this RtfList is based on
         * @since 2.1.3
         */
        public RtfList(RtfDocument doc, List list) : base(doc)
        {
            // setup the listlevels
            // Then, setup the list data below

            // setup 1 listlevel if it's a simple list
            // setup 9 if it's a regular list
            // setup 9 if it's a hybrid list (default)
            CreateDefaultLevels();

            this.items = new ArrayList();       // list content
            RtfListLevel ll = (RtfListLevel)this.listLevels[0];

            // get the list number or create a new one adding it to the table
            this.listNumber = document.GetDocumentHeader().GetListNumber(this);

            if (list.SymbolIndent > 0 && list.IndentationLeft > 0)
            {
                ll.SetFirstIndent((int)(list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1));
                ll.SetLeftIndent((int)((list.IndentationLeft + list.SymbolIndent) * RtfElement.TWIPS_FACTOR));
            }
            else if (list.SymbolIndent > 0)
            {
                ll.SetFirstIndent((int)(list.SymbolIndent * RtfElement.TWIPS_FACTOR * -1));
                ll.SetLeftIndent((int)(list.SymbolIndent * RtfElement.TWIPS_FACTOR));
            }
            else if (list.IndentationLeft > 0)
            {
                ll.SetFirstIndent(0);
                ll.SetLeftIndent((int)(list.IndentationLeft * RtfElement.TWIPS_FACTOR));
            }
            else
            {
                ll.SetFirstIndent(0);
                ll.SetLeftIndent(0);
            }
            ll.SetRightIndent((int)(list.IndentationRight * RtfElement.TWIPS_FACTOR));
            ll.SetSymbolIndent((int)((list.SymbolIndent + list.IndentationLeft) * RtfElement.TWIPS_FACTOR));
            ll.CorrectIndentation();
            ll.SetTentative(false);

            if (list is RomanList)
            {
                if (list.Lowercase)
                {
                    ll.SetListType(RtfListLevel.LIST_TYPE_LOWER_ROMAN);
                }
                else
                {
                    ll.SetListType(RtfListLevel.LIST_TYPE_UPPER_ROMAN);
                }
            }
            else if (list.Numbered)
            {
                ll.SetListType(RtfListLevel.LIST_TYPE_NUMBERED);
            }
            else if (list.Lettered)
            {
                if (list.Lowercase)
                {
                    ll.SetListType(RtfListLevel.LIST_TYPE_LOWER_LETTERS);
                }
                else
                {
                    ll.SetListType(RtfListLevel.LIST_TYPE_UPPER_LETTERS);
                }
            }
            else
            {
                //          Paragraph p = new Paragraph();
                //          p.Add(new Chunk(list.GetPreSymbol()) );
                //          p.Add(list.GetSymbol());
                //          p.Add(new Chunk(list.GetPostSymbol()) );
                //          ll.SetBulletChunk(list.GetSymbol());
                ll.SetBulletCharacter(list.PreSymbol + list.Symbol.Content + list.PostSymbol);
                ll.SetListType(RtfListLevel.LIST_TYPE_BULLET);
            }

            // now setup the actual list contents.
            for (int i = 0; i < list.Items.Count; i++)
            {
                try {
                    IElement element = (IElement)list.Items[i];

                    if (element.Type == Element.CHUNK)
                    {
                        element = new ListItem((Chunk)element);
                    }
                    if (element is ListItem)
                    {
                        ll.SetAlignment(((ListItem)element).Alignment);
                    }
                    IRtfBasicElement[] rtfElements = doc.GetMapper().MapElement(element);
                    for (int j = 0; j < rtfElements.Length; j++)
                    {
                        IRtfBasicElement rtfElement = rtfElements[j];
                        if (rtfElement is RtfList)
                        {
                            ((RtfList)rtfElement).SetParentList(this);
                        }
                        else if (rtfElement is RtfListItem)
                        {
                            ((RtfListItem)rtfElement).SetParent(ll);
                        }
                        ll.SetFontNumber(new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0))));
                        if (list.Symbol != null && list.Symbol.Font != null && !list.Symbol.Content.StartsWith("-") && list.Symbol.Content.Length > 0)
                        {
                            // only set this to bullet symbol is not default
                            ll.SetBulletFont(list.Symbol.Font);
                            ll.SetBulletCharacter(list.Symbol.Content.Substring(0, 1));
                        }
                        else
                        if (list.Symbol != null && list.Symbol.Font != null)
                        {
                            ll.SetBulletFont(list.Symbol.Font);
                        }
                        else
                        {
                            ll.SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
                        }
                        items.Add(rtfElement);
                    }
                } catch (DocumentException) {
                }
            }
        }
示例#9
0
 /**
 * @param listLevelParent the listLevelParent to set
 */
 public void SetListLevelParent(RtfListLevel listLevelParent) {
     this.listLevelParent = listLevelParent;
 }
示例#10
0
 public RtfListLevel(RtfListLevel ll) : base(ll.document)
 {
     templateID = document.GetRandomInt();
     this.alignment = ll.alignment;
     this.bulletCharacter = ll.bulletCharacter;
     this.firstIndent = ll.firstIndent;
     this.fontBullet = ll.fontBullet;
     this.fontNumber = ll.fontNumber;
     this.inHeader = ll.inHeader;
     this.inTable = ll.inTable;
     this.leftIndent = ll.leftIndent;
     this.listLevel = ll.listLevel;
     this.listNoRestart = ll.listNoRestart;
     this.listStartAt = ll.listStartAt;
     this.listType = ll.listType;
     this.parent = ll.parent;
     this.rightIndent = ll.rightIndent;
     this.symbolIndent = ll.symbolIndent;
 }
示例#11
0
 /**
  * @param listLevelParent the listLevelParent to set
  */
 public void SetListLevelParent(RtfListLevel listLevelParent)
 {
     this.listLevelParent = listLevelParent;
 }
示例#12
0
 /**
  * Set the parent RtfList.
  *
  * @param parentList The parent RtfList to use.
  */
 public void SetParent(RtfListLevel parentList)
 {
     this.parentList = parentList;
 }
示例#13
0
 /**
 * Set the parent RtfList.
 *
 * @param parentList The parent RtfList to use.
 */
 public void SetParent(RtfListLevel parentList)
 {
     this.parentList = parentList;
 }
示例#14
0
 /**
 *
 * @param result
 * @param itemNr
 * @param listLevel
 * @throws IOException
 * @since 2.1.3
 */
 protected void WriteListTextBlock(Stream result, int itemNr, RtfListLevel listLevel)
 {
     byte[] t;
     result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
     result.Write(RtfList.LIST_TEXT, 0, RtfList.LIST_TEXT.Length);
     result.Write(RtfParagraph.PARAGRAPH_DEFAULTS, 0, RtfParagraph.PARAGRAPH_DEFAULTS.Length);
     if (this.inTable) {
         result.Write(RtfParagraph.IN_TABLE, 0, RtfParagraph.IN_TABLE.Length);
     }
     result.Write(RtfFontList.FONT_NUMBER, 0, RtfFontList.FONT_NUMBER.Length);
     if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET) {
         result.Write(t = IntToByteArray(listLevel.GetFontNumber().GetFontNumber()), 0, t.Length);
     } else {
         result.Write(t = IntToByteArray(listLevel.GetFontBullet().GetFontNumber()), 0, t.Length);
     }
     listLevel.WriteIndentation(result);
     result.Write(DELIMITER, 0, DELIMITER.Length);
     if (listLevel.GetListType() != RtfListLevel.LIST_TYPE_BULLET) {
         switch (listLevel.GetListType()) {
             case RtfListLevel.LIST_TYPE_NUMBERED      : result.Write(t = IntToByteArray(itemNr), 0, t.Length); break;
             case RtfListLevel.LIST_TYPE_UPPER_LETTERS : result.Write(t = DocWriter.GetISOBytes(RomanAlphabetFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;
             case RtfListLevel.LIST_TYPE_LOWER_LETTERS : result.Write(t = DocWriter.GetISOBytes(RomanAlphabetFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;
             case RtfListLevel.LIST_TYPE_UPPER_ROMAN   : result.Write(t = DocWriter.GetISOBytes(RomanNumberFactory.GetUpperCaseString(itemNr)), 0, t.Length); break;
             case RtfListLevel.LIST_TYPE_LOWER_ROMAN   : result.Write(t = DocWriter.GetISOBytes(RomanNumberFactory.GetLowerCaseString(itemNr)), 0, t.Length); break;
         }
         result.Write(LIST_NUMBER_END, 0, LIST_NUMBER_END.Length);
     } else {
         this.document.FilterSpecialChar(result, listLevel.GetBulletCharacter(), true, false);
     }
     result.Write(TAB, 0, TAB.Length);
     result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
 }
示例#15
0
 /**
 * Create a default set of listlevels
 * @since 2.1.3
 */
 protected void CreateDefaultLevels()
 {
     this.listLevels = new ArrayList();  // listlevels
     for (int i=0; i<=8; i++) {
         // create a list level
         RtfListLevel ll = new RtfListLevel(this.document);
         ll.SetListType(RtfListLevel.LIST_TYPE_NUMBERED);
         ll.SetFirstIndent(0);
         ll.SetLeftIndent(0);
         ll.SetLevelTextNumber(i);
         ll.SetTentative(true);
         ll.CorrectIndentation();
         this.listLevels.Add(ll);
     }
 }
        public override bool HandleControlWord(RtfCtrlWordData ctrlWordData) {
            bool result = true;
            bool skipCtrlWord = false;

            if (this.rtfParser.IsImport()) {
                skipCtrlWord = true;
                if (ctrlWordData.ctrlWord.Equals("listtable")) {
                    result = true;
                    this.currentListMappingNumber = 0;
                    
                } else
                    /* Picture info for icons/images for lists */
                    if (ctrlWordData.ctrlWord.Equals("listpicture"))/* DESTINATION */{
                    skipCtrlWord = true;
                    // this.rtfParser.SetTokeniserStateSkipGroup();
                    result = true;
                } else
                    /* list */
                    if (ctrlWordData.ctrlWord.Equals("list")) /* DESTINATION */{
                    skipCtrlWord = true;
                    this.newList = new RtfList(this.rtfParser.GetRtfDocument());
                    this.newList.SetListType(RtfList.LIST_TYPE_NORMAL); // set default
                    this.currentLevel = -1;
                    this.currentListMappingNumber++;
                    this.currentSubGroupCount = 0;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("listtemplateid")) /* // List item*/ {
                    // ignore this because it gets regenerated in every document
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("listsimple")) /* // List item*/ {
                    // is value 0 or 1
                    if (ctrlWordData.hasParam && ctrlWordData.param == "1") {
                        this.newList.SetListType(RtfList.LIST_TYPE_SIMPLE);
                    } else {
                        this.newList.SetListType(RtfList.LIST_TYPE_NORMAL);
                    }
                    skipCtrlWord = true;
                    result = true;
                    // this gets set internally. Don't think it should be imported
                } else if (ctrlWordData.ctrlWord.Equals("listhybrid")) /* // List item*/ {
                    this.newList.SetListType(RtfList.LIST_TYPE_HYBRID);
                    skipCtrlWord = true;
                    result = true;
                    // this gets set internally. Don't think it should be imported
                } else if (ctrlWordData.ctrlWord.Equals("listrestarthdn")) /* // List item*/ {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("listid")) {    // List item cannot be between -1 and -5
                    // needs to be mapped for imports and is recreated
                    // we have the new id and the old id. Just add it to the mapping table here.
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("listname"))/* // List item*/ {
                    this.newList.SetName(ctrlWordData.param);
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("liststyleid"))/* // List item*/ {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("liststylename"))/* // List item*/ {
                    skipCtrlWord = true;
                    result = true;
                } else
                    /* listlevel */
                    if (ctrlWordData.ctrlWord.Equals("listlevel")) /* DESTINATION There are 1 or 9 listlevels per list */{
                    this.currentLevel++;
                    this.currentListLevel = this.newList.GetListLevel(this.currentLevel);
                    this.currentListLevel.SetTentative(false);
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("leveljc")) { // listlevel item justify
                    // this is the old number. Only use it if the current type is not set
                    if ( this.currentListLevel.GetAlignment()== RtfListLevel.LIST_TYPE_UNKNOWN) {
                        switch (ctrlWordData.IntValue()) {
                            case 0:
                                this.currentListLevel.SetAlignment(Element.ALIGN_LEFT);
                                break;
                            case 1:
                                this.currentListLevel.SetAlignment(Element.ALIGN_CENTER);
                                break;
                            case 2:
                                this.currentListLevel.SetAlignment(Element.ALIGN_RIGHT);
                                break;
                        }
                    }
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("leveljcn")) { // listlevel item
                    //justify
                    // if this exists, use it and it overrides the old setting
                    switch (ctrlWordData.IntValue()) {
                        case 0:
                            this.currentListLevel.SetAlignment(Element.ALIGN_LEFT);
                            break;
                        case 1:
                            this.currentListLevel.SetAlignment(Element.ALIGN_CENTER);
                            break;
                        case 2:
                            this.currentListLevel.SetAlignment(Element.ALIGN_RIGHT);
                            break;
                    }
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelstartat")) {
                    this.currentListLevel.SetListStartAt(ctrlWordData.IntValue());
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("lvltentative")) {
                    this.currentListLevel.SetTentative(true);
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelold")) {
                    // old style. ignore
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelprev")) {
                    // old style. ignore
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelprevspace")) {
                    // old style. ignore
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelspace")) {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelindent")) {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("leveltext")) {/* FIX */
                    skipCtrlWord = true;
                    result = true;
                }  else if (ctrlWordData.ctrlWord.Equals("levelfollow")) {
                    this.currentListLevel.SetLevelFollowValue(ctrlWordData.IntValue());
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levellegal")) {
                    this.currentListLevel.SetLegal(ctrlWordData.param=="1"?true:false);
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelnorestart")) {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("chrfmt")) {/* FIX */
                    // set an attribute pair
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelpicture")) {
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("li")) {
                    // set an attribute pair
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("fi")) {
                    // set an attribute pair
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("jclisttab")) {
                    // set an attribute pair
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("tx")) {
                    // set an attribute pair
                    skipCtrlWord = true;
                    result = true;
                } else
                    /* number */
                    if (ctrlWordData.ctrlWord.Equals("levelnfc")) /* old style */ {
                    if ( this.currentListLevel.GetListType()== RtfListLevel.LIST_TYPE_UNKNOWN) {
                        this.currentListLevel.SetListType(ctrlWordData.IntValue()+RtfListLevel.LIST_TYPE_BASE);
                    }
                    skipCtrlWord = true;
                    result = true;
                } else if (ctrlWordData.ctrlWord.Equals("levelnfcn")) /* new style takes priority over levelnfc.*/ {
                    this.currentListLevel.SetListType(ctrlWordData.IntValue()+RtfListLevel.LIST_TYPE_BASE);
                    skipCtrlWord = true;
                    result = true;
                } else
                    /* level text */
                    if (ctrlWordData.ctrlWord.Equals("leveltemplateid")) {
                    // ignore. this value is regenerated in each document.
                    skipCtrlWord = true;
                    result = true;
                } else
                    /* levelnumber */
                    if (ctrlWordData.ctrlWord.Equals("levelnumbers")) {
                    skipCtrlWord = true;
                    result = true;
                }
            }

            if (this.rtfParser.IsConvert()) {
                if (ctrlWordData.ctrlWord.Equals("shppict")) {
                    result = true;
                }
                if (ctrlWordData.ctrlWord.Equals("nonshppict")) {
                    skipCtrlWord = true;
                    this.rtfParser.SetTokeniserStateSkipGroup();
                    result = true;
                }
            }
            if (!skipCtrlWord) {
                switch (this.rtfParser.GetConversionType()) {
                    case RtfParser.TYPE_IMPORT_FULL:
                        // WriteBuffer();
                        // WriteText(ctrlWordData.ToString());
                        result = true;
                        break;
                    case RtfParser.TYPE_IMPORT_FRAGMENT:
                        // WriteBuffer();
                        // WriteText(ctrlWordData.ToString());
                        result = true;
                        break;
                    case RtfParser.TYPE_CONVERT:
                        result = true;
                        break;
                    default: // error because is should be an import or convert
                        result = false;
                        break;
                }
            }

            return result;
        }