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

IE_Imp_MsWord_97 Class Reference

#include <ie_imp_MsWord_97.h>

Inheritance diagram for IE_Imp_MsWord_97:
IE_Imp

List of all members.

Public Member Functions

 IE_Imp_MsWord_97 (PD_Document *pDocument)
 ~IE_Imp_MsWord_97 ()
virtual bool supportsLoadStylesOnly ()
int _specCharProc (wvParseStruct *ps, UT_uint16 eachchar, CHP *achp)
int _charProc (wvParseStruct *ps, UT_uint16 eachchar, UT_Byte chartype, UT_uint16 lid)
int _docProc (wvParseStruct *ps, UT_uint32 tag)
int _eleProc (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)

Protected Member Functions

UT_Error _loadFile (GsfInput *input)

Private Member Functions

void _handleMetaData (wvParseStruct *ps)
int _beginSect (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _endSect (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _beginPara (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _endPara (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _beginChar (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _endChar (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _beginComment (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
int _endComment (wvParseStruct *ps, UT_uint32 tag, void *props, int dirty)
gchar * _getBookmarkName (const wvParseStruct *ps, UT_uint32 pos)
bool _insertBookmarkIfAppropriate (UT_uint32 iPos)
bool _insertBookmark (bookmark *bm)
UT_Error _handleImage (Blip *, long width, long height, long cropt, long cropb, long cropl, long cropr)
UT_Error _handlePositionedImage (Blip *, UT_String &sImageName)
bool _handleCommandField (char *command)
bool _handleFieldEnd (char *command, UT_uint32 iPos)
int _fieldProc (wvParseStruct *ps, UT_uint16 eachchar, UT_Byte chartype, UT_uint16 lid)
void _appendChar (UT_UCSChar ch)
void _flush ()
void _table_open ()
void _table_close (const wvParseStruct *ps, const PAP *apap)
void _row_open (const wvParseStruct *ps)
void _row_close ()
void _cell_open (const wvParseStruct *ps, const PAP *apap)
void _cell_close ()
void _handleStyleSheet (const wvParseStruct *ps)
void _generateCharProps (UT_String &s, const CHP *achp, wvParseStruct *ps)
void _generateParaProps (UT_String &s, const PAP *apap, wvParseStruct *ps)
int _handleBookmarks (const wvParseStruct *ps)
void _handleNotes (const wvParseStruct *ps)
void _handleTextBoxes (const wvParseStruct *ps)
bool _insertNoteIfAppropriate (UT_uint32 iDocPosition, UT_UCS4Char c)
bool _insertFootnote (const footnote *f, UT_UCS4Char c)
bool _insertEndnote (const footnote *f, UT_UCS4Char c)
bool _handleNotesText (UT_uint32 iPos)
bool _handleTextboxesText (UT_uint32 iPos)
bool _findNextTextboxSection ()
bool _findNextFNoteSection ()
bool _findNextENoteSection ()
bool _shouldUseInsert () const
bool _ensureInBlock ()
bool _appendStrux (PTStruxType pts, const PP_PropertyVector &attributes)
bool _appendObject (PTObjectType pto, const PP_PropertyVector &attributes)
bool _appendSpan (const UT_UCSChar *p, UT_uint32 length)
bool _appendStruxHdrFtr (PTStruxType pts, const PP_PropertyVector &attributes)
bool _appendObjectHdrFtr (PTObjectType pto, const PP_PropertyVector &attributes)
bool _appendSpanHdrFtr (const UT_UCSChar *p, UT_uint32 length)
bool _appendFmt (const PP_PropertyVector &attributes)
void _handleHeaders (const wvParseStruct *ps)
bool _handleHeadersText (UT_uint32 iPos, bool bDoBlockIns)
bool _insertHeaderSection (bool bDoBlockIns)
bool _build_ColumnWidths (UT_NumberVector &colWidths)
bool _isVectorFull (UT_NumberVector &vec)
void setNumberVector (UT_NumberVector &vec, UT_sint32 i, UT_sint32 val)
bool findMatchSpan (UT_sint32 iLeft, UT_sint32 iRight)
bool _ignorePosition (UT_uint32 pos)
bool _isTOCsupported (field *f)
bool _insertTOC (field *f)

Private Attributes

UT_UCS4String m_pTextRun
UT_uint32 m_nSections
bool m_bSetPageSize
UT_Stack m_stackField
bool m_bIsLower
bool m_bInSect
bool m_bInPara
bool m_bLTRCharContext
bool m_bLTRParaContext
bool m_bBidiMode
bool m_bInLink
bookmarkm_pBookmarks
UT_uint32 m_iBookmarksCount
footnotem_pFootnotes
UT_uint32 m_iFootnotesCount
footnotem_pEndnotes
UT_uint32 m_iEndnotesCount
textboxm_pTextboxes
UT_sint32 m_iTextboxCount
UT_Vector m_vLists
UT_uint32 m_iListIdIncrement [9]
UT_uint32 m_iMSWordListId
bool m_bEncounteredRevision
bool m_bInTable
int m_iRowsRemaining
int m_iCellsRemaining
int m_iCurrentRow
int m_iCurrentCell
bool m_bRowOpen
bool m_bCellOpen
UT_NumberVector m_vecColumnSpansForCurrentRow
UT_GenericVector< MsColSpan * > m_vecColumnWidths
UT_GenericVector< emObject * > m_vecEmObjects
UT_NumberVector m_vecColumnPositions
UT_String m_charProps
UT_String m_charRevs
UT_String m_charStyle
UT_String m_paraProps
UT_String m_paraStyle
UT_uint32 m_iFootnotesStart
UT_uint32 m_iFootnotesEnd
UT_uint32 m_iEndnotesStart
UT_uint32 m_iEndnotesEnd
UT_uint32 m_iNextFNote
UT_uint32 m_iNextENote
bool m_bInFNotes
bool m_bInENotes
pf_Fragm_pNotesEndSection
headerm_pHeaders
UT_uint32 m_iHeadersCount
UT_uint32 m_iHeadersStart
UT_uint32 m_iHeadersEnd
UT_uint32 m_iCurrentHeader
bool m_bInHeaders
UT_uint32 m_iCurrentSectId
UT_uint32 m_iAnnotationsStart
UT_uint32 m_iAnnotationsEnd
UT_uint32 m_iMacrosStart
UT_uint32 m_iMacrosEnd
UT_uint32 m_iTextStart
UT_uint32 m_iTextEnd
bool m_bPageBreakPending
bool m_bLineBreakPending
UT_NumberVector m_vListIdMap
bool m_bSymbolFont
UT_Dimension m_dim
UT_sint32 m_iLeft
UT_sint32 m_iRight
UT_uint32 m_iTextboxesStart
UT_uint32 m_iTextboxesEnd
UT_sint32 m_iNextTextbox
UT_uint32 m_iPrevHeaderPosition
bool m_bEvenOddHeaders
UT_sint32 m_bInTOC
bool m_bTOCsupported
bool m_bInTextboxes
pf_Fragm_pTextboxEndSection
UT_GenericVector< textboxPos * > m_vecTextboxPos
UT_sint32 m_iLeftCellPos
UT_uint32 m_iLastAppendedHeader

Constructor & Destructor Documentation

IE_Imp_MsWord_97::IE_Imp_MsWord_97 ( PD_Document pDocument  ) 

Member Function Documentation

void IE_Imp_MsWord_97::_appendChar ( UT_UCSChar  ch  )  [private]
bool IE_Imp_MsWord_97::_appendFmt ( const PP_PropertyVector attributes  )  [private]
bool IE_Imp_MsWord_97::_appendStruxHdrFtr ( PTStruxType  pts,
const PP_PropertyVector attributes 
) [private]

The append*HdrFtr() methods below are needed because in AW headers cannot be shared among sections; in contrast in Word one header can be used by a chain of sections. We get around it by duplicating that one header for each section that uses it. Since we cannot wind back throught the data stream we have to duplicate each shared header as we go using the info stored in the current header's d struct.

References PD_Document::appendStrux(), d, header::d, header::_d::frag, IE_Imp::getDoc(), UT_GenericVector< T >::getItemCount(), PD_Document::insertStruxBeforeFrag(), m_bInHeaders, m_bInPara, m_bInSect, m_iCurrentHeader, m_iHeadersCount, m_pHeaders, PTX_Block, UT_ASSERT, UT_DEBUGMSG, UT_return_val_if_fail, and xxx_UT_DEBUGMSG.

Referenced by _appendStrux().

int IE_Imp_MsWord_97::_beginComment ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]

References UT_DEBUGMSG.

Referenced by _eleProc().

int IE_Imp_MsWord_97::_beginPara ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]

References _appendObject(), _appendSpan(), _appendStrux(), _cell_close(), _cell_open(), _flush(), _generateCharProps(), _generateParaProps(), _handleHeadersText(), _handleTextboxesText(), _ignorePosition(), _row_close(), _row_open(), _table_close(), _table_open(), UT_GenericVector< T >::addItem(), PD_Document::appendFmt(), PD_Document::appendList(), UT_String::c_str(), UT_String::clear(), UT_GenericVector< T >::clear(), FREEP, gchar, IE_Imp::getDoc(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), PD_Document::getUID(), header::len, ListIdLevelPair::level, UT_UniqueId::List, ListIdLevelPair::listId, m_bBidiMode, m_bCellOpen, m_bInENotes, m_bInFNotes, m_bInHeaders, m_bInPara, m_bInSect, m_bInTable, m_bLTRParaContext, m_charProps, m_charStyle, m_iAnnotationsEnd, m_iAnnotationsStart, m_iCellsRemaining, m_iCurrentHeader, m_iEndnotesCount, m_iEndnotesEnd, m_iEndnotesStart, m_iFootnotesCount, m_iFootnotesEnd, m_iFootnotesStart, m_iHeadersCount, m_iHeadersEnd, m_iHeadersStart, m_iListIdIncrement, m_iMacrosEnd, m_iMacrosStart, m_iMSWordListId, m_iNextENote, m_iNextFNote, m_iRowsRemaining, m_iTextboxesEnd, m_iTextboxesStart, m_iTextEnd, m_iTextStart, m_paraProps, m_paraStyle, m_pEndnotes, m_pFootnotes, m_pHeaders, m_vecColumnPositions, m_vecColumnSpansForCurrentRow, m_vListIdMap, m_vLists, header::pos, PTO_Field, PTX_Block, PTX_Section, s_convert_to_utf8(), s_fieldFontForListStyle(), s_mapDocToAbiListDelim(), s_mapDocToAbiListId(), s_mapDocToAbiListStyle(), s_stripDangerousChars(), s_translateStyleId(), UT_String::size(), UT_ASSERT_HARMLESS, UT_ASSERT_NOT_REACHED, UT_DEBUGMSG, UT_std_string_sprintf(), UT_UID_INVALID, UT_VECTOR_PURGEALL, UT_UTF8String::utf8_str(), and xxx_UT_DEBUGMSG.

Referenced by _eleProc().

bool IE_Imp_MsWord_97::_build_ColumnWidths ( UT_NumberVector colWidths  )  [private]

This method parses the vector of MsColSpans held by m_vecColumnWidths and fills the vector colWidths with the widths of the individual columns.

We do this because MSWord provides the widths of column spans, and in some cases you can get a table with no row fully partitioned into individual cells.

References _isVectorFull(), UT_GenericVector< T >::addItem(), findMatchSpan(), UT_GenericVector< T >::getNthItem(), MsColSpan::iLeft, MsColSpan::iRight, m_vecColumnWidths, setNumberVector(), UT_GenericVector< T >::size(), UT_ASSERT_HARMLESS, MsColSpan::width, and xxx_UT_DEBUGMSG.

Referenced by _table_close().

void IE_Imp_MsWord_97::_cell_close (  )  [private]
int IE_Imp_MsWord_97::_charProc ( wvParseStruct ps,
UT_uint16  eachchar,
UT_Byte  chartype,
UT_uint16  lid 
)

Referenced by charProc().

int IE_Imp_MsWord_97::_eleProc ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
)
int IE_Imp_MsWord_97::_endChar ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]

Referenced by _eleProc().

int IE_Imp_MsWord_97::_endComment ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]

References UT_DEBUGMSG.

Referenced by _eleProc().

int IE_Imp_MsWord_97::_endPara ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]
int IE_Imp_MsWord_97::_endSect ( wvParseStruct ps,
UT_uint32  tag,
void *  props,
int  dirty 
) [private]
bool IE_Imp_MsWord_97::_ensureInBlock (  )  [private]
int IE_Imp_MsWord_97::_fieldProc ( wvParseStruct ps,
UT_uint16  eachchar,
UT_Byte  chartype,
UT_uint16  lid 
) [private]
void IE_Imp_MsWord_97::_generateParaProps ( UT_String s,
const PAP apap,
wvParseStruct ps 
) [private]
gchar * IE_Imp_MsWord_97::_getBookmarkName ( const wvParseStruct ps,
UT_uint32  pos 
) [private]
int IE_Imp_MsWord_97::_handleBookmarks ( const wvParseStruct ps  )  [private]
bool IE_Imp_MsWord_97::_handleHeadersText ( UT_uint32  iDocPosition,
bool  bDoBlockIns 
) [private]

This function makes sure that the insert is happening at the correct place if we are in the header segment.

UT_uint32 iDocPosition: character position in the Word document stream

Returns:
returns false if the present character is to be skipped, true otherwise

References _endSect(), _insertHeaderSection(), HF_Unsupported, m_bInENotes, m_bInFNotes, m_bInHeaders, m_bInSect, m_iCurrentHeader, m_iHeadersCount, m_iHeadersEnd, m_iHeadersStart, m_iPrevHeaderPosition, m_pHeaders, type, UT_DEBUGMSG, and xxx_UT_DEBUGMSG.

Referenced by _beginPara().

UT_Error IE_Imp_MsWord_97::_handleImage ( Blip b,
long  width,
long  height,
long  cropt,
long  cropb,
long  cropl,
long  cropr 
) [private]
void IE_Imp_MsWord_97::_handleMetaData ( wvParseStruct ps  )  [private]

References IE_Imp::getDoc(), and print_summary_stream().

Referenced by _loadFile().

bool IE_Imp_MsWord_97::_handleNotesText ( UT_uint32  iDocPosition  )  [private]

This function makes sure that the insert is happening at the correct place if we are in a segment which belongs to one of the set of notes (foonotes & endnote, in future also annotations).

UT_uint32 iDocPosition: character position in the Word document stream

Returns:
returns false if the present character is to be skipped, true otherwise

References _appendObject(), _appendStrux(), _endSect(), _findNextENoteSection(), _findNextFNoteSection(), UT_String::c_str(), m_bInENotes, m_bInFNotes, m_bInHeaders, m_bInPara, m_bInSect, m_charProps, m_charStyle, m_iEndnotesCount, m_iEndnotesEnd, m_iEndnotesStart, m_iFootnotesCount, m_iFootnotesEnd, m_iFootnotesStart, m_iNextENote, m_iNextFNote, m_paraProps, m_paraStyle, m_pEndnotes, m_pFootnotes, PTO_Field, PTX_Block, type, UT_DEBUGMSG, UT_std_string_sprintf(), and xxx_UT_DEBUGMSG.

UT_Error IE_Imp_MsWord_97::_handlePositionedImage ( Blip b,
UT_String sImageName 
) [private]

This method imports an image that can be later used as an embedded object. The Blip pointer p contains the MS Word data we use to create the image "width" and "height" are the width and height of the object in inches. The routine returns the name of the data-item it creates is in the UT_UTF8String sImageName

References UT_String::c_str(), DELETEPV, abicollab::service::error(), IE_Imp::getDoc(), IEGFT_Unknown, UT_UniqueId::Image, IE_ImpGraphic::loadGraphic(), MSWord_RasterImage, MSWord_VectorImage, s_determineImageType(), size, UT_DEBUGMSG, UT_ERROR, UT_OK, and UT_String_sprintf().

void IE_Imp_MsWord_97::_handleTextBoxes ( const wvParseStruct ps  )  [private]
bool IE_Imp_MsWord_97::_handleTextboxesText ( UT_uint32  iDocPosition  )  [private]

This function makes sure that the insert is happening at the correct place if we are in a segment which belongs to one of the set of Textboxes

UT_uint32 iDocPosition: character position in the Word document stream

Returns:
returns false if the present character is to be skipped, true otherwise

References _endSect(), _findNextTextboxSection(), m_bInFNotes, m_bInHeaders, m_bInSect, m_bInTextboxes, m_iNextTextbox, m_iTextboxCount, m_iTextboxesEnd, m_iTextboxesStart, m_pTextboxes, UT_DEBUGMSG, and xxx_UT_DEBUGMSG.

Referenced by _beginPara().

bool IE_Imp_MsWord_97::_ignorePosition ( UT_uint32  pos  )  [private]
bool IE_Imp_MsWord_97::_insertBookmarkIfAppropriate ( UT_uint32  iPos  )  [private]
bool IE_Imp_MsWord_97::_insertNoteIfAppropriate ( UT_uint32  iDocPosition,
UT_UCS4Char  c 
) [private]

Determines whether footnote is to be inserted at present document position, and if so takes care of inserting the reference marker, note section and anchor marker.

returns true if a note was successfully inserted, false otherwise; if the return value is true, the caller should ignore the present character

we will take advantage of the notes being in document order, so we can just remember the last note we inserted, rather than having to search through the list

References _insertEndnote(), _insertFootnote(), m_bInENotes, m_bInFNotes, m_iEndnotesCount, m_iFootnotesCount, m_iNextENote, m_iNextFNote, m_pEndnotes, and m_pFootnotes.

bool IE_Imp_MsWord_97::_insertTOC ( field f  )  [private]
bool IE_Imp_MsWord_97::_isTOCsupported ( field f  )  [private]

Word has several different toc tables (TOC, TOA, indexes); at the moment we only support TOC and even than only if it is based on heading styles

References field::command, command, F_TOC, F_TOC_FROM_RANGE, FREEP, field::type, UT_DEBUGMSG, and UT_return_val_if_fail.

Referenced by _handleCommandField().

bool IE_Imp_MsWord_97::_isVectorFull ( UT_NumberVector vec  )  [private]

Returns false if any element in the vector is non-zero

References UT_GenericVector< T >::size(), and xxx_UT_DEBUGMSG.

Referenced by _build_ColumnWidths().

void IE_Imp_MsWord_97::_row_close (  )  [private]

References m_bRowOpen, and xxx_UT_DEBUGMSG.

Referenced by _beginPara(), and _table_close().

void IE_Imp_MsWord_97::_row_open ( const wvParseStruct ps  )  [private]
bool IE_Imp_MsWord_97::_shouldUseInsert (  )  const [private]
int IE_Imp_MsWord_97::_specCharProc ( wvParseStruct ps,
UT_uint16  eachchar,
CHP achp 
)

Referenced by specCharProc().

void IE_Imp_MsWord_97::_table_open (  )  [private]
bool IE_Imp_MsWord_97::findMatchSpan ( UT_sint32  iLeft,
UT_sint32  iRight 
) [private]

Returns true if a span in the m_vecColumnWidths span matches the left, right values given

References UT_GenericVector< T >::getNthItem(), MsColSpan::iLeft, MsColSpan::iRight, m_vecColumnWidths, and UT_GenericVector< T >::size().

Referenced by _build_ColumnWidths().

void IE_Imp_MsWord_97::setNumberVector ( UT_NumberVector vec,
UT_sint32  i,
UT_sint32  val 
) [private]

Exand a vector with zeros to make room for a new value

References UT_GenericVector< T >::addItem(), and UT_GenericVector< T >::size().

Referenced by _build_ColumnWidths().

virtual bool IE_Imp_MsWord_97::supportsLoadStylesOnly (  )  [inline, virtual]

Reimplemented from IE_Imp.


Member Data Documentation

Referenced by _endPara(), and _endSect().

Referenced by _beginChar(), and _flush().

Referenced by _endSect().

Referenced by _beginSect().

Referenced by _beginChar().

Referenced by _beginPara().

Referenced by _beginPara().


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