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

IE_Imp Class Reference

#include <ie_imp.h>

Inheritance diagram for IE_Imp:
IE_Imp_AbiCollab IE_Imp_Applix IE_Imp_ClarisWorks IE_Imp_Component IE_Imp_EPUB IE_Imp_GDA IE_Imp_GraphicAsDocument IE_Imp_Hancom IE_Imp_MathML IE_Imp_MIF IE_Imp_MsWord_97 IE_Imp_MSWrite IE_Imp_Object IE_Imp_OpenDocument IE_Imp_OpenWriter IE_Imp_OpenXML IE_Imp_PalmDoc IE_Imp_PDF IE_Imp_Psion IE_Imp_RDF IE_Imp_RTF IE_Imp_StarOffice IE_Imp_T602 IE_Imp_Text IE_Imp_WordPerfect IE_Imp_XML

List of all members.

Public Member Functions

virtual ~IE_Imp ()
UT_Error importFile (const char *szFilename)
UT_Error importFile (GsfInput *input)
virtual bool pasteFromBuffer (PD_DocumentRange *pDocRange, const unsigned char *pData, UT_uint32 lenData, const char *szEncoding=0)
PD_DocumentgetDoc () const
void setLoadStylesOnly (bool b)
bool getLoadStylesOnly () const
virtual bool supportsLoadStylesOnly ()
void setLoadDocProps (bool b)
bool getLoadDocProps () const
UT_Confidence_t getFidelity () const
void setProps (const char *props)
bool isPasting (void) const
const std::string & getProperty (const char *key)

Static Public Member Functions

static IEFileType fileTypeForContents (const char *szBuf, UT_uint32 iNumbytes)
static IEFileType fileTypeForSuffix (const char *szSuffix)
static IEFileType fileTypeForDescription (const char *szSuffix)
static IEFileType fileTypeForMimetype (const char *szMimetype)
static IEFileType fileTypeForSuffixes (const char *suffixList)
static IE_ImpSniffersnifferForFileType (IEFileType ieft)
static const char * suffixesForFileType (IEFileType ieft)
static const char * descriptionForFileType (IEFileType ieft)
static UT_Error constructImporter (PD_Document *pDocument, const char *szFilename, IEFileType ieft, IE_Imp **ppie, IEFileType *pieft=NULL)
static UT_Error constructImporter (PD_Document *pDocument, GsfInput *input, IEFileType ieft, IE_Imp **ppie, IEFileType *pieft=NULL)
static UT_Error constructImporter (PD_Document *pDocument, IEFileType ieft, IE_Imp **ppie, IEFileType *pieft=NULL)
static bool enumerateDlgLabels (UT_uint32 ndx, const char **pszDesc, const char **pszSuffixList, IEFileType *ft)
static UT_uint32 getImporterCount (void)
static void registerImporter (IE_ImpSniffer *sniffer)
static void unregisterImporter (IE_ImpSniffer *sniffer)
static void unregisterAllImporters ()
static const std::vector
< std::string > & 
getSupportedMimeTypes ()
static const std::vector
< std::string > & 
getSupportedMimeClasses ()
static const std::vector
< std::string > & 
getSupportedSuffixes ()
static const char * getMimeTypeForSuffix (const char *suffix)
static UT_Error loadFile (PD_Document *doc, const char *szFilename, IEFileType ieft=IEFT_Unknown, const char *props=NULL, IEFileType *savedAsType=NULL)
static UT_Error loadFile (PD_Document *doc, GsfInput *input, IEFileType ieft=IEFT_Unknown, const char *props=NULL, IEFileType *savedAsType=NULL)

Protected Member Functions

 IE_Imp (PD_Document *pDocument, UT_Confidence_t fidelity=0)
