Public Member Functions | Protected Member Functions | Static Private Member Functions | Private Attributes | Friends

IE_Exp_RTF Class Reference

#include <ie_exp_RTF.h>

Inheritance diagram for IE_Exp_RTF:
IE_Exp

List of all members.

Public Member Functions

 IE_Exp_RTF (PD_Document *pDocument)
 IE_Exp_RTF (PD_Document *pDocument, bool atticFormat)
virtual ~IE_Exp_RTF ()
ie_exp_RTF_MsWord97ListMultigetNthMultiLevel (UT_uint32 i) const
ie_exp_RTF_MsWord97ListSimplegetNthSimple (UT_uint32 i) const
ie_exp_RTF_ListOveridegetNthOveride (UT_uint32 i) const
UT_uint32 getMultiLevelCount (void) const
UT_uint32 getSimpleListCount (void) const
UT_uint32 getOverideCount (void) const
UT_uint32 getMatchingOverideNum (UT_uint32 ID)
void exportHdrFtr (const char *pszHdrFtr, const char *pszHdrFtrID, const char *pszKeyword)
UT_BidiCharType isCharRTL ()
void setCharRTL (UT_BidiCharType t)
void setByteBuf (UT_ByteBuf *pBuf)
UT_ByteBufgetByteBuf (void)

Protected Member Functions

virtual UT_Error _writeDocument (void)
UT_Error _writeDocumentLocal (bool bSkipHeader)
UT_sint32 _findColor (const char *szColor) const
UT_sint32 _findOrAddColor (const char *szColor)
void _addColor (const char *szColor)
void _rtf_open_brace (void)
void _rtf_close_brace (void)
bool _rtf_reopen_brace (void)
void _rtf_keyword (const char *szKey)
void _rtf_keyword (const char *szKey, UT_sint32 d)
void _rtf_keyword_space (const char *szKey, UT_sint32 d)
void _rtf_keyword (const char *szKey, const char *szValue)
void _rtf_nonascii_hex2 (UT_sint32 d)
void _rtf_nonascii_hex2 (UT_sint32 d, UT_String &pStr)
void _rtf_keyword_hex2 (const char *szKey, UT_sint32 d)
void _rtf_keyword_ifnotdefault (const char *szKey, const char *szValue, UT_sint32 defaultValue)
void _rtf_keyword_ifnotdefault_twips (const char *szKey, const char *szValue, UT_sint32 defaultValue)
void _rtf_semi (void)
void _rtf_fontname (const char *szFontName)
void _rtf_chardata (const char *pbuf, UT_uint32 buflen)
void _rtf_chardata (const std::string &buf)
void _rtf_pcdata (UT_UTF8String &sPCData, bool bSupplyUC=false, UT_uint32 iAltChars=1)
void _rtf_pcdata (const std::string &szPCData, bool bSupplyUC=false, UT_uint32 iAltChars=1)
void _rtf_pcdata (const char *szPCData, bool bSupplyUC=false, UT_uint32 iAltChars=1)
void _rtf_nl (void)
const gchar * _getStyleProp (s_RTF_AttrPropAdapter_Style *pADStyle, const s_RTF_AttrPropAdapter *apa, const char *szProp)
bool _write_rtf_header (void)
bool _write_rtf_trailer (void)
void _clearStyles ()
void _selectStyles ()
UT_uint32 _getStyleNumber (const PD_Style *pStyle)
UT_uint32 _getStyleNumber (const gchar *szStyleName)
void _write_prop_ifnotdefault (const PD_Style *pStyle, const gchar *szPropName, const char *szRTFName)
void _write_prop_ifyes (const PD_Style *pStyle, const gchar *szPropName, const char *szRTFName)
void _write_tabdef (const char *szTabStops)
void _write_charfmt (const s_RTF_AttrPropAdapter &)
void _write_parafmt (const PP_AttrProp *pSpanAP, const PP_AttrProp *pBlockAP, const PP_AttrProp *pSectionAP, bool &bStartedList, pf_Frag_Strux *sdh, UT_uint32 &iCurrID, bool &bIsListBlock, UT_sint32 iNestLevel)
void _write_style_fmt (const PD_Style *)
void _write_stylesheets (void)
void _write_listtable (void)
void _output_MultiLevelRTF (ie_exp_RTF_MsWord97ListMulti *pMulti)
void _output_SimpleListRTF (ie_exp_RTF_MsWord97ListSimple *pSimple)
void _output_OveridesRTF (ie_exp_RTF_ListOveride *pOver, UT_uint32 i)
void _output_ListRTF (const fl_AutoNumConstPtr &pAuto, UT_uint32 iLevel)
void _output_LevelText (const fl_AutoNumConstPtr &pAuto, UT_uint32 iLevel, UT_UCSChar bulletsym)
void _get_LeftRight_Side (UT_String &LeftSide, UT_String &RightSide)
void _generate_level_Text (const fl_AutoNumConstPtr &pAuto, UT_String &LevelText, UT_String &LevelNumbers, UT_uint32 &lenText, UT_uint32 &ifoundLevel)
void _output_revision (const s_RTF_AttrPropAdapter &apa, bool bPara, pf_Frag_Strux *sdh, UT_sint32 iNestLevel, bool &bStartedList, bool &bIsListBlock, UT_uint32 &iCurrID)
UT_sint32 _findFont (const s_RTF_AttrPropAdapter *apa) const
UT_sint32 _findFont (const _rtf_font_info *pfi) const
void _addFont (const _rtf_font_info *pfi)

