Class used to import OpenDocument files. More...
#include <ie_imp_OpenDocument.h>
Public Member Functions | |
IE_Imp_OpenDocument (PD_Document *pDocument) | |
Constructor. | |
virtual | ~IE_Imp_OpenDocument () |
virtual bool | pasteFromBuffer (PD_DocumentRange *pDocRange, const unsigned char *pData, UT_uint32 lenData, const char *szEncoding=0) |
Protected Member Functions | |
virtual UT_Error | _loadFile (GsfInput *input) |
Import the given file. | |
Private Member Functions | |
UT_Error | _handleManifestStream () |
Handle the manifest file. | |
UT_Error | _handleMimetype () |
Handle the mimetype file. | |
UT_Error | _handleMetaStream () |
Handle the meta-stream. | |
UT_Error | _handleSettingsStream () |
Handle the setting-stream. | |
UT_Error | _handleStylesStream () |
Handle the styles-stream. | |
UT_Error | _handleContentStream () |
Handle the content-stream. | |
UT_Error | _handleRDFStreams () |
void | _setDocumentProperties () |
Set some document properties. | |
UT_Error | _loadRDFFromFile (GsfInput *pInput, const char *pStream, RDFArguments *args) |
UT_Error | _handleStream (GsfInfile *pGsfInfile, const char *pStream, UT_XML::Listener &rListener) |
Handle the stream using the listener . | |
UT_Error | _parseStream (GsfInput *pInput, UT_XML &parser) |
Static utility method to read a file/stream embedded inside of the zipfile into an xml parser. | |
Private Attributes | |
GsfInfile * | m_pGsfInfile |
std::string | m_sPassword |
std::map< std::string, ODc_CryptoInfo > | m_cryptoInfo |
ODi_StreamListener * | m_pStreamListener |
ODi_Office_Styles | m_styles |
ODi_Abi_Data * | m_pAbiData |
Class used to import OpenDocument files.
IE_Imp_OpenDocument::IE_Imp_OpenDocument | ( | PD_Document * | pDocument | ) |
Constructor.
Referenced by pasteFromBuffer().
IE_Imp_OpenDocument::~IE_Imp_OpenDocument | ( | ) | [virtual] |
References DELETEP, m_pAbiData, m_pGsfInfile, and m_pStreamListener.
UT_Error IE_Imp_OpenDocument::_handleContentStream | ( | ) | [private] |
Handle the content-stream.
References _handleStream(), m_pAbiData, m_pGsfInfile, m_pStreamListener, ODi_Abi_Data::m_rangedAnnotationNames, ODi_StreamListener::setState(), UT_DEBUGMSG, and UT_OK.
Referenced by _loadFile().
UT_Error IE_Imp_OpenDocument::_handleManifestStream | ( | ) | [private] |
Handle the manifest file.
References _handleStream(), abicollab::service::error(), ODi_StreamListener::getElementStack(), GetPassword, m_cryptoInfo, m_pGsfInfile, m_pStreamListener, m_sPassword, ODi_StreamListener::setState(), UT_IE_PROTECTED, and UT_OK.
Referenced by _loadFile().
UT_Error IE_Imp_OpenDocument::_handleMetaStream | ( | ) | [private] |
Handle the meta-stream.
References _handleStream(), gsf_infile_child_exists(), m_pGsfInfile, m_pStreamListener, ODi_StreamListener::setState(), and UT_OK.
Referenced by _loadFile().
UT_Error IE_Imp_OpenDocument::_handleMimetype | ( | ) | [private] |
Handle the mimetype file.
References UT_UTF8String::append(), m_pGsfInfile, UT_DEBUGMSG, and UT_UTF8String::utf8_str().
Referenced by _loadFile().
UT_Error IE_Imp_OpenDocument::_handleRDFStreams | ( | ) | [private] |
UT_Error IE_Imp_OpenDocument::_handleSettingsStream | ( | ) | [private] |
Handle the setting-stream.
References _handleStream(), gsf_infile_child_exists(), m_pGsfInfile, m_pStreamListener, ODi_StreamListener::setState(), and UT_OK.
UT_Error IE_Imp_OpenDocument::_handleStream | ( | GsfInfile * | pGsfInfile, | |
const char * | pStream, | |||
UT_XML::Listener & | rListener | |||
) | [private] |
Handle the stream using the listener .
Tries to abstract away how we're actually going to handle how we read the stream, so that the underlying implementation can easily adapt or change
References _parseStream(), ODc_Crypto::decrypt(), m_cryptoInfo, m_sPassword, UT_XML::setListener(), UT_DEBUGMSG, UT_ERROR, UT_OK, and UT_return_val_if_fail.
Referenced by _handleContentStream(), _handleManifestStream(), _handleMetaStream(), _handleSettingsStream(), and _handleStylesStream().
UT_Error IE_Imp_OpenDocument::_handleStylesStream | ( | ) | [private] |
Handle the styles-stream.
References _handleStream(), gsf_infile_child_exists(), m_pGsfInfile, m_pStreamListener, ODi_StreamListener::setState(), and UT_OK.
Referenced by _loadFile().
UT_Error IE_Imp_OpenDocument::_loadFile | ( | GsfInput * | input | ) | [protected, virtual] |
Import the given file.
Implements IE_Imp.
References _handleContentStream(), _handleManifestStream(), _handleMetaStream(), _handleMimetype(), _handleRDFStreams(), _handleStylesStream(), _setDocumentProperties(), IE_Imp::getDoc(), m_pAbiData, m_pGsfInfile, m_pStreamListener, m_styles, UT_DEBUGMSG, UT_IE_TRY_RECOVER, and UT_OK.
UT_Error IE_Imp_OpenDocument::_loadRDFFromFile | ( | GsfInput * | pInput, | |
const char * | pStream, | |||
RDFArguments * | args | |||
) | [private] |
References RDFArguments::model, RDFArguments::parser, UT_DEBUGMSG, UT_ERROR, UT_return_val_if_fail, UT_UNUSED, and RDFArguments::world.
Referenced by _handleRDFStreams().
Static utility method to read a file/stream embedded inside of the zipfile into an xml parser.
References UT_XML::parse(), UT_ERROR, UT_OK, and UT_return_val_if_fail.
Referenced by _handleStream().
void IE_Imp_OpenDocument::_setDocumentProperties | ( | ) | [private] |
Set some document properties.
The ones that goes on the <abiword> element.
References IE_Imp::getDoc(), PD_Document::setProperties(), and UT_ASSERT_HARMLESS.
Referenced by _loadFile().
bool IE_Imp_OpenDocument::pasteFromBuffer | ( | PD_DocumentRange * | pDocRange, | |
const unsigned char * | pData, | |||
UT_uint32 | lenData, | |||
const char * | szEncoding = 0 | |||
) | [virtual] |
Reimplemented from IE_Imp.
References PD_Document::createRawDocument(), PD_Document::finishRawCreation(), IE_Imp::getDoc(), PD_Document::getDocumentRDF(), IE_Imp_OpenDocument(), IE_Imp::loadFile(), PD_DocumentRange::m_pDoc, PD_DocumentRange::m_pos1, PD_DocumentRange::m_pos2, PD_Document::tellListener(), UNREFP, and UT_return_val_if_fail.
std::map<std::string, ODc_CryptoInfo> IE_Imp_OpenDocument::m_cryptoInfo [private] |
Referenced by _handleManifestStream(), and _handleStream().
ODi_Abi_Data* IE_Imp_OpenDocument::m_pAbiData [private] |
Referenced by _handleContentStream(), _loadFile(), and ~IE_Imp_OpenDocument().
GsfInfile* IE_Imp_OpenDocument::m_pGsfInfile [private] |
std::string IE_Imp_OpenDocument::m_sPassword [private] |
Referenced by _handleManifestStream(), and _handleStream().
Referenced by _loadFile().