Inheritance: iTextSharp.text.rtf.RtfElement, IRtfExtendedElement
Ejemplo n.º 1
0
 public RtfListLevel(RtfDocument doc, RtfList parent) : base(doc)
 {
     this.parent = parent;
     templateID  = document.GetRandomInt();
     SetFontNumber(new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0))));
     SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
 }
        /// <summary>
        /// Remove a RtfList from the list of RtfLists
        /// </summary>
        /// <param name="list">The RtfList to remove.</param>
        public void FreeListNumber(RtfList list)
        {
            var i = _lists.IndexOf(list);

            if (i >= 0)
            {
                _lists.RemoveAt(i);
            }
        }
Ejemplo n.º 3
0
        /**
         * Remove a RtfList from the list of RtfLists
         *
         * @param list The RtfList to remove.
         */
        public void FreeListNumber(RtfList list)
        {
            int i = lists.IndexOf(list);

            if (i >= 0)
            {
                lists.RemoveAt(i);
            }
        }
Ejemplo n.º 4
0
 /**
  * Gets the id of the specified RtfList. If the RtfList is not yet in the
  * list of RtfLists, then it is added.
  *
  * @param list The RtfList for which to get the id.
  * @return The id of the RtfList.
  */
 public int GetListNumber(RtfList list)
 {
     if (lists.Contains(list))
     {
         return(lists.IndexOf(list));
     }
     else
     {
         lists.Add(list);
         return(lists.Count);
     }
 }
