This commit is contained in:
ElenaSubbotina
2018-06-20 19:37:32 +03:00
parent 2b6650dde1
commit 9b5784e344
4 changed files with 136 additions and 12 deletions

View File

@ -1639,11 +1639,8 @@ std::wostream & bibliography_mark::text_to_stream(std::wostream & _Wostream) con
CP_SERIALIZE_TEXT(content_);
return _Wostream;
}
void bibliography_mark::docx_convert(oox::docx_conversion_context & Context)
void bibliography_mark::serialize(std::wostream & strm)
{
std::wstringstream strm;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"b:Tag")
@ -1706,14 +1703,117 @@ void bibliography_mark::docx_convert(oox::docx_conversion_context & Context)
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*url_);
}
}
if (note_)
{
CP_XML_NODE(L"b:Comments")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*note_);
}
}
if (chapter_)
{
CP_XML_NODE(L"b:ChapterNumber")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*chapter_);
}
}
if (journal_)
{
CP_XML_NODE(L"b:JournalName")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*journal_);
}
}
if (month_)
{
CP_XML_NODE(L"b:Month")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*month_);
}
}
if (pages_)
{
CP_XML_NODE(L"b:Pages")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*pages_);
}
}
if (publisher_)
{
CP_XML_NODE(L"b:Publisher")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*publisher_);
}
}
if (volume_)
{
CP_XML_NODE(L"b:Volume")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*volume_);
}
}
if (address_)
{
CP_XML_NODE(L"b:City")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*address_);
}
}
if (booktitle_)
{
CP_XML_NODE(L"b:BookTitle")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*booktitle_);
}
}
if (edition_)
{
CP_XML_NODE(L"b:Edition")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*edition_);
}
}
if (institution_)
{
CP_XML_NODE(L"b:Institution")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*institution_);
}
}
if (institution_)
{
CP_XML_NODE(L"b:Institution")
{
CP_XML_STREAM() << XmlUtils::EncodeXmlString(*institution_);
}
}
//isbn_;
//annote_;
//editor_;
//howpublished_;
//issn_;
//number_;
//organizations_;
//report_type_;
//school_;
//series_;
}
}
void bibliography_mark::docx_convert(oox::docx_conversion_context & Context)
{
std::wstringstream strm;
serialize(strm);
Context.add_bibliography_item(strm.str());
}
void bibliography_mark::pptx_convert(oox::pptx_conversion_context & Context)
{
if (content_)
content_->pptx_convert(Context);
std::wstringstream strm;
serialize(strm);
//if (content_)
// content_->pptx_convert(Context);
}
//-----------------------------------------------------------------------------------------------
// text:alphabetical-index-auto-mark-file

View File

@ -1262,6 +1262,8 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context) ;
void serialize(std::wostream & strm);
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
std::wstring identifier_;

View File

@ -108,14 +108,14 @@ protected:
m_sFilePath = std::wstring( sTempFile );
// Открываем сессию
HINTERNET hInternetSession = InternetOpen ( L"Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
HINTERNET hInternetSession = InternetOpenW ( L"Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
if ( NULL == hInternetSession )
return S_FALSE;
// Заголовок запроса ( пока содержит 0 байт ( необходимо для проверки ) )
std::wstring sHTTPHdr = L"Range: bytes=0-0";
// Открываем ссылку для проверки на ее существование, а также на возможность чтения частями
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternetSession, sFileUrl.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
HINTERNET hInternetOpenURL = InternetOpenUrlW ( hInternetSession, sFileUrl.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
if ( NULL != hInternetOpenURL )
{
// Открытие произошло, проверяем ответ
@ -211,7 +211,7 @@ protected:
// Заголовок запроса ( содержит nEndByte - nStartByte байт )
std::wstring sHTTPHdr = L"Range: bytes=" + std::to_wstring(nStartByte) + L"-" + std::to_wstring(nEndByte);
// Открываем ссылку для закачки
HINTERNET hInternetOpenURL = InternetOpenUrl ( hInternet, sFileURL.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
HINTERNET hInternetOpenURL = InternetOpenUrlW ( hInternet, sFileURL.c_str(), sHTTPHdr.c_str(), -1, INTERNET_FLAG_RESYNCHRONIZE, 0 );
if ( NULL == hInternetOpenURL )
return -1;
// Открытие произошло, проверяем ответ
@ -338,7 +338,7 @@ protected:
m_pFile = NULL;
}
// Скачиваем файл
return URLDownloadToFile (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, NULL);
return URLDownloadToFileW (NULL, sFileURL.c_str(), strFileOutput.c_str(), NULL, NULL);
}
};

View File

@ -32,8 +32,11 @@
#ifndef _BUILD_XMLLIGHT_PRIVATE_CROSSPLATFORM_H_
#define _BUILD_XMLLIGHT_PRIVATE_CROSSPLATFORM_H_
#include "../../../DesktopEditor/common/File.h"
#include "../libxml2/libxml.h"
#include "../libxml2/include/libxml/xmlreader.h"
#include "../include/xmlutils.h"
namespace XmlUtils
{
@ -209,7 +212,7 @@ namespace XmlUtils
if ((XmlNodeType_Element == eNodeType && nCurDepth == nDepth + 1)
|| ((XmlNodeType_Text == eNodeType ||
XmlNodeType_Whitespace == eNodeType ||
XmlNodeType_SIGNIFICANT_WHITESPACE == eNodeType ) && nCurDepth == nDepth + 1))
XmlNodeType_SIGNIFICANT_WHITESPACE == eNodeType ) && nCurDepth == nDepth + 1))
return true;
else if (XmlNodeType_EndElement == eNodeType && nCurDepth == nDepth)
return false;
@ -428,6 +431,25 @@ namespace XmlUtils
return 1 == xmlTextReaderIsEmptyElement(reader) ? true : false;
}
std::wstring GetNamespacePrefix()
{
xmlChar* pName = xmlTextReaderPrefix(reader);
if (NULL == pName)
return L"";
std::wstring sTemp = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)pName, (LONG)strlen((const char*)pName));
free(pName);
return sTemp;
}
XmlNodeType GetNodeType()
{
return (XmlUtils::XmlNodeType)xmlTextReaderNodeType(reader);
}
bool IsDefaultAttribute()
{
return (0 != xmlTextReaderIsDefault(reader)) ? true : false;
}
private:
inline std::wstring GetXml(bool bInner)
{
@ -510,4 +532,4 @@ namespace XmlUtils
};
}
#endif // _BUILD_XMLLIGHT_PRIVATE_CROSSPLATFORM_H_
#endif // _BUILD_XMLLIGHT_PRIVATE_CROSSPLATFORM_H_