⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rtflistlevel.java

📁 源码包含生成 PDF 和 HTML 的类库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
            default:	// catch all for other unsupported types
            	if(this.listType >= RtfListLevel.LIST_TYPE_BASE) {
            		result.write(intToByteArray(this.listType - RtfListLevel.LIST_TYPE_BASE));
            	}
            break;
        }
        
        result.write(LIST_LEVEL_TYPE_NEW);
        switch(this.listType) {
            case LIST_TYPE_BULLET        : result.write(intToByteArray(23)); break;
            case LIST_TYPE_NUMBERED      : result.write(intToByteArray(0)); break;
            case LIST_TYPE_UPPER_LETTERS : result.write(intToByteArray(3)); break;
            case LIST_TYPE_LOWER_LETTERS : result.write(intToByteArray(4)); break;
            case LIST_TYPE_UPPER_ROMAN   : result.write(intToByteArray(1)); break;
            case LIST_TYPE_LOWER_ROMAN   : result.write(intToByteArray(2)); break;
            /* New types */
            case LIST_TYPE_ARABIC   	 : result.write(intToByteArray(0)); break;
            case LIST_TYPE_UPPERCASE_ROMAN_NUMERAL   	 : result.write(intToByteArray(1)); break;
            case LIST_TYPE_LOWERCASE_ROMAN_NUMERAL   	 : result.write(intToByteArray(2)); break;
            case LIST_TYPE_UPPERCASE_LETTER   	 : result.write(intToByteArray(3)); break;
            case LIST_TYPE_ORDINAL_NUMBER   	 : result.write(intToByteArray(4)); break;
            case LIST_TYPE_CARDINAL_TEXT_NUMBER   	 : result.write(intToByteArray(5)); break;
            case LIST_TYPE_ORDINAL_TEXT_NUMBER   	 : result.write(intToByteArray(6)); break;
            case LIST_TYPE_LOWERCASE_LETTER   	 : result.write(intToByteArray(7)); break;
            case LIST_TYPE_ARABIC_LEADING_ZERO   	 : result.write(intToByteArray(22)); break;
            case LIST_TYPE_NO_NUMBER   	 : result.write(intToByteArray(255)); break;
            default:	// catch all for other unsupported types
            	if(this.listType >= RtfListLevel.LIST_TYPE_BASE) {
            		result.write(intToByteArray(this.listType - RtfListLevel.LIST_TYPE_BASE));
            	}
            break;
        }
        result.write(LIST_LEVEL_ALIGNMENT);
        result.write(intToByteArray(0));
        result.write(LIST_LEVEL_ALIGNMENT_NEW);
        result.write(intToByteArray(0));
        result.write(LIST_LEVEL_FOLOW);
        result.write(intToByteArray(levelFollowValue));
        result.write(LIST_LEVEL_START_AT);
        result.write(intToByteArray(this.listStartAt));
        if(this.isTentative) {
            result.write(LIST_LEVEL_TENTATIVE);
        }
        if(this.isLegal) {
            result.write(LIST_LEVEL_LEGAL);
        }
        result.write(LIST_LEVEL_SPACE);
        result.write(intToByteArray(0));
        result.write(LIST_LEVEL_INDENT);
        result.write(intToByteArray(0));
        if(levelPicture != -1) {
            result.write(LIST_LEVEL_PICTURE);
            result.write(intToByteArray(levelPicture));
        }
        
        result.write(OPEN_GROUP); // { leveltext
        result.write(LIST_LEVEL_TEXT);
        result.write(LIST_LEVEL_TEMPLATE_ID);
        result.write(intToByteArray(this.templateID));
        /* NEVER seperate the LEVELTEXT elements with a return in between 
         * them or it will not fuction correctly!
         */
        // TODO Needs to be rewritten to support 1-9 levels, not just simple single level
        if(this.listType != LIST_TYPE_BULLET) {
            result.write(LIST_LEVEL_STYLE_NUMBERED_BEGIN);
            if(this.levelTextNumber < 10) {
                result.write(intToByteArray(0));
            }
            result.write(intToByteArray(this.levelTextNumber));
            result.write(LIST_LEVEL_STYLE_NUMBERED_END);
        } else {
            result.write(LIST_LEVEL_STYLE_BULLETED_BEGIN);
            this.document.filterSpecialChar(result, this.bulletCharacter, false, false);
            result.write(LIST_LEVEL_STYLE_BULLETED_END);
        }
        result.write(CLOSE_GROUP);	// } leveltext
        
        result.write(OPEN_GROUP);  // { levelnumbers
        result.write(LIST_LEVEL_NUMBERS_BEGIN);
        if(this.listType != LIST_TYPE_BULLET) {
            result.write(LIST_LEVEL_NUMBERS_NUMBERED);
        }
        result.write(LIST_LEVEL_NUMBERS_END);
        result.write(CLOSE_GROUP);// { levelnumbers
        
        // write properties now
        result.write(RtfFontList.FONT_NUMBER);
        if(this.listType != LIST_TYPE_BULLET) {
            result.write(intToByteArray(fontNumber.getFontNumber()));
        } else {
            result.write(intToByteArray(fontBullet.getFontNumber()));
        }
        result.write(DocWriter.getISOBytes("\\cf"));
