de.betabeans.scroogexhtml.converter
Class ScroogeXHTMLMain

java.lang.Object
  extended by de.betabeans.scroogexhtml.converter.ScroogeXHTMLBase
      extended by de.betabeans.scroogexhtml.converter.ScroogeXHTMLMain
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ScroogeXHTML

public abstract class ScroogeXHTMLMain
extends ScroogeXHTMLBase
implements java.io.Serializable

The ScroogeXHTMLMain class contains the core conversion algorithm for RTF. It follows the Microsoft Technical Documentation and Implementation Guide for RTF readers.

Author:
Michael Justin
See Also:
Serialized Form
Note:
Some RTF writers do not currently follow the requirement that keywords may not contain any uppercase alphabetic characters. To support these exceptions, uncomment the private method isAlpha and replace the calls of private method isLowerAlpha in method parseRTFKeyword by calls of isAlpha. Caution : this modification has not been tested for possible side-effects with RTF code generated by other RTF writers.

Field Summary
 
Fields inherited from class de.betabeans.scroogexhtml.converter.ScroogeXHTMLBase
DEFAULT_FONT_NR_UNKNOWN, FONTSIZE_EM, FONTSIZE_EX, FONTSIZE_PERCENT, FONTSIZE_POINT, NBSP_TAG
 
Constructor Summary
ScroogeXHTMLMain()
           
 
Method Summary
 java.lang.String convert()
          The main converter method.
 java.lang.String process(FormattedText textElement)
          The toString() methods of the FormattedText object calls this method to convert itself to HTML/XHTML.
protected  void replaceHyperlink(FormattedText textElement)
          Implements abstract method ScroogeXHTMLBase.replaceHyperlink.
protected  void setReader(java.io.PushbackReader r)
          Sets the reader attribute of the ScroogeXHTMLMain object.
 
Methods inherited from class de.betabeans.scroogexhtml.converter.ScroogeXHTMLBase
addAfterTextConversionListener, addBeforeTextConversionListener, addHyperlinkListener, addProgressListener, debug, debug, getAfterTextConversionListeners, getAfterTextConversionListenerVector, getBeforeTextConversionListeners, getBeforeTextConversionListenerVector, getCurFontCSet, getCurFontName, getCurFontNr, getCurFontType, getDebugger, getDefaultFontColor, getDefaultFontName, getDefaultFontNr, getDefaultFontSize, getDefaultFontStyleDefinition, getDefaultLanguage, getDocType, getDocumentTitle, getEmptyParagraph, getFontSizeUnit, getFontSizeUnitCode, getFormatter, getHeadTags, getHyperlinkListeners, getHyperlinkListenerVector, getLinebreakTag, getListItemTag, getMetaAuthor, getMetaContentType, getMetaDate, getMetaTags, getParClose, getParOpen, getParser, getProgressListeners, getReader, getReplaceFonts, getStyleSheetInclude, getStyleSheetLink, getTabString, getTagClass, getTagClassParam, getTagStyle, getTagStyleParam, getTranslator, getVersion, getWriter, hasProgressListeners, isAbortConversion, isAddOuterHTML, isConvertEmptyParagraphs, isConvertFontBGColor, isConvertFontColor, isConvertFontHLColor, isConvertFontName, isConvertFontSize, isConvertFontStyle, isConvertHyperlinks, isConvertIndent, isConvertLanguage, isConvertSpaces, isDebugMode, isIncludeDefaultFontStyle, isIncludeDocType, isIncludeXMLDeclaration, isMetaDateAuto, isMetaDescription, isMetaGenerator, isMetaKeywords, nameAndVersion, notifyProgress, removeAfterTextConversionListener, removeBeforeTextConversionListener, removeHyperlinkListener, removeProgressListener, setAbortConversion, setAddOuterHTML, setConvertEmptyParagraphs, setConvertFontBGColor, setConvertFontColor, setConvertFontHLColor, setConvertFontName, setConvertFontSize, setConvertFontStyle, setConvertHyperlinks, setConvertIndent, setConvertLanguage, setConvertSpaces, setCurFontCSet, setCurFontName, setCurFontNr, setCurFontType, setDebugMode, setDefaultFontColor, setDefaultFontName, setDefaultFontNr, setDefaultFontSize, setDefaultLanguage, setDocType, setDocumentTitle, setFontSizeUnit, setHeadTags, setIncludeDefaultFontStyle, setIncludeDocType, setIncludeXMLDeclaration, setMetaAuthor, setMetaContentType, setMetaDate, setMetaDateAuto, setMetaDescription, setMetaGenerator, setMetaKeywords, setMetaTags, setParser, setReader, setReplaceFonts, setStyleSheetInclude, setStyleSheetLink, setTagClass, setTagStyle, setTranslator, setWriter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScroogeXHTMLMain

public ScroogeXHTMLMain()
Method Detail

setReader

protected final void setReader(java.io.PushbackReader r)
Sets the reader attribute of the ScroogeXHTMLMain object.

Parameters:
r - The new reader value

convert

public final java.lang.String convert()
The main converter method.

Returns:
HTML/XHTML result

process

public final java.lang.String process(FormattedText textElement)
The toString() methods of the FormattedText object calls this method to convert itself to HTML/XHTML. This method performs the following operations:
  1. call all registered 'beforeConversion' event handlers
  2. replace default font style by null values (if isIncludeDefaultFontStyle() returns true)
  3. Unicode/UTF-8-encode (if it was not already marked as encoded)
  4. convert hyperlinks (if isConvertHyperlinks() returns true, this will clear the underline flag and the text color)
  5. convert all duplicate spaces to two NBSP_TAG tags (if isConvertSpaces() is true)
  6. call all registered 'afterConversion' event handlers
  7. call the translator's 'formatElement' method

Specified by:
process in class ScroogeXHTMLBase
Parameters:
textElement - The text element.
Returns:
the HTML/XHTML representation of the text element

replaceHyperlink

protected final void replaceHyperlink(FormattedText textElement)
Implements abstract method ScroogeXHTMLBase.replaceHyperlink. Replaces a hyperlink.

Specified by:
replaceHyperlink in class ScroogeXHTMLBase
Parameters:
textElement - The text element to be processed.


Copyright (c) 1998-2006 BetaSoft Michael Justin. All Rights Reserved.