Revision: 061001e6d4ab Branch: default Author: John Boyer <john.boyer@xxxxxxxxxxxxxxxxx> Date: Fri Oct 26 07:59:31 2012 Log: changing indevelopment package to newcode http://code.google.com/p/brailleblaster/source/detail?r=061001e6d4ab Added: /src/main/org/brailleblaster/newcode/Semantics.java /src/main/org/brailleblaster/newcode/Styles.java Deleted: /src/main/org/brailleblaster/indevelopment/Semantics.java /src/main/org/brailleblaster/indevelopment/Styles.java ======================================= --- /dev/null+++ /src/main/org/brailleblaster/newcode/Semantics.java Fri Oct 26 07:59:31 2012
@@ -0,0 +1,117 @@ +/* BrailleBlaster Braille Transcription Application + * + * Copyright (C) 2010, 2012 + * ViewPlus Technologies, Inc. www.viewplus.com + * and + * Abilitiessoft, Inc. www.abilitiessoft.com + * and + * American Printing House for the Blind, Inc. www.aph.org + * + * All rights reserved + * + * This file may contain code borrowed from files produced by various + * Java development teams. These are gratefully acknoledged. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the Apache 2.0 License, as given at + * http://www.apache.org/licenses/ + * + * This file 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 Apache 2.0 License for more details. + * + * You should have received a copy of the Apache 2.0 License along with + * this program; see the file LICENSE. + * If not, see + * http://www.apache.org/licenses/ + * + * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx +*/ + +package newcode; + +import nu.xom.Document; +import nu.xom.Element; +import nu.xom.Text; +import nu.xom.Attribute; + +/** + * This class provides the means of displaying and editing different + * flavors of xml. + * This is accomplished by using a semantic-action file for each type of + * xml document, such as NIMAS, epub or docbook. Displaying and editing + * both the print and Braille windows are covered. No transformations + * are necessary. + * See also Styles.java + */ +public class Semantics { +/** + * The various actions that can be carried out on an xml document, in + * addition to processing styles. + */ +enum Action { + blankSpace, + skip, + generic, + cdata, + htmlLink, + htmlTarget, + noTranslate, + attrToText, + runningHead, + footer, + boxLine, + italic, + bold, + underline, + compbrl, + lineSpacing, + blankLine, + softReturn, + newPage, + brl, + music, + math, + chemistry, + graphic +}; + + /** + * This is an entry in the SemanticTable, which is used to control + * displaying and editing. + */ +class SemanticEntry { + String markup; + String operation; + String operand; + String parameters; + Action action; + Styles.StyleType style; + String macro; +} + +/** + * The semantic table. The semantic-action file for the type of document + * being processed is read and each line is used to create an entry in + * this table. + */ +SemanticEntry[] semanticTable = new SemanticEntry[100]; + +public boolean makeSemanticsTable (Document doc) { +return true; +} + +private void addBBSemAttr (Element element) { +} + +public void makeDocumentModel (Document doc) { +} + +private void doActionOrStyle (Element element) { +} + +public void readAndEdit (Document doc) { +} + +} ======================================= --- /dev/null+++ /src/main/org/brailleblaster/newcode/Styles.java Fri Oct 26 07:59:31 2012
@@ -0,0 +1,154 @@ +/* BrailleBlaster Braille Transcription Application + * + * Copyright (C) 2010, 2012 + * ViewPlus Technologies, Inc. www.viewplus.com + * and + * Abilitiessoft, Inc. www.abilitiessoft.com + * and + * American Printing House for the Blind, Inc. www.aph.org + * + * All rights reserved + * + * This file may contain code borrowed from files produced by various + * Java development teams. These are gratefully acknoledged. + * + * This file is free software; you can redistribute it and/or modify it + * under the terms of the Apache 2.0 License, as given at + * http://www.apache.org/licenses/ + * + * This file 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 Apache 2.0 License for more details. + * + * You should have received a copy of the Apache 2.0 License along with + * this program; see the file LICENSE. + * If not, see + * http://www.apache.org/licenses/ + * + * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx +*/ + +package newcode; + +import nu.xom.Element; +/** + * This class contains the data structures and mothods used for handling + *styles. + * <p>Styles are used in the print window only. The Braille window will + * already have been + * formatted by liblouisutdml. The rationale behind the use of styles is + * that if the print window looks good visually and the correct markup + * is used in the document, the Braille will also be formatted + * correctly.<p> + + * <p>Note that BrailleBlaster styles deal with layout. Italic, bold, + * etc. are dealt with by action methods in the Semantic class.</p> +*/ + +public class Styles { + + /** + * Reserved styles are defined by the developers. If the user + * redefines them the changed styles go in her/his directories. + */ +String[] reservedStyles = { + "document", + "para", + "heading1", + "heading2", + "heading3", + "heading4", + "heading5", + "heading6", + "heading7", + "heading8", + "heading9", + "heading10", + "contentsHeader", + "contents1", + "contents2", + "contents3", + "contents4", + "conents5", + "contents6", + "contents7", + "contents8", + "contents9", + "contents10" + }; +/** + * The different formats that can be applied to styles. + */ +enum StyleFormat { + inherit, + leftJustified, + rightJustified, + centered, + alignColumnsLeft, + alignColumnsRight, + listColumns, + listLines, + computerCoded, + contents +}; + +/** + * The status items mark the various stages in the procession of a + * style. + */ +enum StyleStatus { + error, + beforeBody, + startBody, + resumeBody, + bodyInterrupted, + afterBody, +}; + +class StyleType { + int linesBefore; + int linesAfter; + int leftMargin; + int rightMargin; + boolean keepWithNext; + boolean dontSplit; + boolean orphanControl; + int firstLineIndent; + StyleFormat format; + boolean newPageBefore; + boolean newPageAfter; +} + +class StyleRecord { + StyleType style; + StyleStatus status; + StyleFormat curStyleFormat; + Element curElement; + int curLeftMargin; + int curRightMargin; + int curFirstLineIndent; +} + +/** + * The stack array is managed as a fifo stack to handle nested styles.+ * For example, we might push a table style onto the stack in the startStyle
+ * method. Each row would then be pushed onto the stack by StartStyle+ * and removed by endStyle. When the last row has been processed, the top of
+ * the stack will contain the table style, which is then completed by + * endStyle. + */ +StyleRecord[] stack = new StyleRecord[20]; + +public boolean startStyle (Element element) { + return true; +} + +public void endStyle () { +} + +public void applyStyle (String style, String text) { +} + +} + =======================================--- /src/main/org/brailleblaster/indevelopment/Semantics.java Wed Oct 24 12:14:42 2012
+++ /dev/null @@ -1,74 +0,0 @@ -/* BrailleBlaster Braille Transcription Application - * - * Copyright (C) 2010, 2012 - * ViewPlus Technologies, Inc. www.viewplus.com - * and - * Abilitiessoft, Inc. www.abilitiessoft.com - * and - * American Printing House for the Blind, Inc. www.aph.org - * - * All rights reserved - * - * This file may contain code borrowed from files produced by various - * Java development teams. These are gratefully acknoledged. - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the Apache 2.0 License, as given at - * http://www.apache.org/licenses/ - * - * This file 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 Apache 2.0 License for more details. - * - * You should have received a copy of the Apache 2.0 License along with - * this program; see the file LICENSE. - * If not, see - * http://www.apache.org/licenses/ - * - * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx -*/ - -package indevelopment; - -public class Semantics { -enum Action { - no, - skip, - generic, - cdata, - htmlLink, - htmlTarget, - noTranslate, - attrToText, - runningHead, - footer, - boxLine, - italic, - bold, - underline, - compbrl, - lineSpacing, - blankLine, - softReturn, - newPage, - brl, - music, - math, - chemistry, - graphic -}; - -class SemanticEntry { - String markup; - String operation; - String operand; - String parameters; - Action action; - Styles.StyleType style; - String macro; -} - -SemanticEntry[] semanticTable = new SemanticEntry[100]; - -} =======================================--- /src/main/org/brailleblaster/indevelopment/Styles.java Wed Oct 24 14:03:44 2012
+++ /dev/null @@ -1,154 +0,0 @@ -/* BrailleBlaster Braille Transcription Application - * - * Copyright (C) 2010, 2012 - * ViewPlus Technologies, Inc. www.viewplus.com - * and - * Abilitiessoft, Inc. www.abilitiessoft.com - * and - * American Printing House for the Blind, Inc. www.aph.org - * - * All rights reserved - * - * This file may contain code borrowed from files produced by various - * Java development teams. These are gratefully acknoledged. - * - * This file is free software; you can redistribute it and/or modify it - * under the terms of the Apache 2.0 License, as given at - * http://www.apache.org/licenses/ - * - * This file 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 Apache 2.0 License for more details. - * - * You should have received a copy of the Apache 2.0 License along with - * this program; see the file LICENSE. - * If not, see - * http://www.apache.org/licenses/ - * - * Maintained by John J. Boyer john.boyer@xxxxxxxxxxxxxxxxx -*/ - -package indevelopment; - -import nu.xom.Element; -/** - * This class contains the data structures and mothods used for handling - *styles. - * <p>Styles are used in the print window only. The Braille window will - * already have been - * formatted by liblouisutdml. The rationale behind the use of styles is - * that if the print window looks good visually and the correct markup - * is used in the document, the Braille will also be formatted - * correctly.<p> - - * <p>Note that BrailleBlaster styles deal with layout. Italic, bold, - * etc. are dealt with by action methods in the Semantic class.</p> -*/ - -public class Styles { - - /** - * Reserved styles are defined by the developers. If the user - * redefines them the changed styles go in her/his directories. - */ -String[] reservedStyles = { - "document", - "para", - "heading1", - "heading2", - "heading3", - "heading4", - "heading5", - "heading6", - "heading7", - "heading8", - "heading9", - "heading10", - "contentsHeader", - "contents1", - "contents2", - "contents3", - "contents4", - "conents5", - "contents6", - "contents7", - "contents8", - "contents9", - "contents10" - }; -/** - * The different formats that can be applied to styles. - */ -enum StyleFormat { - inherit, - leftJustified, - rightJustified, - centered, - alignColumnsLeft, - alignColumnsRight, - listColumns, - listLines, - computerCoded, - contents -}; - -/** - * The status items mark the various stages in the procession of a - * style. - */ -enum StyleStatus { - error, - beforeBody, - startBody, - resumeBody, - bodyInterrupted, - afterBody, -}; - -class StyleType { - int linesBefore; - int linesAfter; - int leftMargin; - int rightMargin; - boolean keepWithNext; - boolean dontSplit; - boolean orphanControl; - int firstLineIndent; - StyleFormat format; - boolean newPageBefore; - boolean newPageAfter; -} - -class StyleRecord { - StyleType style; - StyleStatus status; - StyleFormat curStyleFormat; - Element curElement; - int curLeftMargin; - int curRightMargin; - int curFirstLineIndent; -} - -/** - * The stack array is managed as a fifo stack to handle nested styles.- * For example, we might push a table style onto the stack in the startStyle
- * method. Each row would then be pushed onto the stack by StartStyle- * and removed by endStyle. When the last row has been processed, the top of
- * the stack will contain the table style, which is then completed by - * endStyle. - */ -StyleRecord[] stack = new StyleRecord[20]; - -public boolean startStyle (Element element) { - return true; -} - -public void endStyle () { -} - -public void applyStyle (String style, String text) { -} - -} -