Ejemplo n.º 5
0
 /**
  * Writes the definition of the first element in this RtfListItem that is
  * an is {@link RtfList} to the given stream.<br>
  * If this item does not contain a {@link RtfList} element nothing is written
  * and the method returns <code>false</code>.
  *
  * @param out destination stream
  * @return <code>true</code> if a RtfList definition was written, <code>false</code> otherwise
  * @throws IOException
  * @see {@link RtfList#writeDefinition(Stream)}
  */
 public bool WriteDefinition(Stream outp)
 {
     for (int i = 0; i < chunks.Count; i++)
     {
         IRtfBasicElement rtfElement = (IRtfBasicElement)chunks[i];
         if (rtfElement is RtfList)
         {
             RtfList rl = (RtfList)rtfElement;
             rl.WriteDefinition(outp);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 6
0
        /**
         * Writes the list and list override tables.
         */
        public virtual void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(LIST_TABLE, 0, LIST_TABLE.Length);
            this.document.OutputDebugLinebreak(result);

            for (int i = 0; i < picturelists.Count; i++)
            {
                RtfPictureList l = (RtfPictureList)picturelists[i];
                //          l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                this.document.OutputDebugLinebreak(result);
            }

            for (int i = 0; i < lists.Count; i++)
            {
                RtfList l = (RtfList)lists[i];
                l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                this.document.OutputDebugLinebreak(result);
            }
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);

            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(LIST_OVERRIDE_TABLE, 0, LIST_OVERRIDE_TABLE.Length);
            this.document.OutputDebugLinebreak(result);

            // list override index values are 1-based, not 0.
            // valid list override index values \ls are 1 to 2000.
            // if there are more then 2000 lists, the result is undefined.
            for (int i = 0; i < lists.Count; i++)
            {
                result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
                result.Write(LIST_OVERRIDE, 0, LIST_OVERRIDE.Length);
                result.Write(RtfList.LIST_ID, 0, RtfList.LIST_ID.Length);
                result.Write(t = IntToByteArray(((RtfList)lists[i]).GetID()), 0, t.Length);
                result.Write(LIST_OVERRIDE_COUNT, 0, LIST_OVERRIDE_COUNT.Length);
                result.Write(t = IntToByteArray(0), 0, t.Length);    // is this correct? Spec says valid values are 1 or 9.
                result.Write(RtfList.LIST_NUMBER, 0, RtfList.LIST_NUMBER.Length);
                result.Write(t = IntToByteArray(((RtfList)lists[i]).GetListNumber()), 0, t.Length);
                result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
                this.document.OutputDebugLinebreak(result);
            }
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Writes the list and list override tables.
        /// </summary>
        public virtual void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(_listTable, 0, _listTable.Length);
            Document.OutputDebugLinebreak(result);

            for (int i = 0; i < _picturelists.Count; i++)
            {
                RtfPictureList l = (RtfPictureList)_picturelists[i];
                //          l.SetID(document.GetRandomInt());
                l.WriteDefinition(result);
                Document.OutputDebugLinebreak(result);
            }

            for (int i = 0; i < _lists.Count; i++)
            {
                RtfList l = (RtfList)_lists[i];
                l.SetId(Document.GetRandomInt());
                l.WriteDefinition(result);
                Document.OutputDebugLinebreak(result);
            }
            result.Write(CloseGroup, 0, CloseGroup.Length);
            Document.OutputDebugLinebreak(result);

            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(_listOverrideTable, 0, _listOverrideTable.Length);
            Document.OutputDebugLinebreak(result);

            // list override index values are 1-based, not 0.
            // valid list override index values \ls are 1 to 2000.
            // if there are more then 2000 lists, the result is undefined.
            for (int i = 0; i < _lists.Count; i++)
            {
                result.Write(OpenGroup, 0, OpenGroup.Length);
                result.Write(_listOverride, 0, _listOverride.Length);
                result.Write(RtfList.ListId, 0, RtfList.ListId.Length);
                result.Write(t = IntToByteArray(((RtfList)_lists[i]).GetId()), 0, t.Length);
                result.Write(_listOverrideCount, 0, _listOverrideCount.Length);
                result.Write(t = IntToByteArray(0), 0, t.Length);    // is this correct? Spec says valid values are 1 or 9.
                result.Write(RtfList.ListNumber, 0, RtfList.ListNumber.Length);
                result.Write(t = IntToByteArray(((RtfList)_lists[i]).GetListNumber()), 0, t.Length);
                result.Write(CloseGroup, 0, CloseGroup.Length);
                Document.OutputDebugLinebreak(result);
            }
            result.Write(CloseGroup, 0, CloseGroup.Length);
            Document.OutputDebugLinebreak(result);
        }
 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;
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Writes the definition part of this list level
        /// @throws IOException
        /// @since 2.1.3
        /// </summary>
        /// <param name="result"></param>
        public void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OpenGroup, 0, OpenGroup.Length);
            result.Write(_list, 0, _list.Length);
            result.Write(_listTemplateId, 0, _listTemplateId.Length);
            result.Write(t = IntToByteArray(Document.GetRandomInt()), 0, t.Length);

            int levelsToWrite = -1;

            switch (_listType)
            {
            case LIST_TYPE_NORMAL:
                levelsToWrite = _listLevels.Count;
                break;

            case LIST_TYPE_SIMPLE:
                result.Write(_listSimple, 0, _listSimple.Length);
                result.Write(t = IntToByteArray(1), 0, t.Length);
                levelsToWrite  = 1;
                break;

            case LIST_TYPE_HYBRID:
                result.Write(_listHybrid, 0, _listHybrid.Length);
                levelsToWrite = _listLevels.Count;
                break;

            default:
                break;
            }
            Document.OutputDebugLinebreak(result);

            // TODO: Figure out hybrid because multi-level hybrid does not work.
            // Seems hybrid is mixed type all single level - Simple = single level
            // SIMPLE1/HYRBID
            // 1. Line 1
            // 2. Line 2
            // MULTI-LEVEL LISTS Are Simple0 - 9 levels (0-8) all single digit
            // 1. Line 1
            // 1.1. Line 1.1
            // 1.2. Line 1.2
            // 2. Line 2

            // write the listlevels here
            for (int i = 0; i < levelsToWrite; i++)
            {
                ((RtfListLevel)_listLevels[i]).WriteDefinition(result);
                Document.OutputDebugLinebreak(result);
            }

            result.Write(ListId, 0, ListId.Length);
            result.Write(t = IntToByteArray(_listId), 0, t.Length);
            result.Write(CloseGroup, 0, CloseGroup.Length);
            Document.OutputDebugLinebreak(result);
            if (_items != null)
            {
                for (int i = 0; i < _items.Count; i++)
                {
                    RtfElement rtfElement = (RtfElement)_items[i];
                    if (rtfElement is RtfList)
                    {
                        RtfList rl = (RtfList)rtfElement;
                        rl.WriteDefinition(result);
                        break;
                    }
                    else if (rtfElement is RtfListItem)
                    {
                        RtfListItem rli = (RtfListItem)rtfElement;
                        if (rli.WriteDefinition(result))
                        {
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 11
0
 /**
 * @param parent the parent to set
 */
 public void SetParent(RtfList parent) {
     this.parent = parent;
 }
Ejemplo n.º 12
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;
 }
Ejemplo n.º 13
0
 public RtfListLevel(RtfDocument doc, RtfList parent) : base(doc)
 {
     this.parent = parent;
     templateID = document.GetRandomInt();
     SetFontNumber( new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0))));
     SetBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0)));
 }