PT_DocPosition getDocPos () const
void setClipboard (PT_DocPosition dpos)
bool isClipboard () const
virtual bool appendStrux (PTStruxType pts, const PP_PropertyVector &attributes)
virtual bool appendStruxFmt (pf_Frag_Strux *pfs, const PP_PropertyVector &attributes)
virtual bool appendSpan (const UT_UCSChar *p, UT_uint32 length)
virtual bool appendSpan (const std::string &s)
virtual bool appendObject (PTObjectType pto, const PP_PropertyVector &attribs, const PP_PropertyVector &props=PP_NOPROPS)
bool appendFmt (const gchar **attributes)
virtual bool appendFmt (const PP_PropertyVector &pVecAttributes)
virtual UT_Error _loadFile (GsfInput *input)=0

Private Types

typedef std::map< std::string,
std::string > 
map_type

Private Attributes

PD_Documentm_pDocument
bool m_isPaste
PT_DocPosition m_dpos
bool m_bStylesOnly
bool m_bDocProps
map_type m_props_map
UT_Confidence_t m_fidelity

Member Typedef Documentation

typedef std::map<std::string, std::string> IE_Imp::map_type [private]

Constructor & Destructor Documentation

IE_Imp::~IE_Imp (  )  [virtual]
IE_Imp::IE_Imp ( PD_Document pDocument,
UT_Confidence_t  fidelity = 0 
) [protected]

Member Function Documentation

bool IE_Imp::appendFmt ( const PP_PropertyVector pVecAttributes  )  [protected, virtual]
bool IE_Imp::appendSpan ( const std::string &  s  )  [protected, virtual]
bool IE_Imp::appendStrux ( PTStruxType  pts,
const PP_PropertyVector attributes 
) [protected, virtual]

References PD_Document::appendStrux(), PD_Document::insertStrux(), m_dpos, m_isPaste, and m_pDocument.

Referenced by IE_Imp_MSWrite::_append_hdrftr(), IE_Imp_WordPerfect::_appendSection(), IE_Imp_Applix::_applixNewPara(), IE_Imp_OPML::_createBullet(), IE_Imp_GDA::_importDataModel(), IE_Imp_T602::_inschar(), IE_Imp_Text::_insertBlock(), IE_Imp_StarOffice::_loadFile(), IE_Imp_Hancom::_loadFile(), IE_Imp_GraphicAsDocument::_loadFile(), IE_Imp_PalmDoc::_parseFile(), IE_Imp_ClarisWorks::_parseFile(), IE_Imp_T602::_write_fh(), IE_Imp_Text::_writeHeader(), IE_Imp_PalmDoc::_writeHeader(), IE_Imp_MIF::_writeHeader(), IE_Imp_ClarisWorks::_writeHeader(), IE_Imp_Applix::_writeHeader(), IE_Imp_T602::_writePP(), IE_Imp_T602::_writeSP(), IE_Imp_GDA::addCell(), IE_Imp_Psion::applyPageAttributes(), IE_Imp_Psion::applyParagraphAttributes(), IE_Imp_WordPerfect::closeEndnote(), IE_Imp_WordPerfect::closeFootnote(), IE_Imp_WordPerfect::closeTable(), IE_Imp_GDA::closeTable(), IE_Imp_DocBook::createTitle(), IE_Imp_XSL_FO::endElement(), IE_Imp_WML::endElement(), IE_Imp_OPML::endElement(), IE_Imp_DocBook::endElement(), IE_Imp_AbiWord_1::endElement(), IE_Imp_WordPerfect::openEndnote(), IE_Imp_WordPerfect::openFootnote(), IE_Imp_WordPerfect::openListElement(), IE_Imp_WordPerfect::openParagraph(), IE_Imp_WordPerfect::openTable(), IE_Imp_GDA::openTable(), IE_Imp_WordPerfect::openTableCell(), IE_Imp_WordPerfect::openTableRow(), IE_Imp_Psion::processHeaderFooter(), IE_Imp_MSWrite::read_pap(), IE_Imp_MSWrite::read_pic(), IE_Imp_MSWrite::read_sep(), IE_Imp_DocBook::requireBlock(), IE_Imp_XSL_FO::startElement(), IE_Imp_WML::startElement(), IE_Imp_OPML::startElement(), IE_Imp_KWord_1::startElement(), IE_Imp_DocBook::startElement(), IE_Imp_AbiWord_1::startElement(), and IE_Imp_AbiWord_1::~IE_Imp_AbiWord_1().

bool IE_Imp::appendStruxFmt ( pf_Frag_Strux pfs,
const PP_PropertyVector attributes 
) [protected, virtual]
UT_Error IE_Imp::constructImporter ( PD_Document pDocument,
const char *  szFilename,
IEFileType  ieft,
IE_Imp **  ppie,
IEFileType pieft = NULL 
) [static]

Construct an importer of the right type.

Parameters:
pDocument Document
szFilename Name of file - optional
ieft Desired filetype - pass IEFT_Unknown for best guess
ppie Pointer to return importer in
pieft Pointer to fill in actual filetype

Caller is responsible for deleting the importer object when finished with it. This function should closely match IE_Exp::contructExporter()

References UT_go_file_open().

Referenced by AP_Win32App::_pasteFormatFromClipboard(), constructImporter(), Drop(), PD_Document::importStyles(), loadFile(), AP_UnixApp::pasteFromClipboard(), and s_pasteText().

UT_Error IE_Imp::constructImporter ( PD_Document pDocument,
GsfInput *  input,
IEFileType  ieft,
IE_Imp **  ppie,
IEFileType pieft = NULL 
) [static]

Construct an importer of the right type.

Parameters:
pDocument Document
input,: 
ieft Desired filetype - pass IEFT_Unknown for best guess
ppie Pointer to return importer in
pieft Pointer to fill in actual filetype

Caller is responsible for deleting the importer object when finished with it. This function should closely match IE_Exp::contructExporter()

References IE_SuffixConfidence::confidence, CONFIDENCE_THRESHOLD, constructImporter(), IE_ImpSniffer::constructImporter(), fileTypeForSuffix(), FREEP, gchar, getImporterCount(), IE_ImpSniffer::getSuffixConfidence(), IE_IMP_Sniffers, IEFT_Unknown, IEGFT_Unknown, IE_ImpSniffer::recognizeContents(), s, s_confidence_heuristic(), IE_SuffixConfidence::suffix, IE_ImpSniffer::supportsFileType(), UT_ASSERT_HARMLESS, UT_CONFIDENCE_PERFECT, UT_ERROR, UT_IE_NOMEMORY, UT_OK, and UT_return_val_if_fail.

UT_Error IE_Imp::constructImporter ( PD_Document pDocument,
IEFileType  ieft,
IE_Imp **  ppie,
IEFileType pieft = NULL 
) [static]

Construct an importer of the right type.

Parameters:
pDocument Document
ieft Desired filetype - pass IEFT_Unknown for best guess
ppie Pointer to return importer in
pieft Pointer to fill in actual filetype

Caller is responsible for deleting the importer object when finished with it. This function should closely match IE_Exp::contructExporter()

References constructImporter().

const char * IE_Imp::descriptionForFileType ( IEFileType  ieft  )  [static]

Find the description for the given filetype.

Parameters:
ieft Numerical "import filetype" ID

Returns 0 if filetype doesn't exist. This function should closely resemble IE_Imp::descriptionForFileType()

References IE_ImpSniffer::getDlgLabels(), snifferForFileType(), UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.

bool IE_Imp::enumerateDlgLabels ( UT_uint32  ndx,
const char **  pszDesc,
const char **  pszSuffixList,
IEFileType ft 
) [static]
IEFileType IE_Imp::fileTypeForContents ( const char *  szBuf,
UT_uint32  iNumbytes 
) [static]
IEFileType IE_Imp::fileTypeForDescription ( const char *  szDescription  )  [static]

Find the filetype for the given filetype description.

Parameters:
szDescription Filetype description

Returns IEFT_Unknown if no importer has this description. This function should closely resemble IE_Exp::fileTypeForDescription()

References IE_ImpSniffer::getDlgLabels(), getImporterCount(), IE_IMP_Sniffers, UT_ASSERT_HARMLESS, and UT_SHOULD_NOT_HAPPEN.

IEFileType IE_Imp::fileTypeForMimetype ( const char *  szMimetype  )  [static]

Find the filetype for the given mimetype.

Parameters:
szMimetype File mimetype

Returns IEFT_Unknown if no importer knows this mimetype. Note that more than one importer may support a mimetype. We return the first one we find. This function should closely resemble IE_Exp::fileTypeForSuffix()

References IE_MimeConfidence::confidence, getImporterCount(), IE_ImpSniffer::getMimeConfidence(), IE_IMP_Sniffers, IE_MIME_MATCH_FULL, IEFT_Unknown, IE_MimeConfidence::match, IE_MimeConfidence::mimetype, s, IE_ImpSniffer::supportsFileType(), and UT_CONFIDENCE_PERFECT.

Referenced by getImportFileType(), AP_UnixApp::pasteFromClipboard(), s_abi_widget_get_file_type(), and s_pasteText().

IEFileType IE_Imp::fileTypeForSuffix ( const char *  szSuffix  )  [static]
IEFileType IE_Imp::fileTypeForSuffixes ( const char *  suffixList  )  [static]
PD_Document * IE_Imp::getDoc ( void   )  const

References m_pDocument.

Referenced by IE_Imp_RTF::_appendField(), IE_Imp_MsWord_97::_appendFmt(), IE_Imp_RTF::_appendHdrFtr(), IE_Imp_MsWord_97::_appendObject(), IE_Imp_MsWord_97::_appendObjectHdrFtr(), IE_Imp_RTF::_appendSpan(), IE_Imp_MsWord_97::_appendSpan(), IE_Imp_MsWord_97::_appendSpanHdrFtr(), IE_Imp_MsWord_97::_appendStrux(), IE_Imp_MsWord_97::_appendStruxHdrFtr(), IE_Imp_MsWord_97::_beginChar(), IE_Imp_MsWord_97::_beginPara(), IE_Imp_MsWord_97::_beginSect(), IE_Imp_OPML::_createList(), IE_Imp_MsWord_97::_docProc(), IE_Imp_Text::_doEncodingDialog(), IE_Imp_MsWord_97::_ensureInBlock(), IE_Imp_MsWord_97::_findNextENoteSection(), IE_Imp_MsWord_97::_findNextFNoteSection(), IE_Imp_MsWord_97::_flush(), IE_Imp_MsWord_97::_generateCharProps(), IE_Imp_MsWord_97::_handleHeaders(), IE_Imp_MsWord_97::_handleImage(), IE_Imp_AbiWord_1::_handleImage(), IE_Imp_MsWord_97::_handleMetaData(), IE_Imp_MsWord_97::_handleNotes(), IE_Imp_MsWord_97::_handlePositionedImage(), IE_Imp_OpenDocument::_handleRDFStreams(), IE_Imp_AbiWord_1::_handleResource(), IE_Imp_MsWord_97::_handleStyleSheet(), IE_Imp_Text::_insertBlock(), IE_Imp_MsWord_97::_insertBookmark(), IE_Imp_MsWord_97::_insertHeaderSection(), IE_Imp_Text::_insertSpan(), IE_Imp_RTF::_insertSpan(), IE_Imp_Text::_loadFile(), IE_Imp_StarOffice::_loadFile(), IE_Imp_RTF::_loadFile(), IE_Imp_OpenXML::_loadFile(), IE_Imp_OpenDocument::_loadFile(), IE_Imp_MsWord_97::_loadFile(), IE_Imp_GraphicAsDocument::_loadFile(), IE_Imp_AbiCollab::_openDocument(), IE_Imp_RTF::_parseFile(), IE_Imp_RTF::_parseFldinstBlock(), IE_Imp_PDF::_runConversion(), IE_Imp_OpenDocument::_setDocumentProperties(), IE_Imp_MsWord_97::_table_close(), IE_Imp_WordPerfect::_updateDocumentOrderedListDefinition(), IE_Imp_WordPerfect::_updateDocumentUnorderedListDefinition(), IE_Imp_Text::_writeHeader(), IE_Imp_RTF::addFrame(), IE_Imp_XHTML::appendFmt(), IE_Imp_XHTML::appendObject(), IE_Imp_XHTML::appendSpan(), IE_Imp_XHTML::appendStrux(), IE_Imp_RTF::ApplyCharacterAttributes(), IE_Imp_Psion::applyPageAttributes(), IE_Imp_RTF::ApplyParagraphAttributes(), IE_Imp_Psion::applyParagraphAttributes(), IE_Imp_RTF::ApplySectionAttributes(), IE_Imp_Psion::applyStyles(), RTF_msword97_level::buildAbiListProperties(), IE_Imp_XML::charData(), IE_Imp_OPML::charData(), IE_Imp_DocBook::charData(), IE_Imp_RTF::closePastedTableIfNeeded(), IE_Imp_RTF::CloseTable(), IE_Imp_RTF::CreateDataItemfromStream(), IE_Imp_XSL_FO::createImage(), IE_Imp_WML::createImage(), IE_Imp_DocBook::createImage(), IE_Imp_DocBook::createList(), IE_Imp_RTF::EndAnnotation(), IE_Imp_XHTML::endElement(), IE_Imp_AbiWord_1::endElement(), IE_Imp_RTF::FlushStoredChars(), IE_Imp_OpenWriter::getDocument(), IE_Imp_RTF::HandleAbiEmbed(), IE_Imp_RTF::HandleAbiEndTable(), IE_Imp_RTF::HandleAbiMathml(), IE_Imp_RTF::HandleAbiTable(), IE_Imp_RTF::HandleAnnotation(), IE_Imp_RTF::HandleBookmark(), IE_Imp_RTF::HandleCell(), IE_Imp_RTF::HandleDeltaMoveID(), IE_Imp_RTF::HandleField(), IE_Imp_RTF::HandleHeaderFooter(), IE_Imp_RTF::HandleInfoMetaData(), IE_Imp_RTF::HandleListLevel(), IE_Imp_RTF::HandleNote(), IE_Imp_RTF::HandleNoteReference(), IE_Imp_RTF::HandleParKeyword(), IE_Imp_RTF::HandlePicture(), IE_Imp_RTF::HandleRDFAnchor(), IE_Imp_RTF::HandleRevisedTextTimestamp(), IE_Imp_RTF::HandleRow(), IE_Imp_RTF::HandleShape(), IE_Imp_RTF::HandleStyleDefinition(), IE_Imp_RTF::IE_Imp_RTF(), IE_Imp_RTF::InsertImage(), IE_Imp_Psion::insertImage(), IE_Imp_RTF::insertStrux(), IE_Imp_RTF::mapID(), IE_Imp_WordPerfect::openListElement(), IE_Imp_WML::openTable(), IE_Imp_RTF::OpenTable(), IE_Imp_XHTML::pasteFromBuffer(), IE_Imp_Text::pasteFromBuffer(), IE_Imp_RTF::pasteFromBuffer(), IE_Imp_RDF::pasteFromBuffer(), IE_Imp_OpenDocument::pasteFromBuffer(), IE_Imp_MathML::pasteFromBuffer(), IE_Imp_Component::pasteFromBuffer(), IE_Imp_Object::pasteFromBuffer(), IE_Imp_EPUB::pasteFromBuffer(), IE_Imp_RDF_Calendar::pasteFromBufferSS(), IE_Imp_RDF_VCard::pasteFromBufferSS(), IE_Imp_MSWrite::read_pic(), IE_Imp_RTF::ReadRDFTriples(), IE_Imp_RTF::ReadRevisionTable(), IE_Imp_EPUB::readStructure(), RTF_msword97_level::RTF_msword97_level(), IE_Imp_WordPerfect::setDocumentMetaData(), IE_Imp_RTF::StartAnnotation(), IE_Imp_XSL_FO::startElement(), IE_Imp_XHTML::startElement(), IE_Imp_WML::startElement(), IE_Imp_KWord_1::startElement(), IE_Imp_AbiWord_1::startElement(), IE_Imp_RTF::TranslateKeywordID(), IE_Imp_EPUB::uncompress(), and IE_Imp_ShpGroupParser::~IE_Imp_ShpGroupParser().

PT_DocPosition IE_Imp::getDocPos (  )  const [protected]
UT_Confidence_t IE_Imp::getFidelity (  )  const [inline]
bool IE_Imp::getLoadDocProps (  )  const [inline]
const char * IE_Imp::getMimeTypeForSuffix ( const char *  suffix  )  [static]
const std::string& IE_Imp::getProperty ( const char *  key  )  [inline]
const std::vector< std::string > & IE_Imp::getSupportedMimeClasses (  )  [static]

Get supported mime classes by builtin- and plugin-filters.

References IE_IMP_MimeClasses, IE_IMP_Sniffers, IE_MIME_MATCH_CLASS, IE_MimeConfidence::match, and IE_MimeConfidence::mimetype.

const std::vector< std::string > & IE_Imp::getSupportedMimeTypes (  )  [static]

Get supported mimetypes by builtin- and plugin-filters.

References IE_IMP_MimeTypes, IE_IMP_Sniffers, IE_MIME_MATCH_FULL, IE_MimeConfidence::match, and IE_MimeConfidence::mimetype.

Referenced by s_getDragInfo().

const std::vector< std::string > & IE_Imp::getSupportedSuffixes (  )  [static]

Get supported suffixes by builtin- and plugin-filters.

References IE_IMP_Sniffers, IE_IMP_Suffixes, and IE_SuffixConfidence::suffix.

UT_Error IE_Imp::importFile ( GsfInput *  input  ) 

References _loadFile().

bool IE_Imp::isClipboard (  )  const [protected]
UT_Error IE_Imp::loadFile ( PD_Document doc,
const char *  szFilename,
IEFileType  ieft = IEFT_Unknown,
const char *  props = NULL,
IEFileType savedAsType = NULL 
) [static]
UT_Error IE_Imp::loadFile ( PD_Document doc,
GsfInput *  input,
IEFileType  ieft = IEFT_Unknown,
const char *  props = NULL,
IEFileType savedAsType = NULL 
) [static]
bool IE_Imp::pasteFromBuffer ( PD_DocumentRange pDocRange,
const unsigned char *  pData,
UT_uint32  lenData,
const char *  szEncoding = 0 
) [virtual]
void IE_Imp::setLoadDocProps ( bool  b  )  [inline]
void IE_Imp::setLoadStylesOnly ( bool  b  )  [inline]
void IE_Imp::setProps ( const char *  props  ) 
IE_ImpSniffer * IE_Imp::snifferForFileType ( IEFileType  ieft  )  [static]

Find the filetype sniffer for the given filetype.

Parameters:
ieft Filetype

Returns 0 if no exporter knows this filetype. This function should closely resemble IE_Imp::snifferForFileType()

References getImporterCount(), IE_IMP_Sniffers, s, and IE_ImpSniffer::supportsFileType().

Referenced by descriptionForFileType(), and suffixesForFileType().

const char * IE_Imp::suffixesForFileType ( IEFileType  ieft  )  [static]

Find the suffixes for the given filetype.

Parameters:
szSuffix File suffix

Returns 0 if no exporter knows this filetype. This function should closely resemble IE_Imp::suffixesForFileType()

References IE_ImpSniffer::getDlgLabels(), snifferForFileType(), UT_ASSERT_HARMLESS, UT_return_val_if_fail, and UT_SHOULD_NOT_HAPPEN.

Referenced by PD_Document::_syncFileTypes().

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

Reimplemented in IE_Imp_MsWord_97.

Referenced by PD_Document::importStyles().

void IE_Imp::unregisterAllImporters (  )  [static]

References DELETEP, IE_IMP_Sniffers, and size.

Referenced by IE_ImpExp_UnRegisterXP().


Member Data Documentation

bool IE_Imp::m_bDocProps [private]
bool IE_Imp::m_bStylesOnly [private]

Referenced by setProps().


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