UT_Error IE_Exp_WordPerfect::_writeDocument(void) { UT_DEBUGMSG(("WordPerfect Exporter: _writeDocument\n")); if (_writeHeader() != UT_OK) return UT_ERROR; m_pListener = _constructListener(); if (!m_pListener) return UT_IE_NOMEMORY; if (getDocRange()) getDoc()->tellListenerSubset(static_cast<PL_Listener *>(m_pListener),getDocRange()); else getDoc()->tellListener(static_cast<PL_Listener *>(m_pListener)); DELETEP(m_pListener); if (m_error == UT_OK) { _UT_String_overwrite(*m_buffer, PTR_TO_DOCUMENT_INDEX, m_ptrToDocument); _UT_String_overwrite(*m_buffer, PTR_TO_FILESIZE_INDEX, m_buffer->length()); _UT_String_overwrite(*m_buffer, m_ptrDesiredFontUseCount, m_desiredFontUseCount); write(m_buffer->c_str(), m_buffer->length()); DELETEP(m_buffer); } return ((m_error) ? UT_IE_COULDNOTWRITE : UT_OK); }
UT_Error IE_Exp_Text::_writeDocument(void) { // Don't call base method if user cancels encoding dialog if (!(!m_bIsEncoded || m_bExplicitlySetEncoding || _doEncodingDialog(m_szEncoding))) return UT_SAVE_CANCELLED; // TODO If we're going to the clipboard and the OS supports unicode, set encoding. // TODO Only supports Windows so far. // TODO Should use a finer-grain technique than IsWinNT() since Win98 supports unicode clipboard. if (getDocRange()) { #ifdef WIN32 if (UT_IsWinNT()) _setEncoding(XAP_EncodingManager::get_instance()->getNativeUnicodeEncodingName()); #endif } m_pListener = _constructListener(); if (!m_pListener) return UT_IE_NOMEMORY; if (getDocRange()) getDoc()->tellListenerSubset(static_cast<PL_Listener *>(m_pListener),getDocRange()); else getDoc()->tellListener(static_cast<PL_Listener *>(m_pListener)); DELETEP(m_pListener); return ((m_error) ? UT_IE_COULDNOTWRITE : UT_OK); }