Ejemplo n.º 14
0
 /**
  * @param parent the parent to set
  */
 public void SetParent(RtfList parent)
 {
     this.parent = parent;
 }
Ejemplo n.º 15
0
 /**
 * Gets the number of the specified RtfList
 * 
 * @param list The RtfList for which to get the number
 * @return The number of the list
 */
 public int GetListNumber(RtfList list) {
     return this.listTable.GetListNumber(list);
 }
Ejemplo n.º 16
0
 /**
 * Remove a RtfList from the list of RtfLists
 * 
 * @param list The RtfList to remove.
 */
 public void FreeListNumber(RtfList list) {
     int i = lists.IndexOf(list);
     if (i >= 0) {
         lists.RemoveAt(i);
     }
 }
Ejemplo n.º 17
0
 /**
 * Gets the id of the specified RtfList. If the RtfList is not yet in the
 * list of RtfLists, then it is added.
 * 
 * @param list The RtfList for which to get the id.
 * @return The id of the RtfList.
 */
 public int GetListNumber(RtfList list) {
     if (lists.Contains(list)) {
         return lists.IndexOf(list);
     } else {
         lists.Add(list);
         return lists.Count;
     }
 }
Ejemplo n.º 18
0
        /**
         * Writes the definition part of this list level
         * @param result
         * @throws IOException
         * @since 2.1.3
         */
        public void WriteDefinition(Stream result)
        {
            byte[] t;
            result.Write(OPEN_GROUP, 0, OPEN_GROUP.Length);
            result.Write(LIST, 0, LIST.Length);
            result.Write(LIST_TEMPLATE_ID, 0, LIST_TEMPLATE_ID.Length);
            result.Write(t = IntToByteArray(document.GetRandomInt()), 0, t.Length);

            int levelsToWrite = -1;

            switch (this.listType)
            {
            case LIST_TYPE_NORMAL:
                levelsToWrite = listLevels.Count;
                break;

            case LIST_TYPE_SIMPLE:
                result.Write(LIST_SIMPLE, 0, LIST_SIMPLE.Length);
                result.Write(t = IntToByteArray(1), 0, t.Length);
                levelsToWrite  = 1;
                break;

            case LIST_TYPE_HYBRID:
                result.Write(LIST_HYBRID, 0, LIST_HYBRID.Length);
                levelsToWrite = listLevels.Count;
                break;

            default:
                break;
            }
            this.document.OutputDebugLinebreak(result);

            // TODO: Figure out hybrid because multi-level hybrid does not work.
            // Seems hybrid is mixed type all single level - Simple = single level
            // SIMPLE1/HYRBID
            // 1. Line 1
            // 2. Line 2
            // MULTI-LEVEL LISTS Are Simple0 - 9 levels (0-8) all single digit
            // 1. Line 1
            // 1.1. Line 1.1
            // 1.2. Line 1.2
            // 2. Line 2

            // write the listlevels here
            for (int i = 0; i < levelsToWrite; i++)
            {
                ((RtfListLevel)listLevels[i]).WriteDefinition(result);
                this.document.OutputDebugLinebreak(result);
            }

            result.Write(LIST_ID, 0, LIST_ID.Length);
            result.Write(t = IntToByteArray(this.listID), 0, t.Length);
            result.Write(CLOSE_GROUP, 0, CLOSE_GROUP.Length);
            this.document.OutputDebugLinebreak(result);
            if (items != null)
            {
                for (int i = 0; i < items.Count; i++)
                {
                    RtfElement rtfElement = (RtfElement)items[i];
                    if (rtfElement is RtfList)
                    {
                        RtfList rl = (RtfList)rtfElement;
                        rl.WriteDefinition(result);
                        break;
                    }
                    else if (rtfElement is RtfListItem)
                    {
                        RtfListItem rli = (RtfListItem)rtfElement;
                        if (rli.WriteDefinition(result))
                        {
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 19
0
 /**
  * Sets the parent RtfList of this RtfList
  *
  * @param parent The parent RtfList to use.
  */
 protected internal void SetParent(RtfList parent)
 {
     this.parentList = parent;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// @since 2.1.3
 /// </summary>
 /// <param name="parentList">the parentList to set</param>
 public void SetParentList(RtfList parentList)
 {
     _parentList = parentList;
 }
Ejemplo n.º 21
0
 /**
 * Imports a stylesheet list value. The stylesheet number for the stylesheet defined
 * is determined and then the resulting mapping is added.
 */
 public bool ImportStylesheetList(String listNr, List listIn)
 {
     RtfList rtfList = new RtfList(this.rtfDoc, listIn);
     rtfList.SetRtfDocument(this.rtfDoc);
     return true;
 }
Ejemplo n.º 22
0
 /**
 * Removes a RtfList from the list table
 * 
 * @param list The RtfList to remove
 */
 public void FreeListNumber(RtfList list) {
     this.listTable.FreeListNumber(list);
 }
Ejemplo n.º 23
0
        /**
        * Takes an Element subclass and returns the correct IRtfBasicElement
        * subclass, that wraps the Element subclass.
        *
        * @param element The Element to wrap
        * @return A IRtfBasicElement wrapping the Element
        * @throws DocumentException
        */
        public IRtfBasicElement MapElement(IElement element)
        {
            IRtfBasicElement rtfElement = null;

            if (element is IRtfBasicElement) {
                rtfElement = (IRtfBasicElement) element;
                rtfElement.SetRtfDocument(this.rtfDoc);
                return rtfElement;
            }
            switch (element.Type) {
                case Element.CHUNK:
                    if (((Chunk) element).GetImage() != null) {
                        rtfElement = new RtfImage(rtfDoc, ((Chunk) element).GetImage());
                    } else if (((Chunk) element).HasAttributes() && ((Chunk) element).Attributes.ContainsKey(Chunk.NEWPAGE)) {
                        rtfElement = new RtfNewPage(rtfDoc);
                    } else {
                        rtfElement = new RtfChunk(rtfDoc, (Chunk) element);
                    }
                    break;
                case Element.PHRASE:
                    rtfElement = new RtfPhrase(rtfDoc, (Phrase) element);
                    break;
                case Element.PARAGRAPH:
                    rtfElement = new RtfParagraph(rtfDoc, (Paragraph) element);
                    break;
                case Element.ANCHOR:
                    rtfElement = new RtfAnchor(rtfDoc, (Anchor) element);
                    break;
                case Element.ANNOTATION:
                    rtfElement = new RtfAnnotation(rtfDoc, (Annotation) element);
                    break;
                case Element.IMGRAW:
                case Element.IMGTEMPLATE:
                case Element.JPEG:
                    rtfElement = new RtfImage(rtfDoc, (Image) element);
                    break;
                case Element.AUTHOR:
                case Element.SUBJECT:
                case Element.KEYWORDS:
                case Element.TITLE:
                case Element.PRODUCER:
                case Element.CREATIONDATE:
                    rtfElement = new RtfInfoElement(rtfDoc, (Meta) element);
                    break;
                case Element.LIST:
                    rtfElement = new RtfList(rtfDoc, (List) element);
                    break;
                case Element.LISTITEM:
                    rtfElement = new RtfListItem(rtfDoc, (ListItem) element);
                    break;
                case Element.SECTION:
                    rtfElement = new RtfSection(rtfDoc, (Section) element);
                    break;
                case Element.CHAPTER:
                    rtfElement = new RtfChapter(rtfDoc, (Chapter) element);
                    break;
                case Element.TABLE:
                    try {
                        rtfElement = new TB.RtfTable(rtfDoc, (Table) element);
                    }
                    catch (InvalidCastException) {
                        rtfElement = new TB.RtfTable(rtfDoc, ((SimpleTable) element).CreateTable());
                    }
                    break;
            }

            return rtfElement;
        }
Ejemplo n.º 24
0
 /**
 * Sets the parent RtfList of this RtfList
 *
 * @param parent The parent RtfList to use.
 */
 protected internal void SetParent(RtfList parent)
 {
     this.parentList = parent;
 }
 /// <summary>
 /// </summary>
 /// <param name="parent">the parent to set</param>
 public void SetParent(RtfList parent)
 {
     _parent = parent;
 }
Ejemplo n.º 26
0
 /**
 * @param parentList the parentList to set
 * @since 2.1.3
 */
 public void SetParentList(RtfList parentList)
 {
     this.parentList = parentList;
 }
Ejemplo n.º 27
0
 /**
  * @param parentList the parentList to set
  * @since 2.1.3
  */
 public void SetParentList(RtfList parentList)
 {
     this.parentList = parentList;
 }
        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;
        }