Static Private Member Functions

static bool s_escapeString (UT_UTF8String &sOutStr, UT_UCS4String &sInStr, UT_uint32 iAltChars)
static bool s_escapeString (UT_UTF8String &sOutStr, const char *szInStr, UT_uint32 iSize, UT_uint32 iAltChars)
static bool s_escapeString (std::string &outStr, const std::string &inStr, UT_uint32 iAltChars=1)
static std::string s_escapeString (const std::string &inStr, UT_uint32 iAltChars=1)
static std::string s_escapeXMLString (const std::string &inStr)

Private Attributes

s_RTF_ListenerWriteDocm_pListenerWriteDoc
UT_Vector m_vecColors
UT_Vector m_vecFonts
bool m_bNeedUnicodeText
UT_sint32 m_braceLevel
bool m_bLastWasKeyword
bool m_atticFormat
UT_GenericStringMap
< NumberedStyle * > 
m_hashStyles
UT_Vector m_vecMultiLevel
UT_Vector m_vecSimpleList
UT_Vector m_vecOverides
UT_BidiCharType m_CharRTL
UT_iconv_t m_conv

Friends

class s_RTF_ListenerWriteDoc
class s_RTF_ListenerGetProps

Constructor & Destructor Documentation

IE_Exp_RTF::IE_Exp_RTF ( PD_Document pDocument,
bool  atticFormat 
)
IE_Exp_RTF::~IE_Exp_RTF (  )  [virtual]

Member Function Documentation

void IE_Exp_RTF::_addFont ( const _rtf_font_info pfi  )  [protected]

Add a font to the font table. The font must not be present in the font table at the start of the call.

References _findFont(), UT_GenericVector< T >::addItem(), m_vecFonts, and UT_return_if_fail.

Referenced by s_RTF_ListenerGetProps::_check_revs_for_font(), s_RTF_ListenerGetProps::_compute_span_properties(), and _selectStyles().

void IE_Exp_RTF::_clearStyles (  )  [protected]

Clear the style hash.

References m_hashStyles, and UT_GenericStringMap< T >::purgeData().

Referenced by _selectStyles(), and ~IE_Exp_RTF().

UT_sint32 IE_Exp_RTF::_findFont ( const _rtf_font_info pfi  )  const [protected]

Find a font in the font table. Return the index of the font. If it is not found, return -1.

References _rtf_font_info::_is_same(), UT_GenericVector< T >::getItemCount(), UT_GenericVector< T >::getNthItem(), m_vecFonts, and UT_return_val_if_fail.

UT_sint32 IE_Exp_RTF::_findOrAddColor ( const char *  szColor  )  [protected]
void IE_Exp_RTF::_generate_level_Text ( const fl_AutoNumConstPtr pAuto,
UT_String LevelText,
UT_String LevelNumbers,
UT_uint32 lenText,
UT_uint32 ifoundLevel 
) [protected]

This method generates the leveltext and levelnumber strings.HOWEVER it does not generate the leading text string which is the length of the string. It is the responsibility of the calling routine to this.

References _get_LeftRight_Side(), _rtf_nonascii_hex2(), UT_String::c_str(), UT_String::clear(), UT_String::size(), and xxx_UT_DEBUGMSG.

Referenced by _output_LevelText().

void IE_Exp_RTF::_get_LeftRight_Side ( UT_String LeftSide,
UT_String RightSide 
) [protected]

This method splits the abiword List delim string into text to the left and right of the "%L" marker. The input string is in LeftSide.

References UT_String::c_str(), UT_String::clear(), UT_String::substr(), and xxx_UT_DEBUGMSG.

Referenced by _generate_level_Text().

UT_uint32 IE_Exp_RTF::_getStyleNumber ( const PD_Style pStyle  )  [protected]

Return the style number that was assigned to the given style. The style must be present in the style hash.

References PD_Style::getName().

Referenced by s_RTF_ListenerWriteDoc::_openSpan(), _write_charfmt(), _write_parafmt(), and _write_stylesheets().

UT_uint32 IE_Exp_RTF::_getStyleNumber ( const gchar *  szStyle  )  [protected]

Return the style number that was assigned to the named style. The style must be present in the style hash.

References m_hashStyles, NumberedStyle::n, UT_GenericStringMap< T >::pick(), and UT_ASSERT_HARMLESS.

const gchar * IE_Exp_RTF::_getStyleProp ( s_RTF_AttrPropAdapter_Style pADStyle,
const s_RTF_AttrPropAdapter apa,
const char *  szProp 
) [protected]
void IE_Exp_RTF::_output_LevelText ( const fl_AutoNumConstPtr pAuto,
UT_uint32  iLevel,
UT_UCSChar  bulletsym 
) [protected]

This method outputs the RTF defintion of the list pointed to by pAuto

References _generate_level_Text(), _rtf_close_brace(), _rtf_keyword(), _rtf_nonascii_hex2(), _rtf_open_brace(), UT_String::c_str(), UT_std_string_sprintf(), IE_Exp::write(), and xxx_UT_DEBUGMSG.

Referenced by _output_ListRTF().

void IE_Exp_RTF::_output_MultiLevelRTF ( ie_exp_RTF_MsWord97ListMulti pMulti  )  [protected]
void IE_Exp_RTF::_output_OveridesRTF ( ie_exp_RTF_ListOveride pOver,
UT_uint32  i 
) [protected]

Actually output the RTF from an Overide

Parameters:
ie_exp_RTF_Overide * pOver pointer to an Overide definition

References _output_ListRTF(), _rtf_close_brace(), _rtf_keyword(), _rtf_open_brace(), ie_exp_RTF_ListOveride::getAutoNum(), and ie_exp_RTF_ListOveride::getOverideID().

Referenced by _write_listtable().

void IE_Exp_RTF::_output_SimpleListRTF ( ie_exp_RTF_MsWord97ListSimple pSimple  )  [protected]
void IE_Exp_RTF::_rtf_chardata ( const std::string &  buf  )  [protected]

References _rtf_chardata().

void IE_Exp_RTF::_rtf_fontname ( const char *  szFontName  )  [protected]
void IE_Exp_RTF::_rtf_keyword ( const char *  szKey  )  [protected]

References m_bLastWasKeyword, and IE_Exp::write().

Referenced by s_RTF_ListenerWriteDoc::_close_cell(), s_RTF_ListenerWriteDoc::_close_table(), s_RTF_ListenerWriteDoc::_closeBlock(), s_RTF_ListenerWriteDoc::_export_AbiWord_Cell_props(), s_RTF_ListenerWriteDoc::_export_AbiWord_Table_props(), s_RTF_ListenerWriteDoc::_exportCellProps(), s_RTF_ListenerWriteDoc::_newRow(), s_RTF_ListenerWriteDoc::_open_cell(), s_RTF_ListenerWriteDoc::_open_table(), s_RTF_ListenerWriteDoc::_openFrame(), s_RTF_ListenerWriteDoc::_openSpan(), s_RTF_ListenerWriteDoc::_openTag(), _output_LevelText(), _output_ListRTF(), _output_MultiLevelRTF(), _output_OveridesRTF(), _output_revision(), _output_SimpleListRTF(), s_RTF_ListenerWriteDoc::_outputCellBorders(), s_RTF_ListenerWriteDoc::_outputData(), s_RTF_ListenerWriteDoc::_outputTableBorders(), s_RTF_ListenerWriteDoc::_rtf_docfmt(), s_RTF_ListenerWriteDoc::_rtf_info(), s_RTF_ListenerWriteDoc::_rtf_open_section(), _rtf_pcdata(), _write_charfmt(), _write_listtable(), _write_parafmt(), _write_prop_ifyes(), _write_rtf_header(), _write_style_fmt(), _write_stylesheets(), _write_tabdef(), s_RTF_ListenerWriteDoc::_writeAnnotation(), s_RTF_ListenerWriteDoc::_writeBookmark(), s_RTF_ListenerWriteDoc::_writeEmbedData(), s_RTF_ListenerWriteDoc::_writeFieldPreamble(), s_RTF_ListenerWriteDoc::_writeFieldTrailer(), s_RTF_ListenerWriteDoc::_writeHyperlink(), s_RTF_ListenerWriteDoc::_writeImageInRTF(), s_RTF_ListenerWriteDoc::_writeRDFAnchor(), s_RTF_ListenerWriteDoc::_writeSPNumProp(), s_RTF_ListenerWriteDoc::_writeTOC(), exportHdrFtr(), s_RTF_ListenerWriteDoc::populate(), and s_RTF_ListenerWriteDoc::populateStrux().

void IE_Exp_RTF::_rtf_keyword ( const char *  szKey,
UT_sint32  d 
) [protected]
void IE_Exp_RTF::_rtf_keyword ( const char *  szKey,
const char *  szValue 
) [protected]
void IE_Exp_RTF::_rtf_keyword_hex2 ( const char *  szKey,
UT_sint32  d 
) [protected]
void IE_Exp_RTF::_rtf_keyword_ifnotdefault ( const char *  szKey,
const char *  szValue,
UT_sint32  defaultValue 
) [protected]
void IE_Exp_RTF::_rtf_keyword_space ( const char *  szKey,
UT_sint32  d 
) [protected]
void IE_Exp_RTF::_rtf_nonascii_hex2 ( UT_sint32  d,
UT_String pStr 
) [protected]

References UT_String_sprintf().

void IE_Exp_RTF::_rtf_pcdata ( UT_UTF8String sPCData,
bool  bSupplyUC = false,
UT_uint32  iAltChars = 1 
) [protected]
void IE_Exp_RTF::_rtf_pcdata ( const std::string &  szPCData,
bool  bSupplyUC = false,
UT_uint32  iAltChars = 1 
) [protected]

References _rtf_pcdata().

void IE_Exp_RTF::_rtf_pcdata ( const char *  szPCData,
bool  bSupplyUC = false,
UT_uint32  iAltChars = 1 
) [protected]

References _rtf_pcdata().

bool IE_Exp_RTF::_rtf_reopen_brace ( void   )  [protected]
void IE_Exp_RTF::_rtf_semi ( void   )  [protected]
void IE_Exp_RTF::_selectStyles (  )  [protected]

Select styles for export. This inserts all styles to be exported into the style hash. Also, it makes sure that all fonts used in styles are present in the font table.

References _addFont(), _clearStyles(), _findFont(), PD_Document::enumStyles(), PD_Document::getAllUsedStyles(), IE_Exp::getDoc(), PD_Style::getName(), UT_GenericVector< T >::getNthItem(), PD_Document::getStyleCount(), _rtf_font_info::init(), UT_GenericStringMap< T >::insert(), m_hashStyles, UT_GenericStringMap< T >::pick(), and UT_return_if_fail.

Referenced by _writeDocumentLocal().

void IE_Exp_RTF::_write_parafmt ( const PP_AttrProp pSpanAP,
const PP_AttrProp pBlockAP,
const PP_AttrProp pSectionAP,
bool &  bStartedList,
pf_Frag_Strux sdh,
UT_uint32 iCurrID,
bool &  bIsListBlock,
UT_sint32  iNestLevel 
) [protected]

Write out paragraphs-specific fmt. This does not print opening and closing braces.

Output fallback numbered/bulleted label for rtf readers that don't know /*/pn

OK we need to output the char props if there is a list here

OK if there is list info in this paragraph we encase it inside the {\*..} extension

field font

list decimal

list delim

list style

Finished!

OK Now output word-95 style lists

extract text before and after numbering symbol

OK Now output word-97 style lists. First detect if we've moved to a new list list structure. We need m_currID to track the previous list we were in.

References _findOrAddColor(), _getStyleNumber(), _rtf_chardata(), _rtf_close_brace(), _rtf_keyword(), _rtf_keyword_ifnotdefault(), _rtf_keyword_ifnotdefault_twips(), _rtf_open_brace(), _write_charfmt(), _write_tabdef(), BULLETED_LIST, UT_UTF8String::byteLength(), UT_String::c_str(), gchar, PP_AttrProp::getAttribute(), PD_Document::getAttrProp(), IE_Exp::getDoc(), PD_Document::getListByID(), getMatchingOverideNum(), PP_AttrProp::getProperty(), LOWERCASE_LIST, LOWERROMAN_LIST, NOT_A_LIST, NUMBERED_LIST, PP_evalProperty(), UPPERCASE_LIST, UPPERROMAN_LIST, UT_ASSERT_HARMLESS, UT_convertDimensionless(), UT_DEBUGMSG, UT_hasDimensionComponent(), UT_return_if_fail, UT_String_sprintf(), UT_UTF8String::utf8_str(), IE_Exp::write(), and xxx_UT_DEBUGMSG.

Referenced by _output_revision(), and s_RTF_ListenerWriteDoc::_rtf_open_block().

void IE_Exp_RTF::_write_prop_ifnotdefault ( const PD_Style pStyle,
const gchar *  szPropName,
const char *  szRTFName 
) [protected]

Write an rtf keyword if the given property isn't the default value. Use this only with twips-valued properties.

!param pStyle A style. !param szPropName The property to check. !param szRTFName The RTF keyword to use if the property doesn't have the default value.

References _rtf_keyword_ifnotdefault_twips(), gchar, and PD_Style::getProperty().

Referenced by _write_style_fmt().

void IE_Exp_RTF::_write_prop_ifyes ( const PD_Style pStyle,
const gchar *  szPropName,
const char *  szRTFName 
) [protected]

Write an RTF keyword if the given property is "yes".

References _rtf_keyword(), gchar, and PD_Style::getProperty().

Referenced by _write_style_fmt().

bool IE_Exp_RTF::_write_rtf_trailer ( void   )  [protected]
void IE_Exp_RTF::_write_style_fmt ( const PD_Style pStyle  )  [protected]
void IE_Exp_RTF::_write_stylesheets ( void   )  [protected]
UT_Error IE_Exp_RTF::_writeDocument ( void   )  [protected, virtual]

Implements IE_Exp.

References _writeDocumentLocal().

void IE_Exp_RTF::exportHdrFtr ( const char *  pszHdrFtr,
const char *  pszHdrFtrID,
const char *  pszKeyWord 
)
UT_ByteBuf* IE_Exp_RTF::getByteBuf ( void   )  [inline]
UT_uint32 IE_Exp_RTF::getMatchingOverideNum ( UT_uint32  ID  ) 

Return the the number of the overide that matches the given ID. Returns 0 on failure to find a matching ID.

References ie_exp_RTF_ListOveride::doesOverideMatch(), getNthOveride(), getOverideCount(), and ie_exp_RTF_ListOveride::getOverideID().

Referenced by _write_parafmt().

UT_uint32 IE_Exp_RTF::getMultiLevelCount ( void   )  const

Get Number of multilevel lists in the document

References UT_GenericVector< T >::getItemCount(), and m_vecMultiLevel.

ie_exp_RTF_MsWord97ListMulti * IE_Exp_RTF::getNthMultiLevel ( UT_uint32  i  )  const

Get ith Multilevel list

References UT_GenericVector< T >::getNthItem(), and m_vecMultiLevel.

Referenced by _write_listtable().

ie_exp_RTF_ListOveride * IE_Exp_RTF::getNthOveride ( UT_uint32  i  )  const
ie_exp_RTF_MsWord97ListSimple * IE_Exp_RTF::getNthSimple ( UT_uint32  i  )  const

Get ith Simple list

References UT_GenericVector< T >::getNthItem(), and m_vecSimpleList.

Referenced by _write_listtable().

UT_uint32 IE_Exp_RTF::getOverideCount ( void   )  const

Get Number of overides in the document

References UT_GenericVector< T >::getItemCount(), and m_vecOverides.

Referenced by getMatchingOverideNum().

UT_uint32 IE_Exp_RTF::getSimpleListCount ( void   )  const

Get Number of simple lists in the document

References UT_GenericVector< T >::getItemCount(), and m_vecSimpleList.

UT_BidiCharType IE_Exp_RTF::isCharRTL (  )  [inline]
bool IE_Exp_RTF::s_escapeString ( UT_UTF8String sOutStr,
UT_UCS4String sInStr,
UT_uint32  iAltChars 
) [static, private]
bool IE_Exp_RTF::s_escapeString ( std::string &  outStr,
const std::string &  inStr,
UT_uint32  iAltChars = 1 
) [static, private]
std::string IE_Exp_RTF::s_escapeString ( const std::string &  inStr,
UT_uint32  iAltChars = 1 
) [static, private]
bool IE_Exp_RTF::s_escapeString ( UT_UTF8String sOutStr,
const char *  szInStr,
UT_uint32  iSize,
UT_uint32  iAltChars 
) [static, private]

References s_escapeString().

std::string IE_Exp_RTF::s_escapeXMLString ( const std::string &  inStr  )  [static, private]

References replace_all(), and s.

Referenced by _write_rtf_header().

void IE_Exp_RTF::setByteBuf ( UT_ByteBuf pBuf  )  [inline]
void IE_Exp_RTF::setCharRTL ( UT_BidiCharType  t  )  [inline]

Friends And Related Function Documentation

friend class s_RTF_ListenerGetProps [friend]

Referenced by _writeDocumentLocal().

friend class s_RTF_ListenerWriteDoc [friend]

Referenced by _writeDocumentLocal().


Member Data Documentation


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