//        document.getDocumentHeader().getColorNumber(new RtfColor(this.document,this.getFontNumber().getColor()));
        result.write(intToByteArray(document.getDocumentHeader().getColorNumber(new RtfColor(this.document,this.getFontNumber().getColor()))));
            
        writeIndentation(result);
        result.write(CLOSE_GROUP);
        this.document.outputDebugLinebreak(result);
        
	}
    /**
     * unused
     */    
    public void writeContent(final OutputStream result) throws IOException
    {
    }     
    
    /**
     * Writes only the list number and list level number.
     * 
     * @param result The <code>OutputStream</code> to write to
     * @throws IOException On i/o errors.
     */
    protected void writeListNumbers(final OutputStream result) throws IOException {

        if(listLevel > 0) {
            result.write(RtfList.LIST_LEVEL_NUMBER);
            result.write(intToByteArray(listLevel));
        }
    }
    
    
    /**
     * Write the indentation values for this <code>RtfList</code>.
     * 
     * @param result The <code>OutputStream</code> to write to.
     * @throws IOException On i/o errors.
     */
    public void writeIndentation(final OutputStream result) throws IOException {
        result.write(LIST_LEVEL_FIRST_INDENT);
        result.write(intToByteArray(firstIndent));
        result.write(RtfParagraphStyle.INDENT_LEFT);
        result.write(intToByteArray(leftIndent));
        result.write(RtfParagraphStyle.INDENT_RIGHT);
        result.write(intToByteArray(rightIndent));
        result.write(LIST_LEVEL_SYMBOL_INDENT);
        result.write(intToByteArray(this.leftIndent));

    }
    /**
     * Writes the initialization part of the RtfList
     * 
     * @param result The <code>OutputStream</code> to write to
     * @throws IOException On i/o errors.
     */
    public void writeListBeginning(final OutputStream result) throws IOException {
        result.write(RtfParagraph.PARAGRAPH_DEFAULTS);
        if(this.inTable) {
            result.write(RtfParagraph.IN_TABLE);
        }
        switch (this.alignment) {
            case Element.ALIGN_LEFT:
                result.write(RtfParagraphStyle.ALIGN_LEFT);
                break;
            case Element.ALIGN_RIGHT:
                result.write(RtfParagraphStyle.ALIGN_RIGHT);
                break;
            case Element.ALIGN_CENTER:
                result.write(RtfParagraphStyle.ALIGN_CENTER);
                break;
            case Element.ALIGN_JUSTIFIED:
            case Element.ALIGN_JUSTIFIED_ALL:
                result.write(RtfParagraphStyle.ALIGN_JUSTIFY);
                break;
        }
        writeIndentation(result);
        result.write(RtfFont.FONT_SIZE);
        result.write(intToByteArray(fontNumber.getFontSize() * 2));
        if(this.symbolIndent > 0) {
            result.write(LIST_LEVEL_SYMBOL_INDENT);
            result.write(intToByteArray(this.leftIndent));
        }
    }
    /**
     * Correct the indentation of this level
     */
    protected void correctIndentation() {

        if(this.listLevelParent != null) {
            this.leftIndent = this.leftIndent + this.listLevelParent.getLeftIndent() + this.listLevelParent.getFirstIndent();
        }
    }
    /**
     * Gets the list level of this RtfList
     * 
     * @return Returns the list level.
     */
    public int getListLevel() {
        return listLevel;
    }
    
    
    /**
     * Sets the list level of this RtfList. 
     * 
     * @param listLevel The list level to set.
     */
    public void setListLevel(int listLevel) {
        this.listLevel = listLevel;
    }
    
    
	public String getBulletCharacter() {
		return this.bulletCharacter;
	}
	/**
	 * @return the listStartAt
	 */
	public int getListStartAt() {
		return listStartAt;
	}
	/**
	 * @param listStartAt the listStartAt to set
	 */
	public void setListStartAt(int listStartAt) {
		this.listStartAt = listStartAt;
	}

	/**
	 * @return the firstIndent
	 */
	public int getFirstIndent() {
		return firstIndent;
	}
	/**
	 * @param firstIndent the firstIndent to set
	 */
	public void setFirstIndent(int firstIndent) {
		this.firstIndent = firstIndent;
	}
	/**
	 * @return the leftIndent
	 */
	public int getLeftIndent() {
		return leftIndent;
	}
	/**
	 * @param leftIndent the leftIndent to set
	 */
	public void setLeftIndent(int leftIndent) {
		this.leftIndent = leftIndent;
	}
	/**
	 * @return the rightIndent
	 */
	public int getRightIndent() {
		return rightIndent;
	}
	/**
	 * @param rightIndent the rightIndent to set
	 */
	public void setRightIndent(int rightIndent) {
		this.rightIndent = rightIndent;
	}
	/**
	 * @return the symbolIndent
	 */
	public int getSymbolIndent() {
		return symbolIndent;
	}
	/**
	 * @param symbolIndent the symbolIndent to set
	 */
	public void setSymbolIndent(int symbolIndent) {
		this.symbolIndent = symbolIndent;
	}
	/**
	 * @return the parent
	 */
	public RtfList getParent() {
		return parent;
	}
	/**
	 * @param parent the parent to set
	 */
	public void setParent(RtfList parent) {
		this.parent = parent;
	}
	/**
	 * @param bulletCharacter the bulletCharacter to set
	 */
	public void setBulletCharacter(String bulletCharacter) {
		this.bulletCharacter = bulletCharacter;
	}
	/**
	 * 
	 * @param bulletCharacter
	 * @since 2.1.4
	 */
	public void setBulletChunk(Chunk bulletCharacter) {
		this.bulletChunk = bulletCharacter;
	}
	/**
	 * @return the listType
	 */
	public int getListType() {
		return listType;
	}
	/**
	 * @param listType the listType to set
	 */
	public void setListType(int listType) {
		this.listType = listType;
	}
	/**
	 * set the bullet font
	 * @param f
	 */
	public void setBulletFont(Font f) {
		this.fontBullet = new RtfFont(document, f);
	}

	/**
	 * @return the fontNumber
	 */
	public RtfFont getFontNumber() {
		return fontNumber;
	}

	/**
	 * @param fontNumber the fontNumber to set
	 */
	public void setFontNumber(RtfFont fontNumber) {
		this.fontNumber = fontNumber;
	}

	/**
	 * @return the fontBullet
	 */
	public RtfFont getFontBullet() {
		return fontBullet;
	}

	/**
	 * @param fontBullet the fontBullet to set
	 */
	public void setFontBullet(RtfFont fontBullet) {
		this.fontBullet = fontBullet;
	}

	/**
	 * @return the isTentative
	 */
	public boolean isTentative() {
		return isTentative;
	}

	/**
	 * @param isTentative the isTentative to set
	 */
	public void setTentative(boolean isTentative) {
		this.isTentative = isTentative;
	}

	/**
	 * @return the isLegal
	 */
	public boolean isLegal() {
		return isLegal;
	}

	/**
	 * @param isLegal the isLegal to set
	 */
	public void setLegal(boolean isLegal) {
		this.isLegal = isLegal;
	}

	/**
	 * @return the levelFollowValue
	 */
	public int getLevelFollowValue() {
		return levelFollowValue;
	}

	/**
	 * @param levelFollowValue the levelFollowValue to set
	 */
	public void setLevelFollowValue(int levelFollowValue) {
		this.levelFollowValue = levelFollowValue;
	}

	/**
	 * @return the levelTextNumber
	 */
	public int getLevelTextNumber() {
		return levelTextNumber;
	}

	/**
	 * @param levelTextNumber the levelTextNumber to set
	 */
	public void setLevelTextNumber(int levelTextNumber) {
		this.levelTextNumber = levelTextNumber;
	}

	/**
	 * @return the listLevelParent
	 */
	public RtfListLevel getListLevelParent() {
		return listLevelParent;
	}

	/**
	 * @param listLevelParent the listLevelParent to set
	 */
	public void setListLevelParent(RtfListLevel listLevelParent) {
		this.listLevelParent = listLevelParent;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -