Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

IE_Imp_Applix Class Reference

#include <ie_imp_Applix.h>

Inheritance diagram for IE_Imp_Applix:
IE_Imp

List of all members.

Classes

struct  Applix_mapping_t

Public Member Functions

 IE_Imp_Applix (PD_Document *pDocument)
 ~IE_Imp_Applix ()

Protected Member Functions

virtual UT_Error _loadFile (GsfInput *fp)
UT_Error _parseFile (GsfInput *fp)
UT_Error _writeHeader (GsfInput *fp)

Private Types

enum  Applix_tag_t {
  APPLIX_T, GLOBALS_T, START_STYLES_T, END_STYLES_T,
  STYLE_T, COLOR_T, START_FLOW_T, END_FLOW_T,
  WP400_T, TEXT_T, PAGE_BREAK_T, PARA_T,
  START_VARS_T, END_VARS_T, VARIABLE_T, END_DOCUMENT_T,
  OBJECT_T, PICTURE_T, SECTION_T, MARKER_T,
  START_FIELD_T, END_FIELD_T, FIELD_VALUE_T, NOT_A_TAG,
  tag_Unknown
}
enum  Applix_content_t { axCtnNone, axCtnText, axCtnField, axCtnGlossary }
enum  Applix_context_t {
  axCtxNone, axCtxDef, axCtxFlow, axCtxHdrFtr,
  axCtxFootnote, axCtxVar
}

Private Member Functions

void _dispatchTag (Applix_tag_t tag, const char *buf, size_t len)
bool _applixGetLine (UT_ByteBuf *pBuf, GsfInput *fp)
void _applixDecodeText (const char *buf, size_t len)
void _applixNewPara (const char *buf, size_t len)
void _applixPageBreak (const char *buf, size_t len)

Static Private Member Functions

static Applix_tag_t s_name_2_tag (const char *name, size_t n)
static Applix_tag_t s_getTagName (const char *str, size_t len)
static short s_8bitsToUCS (const char *str, size_t len, UT_UCSChar *c)
static short s_16bitsToUCS (const char *str, size_t len, UT_UCSChar *c)
static short s_decodeToUCS (const char *str, size_t len, UT_UCSChar *c)

Private Attributes

UT_GrowBuf m_textBuf
UT_UCS4_mbtowc m_mbtowc
Applix_context_t m_axContext

Static Private Attributes

static Applix_mapping_t axwords []

Member Enumeration Documentation

Enumerator:
axCtnNone 
axCtnText 
axCtnField 
axCtnGlossary 
Enumerator:
axCtxNone 
axCtxDef 
axCtxFlow 
axCtxHdrFtr 
axCtxFootnote 
axCtxVar 
Enumerator:
APPLIX_T 
GLOBALS_T 
START_STYLES_T 
END_STYLES_T 
STYLE_T 
COLOR_T 
START_FLOW_T 
END_FLOW_T 
WP400_T 
TEXT_T 
PAGE_BREAK_T 
PARA_T 
START_VARS_T 
END_VARS_T 
VARIABLE_T 
END_DOCUMENT_T 
OBJECT_T 
PICTURE_T 
SECTION_T 
MARKER_T 
START_FIELD_T 
END_FIELD_T 
FIELD_VALUE_T 
NOT_A_TAG 
tag_Unknown 

Constructor & Destructor Documentation

IE_Imp_Applix::IE_Imp_Applix ( PD_Document pDocument  ) 
IE_Imp_Applix::~IE_Imp_Applix (  ) 

Member Function Documentation

void IE_Imp_Applix::_applixDecodeText ( const char *  buf,
size_t  len 
) [private]

Decode a Text tag.

Parameters:
buf the buffer containing current reassembled line (ie not wrapped)
len length of the content of buf
Returns:
void Decode a Text tag and send the output to the document as text spans. It will perform span attribute decoding too and char escape descoding. Format is <T "text" attr> where T is T or Text, and "text" the text span encoded.

References UT_GrowBuf::append(), IE_Imp::appendSpan(), UT_GrowBuf::getLength(), UT_GrowBuf::getPointer(), m_mbtowc, m_textBuf, UT_UCS4_mbtowc::mbtowc(), s_decodeToUCS(), UT_GrowBuf::truncate(), and UT_DEBUGMSG.

Referenced by _dispatchTag().

bool IE_Imp_Applix::_applixGetLine ( UT_ByteBuf pBuf,
GsfInput *  fp 
) [private]

Read an ApplixLine pBuf a byte buffer

Parameters:
fp the file to read from
Returns:
true if success. Read an Applix line. Reassemble it if need since it is able to analyse that the line is wrapped.

References UT_ByteBuf::append(), APPLIX_MAX_LINE_LENGTH, fgets(), UT_ByteBuf::truncate(), UT_ASSERT, and UT_DEBUGMSG.

Referenced by _parseFile().

void IE_Imp_Applix::_applixNewPara ( const char *  buf,
size_t  len 
) [private]

Insert a new paragraph tag.

Parameters:
buf the buffer containing current reassembled line (ie not wrapped)
len length of the content of buf
Returns:
void Insert a new paragraph
Todo:
TODO handle the style and paragraph attributes.

References IE_Imp::appendSpan(), IE_Imp::appendStrux(), UT_GrowBuf::getLength(), UT_GrowBuf::getPointer(), m_textBuf, PTX_Block, and xxx_UT_DEBUGMSG.

Referenced by _dispatchTag().

void IE_Imp_Applix::_applixPageBreak ( const char *  buf,
size_t  len 
) [private]

Decode a Page Break tag.

Parameters:
buf the buffer containing current reassembled line (ie not wrapped)
len length of the content of buf
Returns:
void Insert a page break in the current flow
Todo:
TODO handle even/odd page, currently ignored by Abiword

References UT_GrowBuf::append(), IE_Imp::appendSpan(), UT_GrowBuf::getLength(), UT_GrowBuf::getPointer(), m_textBuf, and UT_GrowBuf::truncate().

Referenced by _dispatchTag().

void IE_Imp_Applix::_dispatchTag ( Applix_tag_t  tag,
const char *  buf,
size_t  len 
) [private]

Dispatch the tag to the right handler.

Parameters:
tag is the Applix tag value
buf is the complete line for parsing.
len buffer content length
Returns:
void Dispatch the tag to the right handler.
Note:
that _dispatchTag may itself read a line for line continuation. Since line continuation is predictable, this is not a problem.
See also:
IE_Imp_Applix::s_getTagName

References _applixDecodeText(), _applixNewPara(), _applixPageBreak(), axCtxFlow, END_FLOW_T, END_STYLES_T, m_axContext, PAGE_BREAK_T, PARA_T, START_FLOW_T, START_STYLES_T, TEXT_T, and UT_DEBUGMSG.

Referenced by _parseFile().

UT_Error IE_Imp_Applix::_loadFile ( GsfInput *  fp  )  [protected, virtual]

Implements IE_Imp.

References _parseFile(), _writeHeader(), and X_CleanupIfError.

UT_Error IE_Imp_Applix::_parseFile ( GsfInput *  fp  )  [protected]
UT_Error IE_Imp_Applix::_writeHeader ( GsfInput *  fp  )  [protected]
short IE_Imp_Applix::s_16bitsToUCS ( const char *  str,
size_t  len,
UT_UCSChar c 
) [static, private]

Converts an ^yxx sequence for 8 bits chars to an UCSChar

Parameters:
str the buffer containing the sequence without ^ in head
len the actual length of the buffer not includin the trailing 0. Must be at least 3
Return values:
c the output char
Returns:
the number of bytes read
Note:
the documentation is vague on this point, but I suspect that the charset is UNICODE encoded in UCS-2

References UT_ASSERT.

Referenced by s_decodeToUCS().

short IE_Imp_Applix::s_8bitsToUCS ( const char *  str,
size_t  len,
UT_UCSChar c 
) [static, private]

Converts an ^xx sequence for 8 bits chars to an UCSChar

Parameters:
str the buffer containing the sequence without ^ in head
len the actual length of the buffer not includin the trailing 0. Must be at least 2
Return values:
c the output char
Returns:
the number of bytes read
Note:
the documentation is vague on this point, but I suspect that the charset
is ISO-8859-1

References UT_ASSERT.

Referenced by s_decodeToUCS().

short IE_Imp_Applix::s_decodeToUCS ( const char *  str,
size_t  len,
UT_UCSChar c 
) [static, private]

Dispatch an ^yxx sequence to the right decoder

Parameters:
str the buffer containing the sequence without ^ in head
len the actual length of the buffer not includin the trailing 0. Must be at least 2
Return values:
c the output char
Returns:
the number of bytes read
Note:
'^' is invalid and must be handle before

References s_16bitsToUCS(), s_8bitsToUCS(), and UT_DEBUGMSG.

Referenced by _applixDecodeText().

IE_Imp_Applix::Applix_tag_t IE_Imp_Applix::s_getTagName ( const char *  str,
size_t  len 
) [static, private]

Get the tag from the buffer and return the tag value.

Parameters:
str the buffer
len the length of the buffer content
Returns:
the Applix_tag_t associated with tag Get the tag from the buffer and return the tag value. After extracting the tag from the line, call s_name_2_tag to get the tag value
See also:
IE_Imp_Applix::s_name_2_tag

References APPLIX_LINE_LENGTH, NOT_A_TAG, s_name_2_tag(), tag_Unknown, UT_DEBUGMSG, UT_UCS4_isspace(), and xxx_UT_DEBUGMSG.

Referenced by _parseFile().

IE_Imp_Applix::Applix_tag_t IE_Imp_Applix::s_name_2_tag ( const char *  name,
size_t  n 
) [static, private]

Convert a tag string to a tag value. For tokenization.

Parameters:
name tag string
n size of content
Returns:
the tag value Convert a tag string to a tag value. For tokenization. It helps by providing a code value that will helps dispatching to the right methods quickly. TODO: make it faster by using hash table or something else
See also:
IE_Imp_Applix::s_getTagName
IE_Imp_Applix::axwords

References AX_STRN_CMP, axwords, IE_Imp_Applix::Applix_mapping_t::tag, and xxx_UT_DEBUGMSG.

Referenced by s_getTagName().


Member Data Documentation


The documentation for this class was generated from the following files: