📄 rtfdestinationstylesheettable.java
字号:
/* * $Id: RtfDestinationStylesheetTable.java 3580 2008-08-06 15:52:00Z howard_s $ * * Copyright 2007 by Howard Shank (hgshank@yahoo.com) * * The contents of this file are subject to the Mozilla Public License Version 1.1 * (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the License. * * The Original Code is 'iText, a free JAVA-PDF library'. * * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by * the Initial Developer are Copyright (C) 1999-2006 by Bruno Lowagie. * All Rights Reserved. * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer * are Copyright (C) 2000-2006 by Paulo Soares. All Rights Reserved. * * Contributor(s): all the names of the contributors are added in the source code * where applicable. * * Alternatively, the contents of this file may be used under the terms of the * LGPL license (the ?GNU LIBRARY GENERAL PUBLIC LICENSE?), in which case the * provisions of LGPL are applicable instead of those above. If you wish to * allow use of your version of this file only under the terms of the LGPL * License and not to allow others to use your version of this file under * the MPL, indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by the LGPL. * If you do not delete the provisions above, a recipient may use your version * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE. * * This library is free software; you can redistribute it and/or modify it * under the terms of the MPL as stated above or under the terms of the GNU * Library General Public License as published by the Free Software Foundation; * either version 2 of the License, or any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more * details. * * If you didn't download this code from the following link, you should check if * you aren't using an obsolete version: * http://www.lowagie.com/iText/ */ package com.lowagie.text.rtf.parser.destinations;import com.lowagie.text.Element;import com.lowagie.text.rtf.parser.RtfImportMgr;import com.lowagie.text.rtf.parser.RtfParser;import com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordData;import com.lowagie.text.rtf.parser.ctrlwords.RtfCtrlWordType;import com.lowagie.text.rtf.style.RtfParagraphStyle;import com.lowagie.text.rtf.style.RtfStyleTypes;/** * <code>RtfDestinationStylesheetTable</code> handles data destined for the * Stylesheet Table destination * * @author Howard Shank (hgshank@yahoo.com) * @since 2.1.0 */public class RtfDestinationStylesheetTable extends RtfDestination { private String styleName = ""; /** * <code>RtfParagraphStyle</code> object for setting styleshee values * as they are parsed from the input. */ private RtfParagraphStyle rtfParagraphStyle = null; private String elementName = ""; /** * RTF Style number from stylesheet table. */ private int styleNr = 0; /** * What kind of style is this, Paragraph or Character or Table */ private int styleType = RtfStyleTypes.PARAGRAPH; // Alignment /** * Alignment - page 85 * \qc, \qj, \ql, \qr, \qd, \qkN, \qt */ private int alignment = Element.ALIGN_LEFT; /** * Percentage of line occupied by Kashida justification (0 � low, 10 � medium, 20 � high). * \qkN */ private int justificationPercentage = 0; // Indentation /** * First line indentation. */ private int firstLineIndent = 0; /** * Left indentation */ private int leftIndent = 0; /** * Right indentation */ private int rightIndent = 0; /** * Automatically adjust right indentation when docunent grid is defined */ private int adustRightIndent = 0; /** * Mirror indents? */ private int mirrorIndent = 0; // Document Foratting Properties /** * Override orphan/widow control. */ private int overrideWidowControl = -1; // Asian Typography /** * auto spacing betwee DBC and English */ private int AutoSpaceBetweenDBCEnglish = 0; /** * auto spacing betwee DBC and numbers */ private int AutoSpaceBetweenDBCNumbers = 0; /** * No Character wrapping */ private int noCharacterWrapping = 0; /** * No Word wrapping */ private int noWordWrapping = 0; /** * No overflow period and comma */ private int noOverflowPeriodComma = 0; ////////////////////////////////////////////////////// /** * The RtfImportHeader to add color mappings to. */ private RtfImportMgr importHeader = null; private String type = ""; public RtfDestinationStylesheetTable() { super(null); } public RtfDestinationStylesheetTable(RtfParser parser, String type) { super(parser); this.importHeader = parser.getImportManager(); this.type = type; } public void setParser(RtfParser parser) { this.rtfParser = parser; this.importHeader = parser.getImportManager(); } public void setType(String value) { this.type = value; } public void setElementName(String value) { this.elementName = value; } /* (non-Javadoc) * @see com.lowagie.text.rtf.parser.destinations.RtfDestination#handleOpenNewGroup() */ public boolean handleOpeningSubGroup() { // TODO Auto-generated method stub return false; } /* (non-Javadoc) * @see com.lowagie.text.rtf.direct.RtfDestination#closeDestination() */ public boolean closeDestination() { return true; } public boolean handleControlWord(RtfCtrlWordData ctrlWordData) { boolean result = true; this.onCtrlWord(ctrlWordData); // event handler if(this.rtfParser.isImport()) { // information // start of a stylesheet element if(ctrlWordData.ctrlWord.equals("s")) { } if(ctrlWordData.ctrlWord.equals("cs")) {} if(ctrlWordData.ctrlWord.equals("ds")) {} if(ctrlWordData.ctrlWord.equals("ts")) {} if(ctrlWordData.ctrlWord.equals("tsrowd")) {} if(ctrlWordData.ctrlWord.equals("keycode")) {} if(ctrlWordData.ctrlWord.equals("shift")) { } if(ctrlWordData.ctrlWord.equals("ctrl")) { } if(ctrlWordData.ctrlWord.equals("alt")) { } //cells if(ctrlWordData.ctrlWord.equals("fn")) { } if(ctrlWordData.ctrlWord.equals("additive")) { } if(ctrlWordData.ctrlWord.equals("sbasedon")) { } if(ctrlWordData.ctrlWord.equals("snext")) { } if(ctrlWordData.ctrlWord.equals("sautoupd")) { } if(ctrlWordData.ctrlWord.equals("shidden")) { } if(ctrlWordData.ctrlWord.equals("slink")) { } if(ctrlWordData.ctrlWord.equals("slocked")) { } if(ctrlWordData.ctrlWord.equals("spersonal")) { } if(ctrlWordData.ctrlWord.equals("scompose")) { } if(ctrlWordData.ctrlWord.equals("sreply")) { } /* FORMATTING */ // brdrdef/parfmt/apoctl/tabdef/shading/chrfmt if(ctrlWordData.ctrlWord.equals("styrsid")) { } if(ctrlWordData.ctrlWord.equals("ssemihidden")) { } if(ctrlWordData.ctrlWord.equals("sqformat")) { } if(ctrlWordData.ctrlWord.equals("spriority")) { } if(ctrlWordData.ctrlWord.equals("sunhideused")) { } /* TABLE STYLES */ if(ctrlWordData.ctrlWord.equals("tscellwidth")) { } if(ctrlWordData.ctrlWord.equals("tscellwidthfts")) { } if(ctrlWordData.ctrlWord.equals("tscellpaddt")) { } if(ctrlWordData.ctrlWord.equals("tscellpaddl")) { } if(ctrlWordData.ctrlWord.equals("tscellpaddr")) { } if(ctrlWordData.ctrlWord.equals("tscellpaddb")) { } if(ctrlWordData.ctrlWord.equals("tscellpaddft"))/*0-auto, 3-twips*/ { } if(ctrlWordData.ctrlWord.equals("tscellpaddfl"))/*0-auto, 3-twips*/ { } if(ctrlWordData.ctrlWord.equals("tscellpaddfr"))/*0-auto, 3-twips*/ { } if(ctrlWordData.ctrlWord.equals("tscellpaddfb"))/*0-auto, 3-twips*/ { } if(ctrlWordData.ctrlWord.equals("tsvertalt")) { } if(ctrlWordData.ctrlWord.equals("tsvertalc")) { } if(ctrlWordData.ctrlWord.equals("tsvertalb")) { } if(ctrlWordData.ctrlWord.equals("tsnowrap")) { } if(ctrlWordData.ctrlWord.equals("tscellcfpat")) { } if(ctrlWordData.ctrlWord.equals("tscellcbpat")) { } if(ctrlWordData.ctrlWord.equals("tsbgbdiag")) { } if(ctrlWordData.ctrlWord.equals("tsbgfdiag")) { } if(ctrlWordData.ctrlWord.equals("tsbgcross")) { } if(ctrlWordData.ctrlWord.equals("tsbgdcross")) { } if(ctrlWordData.ctrlWord.equals("tsbgdkcross ")) { } if(ctrlWordData.ctrlWord.equals("tsbgdkdcross")) { } if(ctrlWordData.ctrlWord.equals("tsbghoriz")) { } if(ctrlWordData.ctrlWord.equals("tsbgvert")) { } if(ctrlWordData.ctrlWord.equals("tsbgdkhor")) { } if(ctrlWordData.ctrlWord.equals("tsbgdkvert")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrt")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrb")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrl")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrr")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrh")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrv")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrdgl")) { } if(ctrlWordData.ctrlWord.equals("tsbrdrdgr")) { } if(ctrlWordData.ctrlWord.equals("tscbandsh")) { } if(ctrlWordData.ctrlWord.equals("tscbandsv")) { } } if(ctrlWordData.ctrlWordType == RtfCtrlWordType.FLAG || ctrlWordData.ctrlWordType == RtfCtrlWordType.TOGGLE || ctrlWordData.ctrlWordType == RtfCtrlWordType.VALUE) { this.rtfParser.getState().properties.setProperty(ctrlWordData); } switch(this.rtfParser.getConversionType()) { case RtfParser.TYPE_IMPORT_FULL: result = true; break; case RtfParser.TYPE_IMPORT_FRAGMENT: 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; } /* (non-Javadoc) * @see com.lowagie.text.rtf.direct.RtfDestination#handleGroupEnd() */ public boolean handleCloseGroup() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -