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

PL_Psion_Listener Class Reference

#include <ie_exp_Psion.h>

Inheritance diagram for PL_Psion_Listener:
PL_Listener PL_Psion_TextEd_Listener PL_Psion_Word_Listener

List of all members.

Public Member Functions

 PL_Psion_Listener (PD_Document *pDocument)
virtual ~PL_Psion_Listener (void)
virtual bool populate (fl_ContainerLayout *sfh, const PX_ChangeRecord *pcr)
virtual bool populateStrux (pf_Frag_Strux *sdh, const PX_ChangeRecord *pcr, fl_ContainerLayout **psfh)
bool startDocument (void)
bool finishDocument (void)
virtual psiconv_file createPsionFile (void)=0
virtual bool change (fl_ContainerLayout *, const PX_ChangeRecord *)
virtual bool insertStrux (fl_ContainerLayout *, const PX_ChangeRecord *, pf_Frag_Strux *, PL_ListenerId, void(*)(pf_Frag_Strux *sdhNew, PL_ListenerId lid, fl_ContainerLayout *sfhNew))
virtual bool signal (UT_uint32)

Protected Attributes

psiconv_text_and_layout m_paragraphs
psiconv_word_styles_section m_styles
psiconv_page_header m_header
psiconv_page_header m_footer

Private Types

enum  sectionType { section_none, section_header, section_footer, section_main }

Private Member Functions

bool _writeText (const UT_UCSChar *p, UT_uint32 inlength, UT_uint32 &outlength)
bool _openParagraph (const PT_AttrPropIndex api)
bool _closeParagraph (void)
bool _addInLine (const PT_AttrPropIndex api, UT_uint32 textlen)
bool _processStyles (void)
bool _setStyleLayout (PD_Style *style, psiconv_paragraph_layout para_layout, psiconv_character_layout char_layout)
bool _insertImage (const PT_AttrPropIndex api)

Private Attributes

bool m_inParagraph
sectionType m_sectionType
psiconv_list m_currentParagraphText
psiconv_paragraph_layout m_currentParagraphPLayout
psiconv_character_layout m_currentParagraphCLayout
psiconv_in_line_layouts m_currentParagraphInLines
psiconv_s16 m_currentParagraphStyle

Detailed Description

Abstract listener class for Psion files.

The actual Word and TextEd listeners are derived from this class. Listener classes are used to traverse the AbiWord document, using the defined callbacks whenever something interesting is found. This specific class builds a psiconv representation of the AbiWord document internally. The abstract createPsionFile method will need to be defined to return this psiconv document, currently in Word or TextEd form.

Member Enumeration Documentation


Constructor & Destructor Documentation

PL_Psion_Listener::PL_Psion_Listener ( PD_Document pDocument  ) 


The listener uses several psiconv_file fragments while building paragraphs (and perhaps other things). We can't allocate them here, because we can't fail in a constructor. At all places, we use NULL to indicate an unallocated structure.

PL_Psion_Listener::~PL_Psion_Listener ( void   )  [virtual]


Deallocate those psiconv_file fragments that are currently allocated. NULL is used to indicate an unallocated structure.

References m_currentParagraphCLayout, m_currentParagraphInLines, m_currentParagraphPLayout, m_currentParagraphText, m_footer, m_header, and m_paragraphs.

Member Function Documentation

bool PL_Psion_Listener::_addInLine ( const PT_AttrPropIndex  api,
UT_uint32  textlen 
) [private]
bool PL_Psion_Listener::_closeParagraph ( void   )  [private]

Close the paragraph

The current paragraph stuff is added to the paragraph list. It is safe to call this function if no paragraph is opened.

References m_currentParagraphCLayout, m_currentParagraphInLines, m_currentParagraphPLayout, m_currentParagraphStyle, m_currentParagraphText, m_footer, m_header, m_inParagraph, m_paragraphs, m_sectionType, section_footer, section_header, section_main, section_none, and UT_DEBUGMSG.

Referenced by _openParagraph(), finishDocument(), and populateStrux().

bool PL_Psion_Listener::_insertImage ( const PT_AttrPropIndex  api  )  [private]
bool PL_Psion_Listener::_setStyleLayout ( PD_Style style,
psiconv_paragraph_layout  para_layout,
psiconv_character_layout  char_layout 
) [private]

Determine the layout of this style, considering the styles it is based on.

A paragraph style is associated with a certain layout. That layout is partly defined in the style itself, and partly because it inherits layout from its parent style. This method gathers all that information, translates it to Psiconv format and puts it in para_layout and char_layout. Note that we call ourselves recursively; if we ever encounter a situation in which is style is based on itself, or is in some other circular relationship, we will crash and burn. So don't do that :-)

References PD_Document::getAttrProp(), PD_Style::getBasedOn(), PD_Style::getIndexAP(), m_pDocument, updateCharacterLayout(), and updateParagraphLayout().

Referenced by _processStyles().

bool PL_Psion_Listener::_writeText ( const UT_UCSChar p,
UT_uint32  inLength,
UT_uint32 outLength 
) [private]

Add some AbiWord document text to the current paragraph

Add some text to the current paragraph. Returns the length of the written text in outLength; this may be more or less than inLength, because some input characters may need to be represented by more than one output character, and because we may ignore some input characters.

References UT_UTF8Stringbuf::appendUCS4(), UT_UTF8Stringbuf::data(), m_currentParagraphText, UCS_ABI_OBJECT, UCS_CR, UCS_EM_DASH, UCS_EM_SPACE, UCS_EN_DASH, UCS_EN_SPACE, UCS_FF, UCS_LF, UCS_TAB, and UT_DEBUGMSG.

Referenced by populate().

virtual bool PL_Psion_Listener::change ( fl_ContainerLayout ,
const PX_ChangeRecord  
) [inline, virtual]

Implements PL_Listener.


virtual psiconv_file PL_Psion_Listener::createPsionFile ( void   )  [pure virtual]
bool PL_Psion_Listener::finishDocument ( void   ) 

Finish the traversing of the document by the Listener.

Call this after calling tellListener to traverse the document. Closes remaining paragraphs and sections.

References _closeParagraph().

Referenced by IE_Exp_Psion::_writeDocument().

virtual bool PL_Psion_Listener::insertStrux ( fl_ContainerLayout ,
const PX_ChangeRecord ,
pf_Frag_Strux ,
PL_ListenerId  ,
void(*)(pf_Frag_Strux *sdhNew,PL_ListenerId lid,fl_ContainerLayout *sfhNew)   
) [inline, virtual]

Implements PL_Listener.


bool PL_Psion_Listener::populateStrux ( pf_Frag_Strux sdh,
const PX_ChangeRecord pcr,
fl_ContainerLayout **  psfh 
) [virtual]
virtual bool PL_Psion_Listener::signal ( UT_uint32   )  [inline, virtual]

Implements PL_Listener.


bool PL_Psion_Listener::startDocument ( void   ) 

Initialize a new Psion Listener.

Call this right after the constructor. We can't call it from the constructor, because our constructor may not fail. We initialize all kinds of private variables. Some juggling is done with NULL values to make sure everything can be safely deallocated at any time by our destructor. We also parse all styles here. This is needed further on, and listeners do not traverse styles.

References _processStyles(), m_currentParagraphText, m_footer, m_header, and m_paragraphs.

Referenced by IE_Exp_Psion::_writeDocument().

Member Data Documentation

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